Adonthell
0.4
|
The window manager takes care of basic GUI functions, such as input focus, window state updates and displaying everything in the right order. More...
#include <win_manager.h>
Public Member Functions | |
win_manager () | |
Standard constructor. More... | |
~win_manager () | |
Destructor. More... | |
Window handling methods | |
static win_manager * | active = NULL |
Pointer to the active, i.e. More... | |
void | add (win_base *wnd) |
Add a window to the window manager. More... | |
void | remove (win_base *wnd) |
Remove a window from the window manager. More... | |
void | update () |
Update the state of all top level windows. More... | |
void | input_update () |
Checks for user input. More... | |
void | draw () |
Draws all windows. More... | |
void | set_focus (win_base *wnd) |
Gives the input focus to wnd. More... | |
void | destroy () |
Closes and deletes all windows of the current level. More... | |
static win_manager * | get_active () |
Use this method to get the active manger from Python. More... | |
Theme and font related methods | |
static void | init (const string &font) |
Empty for now. More... | |
static void | cleanup () |
Delete all themes and fonts currently loaded. More... | |
static void | add_theme (string name) |
Load a theme from disk. More... | |
static bool | remove_theme (string name) |
Delete a theme. More... | |
static win_theme * | get_theme (string name) |
Returns a pointer to a theme. More... | |
static void | add_font (string name) |
Load a font from disk. More... | |
static bool | remove_font (string name) |
Delete a font. More... | |
static win_font * | get_font (string name) |
Returns a pointer to a font. More... | |
The window manager takes care of basic GUI functions, such as input focus, window state updates and displaying everything in the right order.
It also provides centralised access to fonts and themes, so that they can be used by different windows without having to load them multiple times. For something to appear on screen, it has to be passes to the window manager.
Before the window manager can be used, adonthell::main() has to be called. This instanciates a window manager object and makes it available to other classes via the static win_manager::active pointer. All windows added to that instance have access to the input focus, although only one window can own it at any given time.
Another call to adonthell::main() will create a new window manager instance that grabs the input focus. As long as it is in existance, none of the parent windows are updated, nor may they recieve the focus. A call to adonthell::main_quit() will delete the topmost window manager and return focus to the underlying windows.
That way it is possible to create a hierarchie of windows, where where only windows on the same level may share the input focus, but only those on the highest level receive input.
Definition at line 65 of file win_manager.h.
win_manager::win_manager | ( | ) |
Standard constructor.
Definition at line 42 of file win_manager.cc.
win_manager::~win_manager | ( | ) |
Destructor.
Definition at line 57 of file win_manager.cc.
void win_manager::add | ( | win_base * | wnd | ) |
Add a window to the window manager.
wnd | The window to be added |
Definition at line 110 of file win_manager.cc.
void win_manager::remove | ( | win_base * | wnd | ) |
Remove a window from the window manager.
The window is erased from the window list, but not deleted. If it had the input focus, it is passed on to the topmost window, i.e. the last one in the window list (if such a window exists).
wnd | The window to be removed |
Definition at line 128 of file win_manager.cc.
void win_manager::update | ( | ) |
Update the state of all top level windows.
Calls the update() method of all windows in the window list. If that method returns 0, it will be removed from the window list and deleted.
Definition at line 173 of file win_manager.cc.
void win_manager::input_update | ( | ) |
Checks for user input.
Calls the input_update() method of the window that has the input focus.
Definition at line 166 of file win_manager.cc.
void win_manager::draw | ( | ) |
Draws all windows.
If the window hierarchie consists of multiple levels, the lowest windows are drawn first. Within each level, windows are drawn in the order they appear in the window list.
Definition at line 155 of file win_manager.cc.
void win_manager::set_focus | ( | win_base * | wnd | ) |
Gives the input focus to wnd.
Only one window can have the focus at a time, so focus will be removed from the window that had it so far. Only the window with the focus will receive user input.
Definition at line 189 of file win_manager.cc.
void win_manager::destroy | ( | ) |
Closes and deletes all windows of the current level.
Definition at line 66 of file win_manager.cc.
|
inlinestatic |
Use this method to get the active manger from Python.
Definition at line 153 of file win_manager.h.
|
static |
Empty for now.
Definition at line 85 of file win_manager.cc.
|
static |
Delete all themes and fonts currently loaded.
Definition at line 92 of file win_manager.cc.
|
static |
Load a theme from disk.
name | The name of the theme to load. |
Definition at line 204 of file win_manager.cc.
|
static |
Delete a theme.
name | The name of the theme to delete. |
Definition at line 210 of file win_manager.cc.
|
static |
Returns a pointer to a theme.
Loads the theme from disk if it isn't in memory yet.
name | The name of the theme to get. |
Definition at line 221 of file win_manager.cc.
|
static |
Load a font from disk.
name | The name of the font to load. |
Definition at line 235 of file win_manager.cc.
|
static |
Delete a font.
name | The name of the font to delete. |
Definition at line 241 of file win_manager.cc.
|
static |
Returns a pointer to a font.
Loads the font from disk if it isn't in memory yet.
name | The name of the font to get. |
Definition at line 252 of file win_manager.cc.
|
static |