Return to Index

Window

Parent class: Container

This class provides a toplevel window on the screen. It is a descendant of the container class, and thus can hold other widgets directly. It generates events when it is loaded (or created), unloaded (or destroyed), for user close requests, and when it is resized.

Note that handling Close events may not seem very straightforward. By default, a window will ignore close events from the system (i.e. clicking on the X close button on the window's border) and remain on the screen. To accept a close event, the event sent to a OnClose( ) handler must be accepted by calling the Event::accept() method.
   void MyWindow::OnClose( Event &pEvt ) {
     pEvt.accept();
   }
This close mechanism may seem overly complicated, but it allows for a general way to ensure that a user's data can be saved before a window is unloaded without writing the code to check for window closability multiple places.


Object Events:
LoadAn event generated when the window is loaded.
UnloadAn event generated when the window is unloaded.
CloseAn event generated when the window receives a close request.
ResizeAn event generated when the window is resized.

Method Summary:
Window::Window();
void Window::setModal(bool pModal);
void Window::setResizable(bool pResizable);
void Window::setCentered(bool pCentered);
void Window::setTitle(const String& pTitle);
void Window::setBorder(bool pBorder);
bool Window::close();



Window::Window
Window::Window();

Constructs a new toplevel window.

void Window::setModal
void Window::setModal(bool pModal);

Causes the window to be modal. That means that other windows in the application will be blocked until this one is unloaded. Note that once a window is made modal, it cannot be made unmodal.
Parameters:
bool pModalEnable window modality or not.

void Window::setResizable
void Window::setResizable(bool pResizable);

Enables window resizing. Once a window is made resizable, it cannot be made to require a fixed size any longer.
Parameters:
bool pResizableEnable resizing or not.

void Window::setCentered
void Window::setCentered(bool pCentered);

Centers the window on the screen.
Parameters:
bool pCenteredIf true, the window will be centered on the screen.

void Window::setTitle
void Window::setTitle(const String& pTitle);

Changes the window's title on its border.
Parameters:
const String& pTitleThe new window title.

void Window::setBorder
void Window::setBorder(bool pBorder);

Changes whether the window has a system-supplied border around it.
Parameters:
bool pBorderEnable the system border or not.

bool Window::close
bool Window::close();

Causes a Close event to be generated on the window.

Returns: Returns whether the close event was accepted or rejected.


Generated automatically by docgen 0.0.1
© 2003 Aron Dobos