change interface style, add top menu

This commit is contained in:
Eduardo Bart
2011-11-01 14:41:15 -02:00
parent 999fa731c0
commit 59017205b0
29 changed files with 197 additions and 3020 deletions

View File

@@ -28,6 +28,7 @@ void UILabel::setup()
{
UIWidget::setup();
setFocusable(false);
setPhantom(true);
setAlign(Fw::AlignLeft);
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -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();