#include <lvt/Wnd.h>
To handle window messages, derive an object from Wnd, and override the appropriate On*() member function.
Create() must be called before any other member functions or drawing commands are issued.
Public Member Functions | |
void | AdjustCamera (Camera *cam) |
Adjusts the aspect ratio of cam to match that of the window. | |
bool | Create (const std::string &title, PixelFormat pixelFormat=PF_DEFAULT, WindowStyle style=STYLE_NORMAL) |
Creates a new window. | |
void | Destroy () |
Destroys the window. | |
int | GetHeight () const |
Returns the height of the window, in screen coordinates. | |
Menu | GetMenu () const |
Returns the window's current menu. | |
int | GetWidth () const |
Returns the width of the window, in screen coordinates. | |
bool | IsCreated () const |
Returns true if the window has been created. | |
bool | IsVisible () const |
Returns true if the window is currently visible. | |
MessageBoxResult | MessageBox (const std::string &msg, const std::string &title, MessageBoxButtons buttons=MBB_OK) |
Displays a message box. | |
MessageBoxResult | MessageBox (const std::string &msg, MessageBoxButtons buttons=MBB_OK) |
Displays a message box. | |
void | Redraw () |
Redraws the window. | |
void | SetInputHandler (InputHandler *handler) |
Sets the window's current input handler. | |
bool | SetMenu (const Menu &menu) |
Sets the window's current menu. | |
void | SetPosition (int x, int y) |
Sets the position of the window, in screen coordinates. | |
void | SetSize (int width, int height) |
Sets the size of the window, in screen coordinates. | |
bool | Show (WindowState showCmd=STATE_NORMAL) |
Shows the window with the given WindowState. | |
void | ShowScene (Node *newScene) |
Causes the window to display a scenegraph when it is painted. | |
Protected Member Functions | |
Message Handlers | |
Override these member functions in your Wnd-derived class to handle window messages. | |
virtual bool | OnCreate () |
The window is being created. | |
virtual void | OnDestroy () |
The window has been destroyed. | |
virtual void | OnLButtonDblClk (int x, int y) |
The left mouse button has been double-clicked. | |
virtual void | OnLButtonDown (int x, int y) |
The left mouse button has been pressed. | |
virtual void | OnLButtonUp (int x, int y) |
The left mouse button has been released. | |
virtual void | OnMButtonDblClk (int x, int y) |
The middle mouse button has been double-clicked. | |
virtual void | OnMButtonDown (int x, int y) |
The middle mouse button has been pressed. | |
virtual void | OnMButtonUp (int x, int y) |
The middle mouse button has been released. | |
virtual void | OnMenuCommand (int id) |
The user has activated a menu item. | |
virtual void | OnMouseMove (int x, int y) |
The mouse has been moved. | |
virtual void | OnMouseWheel (int x, int y, int zDelta) |
The mouse wheel has been moved. | |
virtual void | OnMove (int x, int y) |
The window has been moved. | |
virtual void | OnPaint () |
The window needs to be repainted. | |
virtual void | OnRButtonDblClk (int x, int y) |
The right mouse button has been double-clicked. | |
virtual void | OnRButtonDown (int x, int y) |
The right mouse button has been pressed. | |
virtual void | OnRButtonUp (int x, int y) |
The right mouse button has been released. | |
virtual void | OnSize (WindowState state, int width, int height) |
The window has been resized. |
|
Adjusts the aspect ratio of cam to match that of the window. When a window is resized, its aspect ratio might not match the aspect ratio of any cameras in the window's scenegraph, causing distortion when the scene is rendered. AdjustCamera will change the aspect ratio of cam to match the window's whenever the window is resized. The Wnd object creates a list internally of all the cameras attached to it via AdjustCamera and increments their reference count when added. |
|
Creates a new window.
|
|
Destroys the window. Signals the operating/windowing system that the window should be destroyed. Causes the OnDestroy() member function to be called. |
|
Returns the height of the window, in screen coordinates.
|
|
Returns the window's current menu. The Menu object returned by GetMenu is a copy of the window's current menu. Modifications to the menu will not take effect unless SetMenu() is called. |
|
Returns the width of the window, in screen coordinates.
|
|
Returns true if the window has been created.
|
|
Returns true if the window is currently visible.
|
|
Displays a message box.
|
|
Displays a message box.
|
|
The window is being created. Use this function to do any additional setup and initialization for your window class, such as adding menus, or initializing resources. The OpenGL context is created and active when this method is called, so drawing operations are permitted. Return true from this function to allow creation of the window to proceed. Return false to prevent window creation, and to cause the Create() method to fail. The default implementation does nothing and returns true. |
|
The window has been destroyed.
This method is called after the operating system has destroyed the window. It is acceptable for a Wnd to commit suicide ( The default implementation does nothing. |
|
The left mouse button has been double-clicked.
|
|
The left mouse button has been pressed.
|
|
The left mouse button has been released.
|
|
The middle mouse button has been double-clicked.
|
|
The middle mouse button has been pressed.
|
|
The middle mouse button has been released.
|
|
The user has activated a menu item.
|
|
The mouse has been moved.
|
|
The mouse wheel has been moved.
|
|
The window has been moved.
|
|
The window needs to be repainted. Called as a result of a portion of the window being uncovered or exposed. You should do any drawing that your window requires in response to this message. The default implementation clears the framebuffer and draws the scenegraph attached via ShowScene, if any. |
|
The right mouse button has been double-clicked.
|
|
The right mouse button has been pressed.
|
|
The right mouse button has been released.
|
|
The window has been resized.
|
|
Redraws the window. Notifies the operating/windowing system that the window needs to be redrawn. Causes the OnPaint() method to be called. |
|
Sets the window's current input handler. The default implementation of the On* mouse message handlers is to pass the message onto the current InputHandler, if any. A typical use of an input handler is adjust the orientation of a camera or other scene graph node in response to input (See the Examiner class). NOTE: In a future release of LVT, a Wnd will keep a chain of InputHandlers and pass the message onto each item in the chain successively until one of the handlers accepts the message. |
|
Sets the window's current menu.
|
|
Sets the position of the window, in screen coordinates.
|
|
Sets the size of the window, in screen coordinates.
|
|
Shows the window with the given WindowState.
|
|
Causes the window to display a scenegraph when it is painted. ShowScene increments the reference count of the Node pointed to by scene. If the window was already displaying a scenegraph, that Node's reference count will be decremented. |