diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/chat.cc | 62 | ||||
-rw-r--r-- | src/client/chat.h | 2 | ||||
-rw-r--r-- | src/client/inventorywindow.cc | 89 | ||||
-rw-r--r-- | src/client/inventorywindow.h | 6 | ||||
-rw-r--r-- | src/client/mapwindow.cc | 155 | ||||
-rw-r--r-- | src/client/mapwindow.h | 3 | ||||
-rw-r--r-- | src/client/reputationwindow.cc | 42 | ||||
-rw-r--r-- | src/client/reputationwindow.h | 2 |
8 files changed, 229 insertions, 132 deletions
diff --git a/src/client/chat.cc b/src/client/chat.cc index 25b437c..21fe698 100644 --- a/src/client/chat.cc +++ b/src/client/chat.cc @@ -25,7 +25,7 @@ Chat::Chat(ui::Widget *parent) : ui::Window(parent) history.push_back(""); history_pos = history.rbegin(); - // window title + // window title chat_titlelabel = new ui::Label(this); chat_titlelabel->set_label("title"); chat_titlelabel->set_background(false); @@ -37,14 +37,25 @@ Chat::Chat(ui::Widget *parent) : ui::Window(parent) // close button chat_closebutton = new ui::IconButton(chat_titlelabel, "bitmaps/icons/window_close"); - chat_scrollpane = new ui::ScrollPane(this, chat_log); + // player list + chat_playerlist = new ui::ListView(this); + chat_playerlist->set_label("playerlist"); + + // ---- right pane + chat_pane_right = new ui::Widget(this); + chat_pane_right->set_background(true); + chat_pane_right->set_border(true); + chat_pane_right->set_focus(); + + // chat text + chat_scrollpane = new ui::ScrollPane(chat_pane_right, chat_log); + chat_scrollpane->set_background(false); chat_scrollpane->set_border(false); chat_scrollpane->set_label("text"); - chat_playerlist = new ui::ListView(this); - chat_playerlist->set_label("playerlist"); - - chat_input = new ui::InputBox(this); + // chat input + chat_input = new ui::InputBox(chat_pane_right); + chat_input->set_background(false); chat_input->set_border(false); set_prompt(); chat_input->set_focus(); @@ -254,14 +265,22 @@ void Chat::resize() const float padding = ui::root()->font_large()->height(); if (chat_small) { + chat_titlelabel->hide(); chat_playerlist->hide(); chat_scrollpane->hide(); - chat_titlelabel->hide(); + + // resize right panbe to input bar size + chat_pane_right->set_size(size()); + chat_pane_right->set_location(0.0f, 0.0f); + + // input bar + chat_input->set_size(chat_pane_right->width() - 2.0f * padding, chat_input->font()->height()); + chat_input->set_location(padding, (chat_pane_right->height() - chat_input->height()) * 0.5f ); } else { + chat_titlelabel->show(); chat_playerlist->show(); chat_scrollpane->show(); - chat_titlelabel->show(); // resize title label chat_titlelabel->set_size(width() - padding * 2.0f, chat_titlelabel->font()->height()); @@ -270,19 +289,30 @@ void Chat::resize() // resize close button chat_closebutton->set_size(chat_titlelabel->font()->height(), chat_titlelabel->font()->height()); chat_closebutton->set_location(chat_titlelabel->width() - chat_closebutton->width(), 0); - + // resize player names listview chat_playerlist->set_location(padding, chat_titlelabel->bottom() + padding); - chat_playerlist->set_size(ui::UI::elementsize.width(), height() - chat_playerlist->top() - padding * 2.0f); + chat_playerlist->set_size(ui::UI::elementsize.width(), height() - chat_titlelabel->bottom() - padding * 2.0f); + + // resize right pane + chat_pane_right->set_size(width() - chat_playerlist->right() - padding * 2.0f, chat_playerlist->height()); + chat_pane_right->set_location(chat_playerlist->right() + padding, chat_titlelabel->bottom() + padding); + + { + const ui::Widget *pane = chat_pane_right; + const float margin_horizontal = pane->font()->width(); + const float margin_vertical = pane->font()->height() * 0.5f; - // resize chat text pane - chat_scrollpane->set_location(chat_playerlist->right() + padding, chat_titlelabel->bottom() + padding); - chat_scrollpane->set_size(width() - chat_scrollpane->left() - padding, chat_playerlist->height()); + // resize input bar + chat_input->set_size(pane->width() - 2.0f * margin_horizontal, chat_input->font()->height()); + chat_input->set_location(margin_horizontal, pane->height() - chat_input->height() - margin_vertical); + + // resize chat text pane + chat_scrollpane->set_size(pane->width() - 2.0f * margin_horizontal, chat_input->top() - 2.0f * margin_vertical); + chat_scrollpane->set_location(margin_horizontal, margin_vertical); + } } - // input bar - chat_input->set_location(padding, height() - padding); - chat_input->set_size(width() - 2.0f * padding , padding); } diff --git a/src/client/chat.h b/src/client/chat.h index eaaed10..39b1a1a 100644 --- a/src/client/chat.h +++ b/src/client/chat.h @@ -62,6 +62,8 @@ private: ui::Label *chat_titlelabel; ui::IconButton *chat_closebutton; + ui::Widget *chat_pane_right; + ui::ScrollPane *chat_scrollpane; ui::InputBox *chat_input; ui::ListView *chat_playerlist; diff --git a/src/client/inventorywindow.cc b/src/client/inventorywindow.cc index 2d8ac91..5ffee72 100644 --- a/src/client/inventorywindow.cc +++ b/src/client/inventorywindow.cc @@ -23,36 +23,34 @@ InventoryWindow::InventoryWindow(ui::Widget *parent) : ui::Window(parent) inventorywindow_inforecord = 0; inventorywindow_amount = 0; + // ---- right pane + inventorywindow_pane_right = new ui::Widget(this); + inventorywindow_pane_right->set_background(true); + inventorywindow_pane_right->set_border(true); + // modelview, add it first so it gets rendered before anything else - inventorywindow_modelview = new ui::ModelView(this); + inventorywindow_modelview = new ui::ModelView(inventorywindow_pane_right); inventorywindow_modelview->set_label("modelview"); inventorywindow_modelview->set_background(false); inventorywindow_modelview->set_border(false); - // window title - inventorywindow_titlelabel = new ui::Label(this); - inventorywindow_titlelabel->set_label("title"); - inventorywindow_titlelabel->set_background(false); - inventorywindow_titlelabel->set_border(false); - inventorywindow_titlelabel->set_font(ui::root()->font_large()); - inventorywindow_titlelabel->set_alignment(ui::AlignCenter); - inventorywindow_titlelabel->set_text("INVENTORY"); - - // close button - inventorywindow_closebutton = new ui::IconButton(inventorywindow_titlelabel, "bitmaps/icons/window_close"); - - inventorywindow_modeltitlelabel = new ui::Label(inventorywindow_modelview); + // title label + inventorywindow_modeltitlelabel = new ui::Label(inventorywindow_pane_right); inventorywindow_modeltitlelabel->set_background(false); inventorywindow_modeltitlelabel->set_border(false); - //inventorywindow_modeltitlelabel->set_font(ui::root()->font_large()); inventorywindow_modeltitlelabel->set_alignment(ui::AlignCenter); - inventorywindow_modelnamelabel = new ui::Label(inventorywindow_modelview); + // model label + inventorywindow_modelnamelabel = new ui::Label(inventorywindow_pane_right); inventorywindow_modelnamelabel->set_background(false); inventorywindow_modelnamelabel->set_border(false); - //inventorywindow_modelnamelabel->set_font(ui::root()->font_large()); inventorywindow_modelnamelabel->set_alignment(ui::AlignCenter); + inventorywindow_scrollpane = new ui::ScrollPane(inventorywindow_pane_right, inventorywindow_infotext); + inventorywindow_scrollpane->set_background(false); + inventorywindow_scrollpane->set_border(false); + inventorywindow_scrollpane->set_alignment(ui::AlignTop); + inventorywindow_listview = new ui::ListView(this); inventorywindow_listview->set_label("listview"); //inventorywindow_listview->set_background(true); @@ -64,20 +62,29 @@ InventoryWindow::InventoryWindow(ui::Widget *parent) : ui::Window(parent) inventorywindow_inventorytext->set_border(true); inventorywindow_inventorytext->set_font(ui::root()->font_small()); - inventorywindow_scrollpane = new ui::ScrollPane(this, inventorywindow_infotext); - inventorywindow_scrollpane->set_background(false); - inventorywindow_scrollpane->set_border(false); - inventorywindow_scrollpane->set_alignment(ui::AlignTop); - inventorywindow_shipbutton = new ui::IconButton(this, "bitmaps/icons/button_ship"); inventorywindow_ejectbutton = new ui::IconButton(this, "bitmaps/icons/button_eject"); //inventorywindow_mountbutton = new ui::IconButton(this, "bitmaps/icons/button_mount"); + // window title + inventorywindow_titlelabel = new ui::Label(this); + inventorywindow_titlelabel->set_label("title"); + inventorywindow_titlelabel->set_background(false); + inventorywindow_titlelabel->set_border(false); + inventorywindow_titlelabel->set_font(ui::root()->font_large()); + inventorywindow_titlelabel->set_alignment(ui::AlignCenter); + inventorywindow_titlelabel->set_text("INVENTORY"); + + // close button + inventorywindow_closebutton = new ui::IconButton(inventorywindow_titlelabel, "bitmaps/icons/window_close"); + // eject dialog inventorywindow_ejectconfirmbutton = new ui::Button(inventorywindow_scrollpane, "Eject"); inventorywindow_ejectcancelbutton = new ui::Button(inventorywindow_scrollpane, "Cancel"); inventorywindow_ejectslider = new ui::Slider(inventorywindow_scrollpane); + + hide(); } @@ -240,22 +247,32 @@ void InventoryWindow::resize() inventorywindow_ejectbutton->set_size(icon_size, icon_size); inventorywindow_ejectbutton->set_location(inventorywindow_inventorytext->right() - icon_size, height() - icon_size - padding); - // resize modelview - inventorywindow_modelview->set_size( width() - inventorywindow_inventorytext->right() - padding * 2.0f ,ui::UI::elementsize.width()); - inventorywindow_modelview->set_location(inventorywindow_inventorytext->right() + padding, inventorywindow_inventorytext->top()); + // resize right pane + inventorywindow_pane_right->set_size(width() - inventorywindow_listview->right() - 2.0f * padding, height() - inventorywindow_titlelabel->bottom() - padding * 2.0f); + inventorywindow_pane_right->set_location(inventorywindow_listview->right() + padding, inventorywindow_titlelabel->bottom() + padding); + + { + const ui::Widget *pane = inventorywindow_pane_right; + const float margin_horizontal = pane->font()->width(); + const float margin_vertical = pane->font()->height() * 0.5f; + + // resize target label + inventorywindow_modelnamelabel->set_size(pane->width() - margin_horizontal * 2.0f, inventorywindow_modelnamelabel->font()->height()); + inventorywindow_modelnamelabel->set_location(margin_horizontal, margin_vertical); + + // resize info label + inventorywindow_modeltitlelabel->set_size(pane->width() - margin_horizontal * 2.0f, inventorywindow_modeltitlelabel->font()->height()); + inventorywindow_modeltitlelabel->set_location(margin_horizontal, pane->height() * 0.5f); - // modelview title label - inventorywindow_modelnamelabel->set_location(0, 0); - inventorywindow_modelnamelabel->set_size(inventorywindow_modelview->width(), inventorywindow_modelnamelabel->font()->height()); + // resize target modelview + inventorywindow_modelview->set_size(inventorywindow_modelnamelabel->width(), inventorywindow_modeltitlelabel->top() - inventorywindow_modelnamelabel->bottom() - margin_vertical * 2.0f); + inventorywindow_modelview->set_location(margin_horizontal, inventorywindow_modelnamelabel->bottom() + margin_vertical); - // modelview name label - inventorywindow_modeltitlelabel->set_size(inventorywindow_modelview->width(), inventorywindow_modeltitlelabel->font()->height()); - inventorywindow_modeltitlelabel->set_location(0, inventorywindow_modelview->height() - inventorywindow_modeltitlelabel->height()); + // resize target info text + inventorywindow_scrollpane->set_size(inventorywindow_modeltitlelabel->width(), pane->height() - inventorywindow_modeltitlelabel->bottom() - margin_vertical * 2.0f); + inventorywindow_scrollpane->set_location(inventorywindow_modelview->left(), inventorywindow_modeltitlelabel->bottom() + margin_vertical); + } - // resize infotext - inventorywindow_scrollpane->set_size(inventorywindow_modelview->width(), height() - inventorywindow_modelview->bottom() - 2.0f * padding); - inventorywindow_scrollpane->set_location(inventorywindow_modelview->left(), inventorywindow_modelview->bottom() + padding); - // eject dialog buttons inventorywindow_ejectslider->set_size( inventorywindow_scrollpane->width() - ui::UI::elementsize.width(), @@ -263,7 +280,7 @@ void InventoryWindow::resize() ); inventorywindow_ejectslider->set_location( (inventorywindow_scrollpane->width() - inventorywindow_ejectslider->width()) * 0.5f, - 0 + 0.0f ); inventorywindow_ejectconfirmbutton->set_size(ui::UI::elementsize); inventorywindow_ejectconfirmbutton->set_location( diff --git a/src/client/inventorywindow.h b/src/client/inventorywindow.h index be2db40..472957b 100644 --- a/src/client/inventorywindow.h +++ b/src/client/inventorywindow.h @@ -77,10 +77,12 @@ private: ui::Label *inventorywindow_titlelabel; ui::IconButton *inventorywindow_closebutton; + ui::ListView *inventorywindow_listview; + + ui::Widget *inventorywindow_pane_right; + ui::Label *inventorywindow_modeltitlelabel; ui::Label *inventorywindow_modelnamelabel; - - ui::ListView *inventorywindow_listview; ui::PlainText *inventorywindow_inventorytext; ui::ScrollPane *inventorywindow_scrollpane; ui::IconButton *inventorywindow_shipbutton; diff --git a/src/client/mapwindow.cc b/src/client/mapwindow.cc index f12364d..6a5a6eb 100644 --- a/src/client/mapwindow.cc +++ b/src/client/mapwindow.cc @@ -27,68 +27,77 @@ MapWindow::MapWindow(ui::Widget *parent) : ui::Window(parent) set_background(true); set_font(ui::root()->font_small()); + // ---- right pane + mapwindow_pane_right = new ui::Widget(this); + mapwindow_pane_right->set_background(true); + mapwindow_pane_right->set_border(true); + // modelview, add it first so it gets rendered before anything else - mapwindow_modelview = new ui::ModelView(this); + mapwindow_modelview = new ui::ModelView(mapwindow_pane_right); mapwindow_modelview->set_label("modelview"); mapwindow_modelview->set_background(false); mapwindow_modelview->set_border(false); - // window title - mapwindow_titlelabel = new ui::Label(this); - mapwindow_titlelabel->set_label("title"); - mapwindow_titlelabel->set_background(false); - mapwindow_titlelabel->set_border(false); - mapwindow_titlelabel->set_font(ui::root()->font_large()); - mapwindow_titlelabel->set_alignment(ui::AlignCenter); - mapwindow_titlelabel->set_text("STAR CHART"); + // target title + mapwindow_targetlabel = new ui::Label(mapwindow_pane_right); + mapwindow_targetlabel->set_label("targetlabel"); + mapwindow_targetlabel->set_background(false); + mapwindow_targetlabel->set_border(false); + mapwindow_targetlabel->set_alignment(ui::AlignCenter); - // close button - mapwindow_closebutton = new ui::IconButton(mapwindow_titlelabel, "bitmaps/icons/window_close"); + // info label (modelview child) + mapwindow_infolabel = new ui::Label(mapwindow_pane_right); + mapwindow_infolabel ->set_label("infolabel"); + mapwindow_infolabel->set_background(false); + mapwindow_infolabel->set_border(false); + mapwindow_infolabel->set_alignment(ui::AlignCenter); + + // target text + mapwindow_scrollpane = new ui::ScrollPane(mapwindow_pane_right, mapwindow_infotext); + mapwindow_scrollpane->set_background(false); + mapwindow_scrollpane->set_border(false); + mapwindow_scrollpane->set_alignment(ui::AlignTop); + + // ---- left pane + mapwindow_pane_left = new ui::Widget(this); + mapwindow_pane_left->set_background(true); + mapwindow_pane_left->set_border(true); // map widget - mapwindow_mapwidget = new MapWidget(this); + mapwindow_mapwidget = new MapWidget(mapwindow_pane_left); mapwindow_mapwidget->set_background(false); mapwindow_mapwidget->set_border(false); // galaxy map widget - mapwindow_galaxymapwidget = new GalaxyMapWidget(this); + mapwindow_galaxymapwidget = new GalaxyMapWidget(mapwindow_pane_left); mapwindow_galaxymapwidget->set_background(false); mapwindow_galaxymapwidget->set_border(false); mapwindow_galaxymapwidget->hide(); // map label - mapwindow_maplabel = new ui::Label(this); + mapwindow_maplabel = new ui::Label(mapwindow_pane_left); mapwindow_maplabel->set_label("maplabel"); mapwindow_maplabel->set_background(false); mapwindow_maplabel->set_border(false); mapwindow_maplabel->set_alignment(ui::AlignCenter); // map buttons - mapwindow_zonebutton = new ui::IconButton(this, "bitmaps/icons/button_map"); - mapwindow_galaxybutton = new ui::IconButton(this, "bitmaps/icons/button_galaxy"); - - - // target title - mapwindow_targetlabel = new ui::Label(this); - mapwindow_targetlabel->set_label("targetlabel"); - mapwindow_targetlabel->set_background(false); - mapwindow_targetlabel->set_border(false); - mapwindow_targetlabel->set_alignment(ui::AlignCenter); + mapwindow_zonebutton = new ui::IconButton(mapwindow_pane_left, "bitmaps/icons/button_map"); + mapwindow_galaxybutton = new ui::IconButton(mapwindow_pane_left, "bitmaps/icons/button_galaxy"); - + // ---- window title + mapwindow_titlelabel = new ui::Label(this); + mapwindow_titlelabel->set_label("title"); + mapwindow_titlelabel->set_background(false); + mapwindow_titlelabel->set_border(false); + mapwindow_titlelabel->set_font(ui::root()->font_large()); + mapwindow_titlelabel->set_alignment(ui::AlignCenter); + mapwindow_titlelabel->set_text("STAR CHART"); - // info label (modelview child) - mapwindow_infolabel = new ui::Label(mapwindow_modelview); - mapwindow_infolabel ->set_label("infolabel"); - mapwindow_infolabel->set_background(false); - mapwindow_infolabel->set_border(false); - mapwindow_infolabel->set_alignment(ui::AlignCenter); + // close button + mapwindow_closebutton = new ui::IconButton(mapwindow_titlelabel, "bitmaps/icons/window_close"); - // target text - mapwindow_scrollpane = new ui::ScrollPane(this, mapwindow_infotext); - mapwindow_scrollpane->set_background(false); - mapwindow_scrollpane->set_border(false); - mapwindow_scrollpane->set_alignment(ui::AlignTop); + hide(); } @@ -149,43 +158,61 @@ void MapWindow::resize() mapwindow_closebutton->set_size(mapwindow_titlelabel->font()->height(), mapwindow_titlelabel->font()->height()); mapwindow_closebutton->set_location(mapwindow_titlelabel->width() - mapwindow_closebutton->width(), 0); - // resize map label - mapwindow_maplabel->set_size((width() - padding * 3.0f) * 0.5f, font()->height() ); - mapwindow_maplabel->set_location(padding, mapwindow_titlelabel->bottom() + padding); + // resize left pane + mapwindow_pane_left->set_size((width() - padding * 3.0f) * 0.5f, height() - mapwindow_titlelabel->bottom() - 2.0f * padding); + mapwindow_pane_left->set_location(padding, mapwindow_titlelabel->bottom() + padding); - // resize zone map widget - mapwindow_mapwidget->set_size(mapwindow_maplabel->width(), mapwindow_zonebutton->top() - mapwindow_maplabel->bottom() - 2.0f * padding); - mapwindow_mapwidget->set_location(mapwindow_maplabel->left(), mapwindow_maplabel->bottom() + padding); + { + const ui::Widget *pane = mapwindow_pane_left; + const float margin_horizontal = pane->font()->width(); + const float margin_vertical = pane->font()->height() * 0.5f; + + // resize map label + mapwindow_maplabel->set_size(pane->width() - 2.0f * margin_horizontal, mapwindow_maplabel->font()->height()); + mapwindow_maplabel->set_location(margin_horizontal, margin_vertical); + + // resize zone map widget + mapwindow_mapwidget->set_size(pane->width() - 2.0f * margin_horizontal, pane->height() - mapwindow_maplabel->bottom() - margin_vertical * 4.0f - icon_size); + mapwindow_mapwidget->set_location(margin_horizontal, mapwindow_maplabel->bottom() + margin_vertical); - // set galaxy map size equal to zone map size - mapwindow_galaxymapwidget->set_geometry(mapwindow_mapwidget->location(), mapwindow_mapwidget->size()); + // set galaxy map size equal to zone map size + mapwindow_galaxymapwidget->set_geometry(mapwindow_mapwidget->location(), mapwindow_mapwidget->size()); - // resize map buttons - float l = (mapwindow_mapwidget->width() - math::min(mapwindow_mapwidget->width(), mapwindow_mapwidget->height())) * 0.5f; + // resize map buttons + float l = (mapwindow_mapwidget->width() - math::min(mapwindow_mapwidget->width(), mapwindow_mapwidget->height())) * 0.5f; - mapwindow_zonebutton->set_size(icon_size, icon_size); - mapwindow_zonebutton->set_location(mapwindow_maplabel->left() + l, height() - padding - mapwindow_zonebutton->height()); + mapwindow_zonebutton->set_size(icon_size, icon_size); + mapwindow_zonebutton->set_location(mapwindow_maplabel->left() + l, mapwindow_mapwidget->bottom() + margin_vertical); - mapwindow_galaxybutton->set_size(icon_size, icon_size); - mapwindow_galaxybutton->set_location(mapwindow_maplabel->right() - l - mapwindow_galaxybutton->width(), - height() - padding - mapwindow_galaxybutton->height()); + mapwindow_galaxybutton->set_size(icon_size, icon_size); + mapwindow_galaxybutton->set_location(mapwindow_maplabel->right() - l - icon_size, mapwindow_mapwidget->bottom() + margin_vertical); + } + // resize right pane + mapwindow_pane_right->set_size(mapwindow_pane_left->size()); + mapwindow_pane_right->set_location(mapwindow_pane_left->right() + padding, mapwindow_titlelabel->bottom() + padding); + + { + const ui::Widget *pane = mapwindow_pane_right; + const float margin_horizontal = pane->font()->width(); + const float margin_vertical = pane->font()->height() * 0.5f; - // resize target label - mapwindow_targetlabel->set_size(width() - mapwindow_mapwidget->right() - padding * 2.0f, font()->height()); - mapwindow_targetlabel->set_location(mapwindow_maplabel->right() + padding, mapwindow_maplabel->top()); + // resize target label + mapwindow_targetlabel->set_size(pane->width() - margin_horizontal * 2.0f, mapwindow_targetlabel->font()->height()); + mapwindow_targetlabel->set_location(margin_horizontal, margin_vertical); + + // resize info label + mapwindow_infolabel->set_size(pane->width() - margin_horizontal * 2.0f, mapwindow_infolabel->font()->height()); + mapwindow_infolabel->set_location(margin_horizontal, pane->height() * 0.5f); - // resize target modelview - mapwindow_modelview->set_size(mapwindow_targetlabel->width(), (height() - mapwindow_targetlabel->bottom() - padding * 3.0f) * 0.5f); - mapwindow_modelview->set_location(mapwindow_mapwidget->right() + padding, mapwindow_targetlabel->bottom() + padding); + // resize target modelview + mapwindow_modelview->set_size(mapwindow_targetlabel->width(), mapwindow_infolabel->top() - mapwindow_targetlabel->bottom() - margin_vertical * 2.0f); + mapwindow_modelview->set_location(margin_horizontal, mapwindow_targetlabel->bottom() + margin_vertical); - // resize info label (modelview child) - mapwindow_infolabel->set_size(mapwindow_modelview->width(), mapwindow_infolabel->font()->height()); - mapwindow_infolabel->set_location(0.0f, mapwindow_modelview->height() - mapwindow_infolabel->height()); - - // resize target infopane text - mapwindow_scrollpane->set_size(mapwindow_modelview->size()); - mapwindow_scrollpane->set_location(mapwindow_modelview->left(), mapwindow_modelview->bottom() + padding); + // resize target info text + mapwindow_scrollpane->set_size(mapwindow_infolabel->width(), pane->height() - mapwindow_infolabel->bottom() - margin_vertical * 2.0f); + mapwindow_scrollpane->set_location(mapwindow_modelview->left(), mapwindow_infolabel->bottom() + margin_vertical); + } } void MapWindow::draw() diff --git a/src/client/mapwindow.h b/src/client/mapwindow.h index b746d2b..27f11f0 100644 --- a/src/client/mapwindow.h +++ b/src/client/mapwindow.h @@ -62,6 +62,9 @@ private: ui::Label *mapwindow_titlelabel; + ui::Widget *mapwindow_pane_left; + ui::Widget *mapwindow_pane_right; + MapWidget *mapwindow_mapwidget; GalaxyMapWidget *mapwindow_galaxymapwidget; ui::Label *mapwindow_maplabel; diff --git a/src/client/reputationwindow.cc b/src/client/reputationwindow.cc index 6e5a535..f110971 100644 --- a/src/client/reputationwindow.cc +++ b/src/client/reputationwindow.cc @@ -31,15 +31,20 @@ ReputationWindow::ReputationWindow(ui::Widget *parent) : ui::Window(parent) reputationwindow_listview = new ui::ListView(this); reputationwindow_listview->set_label("listview"); - // target label - reputationwindow_targetlabel = new ui::Label(this); + // ---- right pane + reputationwindow_pane_right = new ui::Widget(this); + reputationwindow_pane_right->set_background(true); + reputationwindow_pane_right->set_border(true); + + // ---- right pane: target label + reputationwindow_targetlabel = new ui::Label(reputationwindow_pane_right); reputationwindow_targetlabel->set_label("info"); reputationwindow_targetlabel->set_background(false); reputationwindow_targetlabel->set_border(false); reputationwindow_targetlabel->set_alignment(ui::AlignCenter); - // player statistics / faction description - reputationwindow_scrollpane = new ui::ScrollPane(this, reputationwindow_infotext); + // ---- right pane: target info + reputationwindow_scrollpane = new ui::ScrollPane(reputationwindow_pane_right, reputationwindow_infotext); reputationwindow_scrollpane->set_background(false); reputationwindow_scrollpane->set_border(false); reputationwindow_scrollpane->set_alignment(ui::AlignTop); @@ -167,7 +172,6 @@ void ReputationWindow::set_info(const core::Info *info) void ReputationWindow::resize() { const float padding = ui::root()->font_large()->height(); - //const float icon_size = 24.0f; // small icons // resize label reputationwindow_titlelabel->set_size(width() - padding * 2.0f, reputationwindow_titlelabel->font()->height()); @@ -175,19 +179,29 @@ void ReputationWindow::resize() // resize close button reputationwindow_closebutton->set_size(reputationwindow_titlelabel->font()->height(), reputationwindow_titlelabel->font()->height()); - reputationwindow_closebutton->set_location(reputationwindow_titlelabel->width() - reputationwindow_closebutton->width(), 0); + reputationwindow_closebutton->set_location(reputationwindow_titlelabel->width() - reputationwindow_closebutton->width(), 0); // resize reputation listview reputationwindow_listview->set_size(ui::UI::elementsize.width(), height() - reputationwindow_titlelabel->bottom() - padding * 2.0f); reputationwindow_listview->set_location(reputationwindow_titlelabel->left(), reputationwindow_titlelabel->bottom() + padding); - - // resize reputation info label - reputationwindow_targetlabel->set_size(width() - reputationwindow_listview->right() - padding * 2.0f, reputationwindow_targetlabel->font()->height()); - reputationwindow_targetlabel->set_location(reputationwindow_listview->right() + padding,reputationwindow_titlelabel->bottom() + padding); - - // resize infotext scrollpane - reputationwindow_scrollpane->set_size(width() - reputationwindow_listview->right() - padding * 2.0f, height() - reputationwindow_targetlabel->bottom() - padding * 2.0f); - reputationwindow_scrollpane->set_location(reputationwindow_listview->right() + padding, reputationwindow_targetlabel->bottom() + padding); + + // resize right pane + reputationwindow_pane_right->set_size(width() - reputationwindow_listview->right() - padding * 2.0f, reputationwindow_listview->height()); + reputationwindow_pane_right->set_location(reputationwindow_listview->right() + padding,reputationwindow_titlelabel->bottom() + padding); + + { + const ui::Widget *pane = reputationwindow_pane_right; + const float margin_horizontal = pane->font()->width(); + const float margin_vertical = pane->font()->height() * 0.5f; + + // resize reputation info label + reputationwindow_targetlabel->set_size(pane->width() - 2.0f * margin_horizontal, reputationwindow_targetlabel->font()->height()); + reputationwindow_targetlabel->set_location(margin_horizontal, margin_vertical); + + // resize infotext scrollpane + reputationwindow_scrollpane->set_size(pane->width()- 2.0f * margin_horizontal, pane->height() - reputationwindow_targetlabel->bottom() - 2.0f * margin_vertical); + reputationwindow_scrollpane->set_location(margin_horizontal, reputationwindow_targetlabel->bottom() + margin_vertical); + } } bool ReputationWindow::on_emit(ui::Widget *sender, const Event event, void *data) diff --git a/src/client/reputationwindow.h b/src/client/reputationwindow.h index d4af145..b13d440 100644 --- a/src/client/reputationwindow.h +++ b/src/client/reputationwindow.h @@ -61,6 +61,8 @@ private: ui::ListView *reputationwindow_listview; ui::ScrollPane *reputationwindow_scrollpane; + ui::Widget *reputationwindow_pane_right; + }; // class ReputationWindow } // namespace client |