Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Moteur3D::UIBaseWindow Class Reference

The class UIBaseWindow represents a fully functional 2D window inside our application. It supports display, dragging and adding component, but not yet resizing. Its default interface is simple and quite ugly, nevertheless it's been made with evolution in mind, and can the class itself can easily be derived in order to change its look and behavior. More...

#include <UIBaseWindow.h>

List of all members.

Public Member Functions

 UIBaseWindow (UserInterface *ui)
 Constructor.
 ~UIBaseWindow ()
 Destructor.
virtual void SetPosition (int x, int y)
 Changes the window's current position (top left corner). 0,0 represents the top left window's corner. Max values depend on the window's size (in pixel).
virtual void SetSize (int x, int y)
 Changes the window's current size. 0,0 represents the top left window's corner. Max values depend on the window's size (in pixel).
virtual int GetWidth ()
 Returns the window's X size.
virtual int GetHeight ()
 Returns the window's Y size.
virtual int GetPositionX ()
 Returns the left window's border position. 0 is the left border of the window. Max values depend on the window's size (in pixel).
virtual int GetPositionY ()
 Returns the top window's border position. 0 is the top border of the window. Max values depend on the window's size (in pixel).
void Close ()
 Asks the window to close itself. Note that this will effect just before next draw, and the window's memory will be freed by the user interface.

Protected Member Functions

virtual void OnDisplay ()
 Event called when the window needs to be displayed. Override it if you want custom graphics for your window (and you probably will).
virtual void OnWindowResized (int width, int height)
 This function is called each time the windows is resized, or the window is switched between fullscreen and windowed mode.
virtual bool OnMouseButton (const MouseInformations *mouseInfo, MouseButton button, bool buttonDown)
 This function is called when a mouse button is pressed or released inside the window's borders. When this happens, the user interface will check (in focus order) if one of the windows can handle the event. This is why the function must return a bool : once the interface has found a window that handles the click, it stops it search (so every window is not checked) and returns true. If no window handles the click, then the Window instance triggers an event (OnMouseButton) to its event manager (i.e. Application).
virtual bool OnMouseMove (const MouseInformations *mouseInfo)
 This function is called when the mouse is moved inside the window's borders. When this happens, the user interface will check (in focus order) if one of the windows can handle the event. This is why the function must return a bool : once the interface has found a window that handles the move, it stops it search (so every window is not checked) and returns true. If no window handles the click, then the Window instance triggers an event (OnMouseButton) to its event manager (i.e. Application).
virtual void OnMouseDrag (const MouseInformations *mouseInfo)
 This function is called when the mouse is dragging inside the window's borders. Dragging means having the left button down while moving the mouse. When this happens, the user interface will check (in focus order) if one of the windows can handle the event. This is why the function must return a bool : once the interface has found a window that handles the move, it stops it search (so every window is not checked). If no window handles the move, then it triggers an event to the application (OnMouseMove).
virtual void OnGetsFocus ()
 This function is called when the current window gets the focus, i.e. is on top of all the other windows. For instance is called when the uses selects the window, or the window is added to the user interface, as adding a window puts it in the first position.
virtual void OnLosesFocus ()
 This function is called when the current window loses the focus, i.e. is no more on top of all the other windows. This may happen if a window is added to the interface, or the uses selects another window.
virtual void AddComponent (UIBaseComponent *component)
 Adds a component to the current window.
virtual bool IsMouseInbound (const MouseInformations *mouseInfo)
 checks if the mouse is above the window or not. You might want to change the algorithm if you want non-rectangular windows.
virtual bool WasMouseInbound (const MouseInformations *mouseInfo)
 checks if the mouse was above the window or not. You might want to change the algorithm if you want non-rectangular windows.
virtual void OnReceiveMessage (UIBaseComponent *trigger, UICMessage message, int infos)
 This function is called whenever a component sends a message to its parent window.

Private Attributes

bool m_IsDragging
 This variable remembers if we're dragging the window.
int m_WindowWidth
 User Window's width and height. TODO : need to find a better solution someday. But I don't like m_UserInterface->GetWidth() either.
int m_WindowHeight
int m_PosX
 Current X and Y position of the window. 0,0 represents the top left window's corner. Max values depend on the window's size (in pixel).
int m_PosY
int m_Width
 Current X and Y size of the window.
int m_Height
UserInterfacem_UserInterface
 user interface that holds this window.
vector< UIBaseComponent * > m_Components
 list of components held by the window.
UIBaseComponentm_ActiveComponent
 Last component that's been manipulated by the user.

Friends

class UIBaseComponent
class UserInterface


Detailed Description

The class UIBaseWindow represents a fully functional 2D window inside our application. It supports display, dragging and adding component, but not yet resizing. Its default interface is simple and quite ugly, nevertheless it's been made with evolution in mind, and can the class itself can easily be derived in order to change its look and behavior.


Constructor & Destructor Documentation

Moteur3D::UIBaseWindow::UIBaseWindow UserInterface ui  ) 
 

Constructor.

Parameters:
ui UserInterface that will hold this window.

Moteur3D::UIBaseWindow::~UIBaseWindow  ) 
 

Destructor.


Member Function Documentation

virtual void Moteur3D::UIBaseWindow::AddComponent UIBaseComponent component  )  [protected, virtual]
 

Adds a component to the current window.

Parameters:
component UIBaseComponent to add.

void Moteur3D::UIBaseWindow::Close  ) 
 

Asks the window to close itself. Note that this will effect just before next draw, and the window's memory will be freed by the user interface.

virtual int Moteur3D::UIBaseWindow::GetHeight  )  [inline, virtual]
 

Returns the window's Y size.

virtual int Moteur3D::UIBaseWindow::GetPositionX  )  [inline, virtual]
 

Returns the left window's border position. 0 is the left border of the window. Max values depend on the window's size (in pixel).

virtual int Moteur3D::UIBaseWindow::GetPositionY  )  [inline, virtual]
 

Returns the top window's border position. 0 is the top border of the window. Max values depend on the window's size (in pixel).

virtual int Moteur3D::UIBaseWindow::GetWidth  )  [inline, virtual]
 

Returns the window's X size.

virtual bool Moteur3D::UIBaseWindow::IsMouseInbound const MouseInformations mouseInfo  )  [inline, protected, virtual]
 

checks if the mouse is above the window or not. You might want to change the algorithm if you want non-rectangular windows.

Parameters:
mouseInfo Mouse informations, such as position, button states etc.

virtual void Moteur3D::UIBaseWindow::OnDisplay  )  [protected, virtual]
 

Event called when the window needs to be displayed. Override it if you want custom graphics for your window (and you probably will).

virtual void Moteur3D::UIBaseWindow::OnGetsFocus  )  [protected, virtual]
 

This function is called when the current window gets the focus, i.e. is on top of all the other windows. For instance is called when the uses selects the window, or the window is added to the user interface, as adding a window puts it in the first position.

virtual void Moteur3D::UIBaseWindow::OnLosesFocus  )  [protected, virtual]
 

This function is called when the current window loses the focus, i.e. is no more on top of all the other windows. This may happen if a window is added to the interface, or the uses selects another window.

virtual bool Moteur3D::UIBaseWindow::OnMouseButton const MouseInformations mouseInfo,
MouseButton  button,
bool  buttonDown
[protected, virtual]
 

This function is called when a mouse button is pressed or released inside the window's borders. When this happens, the user interface will check (in focus order) if one of the windows can handle the event. This is why the function must return a bool : once the interface has found a window that handles the click, it stops it search (so every window is not checked) and returns true. If no window handles the click, then the Window instance triggers an event (OnMouseButton) to its event manager (i.e. Application).

Parameters:
mouseInfo Mouse informations, such as position, button states etc.
button Mouse button that is concerned.
buttonDown true if the button is being pressed, otherwise false.
Returns:
True if the current window handles the event, false otherwise.

virtual void Moteur3D::UIBaseWindow::OnMouseDrag const MouseInformations mouseInfo  )  [protected, virtual]
 

This function is called when the mouse is dragging inside the window's borders. Dragging means having the left button down while moving the mouse. When this happens, the user interface will check (in focus order) if one of the windows can handle the event. This is why the function must return a bool : once the interface has found a window that handles the move, it stops it search (so every window is not checked). If no window handles the move, then it triggers an event to the application (OnMouseMove).

Parameters:
mouseInfo Mouse informations, such as position, button states etc.
Returns:
True if the current window handles the event, false otherwise.

virtual bool Moteur3D::UIBaseWindow::OnMouseMove const MouseInformations mouseInfo  )  [protected, virtual]
 

This function is called when the mouse is moved inside the window's borders. When this happens, the user interface will check (in focus order) if one of the windows can handle the event. This is why the function must return a bool : once the interface has found a window that handles the move, it stops it search (so every window is not checked) and returns true. If no window handles the click, then the Window instance triggers an event (OnMouseButton) to its event manager (i.e. Application).

Parameters:
mouseInfo Mouse informations, such as position, button states etc.
Returns:
True if the current window handles the event, false otherwise.

virtual void Moteur3D::UIBaseWindow::OnReceiveMessage UIBaseComponent trigger,
UICMessage  message,
int  infos
[protected, virtual]
 

This function is called whenever a component sends a message to its parent window.

Parameters:
trigger : Component triggering the event.
message : message sent.
infos : additional data, maybe anything, depending on the component.

virtual void Moteur3D::UIBaseWindow::OnWindowResized int  width,
int  height
[protected, virtual]
 

This function is called each time the windows is resized, or the window is switched between fullscreen and windowed mode.

virtual void Moteur3D::UIBaseWindow::SetPosition int  x,
int  y
[virtual]
 

Changes the window's current position (top left corner). 0,0 represents the top left window's corner. Max values depend on the window's size (in pixel).

Parameters:
x New X position.
y New Y position.

virtual void Moteur3D::UIBaseWindow::SetSize int  x,
int  y
[virtual]
 

Changes the window's current size. 0,0 represents the top left window's corner. Max values depend on the window's size (in pixel).

Parameters:
x New X position.
y New Y position.

virtual bool Moteur3D::UIBaseWindow::WasMouseInbound const MouseInformations mouseInfo  )  [inline, protected, virtual]
 

checks if the mouse was above the window or not. You might want to change the algorithm if you want non-rectangular windows.

Parameters:
mouseInfo Mouse informations, such as position, button states etc.


Friends And Related Function Documentation

friend class UIBaseComponent [friend]
 

friend class UserInterface [friend]
 


Member Data Documentation

UIBaseComponent* Moteur3D::UIBaseWindow::m_ActiveComponent [private]
 

Last component that's been manipulated by the user.

vector<UIBaseComponent*> Moteur3D::UIBaseWindow::m_Components [private]
 

list of components held by the window.

int Moteur3D::UIBaseWindow::m_Height [private]
 

bool Moteur3D::UIBaseWindow::m_IsDragging [private]
 

This variable remembers if we're dragging the window.

int Moteur3D::UIBaseWindow::m_PosX [private]
 

Current X and Y position of the window. 0,0 represents the top left window's corner. Max values depend on the window's size (in pixel).

int Moteur3D::UIBaseWindow::m_PosY [private]
 

UserInterface* Moteur3D::UIBaseWindow::m_UserInterface [private]
 

user interface that holds this window.

int Moteur3D::UIBaseWindow::m_Width [private]
 

Current X and Y size of the window.

int Moteur3D::UIBaseWindow::m_WindowHeight [private]
 

int Moteur3D::UIBaseWindow::m_WindowWidth [private]
 

User Window's width and height. TODO : need to find a better solution someday. But I don't like m_UserInterface->GetWidth() either.


The documentation for this class was generated from the following file:
Generated on Sat Oct 15 15:05:52 2005 for Moteur3D by  doxygen 1.4.4