From 09c870ad68d79424eb089ab50c4cda569805a4af Mon Sep 17 00:00:00 2001 From: scrawl Date: Fri, 25 May 2012 12:58:28 +0200 Subject: [PATCH] first alchemy window layout (not pretty) --- apps/openmw/mwgui/alchemywindow.cpp | 27 +++++++ apps/openmw/mwgui/alchemywindow.hpp | 7 ++ files/mygui/openmw_alchemy_window_layout.xml | 80 ++++++++++++++++++++ 3 files changed, 114 insertions(+) diff --git a/apps/openmw/mwgui/alchemywindow.cpp b/apps/openmw/mwgui/alchemywindow.cpp index 570a1f6d4..90326c3d7 100644 --- a/apps/openmw/mwgui/alchemywindow.cpp +++ b/apps/openmw/mwgui/alchemywindow.cpp @@ -1,10 +1,37 @@ #include "alchemywindow.hpp" +#include "window_manager.hpp" + namespace MWGui { AlchemyWindow::AlchemyWindow(WindowManager& parWindowManager) : WindowBase("openmw_alchemy_window_layout.xml", parWindowManager) { + getWidget(mCreateButton, "CreateButton"); + getWidget(mCancelButton, "CancelButton"); + + + MyGUI::Widget* buttonBox = mCancelButton->getParent(); + int cancelButtonWidth = mCancelButton->getTextSize().width + 24; + mCancelButton->setCoord(buttonBox->getWidth() - cancelButtonWidth, + mCancelButton->getTop(), cancelButtonWidth, mCancelButton->getHeight()); + int createButtonWidth = mCreateButton->getTextSize().width + 24; + mCreateButton->setCoord(buttonBox->getWidth() - createButtonWidth - cancelButtonWidth - 4, + mCreateButton->getTop(), createButtonWidth, mCreateButton->getHeight()); + + mCreateButton->eventMouseButtonClick += MyGUI::newDelegate(this, &AlchemyWindow::onCreateButtonClicked); + mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &AlchemyWindow::onCancelButtonClicked); + center(); } + + void AlchemyWindow::onCancelButtonClicked(MyGUI::Widget* _sender) + { + mWindowManager.popGuiMode(); + mWindowManager.popGuiMode(); + } + + void AlchemyWindow::onCreateButtonClicked(MyGUI::Widget* _sender) + { + } } diff --git a/apps/openmw/mwgui/alchemywindow.hpp b/apps/openmw/mwgui/alchemywindow.hpp index 37e50413b..d43bb6d33 100644 --- a/apps/openmw/mwgui/alchemywindow.hpp +++ b/apps/openmw/mwgui/alchemywindow.hpp @@ -9,6 +9,13 @@ namespace MWGui { public: AlchemyWindow(WindowManager& parWindowManager); + + protected: + MyGUI::Button* mCreateButton; + MyGUI::Button* mCancelButton; + + void onCancelButtonClicked(MyGUI::Widget* _sender); + void onCreateButtonClicked(MyGUI::Widget* _sender); }; } diff --git a/files/mygui/openmw_alchemy_window_layout.xml b/files/mygui/openmw_alchemy_window_layout.xml index c6c4b1caa..22511f013 100644 --- a/files/mygui/openmw_alchemy_window_layout.xml +++ b/files/mygui/openmw_alchemy_window_layout.xml @@ -3,6 +3,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +