display window on screen center

This commit is contained in:
Eduardo Bart
2012-01-02 23:32:34 -02:00
parent 05230f44e4
commit 7172d2251a
7 changed files with 17 additions and 17 deletions

View File

@@ -120,6 +120,7 @@ void Application::registerLuaFunctions()
g_lua.bindClassMemberFunction<UIWidget>("getMarginLeft", &UIWidget::getMarginLeft);
g_lua.bindClassMemberFunction<UIWidget>("getLastFocusReason", &UIWidget::getLastFocusReason);
g_lua.bindClassMemberFunction<UIWidget>("getStyle", &UIWidget::getStyle);
g_lua.bindClassMemberFunction<UIWidget>("getStyleName", &UIWidget::getStyleName);
g_lua.bindClassMemberFunction<UIWidget>("getChildren", &UIWidget::getChildren);
g_lua.bindClassMemberFunction<UIWidget>("getFocusedChild", &UIWidget::getFocusedChild);
g_lua.bindClassMemberFunction<UIWidget>("getChildAfter", &UIWidget::getChildAfter);
@@ -233,6 +234,7 @@ void Application::registerLuaFunctions()
g_lua.bindClassStaticFunction("g_window", "setIcon", std::bind(&PlatformWindow::setIcon, &g_window, _1));
g_lua.bindClassStaticFunction("g_window", "getMousePos", std::bind(&PlatformWindow::getMousePos, &g_window));
g_lua.bindClassStaticFunction("g_window", "getSize", std::bind(&PlatformWindow::getSize, &g_window));
g_lua.bindClassStaticFunction("g_window", "getDisplaySize", std::bind(&PlatformWindow::getDisplaySize, &g_window));
g_lua.bindClassStaticFunction("g_window", "getPlatformType", std::bind(&PlatformWindow::getPlatformType, &g_window));
// Logger

View File

@@ -34,7 +34,6 @@ void UIManager::init()
// creates root widget
m_rootWidget = UIWidget::create<UIWidget>();
m_rootWidget->setId("root");
m_rootWidget->resize(g_window.getSize());
m_mouseReceiver = m_rootWidget;
m_keyboardReceiver = m_rootWidget;
}
@@ -134,8 +133,9 @@ OTMLNodePtr UIManager::getStyle(const std::string& styleName)
// styles starting with UI are automatically defined
if(boost::starts_with(styleName, "UI")) {
OTMLNodePtr node = OTMLNode::create();
OTMLNodePtr node = OTMLNode::create(styleName);
node->writeAt("__class", styleName);
m_styles[styleName] = node;
return node;
}

View File

@@ -155,6 +155,7 @@ void UIWidget::setStyle(const std::string& styleName)
}
applyStyle(styleNode);
m_style = styleNode;
assert(getStyleName() != "");
updateStyle();
}

View File

@@ -26,6 +26,7 @@
#include "declarations.h"
#include <framework/luascript/luaobject.h>
#include <framework/graphics/declarations.h>
#include <framework/otml/otmlnode.h>
class UIWidget : public LuaObject
{
@@ -128,6 +129,7 @@ public:
int getMarginLeft() { return m_marginLeft; }
Fw::FocusReason getLastFocusReason() { return m_lastFocusReason; }
OTMLNodePtr getStyle() { return m_style; }
std::string getStyleName() { return m_style->tag(); }
UIWidgetList getChildren() { return m_children; }
UIWidgetPtr getFocusedChild() { return m_focusedChild; }