diff options
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/buymenu.cc | 16 | ||||
-rw-r--r-- | src/client/buymenu.h | 3 |
2 files changed, 16 insertions, 3 deletions
diff --git a/src/client/buymenu.cc b/src/client/buymenu.cc index b0a0b48..fecf4e0 100644 --- a/src/client/buymenu.cc +++ b/src/client/buymenu.cc @@ -30,7 +30,12 @@ BuyMenu::BuyMenu(ui::Widget *parent, const char * label) : ui::Window(parent) menu_modelpane->set_border(true); menu_closebutton = new ui::Button(menu_modelpane, "Close","view hide"); - + + menu_modelview = new ui::ModelView(menu_modelpane); + menu_modelview->set_label("modelview"); + menu_modelview->set_background(false); + menu_modelview->set_border(true); + // text pane (right) menu_textpane = new ui::Window(this); menu_textpane->set_label("textpane"); @@ -52,6 +57,7 @@ BuyMenu::BuyMenu(ui::Widget *parent, const char * label) : ui::Window(parent) menu_infotimestamp = 0; menu_inforecord = 0; + menu_modelpane->raise(); // DEBUG hide(); } @@ -73,10 +79,13 @@ void BuyMenu::set_item(std::string const & itemtype, std::string const & itemnam menu_infotext.clear(); menu_namelabel->set_text(0); + menu_modelview->set_modelname(0); core::Info *info = core::game()->info(itemtype+'/'+itemname); if (info) { menu_namelabel->set_text(info->name()); + menu_modelview->set_modelname(info->modelname()); + for (core::Info::Text::iterator it = info->text().begin(); it != info->text().end(); it++) { menu_infotext.push_back((*it)); } @@ -103,6 +112,9 @@ void BuyMenu::resize() 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); @@ -124,8 +136,6 @@ void BuyMenu::draw() // update content if necessary if (menu_infotimestamp && (menu_infotimestamp != menu_inforecord->timestamp())) set_item(menu_itemtype, menu_itemname); - - ui::Window::draw(); } } diff --git a/src/client/buymenu.h b/src/client/buymenu.h index 81a87bd..44517cf 100644 --- a/src/client/buymenu.h +++ b/src/client/buymenu.h @@ -11,6 +11,7 @@ #include "ui/container.h" #include "ui/button.h" #include "ui/label.h" +#include "ui/modelview.h" #include "ui/window.h" #include "ui/scrollpane.h" @@ -44,6 +45,8 @@ private: ui::Button *menu_closebutton; ui::Button *menu_buybutton; + ui::ModelView *menu_modelview; + std::string menu_itemtype; std::string menu_itemname; |