win_manager Class Reference

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>

Collaboration diagram for win_manager:

Collaboration graph
[legend]

List of all members.

Window handling methods

static win_manageractive = NULL
 Pointer to the active, i.e.
void add (win_base *wnd)
 Add a window to the window manager.
void remove (win_base *wnd)
 Remove a window from the window manager.
void update ()
 Update the state of all top level windows.
void input_update ()
 Checks for user input.
void draw ()
 Draws all windows.
void set_focus (win_base *wnd)
 Gives the input focus to wnd.
void destroy ()
 Closes and deletes all windows of the current level.
static win_managerget_active ()
 Use this method to get the active manger from Python.

Public Member Functions

 win_manager ()
 Standard constructor.
 ~win_manager ()
 Destructor.

Static Public Member Functions

Theme and font related methods
static void init (const string &font)
 Empty for now.
static void cleanup ()
 Delete all themes and fonts currently loaded.
static void add_theme (string name)
 Load a theme from disk.
static bool remove_theme (string name)
 Delete a theme.
static win_theme * get_theme (string name)
 Returns a pointer to a theme.
static void add_font (string name)
 Load a font from disk.
static bool remove_font (string name)
 Delete a font.
static win_font * get_font (string name)
 Returns a pointer to a font.


Detailed Description

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 61 of file win_manager.h.


Constructor & Destructor Documentation

win_manager::win_manager (  ) 

Standard constructor.

Definition at line 38 of file win_manager.cc.

win_manager::~win_manager (  ) 

Destructor.

Definition at line 53 of file win_manager.cc.


Member Function Documentation

void win_manager::add ( win_base wnd  ) 

Add a window to the window manager.

Parameters:
wnd The window to be added

Definition at line 101 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).

Parameters:
wnd The window to be removed

Definition at line 119 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 164 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.

See also:
set_focus ()

Definition at line 157 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 146 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.

See also:
input_update ()

Definition at line 180 of file win_manager.cc.

void win_manager::destroy (  ) 

Closes and deletes all windows of the current level.

Definition at line 62 of file win_manager.cc.

static win_manager* win_manager::get_active (  )  [inline, static]

Use this method to get the active manger from Python.

Definition at line 149 of file win_manager.h.

void win_manager::init ( const string &  font  )  [static]

Empty for now.

Definition at line 76 of file win_manager.cc.

void win_manager::cleanup ( void   )  [static]

Delete all themes and fonts currently loaded.

Definition at line 83 of file win_manager.cc.

void win_manager::add_theme ( string  name  )  [static]

Load a theme from disk.

Parameters:
name The name of the theme to load.

Definition at line 195 of file win_manager.cc.

bool win_manager::remove_theme ( string  name  )  [static]

Delete a theme.

Parameters:
name The name of the theme to delete.
Returns:
  • true in case of success.
  • false in case of error.

Definition at line 201 of file win_manager.cc.

win_theme * win_manager::get_theme ( string  name  )  [static]

Returns a pointer to a theme.

Loads the theme from disk if it isn't in memory yet.

Parameters:
name The name of the theme to get.
Returns:
Pointer to the theme.

Definition at line 212 of file win_manager.cc.

void win_manager::add_font ( string  name  )  [static]

Load a font from disk.

Parameters:
name The name of the font to load.

Definition at line 226 of file win_manager.cc.

bool win_manager::remove_font ( string  name  )  [static]

Delete a font.

Parameters:
name The name of the font to delete.
Returns:
  • true in case of success.
  • false in case of error.

Definition at line 232 of file win_manager.cc.

win_font * win_manager::get_font ( string  name  )  [static]

Returns a pointer to a font.

Loads the font from disk if it isn't in memory yet.

Parameters:
name The name of the font to get.
Returns:
Pointer to the font.

Definition at line 243 of file win_manager.cc.


Member Data Documentation

win_manager * win_manager::active = NULL [static]

Pointer to the active, i.e.

topmost window manager.

Definition at line 143 of file win_manager.h.


The documentation for this class was generated from the following files:

Generated on Wed Jun 18 16:55:44 2008 for Adonthell by  doxygen 1.5.6