1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
/*
client/trademenu.cc
This file is part of the Osirion project and is distributed under
the terms of the GNU General Public License version 2
*/
#include "ui/button.h"
#include "ui/paint.h"
#include "ui/ui.h"
#include "client/trademenu.h"
namespace client
{
TradeMenu::TradeMenu(ui::Widget *parent, const char * label) : ui::Window(parent)
{
set_border(false);
set_background(false);
if (label)
set_label(label);
else
set_label("trademenu");
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();
}
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 );
}
}
|