24 #include "win_types.h" 31 hash_map<string, win_theme *> win_manager::theme;
33 hash_map<string, win_ttf *> win_manager::font;
35 string win_manager::font_file;
50 current = wnd_list.end ();
64 list<win_base *>::iterator i;
66 for (i = wnd_list.begin(); i != wnd_list.end(); i++)
68 (*i)->set_manager (NULL);
86 for (hash_map <string, win_theme *>::iterator it = theme.begin ();
87 it != theme.end (); it++)
92 for (hash_map <string, win_ttf *>::iterator ifo = font.begin ();
93 ifo != font.end (); ifo++)
103 wnd_list.push_back (tmp);
104 tmp->set_manager (
this);
138 wnd_list.remove (tmp);
139 tmp->set_manager (NULL);
142 if (!wnd_focus)
set_focus (wnd_list.back ());
149 if (prev != NULL) prev->
draw ();
152 for (current = wnd_list.begin (); current != wnd_list.end(); current++)
166 for (current = wnd_list.begin (); current != wnd_list.end ();)
168 if (!(*current)->update ())
183 if (!wnd_list.empty ())
186 if (wnd_focus) wnd_focus->
set_focus (
false);
197 theme[name] =
new win_theme ((
char *) name.c_str ());
203 hash_map <string, win_theme *>::iterator it = theme.find (name);
204 if (it == theme.end ())
return false;
214 hash_map <string, win_theme *>::iterator it = theme.find (name);
217 if (it == theme.end ())
222 else return it->second;
228 font[name] =
new win_ttf ((
char *) name.c_str (), font_file);
234 hash_map <string, win_ttf *>::iterator it = font.find (name);
235 if (it == font.end ())
return false;
245 hash_map <string, win_ttf *>::iterator it = font.find (name);
248 if (it == font.end ())
253 else return it->second;
static win_font * get_font(string name)
Returns a pointer to a font.
Declares some basic types.
void update()
Update the state of all top level windows.
static win_manager * active
Pointer to the active, i.e.
static win_theme * get_theme(string name)
Returns a pointer to a theme.
win_manager()
Standard constructor.
static void add_theme(string name)
Load a theme from disk.
bool is_focus() const
Test if win_* has focus on.
static void init(const string &font)
Empty for now.
static bool remove_theme(string name)
Delete a theme.
Declares the image class.
The window manager takes care of basic GUI functions, such as input focus, window state updates and d...
virtual bool input_update()
Input Update process .
void remove(win_base *wnd)
Remove a window from the window manager.
void set_focus(win_base *wnd)
Gives the input focus to wnd.
void set_focus(const bool b)
Set the focus parameter.
void draw()
Draws all windows.
static void cleanup()
Delete all themes and fonts currently loaded.
~win_manager()
Destructor.
static bool remove_font(string name)
Delete a font.
Declares the win_manager class.
void add(win_base *wnd)
Add a window to the window manager.
static void add_font(string name)
Load a font from disk.
Common properties for each win_base's object.
void input_update()
Checks for user input.
void destroy()
Closes and deletes all windows of the current level.