A base class for all main screen UI. BaseUI implements the UI interface and handles some of the UI interface functions as well as providing another interface set for further derived classes to implement. Each BaseUI-derived class must have an associated TraitsUI class that provides default values for the shape and size of that BaseUI element as well as a mechanism for dynamically resizing that UI element on the fly. BaseUI handles all of the lowest level wx event handling for painting and resizing, and provides a flicker-free drawing mechanism for custom drawn UI elements via the classic bitblt strategy. Each UI element gets a wxMemoryDC to draw itself in, which BaseUI then blasts to the screen all at once with bit blit.
BaseUI also provides a set of anchor points for any derived classes and handles calculating their correct origin on the screen when the main screen is resized, fulfilling that requirement of the UI interface. BaseUI also handles responding to requests from the user to totally resize every UI element, also fulfilling that requirement of the UI interface.
BaseUI.h
A base class for all main screen UI. | |
The anchor point for a UI element. | |
Calculates the origin of the UI given the screen rectangle. | |
Handles a user-initiated total UI resize. | |
The BaseUI constructor. | |
Sets an offset for the UI from the anchor point. | |
The wxWidgets event table declaration. | |
Paints the UI window. | |
Provides the TraitsUI object for the UI element. | |
Resizes the UI element. | |
Erases the button. | |
Paints the window. | |
Resizes the window. | |
The offset anchor for the UI element. | |
The current offset amount from the offset anchor. | |
The memory bitmap for flicker free drawing. |
|
Calculates the origin of the UI given the screen rectangle. Uses the stored OffsetAnchor and offset size to calculate the correct origin for the UI element.
| rect | A wxRect that is the dimensions of the window the UI resides in. |
A wxPoint that is the origin in window coordinates of the UI element.
|
Handles a user-initiated total UI resize. Gets the TraitsUI object for the class, resizes it with the given percentage, and then calls ResizeUI so that the derived class can adjust itself to the new values in the TraitsUI object.
| fPercent | The percentage of UI resize. Ranges from 1.0 to 2.0 inclusive. |
|
The BaseUI constructor. In every way like a wxWindow constructor except it takes an additional OffsetAnchor parameter, setting the anchor point for the UI.
| type | The offset anchor type. |
| parent | The parent window (must not be NULL). |
| id | The id for message handling. |
| pos | The starting position. |
| size | The starting size. |
| style | The window style, using wxWindow parameters. |
| name | The name. |
Paints the UI window. | |
Provides the TraitsUI object for the UI element. | |
Resizes the UI element. | |
Erases the button. | |
Paints the window. | |
Resizes the window. | |
The offset anchor for the UI element. | |
The current offset amount from the offset anchor. | |
The memory bitmap for flicker free drawing. |
| virtual void ResizeUI()=0 |
Resizes the UI element. Each BaseUI-derived class must be ready to handle a user-initiated event to completely resize every UI element based on the parameters in its TraitsUI object.
|
|
|
|
|
| virtual const TraitsUIPtr &GetTraitsUI()=0 |
| virtual void ResizeUI()=0 |
|
|
|
| OffsetAnchor mOffsetAnchor |
| wxSize mOffset |
| wxBitmap mMemBitmap |