Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/trademenu.cc')
-rw-r--r--src/client/trademenu.cc50
1 files changed, 48 insertions, 2 deletions
diff --git a/src/client/trademenu.cc b/src/client/trademenu.cc
index c60791f..75b9d67 100644
--- a/src/client/trademenu.cc
+++ b/src/client/trademenu.cc
@@ -4,15 +4,15 @@
the terms of the GNU General Public License version 2
*/
-#include "ui/ui.h"
#include "ui/button.h"
#include "ui/paint.h"
+#include "ui/ui.h"
#include "client/trademenu.h"
namespace client
{
-TradeMenu::TradeMenu(ui::Window *parent, const char * label) : ui::Window(parent)
+TradeMenu::TradeMenu(ui::Widget *parent, const char * label) : ui::Window(parent)
{
set_border(false);
set_background(false);
@@ -24,7 +24,19 @@ TradeMenu::TradeMenu(ui::Window *parent, const char * label) : ui::Window(parent
menu_tradewindow = new ui::Window(this);
menu_tradewindow->set_label("tradewindow");
menu_tradewindow->set_border(true);
+
+ menu_listview = new ui::ListView(menu_tradewindow);
+ menu_listview->set_label("listview");
+ menu_listview->set_background(false);
+ menu_listview->set_border(true);
+
+ menu_scrollpane = new ui::ScrollPane(menu_tradewindow, menu_infotext);
+ menu_scrollpane->set_background(false);
+ menu_scrollpane->set_border(true);
+ menu_scrollpane->set_alignment(ui::AlignTop);
+ menu_closebutton = new ui::Button(menu_tradewindow, "Return", "view hide");
+
hide();
}
@@ -33,4 +45,38 @@ TradeMenu::~TradeMenu()
}
+void TradeMenu::resize()
+{
+ const float smallmargin = ui::UI::elementsize.height();
+ const float fontmargin = ui::root()->font_large()->height();
+
+ // this menu takes the entire screen
+ set_size(parent()->size());
+
+ // resize the subwindow
+ menu_tradewindow->set_size(width() - smallmargin * 2.0f, height()- smallmargin * 4.0f);
+ menu_tradewindow->set_location(smallmargin, smallmargin * 2.0f);
+
+ // resize label
+ //menu_namelabel->set_size(menu_tradewindow->width() - fontmargin * 2.0f, menu_namelabel->font()->height());
+ //menu_namelabel->set_location(fontmargin, fontmargin);
+
+ // resize listview
+ menu_listview->set_size(ui::UI::elementsize.width() * 1.5f, menu_tradewindow->height() - smallmargin * 2.0f - fontmargin * 3.0f);
+ menu_listview->set_location(fontmargin, fontmargin * 3.0f);
+
+ // resize infotext pane
+ menu_scrollpane->set_size(menu_tradewindow->width() - ui::UI::elementsize.width() * 1.5f - fontmargin * 3.0f,
+ menu_tradewindow->height() - smallmargin * 2.0f - fontmargin * 3.0f);
+ menu_scrollpane->set_location(ui::UI::elementsize.width() * 1.5f + fontmargin * 2.0f, fontmargin * 3.0f);
+
+ // resize buttons
+ //menu_buybutton->set_size(ui::UI::elementsize);
+ //menu_buybutton->set_location(menu_tradewindow->width() * 0.5f - ui::UI::elementsize.width() - smallmargin * 2.0f, menu_tradewindow->height() - smallmargin * 1.5f);
+
+ menu_closebutton->set_size(ui::UI::elementsize);
+ //menu_closebutton->set_location(menu_tradewindow->width() * 0.5f + smallmargin * 2.0f, menu_tradewindow->height() - smallmargin * 1.5f);
+ menu_closebutton->set_location(0.5f * (menu_tradewindow->width() - ui::UI::elementsize.width()), menu_tradewindow->height() - smallmargin * 1.5f );
+}
+
}