mirror of
https://github.com/edubart/otclient.git
synced 2025-10-19 22:13:27 +02:00
add modulemanager module
This commit is contained in:
@@ -421,7 +421,7 @@ void UILineEdit::onGeometryChange(const Rect& oldRect, const Rect& newRect)
|
||||
void UILineEdit::onFocusChange(bool focused, Fw::FocusReason reason)
|
||||
{
|
||||
if(focused && !m_alwaysActive) {
|
||||
if(reason == Fw::TabFocusReason)
|
||||
if(reason == Fw::KeyboardFocusReason)
|
||||
setCursorPos(m_text.length());
|
||||
else
|
||||
blinkCursor();
|
||||
@@ -452,7 +452,7 @@ bool UILineEdit::onKeyPress(uchar keyCode, int keyboardModifiers, bool wouldFilt
|
||||
else if(keyCode == Fw::KeyTab) {
|
||||
if(!m_alwaysActive) {
|
||||
if(UIWidgetPtr parent = getParent())
|
||||
parent->focusNextChild(Fw::TabFocusReason);
|
||||
parent->focusNextChild(Fw::KeyboardFocusReason);
|
||||
}
|
||||
} else
|
||||
return false;
|
||||
|
@@ -219,6 +219,8 @@ void UIWidget::focusChild(const UIWidgetPtr& child, Fw::FocusReason reason)
|
||||
oldFocused->updateState(Fw::FocusState);
|
||||
oldFocused->updateState(Fw::ActiveState);
|
||||
}
|
||||
|
||||
onChildFocusChange(child, oldFocused, reason);
|
||||
}
|
||||
|
||||
void UIWidget::focusNextChild(Fw::FocusReason reason)
|
||||
@@ -485,7 +487,6 @@ void UIWidget::lower()
|
||||
|
||||
void UIWidget::raise()
|
||||
{
|
||||
focus();
|
||||
UIWidgetPtr parent = getParent();
|
||||
if(parent)
|
||||
parent->raiseChild(asUIWidget());
|
||||
@@ -546,9 +547,7 @@ void UIWidget::destroy()
|
||||
parent->removeChild(asUIWidget());
|
||||
}
|
||||
|
||||
// destroy children
|
||||
while(!m_children.empty())
|
||||
getFirstChild()->destroy();
|
||||
destroyChildren();
|
||||
|
||||
callLuaField("onDestroy");
|
||||
|
||||
@@ -568,6 +567,12 @@ void UIWidget::destroy()
|
||||
m_destroyed = true;
|
||||
}
|
||||
|
||||
void UIWidget::destroyChildren()
|
||||
{
|
||||
while(!m_children.empty())
|
||||
getFirstChild()->destroy();
|
||||
}
|
||||
|
||||
void UIWidget::setId(const std::string& id)
|
||||
{
|
||||
m_id = id;
|
||||
@@ -1108,6 +1113,11 @@ void UIWidget::onFocusChange(bool focused, Fw::FocusReason reason)
|
||||
callLuaField("onFocusChange", focused, reason);
|
||||
}
|
||||
|
||||
void UIWidget::onChildFocusChange(const UIWidgetPtr& focusedChild, const UIWidgetPtr& unfocusedChild, Fw::FocusReason reason)
|
||||
{
|
||||
callLuaField("onChildFocusChange", focusedChild, unfocusedChild, reason);
|
||||
}
|
||||
|
||||
void UIWidget::onHoverChange(bool hovered)
|
||||
{
|
||||
callLuaField("onHoverChange", hovered);
|
||||
@@ -1168,7 +1178,7 @@ bool UIWidget::onMousePress(const Point& mousePos, Fw::MouseButton button)
|
||||
bool UIWidget::onMouseRelease(const Point& mousePos, Fw::MouseButton button)
|
||||
{
|
||||
if(isPressed() && getRect().contains(mousePos))
|
||||
callLuaField("onClick");
|
||||
onClick(mousePos);
|
||||
|
||||
UIWidgetPtr draggedWidget = g_ui.getDraggingWidget();
|
||||
if(draggedWidget && button == Fw::MouseLeftButton && (containsPoint(mousePos) || asUIWidget() == g_ui.getRootWidget())) {
|
||||
@@ -1196,6 +1206,11 @@ bool UIWidget::onMouseWheel(const Point& mousePos, Fw::MouseWheelDirection direc
|
||||
return callLuaField<bool>("onMouseWheel", mousePos, direction);
|
||||
}
|
||||
|
||||
bool UIWidget::onClick(const Point& mousePos)
|
||||
{
|
||||
return callLuaField<bool>("onClick", mousePos);
|
||||
}
|
||||
|
||||
bool UIWidget::onDoubleClick(const Point& mousePos)
|
||||
{
|
||||
return callLuaField<bool>("onDoubleClick", mousePos);
|
||||
|
@@ -105,6 +105,7 @@ public:
|
||||
void ungrabKeyboard();
|
||||
void bindRectToParent();
|
||||
void destroy();
|
||||
void destroyChildren();
|
||||
|
||||
void setId(const std::string& id);
|
||||
void setParent(const UIWidgetPtr& parent);
|
||||
@@ -169,6 +170,7 @@ protected:
|
||||
virtual void onStyleApply(const std::string& styleName, const OTMLNodePtr& styleNode);
|
||||
virtual void onGeometryChange(const Rect& oldRect, const Rect& newRect);
|
||||
virtual void onFocusChange(bool focused, Fw::FocusReason reason);
|
||||
virtual void onChildFocusChange(const UIWidgetPtr& focusedChild, const UIWidgetPtr& unfocusedChild, Fw::FocusReason reason);
|
||||
virtual void onHoverChange(bool hovered);
|
||||
virtual void onDragEnter(const Point& mousePos);
|
||||
virtual void onDragLeave(UIWidgetPtr droppedWidget, const Point& mousePos);
|
||||
@@ -181,6 +183,7 @@ protected:
|
||||
virtual bool onMouseRelease(const Point& mousePos, Fw::MouseButton button);
|
||||
virtual bool onMouseMove(const Point& mousePos, const Point& mouseMoved);
|
||||
virtual bool onMouseWheel(const Point& mousePos, Fw::MouseWheelDirection direction);
|
||||
virtual bool onClick(const Point& mousePos);
|
||||
virtual bool onDoubleClick(const Point& mousePos);
|
||||
|
||||
bool propagateOnKeyText(const std::string& keyText);
|
||||
|
Reference in New Issue
Block a user