UI

An interface for custom-drawn main screen UI elements.  UI is an interface that lays on top of a wxWindow, providing a minimum set of functions that allow for totally custom-drawn, dynamically resizable UI elements to be located on the screen and correctly relocated and stretched when the user resizes the window, or resizes all UI elements.  Each UI-derived class must provide a mechanism for calculating its correct origin when a window resize occurs.

Derived From

wxWindow (see http://www.wxwindows.org/manuals/2.4.2/wx411.htm)

Project

UICore

Include

UI.h

Summary
An interface for custom-drawn main screen UI elements.
Calculates the origin of the UI given the screen rectangle.
Initializes the UI element.
Handles a user-initiated total UI resize.
The UI constructor.
The UI destructor.
The default UI constructor.

Public

Summary
Calculates the origin of the UI given the screen rectangle.
Initializes the UI element.
Handles a user-initiated total UI resize.

Pure Virtual Functions

GetPosition

virtual wxPoint GetPosition(const wxRect &rect)=0

Calculates the origin of the UI given the screen rectangle.

Parameters

rectA wxRect that is the dimensions of the window the UI resides in.

Returns

A wxPoint that is the origin in window coordinates of the UI element.

InitializeUI

virtual void InitializeUI(const GamePtr &game)=0

Initializes the UI element.  A derived class should perform any necessary setup in this function.  Allows for a way to initialize all UI elements at one time, if the UI elements are stored as UI * in a container.

Parameters

gameThe current Game.  The UI may use information in the game to help initialize itself.

TotalUIResize

virtual void TotalUIResize(float fPercent)=0

Handles a user-initiated total UI resize.  The UI interface provides a way for users to totally resize every main screen piece of UI in the game.  Derived classes must implement this function, which supplies a percent from 1.0 to 2.0 inclusive that the default size of the UI should be multipled by.  This allows all UI-derived classes to grow linearly by the same amounts when a user applies a resize percentage to the main screen.

Parameters

fPercentThe percentage of UI resize.  Ranges from 1.0 to 2.0 inclusive.

Protected

Summary
The UI constructor.
The UI destructor.

Constructors

UI

UI(wxWindow *parent, 
wxWindowID id, 
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
long style = 0,
const wxString &name = wxPanelNameStr) : wxWindow(parent, id, pos, size, style, name)

The UI constructor.  All the same parameters as a standard wxWindow, which it simply passes along to.

Parameters

parentThe parent window (must not be NULL).
idThe id for message handling.
posThe starting position.
sizeThe starting size.
styleThe window style, using wxWindow parameters.
nameThe name.

Destructor

UI

virtual ~UI()=0

The UI destructor.  Pure virtual because this class must be derived from to be used.

Private

Summary
The default UI constructor.

Constructors

UI

UI()

The default UI constructor.  Declared private so derived classes are forced to use the wxWindow-style constructor.

virtual wxPoint GetPosition(const wxRect &rect)=0
Calculates the origin of the UI given the screen rectangle.
virtual void InitializeUI(const GamePtr &game)=0
Initializes the UI element.
virtual void TotalUIResize(float fPercent)=0
Handles a user-initiated total UI resize.
UI(wxWindow *parent, 
wxWindowID id, 
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
long style = 0,
const wxString &name = wxPanelNameStr) : wxWindow(parent, id, pos, size, style, name)
The UI constructor.
UICore provides a set of common UI controls that promote a constant look and feel across all aspects of the UI.
Still volatile.