mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-14 20:19:38 +00:00
Redo file prompts with in-game UI
This commit is contained in:
@@ -35,6 +35,8 @@ namespace PortabilityLayer
|
||||
, m_isDraggingSelection(false)
|
||||
, m_dragSelectionStartChar(false)
|
||||
, m_scrollOffset(0, 0)
|
||||
, m_characterFilter(nullptr)
|
||||
, m_characterFilterContext(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -121,17 +123,17 @@ namespace PortabilityLayer
|
||||
m_length = len;
|
||||
memcpy(m_chars, str.UChars(), len);
|
||||
|
||||
if (m_selStartChar > len)
|
||||
m_selStartChar = len;
|
||||
if (m_selEndChar > len)
|
||||
m_selEndChar = len;
|
||||
|
||||
if (m_window)
|
||||
{
|
||||
DrawSurface *surface = m_window->GetDrawSurface();
|
||||
|
||||
DrawControl(surface);
|
||||
}
|
||||
|
||||
if (m_selStartChar > len)
|
||||
m_selStartChar = len;
|
||||
if (m_selEndChar > len)
|
||||
m_selEndChar = len;
|
||||
}
|
||||
|
||||
PLPasStr EditboxWidget::GetString() const
|
||||
@@ -166,7 +168,7 @@ namespace PortabilityLayer
|
||||
Redraw();
|
||||
}
|
||||
|
||||
WidgetHandleState_t EditboxWidget::ProcessEvent(const TimeTaggedVOSEvent &evt)
|
||||
WidgetHandleState_t EditboxWidget::ProcessEvent(void *captureContext, const TimeTaggedVOSEvent &evt)
|
||||
{
|
||||
if (m_isDraggingSelection)
|
||||
return HandleDragSelection(evt);
|
||||
@@ -200,6 +202,12 @@ namespace PortabilityLayer
|
||||
resolvedChar = MacRoman::FromUnicode(ch, keyEvent.m_key.m_unicodeChar);
|
||||
}
|
||||
|
||||
if (resolvedChar)
|
||||
{
|
||||
if (m_characterFilter)
|
||||
resolvedChar = m_characterFilter(m_characterFilterContext, ch);
|
||||
}
|
||||
|
||||
if (resolvedChar)
|
||||
{
|
||||
if (ch >= 0x20 && ch <= 0x7e)
|
||||
@@ -979,4 +987,15 @@ namespace PortabilityLayer
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
void EditboxWidget::SetCharacterFilter(void *context, CharacterFilterCallback_t callback)
|
||||
{
|
||||
m_characterFilterContext = context;
|
||||
m_characterFilter = callback;
|
||||
}
|
||||
|
||||
void EditboxWidget::SetCapacity(size_t capacity)
|
||||
{
|
||||
m_capacity = std::min<size_t>(255, capacity);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user