diff options
Diffstat (limited to 'src/client/mapwindow.cc')
-rw-r--r-- | src/client/mapwindow.cc | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/src/client/mapwindow.cc b/src/client/mapwindow.cc index 3dbb1fb..23620f8 100644 --- a/src/client/mapwindow.cc +++ b/src/client/mapwindow.cc @@ -5,18 +5,23 @@ the terms of the GNU General Public License version 2 */ -#include "audio/audio.h" -#include "core/application.h" -#include "core/entity.h" -#include "core/entityglobe.h" #include "client/mapwindow.h" #include "client/targets.h" +#include "client/closeiconbutton.h" + #include "ui/ui.h" #include "ui/paint.h" + #include "render/gl.h" #include "render/textures.h" #include "render/text.h" +#include "audio/audio.h" + +#include "core/application.h" +#include "core/entity.h" +#include "core/entityglobe.h" + namespace client { @@ -82,8 +87,9 @@ MapWindow::MapWindow(ui::Widget *parent) : ui::Window(parent) mapwindow_maplabel->set_alignment(ui::AlignCenter); // map buttons - mapwindow_zonebutton = new ui::IconButton(mapwindow_pane_left, "bitmaps/icons/button_map"); - mapwindow_galaxybutton = new ui::IconButton(mapwindow_pane_left, "bitmaps/icons/button_galaxy"); + mapwindow_zonebutton = new ui::IconButton(mapwindow_pane_left, "bitmaps/icons/button_map", "Zone map"); + mapwindow_galaxybutton = new ui::IconButton(mapwindow_pane_left, "bitmaps/icons/button_galaxy", "Galaxy map"); + mapwindow_galaxybutton->hide(); // ---- window title mapwindow_titlelabel = new ui::Label(this); @@ -95,10 +101,8 @@ MapWindow::MapWindow(ui::Widget *parent) : ui::Window(parent) mapwindow_titlelabel->set_text("STAR CHART"); // close button - mapwindow_closebutton = new ui::IconButton(mapwindow_titlelabel, "bitmaps/icons/window_close"); + mapwindow_closebutton = new CloseIconButton(mapwindow_titlelabel); - - hide(); } @@ -118,6 +122,8 @@ void MapWindow::show() // show map widget mapwindow_mode = ShowZone; mapwindow_galaxymapwidget->hide(); + mapwindow_galaxybutton->show(); + mapwindow_zonebutton->hide(); mapwindow_mapwidget->show(); mapwindow_mapwidget->set_zone(core::localplayer()->zone()); mapwindow_maplabel->set_text(mapwindow_mapwidget->zone()->name()); @@ -174,10 +180,10 @@ void MapWindow::resize() 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, mapwindow_mapwidget->bottom() + margin_vertical); + mapwindow_zonebutton->set_location(mapwindow_maplabel->right() - l - icon_size, mapwindow_mapwidget->bottom() + margin_vertical); mapwindow_galaxybutton->set_size(icon_size, icon_size); - mapwindow_galaxybutton->set_location(mapwindow_maplabel->right() - l - icon_size, mapwindow_mapwidget->bottom() + margin_vertical); + mapwindow_galaxybutton->set_location(mapwindow_zonebutton->location()); } // resize right pane @@ -363,8 +369,10 @@ bool MapWindow::on_emit(ui::Widget *sender, const ui::Widget::Event event, void if (mapwindow_galaxymapwidget->zone()) { mapwindow_mode = ShowZone; mapwindow_galaxymapwidget->hide(); + mapwindow_galaxybutton->show(); + mapwindow_zonebutton->hide(); mapwindow_mapwidget->set_zone(mapwindow_galaxymapwidget->zone()); - mapwindow_mapwidget->show(); + mapwindow_mapwidget->show(); mapwindow_maplabel->set_text(mapwindow_mapwidget->zone()->name()); show_zone_info(mapwindow_mapwidget->zone()); } @@ -387,6 +395,8 @@ bool MapWindow::on_emit(ui::Widget *sender, const ui::Widget::Event event, void mapwindow_galaxymapwidget->hide(); mapwindow_maplabel->set_text(mapwindow_mapwidget->zone()->name()); } + mapwindow_galaxybutton->show(); + mapwindow_zonebutton->hide(); return true; } @@ -403,6 +413,8 @@ bool MapWindow::on_emit(ui::Widget *sender, const ui::Widget::Event event, void show_zone_info(mapwindow_galaxymapwidget->zone()); mapwindow_maplabel->set_text("Starsystems"); } + mapwindow_galaxybutton->hide(); + mapwindow_zonebutton->show(); return true; } } |