mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-24 07:06:36 +00:00
Fix up radio buttons, more editbox functionality.
All blocking issues with UI should now be fixed.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user