mirror of
https://github.com/edubart/otclient.git
synced 2025-10-19 22:13:27 +02:00
save window position and size
This commit is contained in:
@@ -62,7 +62,6 @@ class UIAnchorLayout : public UILayout
|
||||
{
|
||||
public:
|
||||
UIAnchorLayout(UIWidgetPtr parentWidget) : UILayout(parentWidget) { }
|
||||
static UIAnchorLayoutPtr create(UIWidgetPtr parentWidget) { return UIAnchorLayoutPtr(new UIAnchorLayout(parentWidget)); }
|
||||
|
||||
void addAnchor(const UIWidgetPtr& anchoredWidget, Fw::AnchorEdge anchoredEdge,
|
||||
const std::string& hookedWidgetId, Fw::AnchorEdge hookedEdge);
|
||||
|
@@ -32,7 +32,7 @@ UIManager g_ui;
|
||||
void UIManager::init()
|
||||
{
|
||||
// creates root widget
|
||||
m_rootWidget = UIWidget::create<UIWidget>();
|
||||
m_rootWidget = UIWidgetPtr(new UIWidget);
|
||||
m_rootWidget->setId("root");
|
||||
m_mouseReceiver = m_rootWidget;
|
||||
m_keyboardReceiver = m_rootWidget;
|
||||
|
@@ -119,4 +119,3 @@ void UIVerticalLayout::setFitParent(bool fitParent)
|
||||
m_fitParent = fitParent;
|
||||
update();
|
||||
}
|
||||
|
||||
|
@@ -29,7 +29,6 @@ class UIVerticalLayout : public UILayout
|
||||
{
|
||||
public:
|
||||
UIVerticalLayout(UIWidgetPtr parentWidget);
|
||||
static UIVerticalLayoutPtr create(UIWidgetPtr parentWidget) { return UIVerticalLayoutPtr(new UIVerticalLayout(parentWidget)); }
|
||||
|
||||
virtual void applyStyle(const OTMLNodePtr& styleNode);
|
||||
virtual void update();
|
||||
|
@@ -526,7 +526,7 @@ void UIWidget::addChild(const UIWidgetPtr& child)
|
||||
|
||||
// create default layout
|
||||
if(!m_layout)
|
||||
m_layout = UIAnchorLayout::create(asUIWidget());
|
||||
m_layout = UIAnchorLayoutPtr(new UIAnchorLayout(asUIWidget()));
|
||||
|
||||
// add to layout and updates it
|
||||
m_layout->addWidget(child);
|
||||
@@ -559,7 +559,7 @@ void UIWidget::insertChild(int index, const UIWidgetPtr& child)
|
||||
|
||||
// create default layout if needed
|
||||
if(!m_layout)
|
||||
m_layout = UIAnchorLayout::create(asUIWidget());
|
||||
m_layout = UIAnchorLayoutPtr(new UIAnchorLayout(asUIWidget()));
|
||||
|
||||
// add to layout and updates it
|
||||
m_layout->addWidget(child);
|
||||
@@ -829,7 +829,7 @@ void UIWidget::updateState(Fw::WidgetState state)
|
||||
do {
|
||||
parent = widget->getParent();
|
||||
if(!widget->isExplicitlyEnabled() ||
|
||||
((parent && parent->getFocusedChild() != widget))) {
|
||||
((parent && parent->getFocusedChild() != widget))) {
|
||||
newStatus = false;
|
||||
break;
|
||||
}
|
||||
@@ -850,7 +850,7 @@ void UIWidget::updateState(Fw::WidgetState state)
|
||||
do {
|
||||
parent = widget->getParent();
|
||||
if(!widget->isExplicitlyEnabled() || !widget->isExplicitlyVisible() || !widget->containsPoint(mousePos) ||
|
||||
(parent && widget != parent->getChildByPos(mousePos))) {
|
||||
(parent && widget != parent->getChildByPos(mousePos))) {
|
||||
newStatus = false;
|
||||
break;
|
||||
}
|
||||
@@ -1093,9 +1093,9 @@ void UIWidget::onStyleApply(const std::string& styleName, const OTMLNodePtr& sty
|
||||
if(!layoutType.empty()) {
|
||||
UILayoutPtr layout;
|
||||
if(layoutType == "verticalBox")
|
||||
layout = UIVerticalLayout::create(asUIWidget());
|
||||
layout = UIVerticalLayoutPtr(new UIVerticalLayout(asUIWidget()));
|
||||
else if(layoutType == "anchor")
|
||||
layout = UIAnchorLayout::create(asUIWidget());
|
||||
layout = UIAnchorLayoutPtr(new UIAnchorLayout(asUIWidget()));
|
||||
else
|
||||
throw OTMLException(node, "cannot determine layout type");
|
||||
setLayout(layout);
|
||||
@@ -1158,6 +1158,7 @@ void UIWidget::onStyleApply(const std::string& styleName, const OTMLNodePtr& sty
|
||||
}
|
||||
|
||||
if(m_firstOnStyle) {
|
||||
callLuaField("onSetup");
|
||||
// always focus new child
|
||||
if(isFocusable() && isExplicitlyVisible() && isExplicitlyEnabled())
|
||||
focus();
|
||||
|
@@ -35,9 +35,6 @@ public:
|
||||
UIWidget();
|
||||
virtual ~UIWidget() { }
|
||||
|
||||
template<class T>
|
||||
static std::shared_ptr<T> create() { auto t = std::shared_ptr<T>(new T); return t; }
|
||||
|
||||
void destroy();
|
||||
|
||||
protected:
|
||||
|
Reference in New Issue
Block a user