diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/Makefile.am | 2 | ||||
-rw-r--r-- | src/client/mainmenu.cc | 11 | ||||
-rw-r--r-- | src/client/mainmenu.h | 6 | ||||
-rw-r--r-- | src/client/mainwindow.cc | 5 | ||||
-rw-r--r-- | src/client/mainwindow.h | 7 | ||||
-rw-r--r-- | src/client/menuwindow.cc | 32 | ||||
-rw-r--r-- | src/client/menuwindow.h | 34 |
7 files changed, 26 insertions, 71 deletions
diff --git a/src/client/Makefile.am b/src/client/Makefile.am index 71cfc7d..9915d0e 100644 --- a/src/client/Makefile.am +++ b/src/client/Makefile.am @@ -28,7 +28,6 @@ noinst_HEADERS = \ mainwindow.h \ mapwidget.h \ mapwindow.h \ - menuwindow.h \ notifications.h \ soundext.h \ targeticonbutton.h \ @@ -57,7 +56,6 @@ libclient_la_SOURCES = \ mainwindow.cc \ mapwidget.cc \ mapwindow.cc \ - menuwindow.h \ notifications.cc \ soundext.cc \ targeticonbutton.cc \ diff --git a/src/client/mainmenu.cc b/src/client/mainmenu.cc index 5d1706d..6a4f97a 100644 --- a/src/client/mainmenu.cc +++ b/src/client/mainmenu.cc @@ -6,6 +6,7 @@ #include "client/mainmenu.h" #include "ui/paint.h" +#include "ui/ui.h" namespace client { @@ -41,6 +42,16 @@ void MainMenu::hide() ui::Widget::hide(); } +void MainMenu::resize() +{ + // resize and reposition all child windows + const float smallmargin = ui::UI::elementsize.height(); + for (ui::Widget::Children::iterator child = children().begin(); child != children().end(); ++child) { + (*child)->set_size(width() - smallmargin * 2, height() - smallmargin * 4); + (*child)->set_location(smallmargin, smallmargin * 2); + } +} + void MainMenu::draw_background() { // we override draw_background instead of adding a ui::Bitmap child diff --git a/src/client/mainmenu.h b/src/client/mainmenu.h index cadd019..9320668 100644 --- a/src/client/mainmenu.h +++ b/src/client/mainmenu.h @@ -24,12 +24,14 @@ public: MainMenu(ui::Widget *parent = 0); virtual ~MainMenu(); -protected: virtual void show(); virtual void hide(); - + +protected: virtual void draw_background(); + + virtual void resize(); private: /// the menu to show if the application is not connected diff --git a/src/client/mainwindow.cc b/src/client/mainwindow.cc index 6574303..607e503 100644 --- a/src/client/mainwindow.cc +++ b/src/client/mainwindow.cc @@ -37,6 +37,11 @@ MainWindow::MainWindow(ui::Widget *parent) : ui::Widget(parent) mainwindow_gamewindow = new GameWindow(this); mainwindow_gamewindow->raise(); mainwindow_gamewindow->hide(); + + // main menus + mainwindow_mainmenu = new MainMenu(this); + mainwindow_mainmenu->raise(); + mainwindow_mainmenu->hide(); } MainWindow::~MainWindow() diff --git a/src/client/mainwindow.h b/src/client/mainwindow.h index 3497913..78bf92b 100644 --- a/src/client/mainwindow.h +++ b/src/client/mainwindow.h @@ -11,6 +11,7 @@ #include "client/gamewindow.h" #include "client/infowidget.h" +#include "client/mainmenu.h" #include "client/notifications.h" namespace client @@ -34,6 +35,10 @@ public: inline Notifications *notificationswidget() { return mainwindow_notificationswidget; } + + inline MainMenu *mainmenu() { + return mainwindow_mainmenu; + } protected: @@ -47,7 +52,7 @@ private: ClockInfoWidget *mainwindow_clockwidget; Notifications *mainwindow_notificationswidget; GameWindow *mainwindow_gamewindow; - + MainMenu *mainwindow_mainmenu; }; } diff --git a/src/client/menuwindow.cc b/src/client/menuwindow.cc deleted file mode 100644 index 8ebd0cb..0000000 --- a/src/client/menuwindow.cc +++ /dev/null @@ -1,32 +0,0 @@ -/* - client/menuwindow.cc - This file is part of the Osirion project and is distributed under - the terms and conditions of the GNU General Public License version 2 -*/ - -#include "client/menuwindow.h" - -namespace client -{ - -MenuWindow::MenuWindow(ui::Widget *parent) : ui::Widget(parent) -{ - set_border(true); - set_background(true); -} - -MenuWindow::~MenuWindow() -{ -} - -void MenuWindow::resize() -{ -} - -void MainWindow::draw_background() -{ - - -} - -} diff --git a/src/client/menuwindow.h b/src/client/menuwindow.h deleted file mode 100644 index 82aaf8b..0000000 --- a/src/client/menuwindow.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - client/menuwindow.h - This file is part of the Osirion project and is distributed under - the terms and conditions of the GNU General Public License version 2 -*/ - -#ifndef __INCLUDED_CLIENT_MENUWINDOW_H__ -#define __INCLUDED_CLIENT_MENUWINDOW_H__ - -#include "ui/window.h" - -namespace client -{ - -/** - * @brief generic base class for client windows - * This class implements the default layout for most client - * windows - **/ -class MenuWindow : public ui::Window -{ -public: - MenuWindow(ui::Widget *parent = 0); - virtual ~MenuWindow(); - -protected: - - virtual void resize(); -}; - -} - -#endif // __INCLUDED_CLIENT_MENUWINDOW_H__ - |