mirror of
https://github.com/edubart/otclient.git
synced 2025-10-15 03:54:54 +02:00
change interface style, add top menu
This commit is contained in:
@@ -28,6 +28,7 @@ void UILabel::setup()
|
||||
{
|
||||
UIWidget::setup();
|
||||
setFocusable(false);
|
||||
setPhantom(true);
|
||||
setAlign(Fw::AlignLeft);
|
||||
}
|
||||
|
||||
|
@@ -59,6 +59,7 @@ void UIWidget::setup()
|
||||
setVisible(true);
|
||||
setEnabled(true);
|
||||
setFocusable(true);
|
||||
setPhantom(false);
|
||||
setPressed(false);
|
||||
setSizeFixed(false);
|
||||
setFont(g_fonts.getDefaultFont());
|
||||
@@ -732,10 +733,18 @@ void UIWidget::onStyleApply(const OTMLNodePtr& styleNode)
|
||||
else if(node->tag() == "opacity") {
|
||||
setOpacity(node->value<int>());
|
||||
}
|
||||
// enabled
|
||||
else if(node->tag() == "enabled") {
|
||||
setEnabled(node->value<bool>());
|
||||
}
|
||||
// focusable
|
||||
else if(node->tag() == "focusable") {
|
||||
setFocusable(node->value<bool>());
|
||||
}
|
||||
// focusable
|
||||
else if(node->tag() == "phantom") {
|
||||
setPhantom(node->value<bool>());
|
||||
}
|
||||
// size
|
||||
else if(node->tag() == "size") {
|
||||
resize(node->value<Size>());
|
||||
@@ -910,8 +919,11 @@ bool UIWidget::onMousePress(const Point& mousePos, Fw::MouseButton button)
|
||||
|
||||
bool mustEnd = child->onMousePress(mousePos, button);
|
||||
|
||||
if(!child->getChildByPos(mousePos) && !child->isPressed())
|
||||
child->setPressed(true);
|
||||
if(button == Fw::MouseLeftButton && !child->isPressed()) {
|
||||
UIWidgetPtr clickedChild = child->getChildByPos(mousePos);
|
||||
if(!clickedChild || clickedChild->isPhantom())
|
||||
child->setPressed(true);
|
||||
}
|
||||
|
||||
if(mustEnd)
|
||||
return true;
|
||||
|
@@ -46,6 +46,7 @@ public:
|
||||
void setPressed(bool pressed) { m_pressed = pressed; updateState(Fw::PressedState); }
|
||||
void setId(const std::string& id) { m_id = id; }
|
||||
void setFocusable(bool focusable) { m_focusable = focusable; }
|
||||
void setPhantom(bool phantom) { m_phantom = phantom; }
|
||||
void setStyle(const std::string& styleName);
|
||||
void setStyleFromNode(const OTMLNodePtr& styleNode);
|
||||
void setLayout(const UILayoutPtr& layout) { m_layout = layout; }
|
||||
@@ -87,6 +88,7 @@ public:
|
||||
bool isExplicitlyEnabled() const { return m_enabled; }
|
||||
bool isExplicitlyVisible() const { return m_visible; }
|
||||
bool isFocusable() const { return m_focusable; }
|
||||
bool isPhantom() const { return m_phantom; }
|
||||
bool isSizeFixed() const { return m_fixedSize; }
|
||||
bool hasChildren() const { return m_children.size() > 0; }
|
||||
bool hasChild(const UIWidgetPtr& child);
|
||||
@@ -181,6 +183,7 @@ protected:
|
||||
bool m_focusable;
|
||||
bool m_fixedSize;
|
||||
bool m_pressed;
|
||||
bool m_phantom;
|
||||
Rect m_rect;
|
||||
UILayoutPtr m_layout;
|
||||
UIWidgetWeakPtr m_parent;
|
||||
|
@@ -112,10 +112,10 @@ void UIWindow::onFocusChange(bool focused, Fw::FocusReason reason)
|
||||
|
||||
bool UIWindow::onMousePress(const Point& mousePos, Fw::MouseButton button)
|
||||
{
|
||||
if(!getChildByPos(mousePos)) {
|
||||
UIWidgetPtr clickedChild = getChildByPos(mousePos);
|
||||
if(!clickedChild || clickedChild->isPhantom()) {
|
||||
m_moving = true;
|
||||
m_movingReference = mousePos - getRect().topLeft();
|
||||
return true;
|
||||
}
|
||||
return UIWidget::onMousePress(mousePos, button);
|
||||
}
|
||||
|
@@ -148,7 +148,7 @@ void OTClient::run()
|
||||
render();
|
||||
|
||||
// render fps
|
||||
defaultFont->renderText(fpsText, Point(g_graphics.getScreenSize().width() - fpsTextSize.width() - 10, 10));
|
||||
defaultFont->renderText(fpsText, Point(g_graphics.getScreenSize().width() - fpsTextSize.width() - 10, 34));
|
||||
|
||||
// render end
|
||||
g_graphics.endRender();
|
||||
|
Reference in New Issue
Block a user