2 * Copyright (C) 2002,2003,2004,2005,2006 Daniel Heck, Ronald Lamprecht
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #ifndef GUI_LEVELPACKMENU_HH_INCLUDED
20 #define GUI_LEVELPACKMENU_HH_INCLUDED
22 #include "gui/Menu.hh"
24 #include "lev/Index.hh"
29 namespace enigma
{ namespace gui
{
30 /* -------------------- LevelPackMenu -------------------- */
33 * The levelpack selection menu.
35 * The used strategy for horizontal scrolling of the levelpack columns
36 * is to avoid scrolling as long as the target levelpack is still visible.
37 * The current levelpack may be scrolled out of visibility by using the
38 * scoll buttons within this menu. But if the user changes the current
39 * levelpack via indirect methods besides
40 * using the levelpack menu, f.e. the jumpto command, we ensure that
41 * the new current levelpack is visible when the menu is redisplayed.
42 * If it is necessary to scroll we scroll only the minimum amount of columns
43 * needed to display the current levelpack. Even on screen resolution changes
44 * we try to keep the column of the current levelpack unchanged.
46 class LevelPackMenu
: public Menu
{
49 void manageLevelMenu();
50 virtual bool manage();
52 bool on_event (const SDL_Event
&e
);
53 void on_action(Widget
*w
);
54 void draw_background(ecl::GC
&gc
);
57 static std::map
<std::string
, std::string
> groupLastSelectedIndex
;
58 static std::map
<std::string
, int> groupLastSelectedColumn
;
59 static std::string lastGroupName
;
60 static int firstDisplayedGroup
;
63 video::VideoTileType vtt
;
64 int vh
, vv
; // h and v margins due to fullscreen margins
65 std::vector
<TextButton
*> packButtons
;
66 std::vector
<TextButton
*> groupButtons
;
69 ImageButton
*scrollLeft
;
70 ImageButton
*scrollRight
;
71 ImageButton
*scrollUp
;
72 ImageButton
*scrollDown
;
80 bool isLevelMenuSubmenu
;
83 void updateHighlight();
84 int getGroupPosition(std::vector
<std::string
> * groups
, std::string groupName
);
85 int getIndexPosition(std::vector
<lev::Index
*> * group
, std::string indexName
);
86 int checkColumn(int rows
, int columns
, int size
, int position
, int oldColumn
);
88 }} // namespace enigma::gui