Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2011-08-28 09:49:23 +0000
committerStijn Buys <ingar@osirion.org>2011-08-28 09:49:23 +0000
commit14b2372f1a74198ec4f485f9665ef0acc27ae5e3 (patch)
tree0d03c4c08f5b1134b9be05875a2a27148d64dedc /src/client
parent8b9b47e71cfd3ca1a9c3b8f9574ab460c9a8f437 (diff)
New base classes for cient menus.
Diffstat (limited to 'src/client')
-rw-r--r--src/client/Makefile.am4
-rw-r--r--src/client/mainmenu.cc53
-rw-r--r--src/client/mainmenu.h56
-rw-r--r--src/client/menuwindow.cc32
-rw-r--r--src/client/menuwindow.h34
5 files changed, 179 insertions, 0 deletions
diff --git a/src/client/Makefile.am b/src/client/Makefile.am
index 49ac08a..71cfc7d 100644
--- a/src/client/Makefile.am
+++ b/src/client/Makefile.am
@@ -24,9 +24,11 @@ noinst_HEADERS = \
joystick.h \
key.h \
keyboard.h \
+ mainmenu.h \
mainwindow.h \
mapwidget.h \
mapwindow.h \
+ menuwindow.h \
notifications.h \
soundext.h \
targeticonbutton.h \
@@ -51,9 +53,11 @@ libclient_la_SOURCES = \
joystick.cc \
key.cc \
keyboard.cc \
+ mainmenu.cc \
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
new file mode 100644
index 0000000..5d1706d
--- /dev/null
+++ b/src/client/mainmenu.cc
@@ -0,0 +1,53 @@
+/*
+ client/mainmenu.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/mainmenu.h"
+#include "ui/paint.h"
+
+namespace client
+{
+
+MainMenu::MainMenu(ui::Widget *parent) : ui::Window(parent)
+{
+ // default main menus
+ mainmenu_mainmenu = 0;
+ mainmenu_gamemenu = 0;
+ mainmenu_joinmenu = 0;
+
+ // default extra menus
+ mainmenu_optionsmenu = 0;
+ mainmenu_loadmenu = 0;
+ mainmenu_savemenu = 0;
+ mainmenu_connectmenu = 0;
+
+ set_background(true);
+ set_label("mainmenu");
+}
+
+MainMenu::~MainMenu()
+{
+}
+
+void MainMenu::show()
+{
+ ui::Widget::show();
+}
+
+void MainMenu::hide()
+{
+ ui::Widget::hide();
+}
+
+void MainMenu::draw_background()
+{
+ // we override draw_background instead of adding a ui::Bitmap child
+ // this simplifies child window managment
+ if (mainmenu_background.size()) {
+ ui::Paint::draw_bitmap(global_location(), size(), math::Color(), mainmenu_background);
+ }
+}
+
+} // namespace client
diff --git a/src/client/mainmenu.h b/src/client/mainmenu.h
new file mode 100644
index 0000000..cadd019
--- /dev/null
+++ b/src/client/mainmenu.h
@@ -0,0 +1,56 @@
+/*
+ client/mainmenu.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_MAINMENU_H__
+#define __INCLUDED_CLIENT_MAINMENU_H__
+
+#include "ui/window.h"
+#include "ui/bitmap.h"
+
+namespace client
+{
+
+/**
+ * @brief the client's main menu window
+ * The MainMenu contains a number of child menu windows,
+ * of which only one at a time will be visible
+ * */
+class MainMenu : public ui::Window
+{
+public:
+ MainMenu(ui::Widget *parent = 0);
+ virtual ~MainMenu();
+
+protected:
+ virtual void show();
+
+ virtual void hide();
+
+ virtual void draw_background();
+
+private:
+ /// the menu to show if the application is not connected
+ ui::Window *mainmenu_mainmenu;
+ /// the menu to show if the application is connected but the player has not joined yet
+ ui::Window *mainmenu_joinmenu;
+ /// the menu the show if the application is connected and the player has joined
+ ui::Window *mainmenu_gamemenu;
+ /// the options menu
+ ui::Window *mainmenu_optionsmenu;
+ /// the load game menu
+ ui::Window *mainmenu_loadmenu;
+ /// the save game menu
+ ui::Window *mainmenu_savemenu;
+ /// the connect to server menu
+ ui::Window *mainmenu_connectmenu;
+
+ std::string mainmenu_background;
+};
+
+}
+
+#endif // __INCLUDED_CLIENT_MAINMENU_H__
+
diff --git a/src/client/menuwindow.cc b/src/client/menuwindow.cc
new file mode 100644
index 0000000..8ebd0cb
--- /dev/null
+++ b/src/client/menuwindow.cc
@@ -0,0 +1,32 @@
+/*
+ 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
new file mode 100644
index 0000000..82aaf8b
--- /dev/null
+++ b/src/client/menuwindow.h
@@ -0,0 +1,34 @@
+/*
+ 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__
+