Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes

Window Class Reference

A Basic Window. More...

#include <Window.h>

Inheritance diagram for Window:
Control Broadcaster Listener BrokenPalette DebugWindow FileIO MainMenu MapEditorTools MapProperties NewMap PropPalette QuitDialog TilePalette WarpAreaEdit

List of all members.

Public Member Functions

 Window (const std::string &titlebar, int x, int y, int width, int height)
 ~Window ()
void add (Control *control)
void remove (Control *control)
virtual ControlgetChild (string childName) const
void hideCloseButton (bool hidden)

Protected Attributes

ContainermContainer

Private Member Functions

void initialize ()
void determineTitleBarArea ()
void logic ()
virtual void windowInit ()
 Instructs derived Window objects to initialize themselves.
virtual void windowLogic ()
 Instructs derived Window objects to perform their logic.
void drawSkin ()
void drawPlain ()
void onDrag (Event *event)
void onFocus ()
void onLostFocus ()
void onResized ()

Private Attributes

CloseButtonbtnClose
FontmTitleFont
int mTitleOffset
Recti mTitleBarArea
bool mIsInited

Detailed Description

A Basic Window.

The Window Control is effectively a container Control with a TitleBar that can be resized with a mouse. Window should generally not be used on its own and istead should be used as a base upon which to derive new Window objects.


Constructor & Destructor Documentation

Window::Window ( const std::string &  titlebar,
int  x,
int  y,
int  width,
int  height 
)
Window::~Window (  ) 

Member Function Documentation

void Window::add ( Control child  )  [virtual]

Adds a new control of type ControlType to the Control List.

Reimplemented from Control.

void Window::determineTitleBarArea (  )  [private]
void Window::drawPlain (  )  [private, virtual]

Draws a Control without a Skin.

Reimplemented from Control.

void Window::drawSkin (  )  [private, virtual]

Draws a Control using a Skin.

Reimplemented from Control.

Control * Window::getChild ( string  childName  )  const [virtual]

This is here as a special case for Windows as we are adding controls to a Container, not directly to the Window.

void Window::hideCloseButton ( bool  hidden  )  [inline]

Sets whether or not the Close Button is displayed.

void Window::initialize (  )  [private, virtual]

Todo:
The positioning of the close button should be defined within the skin file and not hard coded here.

Reimplemented from Control.

void Window::logic (  )  [private, virtual]

Reimplemented from Control.

void Window::onDrag ( Event event  )  [private, virtual]

Reimplemented from Control.

void Window::onFocus (  )  [inline, private, virtual]

Called whenever a Control gains focus.

Note:
Default implementation sets focus. Overridden versions should either call the setFocus() function or explicitly call the default implementation.

Reimplemented from Control.

void Window::onLostFocus (  )  [inline, private, virtual]

Called whenever a Control loses focus.

Note:
Default implementation sets focus. Overridden versions should either call the setFocus() function or explicitly call the default implementation.

Reimplemented from Control.

void Window::onResized (  )  [inline, private, virtual]

Called whenever a Control changes its size.

Reimplemented from Control.

void Window::remove ( Control child  )  [virtual]

Removes a Child Control from this Control's list.

Parameters:
child A pointer to a child Control of this Control.
Note:
This function is generally deemed safe.
Warning:
This function frees any memory allocated for the specified Control so all references or pointers to it will be invalid.

Reimplemented from Control.

virtual void Window::windowInit (  )  [inline, private, virtual]

Instructs derived Window objects to initialize themselves.

Note:
This function must be overridden in derived objects.

When deriving a Window Control, windowInit() must be overridden. This is the function where one would create and add new Control objects as well as specify various attributes such as color, size, position, etc.

Reimplemented in BrokenPalette, DebugWindow, MapProperties, MapEditorTools, NewMap, PropPalette, TilePalette, WarpAreaEdit, FileIO, MainMenu, and QuitDialog.

virtual void Window::windowLogic (  )  [inline, private, virtual]

Instructs derived Window objects to perform their logic.

Note:
This function must be overridden in derived objects.

During every GUI update cycle, windowLogic() is called to allow derived Window objects to perform logic operations. This is the function where one would respond to events, perform calculations, etc.

Reimplemented in DebugWindow, MainMenu, and QuitDialog.


Member Data Documentation

Close button.

bool Window::mIsInited [private]

This is a bit of a hack. Not thrilled with it.

Windows draw with a bold font.

int Window::mTitleOffset [private]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines