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>2010-09-15 21:29:18 +0000
committerStijn Buys <ingar@osirion.org>2010-09-15 21:29:18 +0000
commite55638d081e2e1ff6fbc06e0e8ac0381a04308e7 (patch)
tree511ccb478adf2acd3cc93f66d217b09f3e3a06dc /src/client/buymenu.cc
parentf612f19e095b8d0ba49f5bcdec6a582824315d69 (diff)
updated comments, updated buy menu, info support for map window, added const to target selection
Diffstat (limited to 'src/client/buymenu.cc')
-rw-r--r--src/client/buymenu.cc91
1 files changed, 42 insertions, 49 deletions
diff --git a/src/client/buymenu.cc b/src/client/buymenu.cc
index d708511..c3878a8 100644
--- a/src/client/buymenu.cc
+++ b/src/client/buymenu.cc
@@ -16,50 +16,42 @@ namespace client
BuyMenu::BuyMenu(ui::Widget *parent, const char * label) : ui::Window(parent)
{
set_border(false);
- set_background(true);
+ set_background(false);
if (label)
set_label(label);
else
set_label("buymenu");
- // model pane (left)
- menu_modelpane = new ui::Window(this);
- menu_modelpane->set_label("modelpane");
- menu_modelpane->set_background(true);
- menu_modelpane->set_border(true);
-
- menu_modelview = new ui::ModelView(menu_modelpane);
- menu_modelview->set_label("modelview");
- menu_modelview->set_background(false);
- menu_modelview->set_border(false);
-
- menu_closebutton = new ui::Button(menu_modelpane, "Return", "view hide");
-
- // text pane (right)
- menu_textpane = new ui::Window(this);
- menu_textpane->set_label("textpane");
- menu_textpane->set_background(true);
- menu_textpane->set_border(true);
+
+ menu_buywindow = new ui::Window(this);
+ menu_buywindow->set_label("buywindow");
+ menu_buywindow->set_background(true);
+ menu_buywindow->set_border(true);
- menu_namelabel = new ui::Label(menu_textpane);
+ menu_namelabel = new ui::Label(menu_buywindow);
menu_namelabel->set_label("infolabel");
menu_namelabel->set_background(false);
menu_namelabel->set_border(false);
menu_namelabel->set_font(ui::root()->font_large());
menu_namelabel->set_alignment(ui::AlignCenter);
- menu_scrollpane = new ui::ScrollPane(menu_textpane, menu_infotext);
+ menu_modelview = new ui::ModelView(menu_buywindow);
+ menu_modelview->set_label("modelview");
+ menu_modelview->set_background(false);
+ menu_modelview->set_border(false);
+
+ menu_scrollpane = new ui::ScrollPane(menu_buywindow, menu_infotext);
menu_scrollpane->set_background(false);
menu_scrollpane->set_border(false);
menu_scrollpane->set_alignment(ui::AlignTop);
- menu_buybutton = new ui::Button(menu_textpane, "Buy");
+ menu_closebutton = new ui::Button(menu_buywindow, "Return", "view hide");
+ menu_buybutton = new ui::Button(menu_buywindow, "Buy");
menu_infotimestamp = 0;
menu_inforecord = 0;
- menu_modelpane->raise(); // DEBUG
hide();
}
@@ -89,7 +81,7 @@ void BuyMenu::set_item(std::string const & itemtype, std::string const & itemnam
menu_namelabel->set_text(menu_inforecord->name());
menu_modelview->set_modelname(menu_inforecord->modelname());
- for (core::Info::Text::iterator it = menu_inforecord->text().begin(); it != menu_inforecord->text().end(); it++) {
+ for (core::Info::Text::const_iterator it = menu_inforecord->text().begin(); it != menu_inforecord->text().end(); it++) {
menu_infotext.push_back((*it));
}
menu_infotimestamp = menu_inforecord->timestamp();
@@ -103,34 +95,35 @@ void BuyMenu::set_item(std::string const & itemtype, std::string const & itemnam
void BuyMenu::resize()
{
const float smallmargin = ui::UI::elementsize.height();
+ const float fontmargin = menu_namelabel->font()->height();
+ // this menu takes the entire screen
set_size(parent()->size());
-
- // reposition model pane (left)
- menu_modelpane->set_size(ui::UI::elementsize.width() * 1.5f, height() - smallmargin * 4.0f);
- menu_modelpane->set_location(smallmargin, smallmargin * 2.0f);
-
+
+ // resize the subwindow
+ menu_buywindow->set_size(width() - smallmargin * 2.0f, height()- smallmargin * 4.0f);
+ menu_buywindow->set_location(smallmargin, smallmargin * 2.0f);
+
+ // resize label
+ menu_namelabel->set_size(menu_buywindow->width() - fontmargin * 2.0f, menu_namelabel->font()->height());
+ menu_namelabel->set_location(fontmargin, fontmargin);
+
+ // resize model view
+ menu_modelview->set_size(ui::UI::elementsize.width() * 1.5f,
+ menu_buywindow->height() - smallmargin * 2.0f - fontmargin * 3.0f);
+ menu_modelview->set_location(fontmargin, fontmargin * 3.0f);
+
+ // resize infotext pane
+ menu_scrollpane->set_size(menu_buywindow->width() - ui::UI::elementsize.width() * 1.5f - fontmargin * 3.0f,
+ menu_buywindow->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_buywindow->width() * 0.5f - ui::UI::elementsize.width() - smallmargin * 2.0f, menu_buywindow->height() - smallmargin * 1.5f);
+
menu_closebutton->set_size(ui::UI::elementsize);
- menu_closebutton->set_location((menu_modelpane->width() - menu_closebutton->width()) * 0.5f,
- menu_modelpane->height() - menu_closebutton->height() - ui::UI::elementsize.height() * 0.5f);
-
- menu_modelview->set_size(menu_modelpane->width() - 8, menu_modelpane->width() - 8);
- menu_modelview->set_location(4, 4);
-
- // reposition text pane (right)
- menu_textpane->set_size(width() - smallmargin * 3.0f - menu_modelpane->width(), height() - smallmargin * 4.0f);
- menu_textpane->set_location(smallmargin * 2.0f + menu_modelpane->width(), smallmargin * 2.0f);
-
- menu_buybutton->set_size(ui::UI::elementsize);
- menu_buybutton->set_location((menu_textpane->width() - menu_buybutton->width()) * 0.5f,
- menu_textpane->height() - menu_buybutton->height() - ui::UI::elementsize.height() * 0.5f);
-
- menu_namelabel->set_size(menu_textpane->width(), menu_namelabel->font()->height() * 2.0f);
- menu_namelabel->set_location(0, 4);
-
- menu_scrollpane->set_size(menu_textpane->width() - 8, menu_buybutton->top() - menu_namelabel->bottom() - 8);
- menu_scrollpane->set_location(4, menu_namelabel->bottom() + 4);
-
+ menu_closebutton->set_location(menu_buywindow->width() * 0.5f + smallmargin * 2.0f, menu_buywindow->height() - smallmargin * 1.5f);
}
void BuyMenu::draw()