Fix up radio buttons, more editbox functionality.

All blocking issues with UI should now be fixed.
This commit is contained in:
elasota
2020-02-16 21:57:02 -05:00
parent a726a88f70
commit 7548690c51
14 changed files with 140 additions and 6 deletions

View File

@@ -1,6 +1,7 @@
#include "PLRadioButtonWidget.h"
#include "PLStandardColors.h"
#include "FontFamily.h"
#include "PLTimeTaggedVOSEvent.h"
#include <algorithm>
@@ -9,6 +10,7 @@ namespace PortabilityLayer
RadioButtonWidget::RadioButtonWidget(const WidgetBasicState &state)
: WidgetSpec<RadioButtonWidget>(state)
, m_text(state.m_text)
, m_haveMouseDown(false)
{
}
@@ -68,4 +70,40 @@ namespace PortabilityLayer
if (m_window)
DrawControl(&m_window->m_surface);
}
WidgetHandleState_t RadioButtonWidget::ProcessEvent(const TimeTaggedVOSEvent &evt)
{
if (m_haveMouseDown)
{
if (evt.IsLMouseUpEvent())
{
m_haveMouseDown = false;
const Point pt = m_window->MouseToLocal(evt.m_vosEvent.m_event.m_mouseInputEvent);
if (m_rect.Contains(pt))
return WidgetHandleStates::kActivated;
else
return WidgetHandleStates::kIgnored;
}
return WidgetHandleStates::kCaptured;
}
else
{
if (evt.IsLMouseDownEvent())
{
const Point pt = m_window->MouseToLocal(evt.m_vosEvent.m_event.m_mouseInputEvent);
if (m_rect.Contains(pt))
{
m_haveMouseDown = true;
return WidgetHandleStates::kCaptured;
}
else
return WidgetHandleStates::kIgnored;
}
}
return WidgetHandleStates::kIgnored;
}
}