IMS2  Pre-Alpha
An Orbiter add-on to allow on-runtime construction of spacecraft from predefined modules
GUIentity Class Referenceabstract

Abstract class providing functionality to create and manage GUI elements. More...

Inheritance diagram for GUIentity:
GUImanager GUIplugin GUIpopup GUIalert GUIlistPopup

Public Member Functions

void RegisterGuiElement (GUI_BaseElement *_element, int _parentId)
 Registers a GUI element that has not been created by this GUIentity. More...
 
int GetDynamicUID ()
 
virtual GUI_BaseElementGetElementById (int _id)
 
GUI_PageCreatePage (RECT _rect, int parent, int _id=-1, GUI_STYLE styleId=STYLE_DEFAULT, bool drawbackground=false)
 Creates a new GUI_Page element. More...
 
GUI_LabelCreateLabel (string text, RECT _rect, int parent, int _id=-1, GUI_STYLE styleId=STYLE_HEADING)
 Creates a new GUI_Label element. More...
 
GUI_LabelValuePair * CreateLabelValuePair (string label, string value, RECT _rect, int parent, int id=-1, GUI_STYLE styleId=STYLE_HEADING, GUI_FONT valueFontId=GUI_NO_FONT)
 Creates a new GUI_LabelValuePair. More...
 
GUI_ListBoxCreateListBox (RECT _rect, int parent, int _id=-1, GUI_STYLE styleId=STYLE_LISTBOX, GUI_STYLE scrollbar_styleId=STYLE_LISTBOX, bool _multiselect=false, bool _noSelect=false)
 Creates a new GUI_ListBox. More...
 
GUI_StaticButtonCreateStaticButton (RECT _rect, int srcX, int srcY, SURFHANDLE _src, int parent, int _id=-1)
 Creates a new GUI_StaticButton. More...
 
GUI_DynamicButtonCreateDynamicButton (string text, RECT _rect, int parent, int _id=-1, GUI_STYLE styleId=STYLE_BUTTON)
 Creates a new GUI_DynamicButton. More...
 
GUI_CheckBoxCreateCheckBox (string text, RECT _rect, int parent, int _id=-1, GUI_STYLE styleId=STYLE_CHECKBOX)
 Creates a new GUI_CheckBox. More...
 
GUI_RadioButtonCreateRadioButton (string text, RECT _rect, int parent, int _id=-1, GUI_STYLE styleId=STYLE_CHECKBOX)
 Creates a new GUI_RadioButton. More...
 
GUI_StatusBar * CreateStatusBar (RECT _rect, int parent, int _id=-1, GUI_STYLE styleid=STYLE_STATUSBAR)
 
void SetStyleSet (string _styleset)
 Sets the styleset this GUIentity uses. More...
 
GUI_ElementStyleGetStyle (GUI_STYLE _styleId=STYLE_DEFAULT)
 
GUI_fontGetFont (GUI_FONT _fontid)
 
virtual bool Update ()=0
 checks if any children had an update NOT triggered by user input. More...
 

Protected Member Functions

virtual bool AddChildToParent (GUI_BaseElement *child, int parentId)=0
 Adds a GUI_ElementBase to a parent. More...
 

Protected Attributes

map< int, GUI_BaseElement * > elements
 a searchtree containing all GUI_Elements of this entity
 
UINT newuid = GUI_UID_DOMAIN
 Variable used to pass out dynamic UIDs for GUI elements.
 
FontsAndStylesfontsandstyles
 Pointer to the global FontsAndStyles instance.
 
string styleset = "default"
 Identifier of the defualt styleset of this entity.
 

Detailed Description

Abstract class providing functionality to create and manage GUI elements.

The GUIentity stores GUIelements in a tree that describes a menu structure. It is capable of handling several such trees, so it needn't be restricted to one root. It has random access to all of its decendants and is a single point of entry to create new GUI elements and directly insert them into the proper tree using the uid of a parent. If elements are created dynamically (i.e. without a set uid), the GUIentity will automatically assign them one. UIDs of elements are LOCAL to the GUIentity managing them. Different GUIentities can have elements of the same UID, provided every UID only appears once in every GUIentity.

Member Function Documentation

virtual bool GUIentity::AddChildToParent ( GUI_BaseElement child,
int  parentId 
)
protectedpure virtual

Adds a GUI_ElementBase to a parent.

Exact behavior depends on implementation.

Parameters
childThe element to be added to the parent
parentIdThe locally unique identifier of the parent.

Implemented in GUImanager, and GUIplugin.

GUI_CheckBox * GUIentity::CreateCheckBox ( string  text,
RECT  _rect,
int  parent,
int  _id = -1,
GUI_STYLE  styleId = STYLE_CHECKBOX 
)

Creates a new GUI_CheckBox.

Parameters
textThe text to be displayed next to the checkbox
_rectThe drawing rectangle the box (and its text) occupies in its parent (i.e. relative to the top-left of the parent)
parentThe locally unique identifier of the parent this element should becoe a child of.
_idA locally unique identifier for this element. Pass -1 (default) to let the GUIentity assign an id itself
styleIdThe identifier of the Style this element should be drawn in
Returns
A pointer to the newly created GUI_CheckBox
See also
GUI_CheckBox
GUI_DynamicButton * GUIentity::CreateDynamicButton ( string  text,
RECT  _rect,
int  parent,
int  _id = -1,
GUI_STYLE  styleId = STYLE_BUTTON 
)

Creates a new GUI_DynamicButton.

Parameters
textThe text that should be displayed on the button
_rectthe drawing rectangle the page occupies in its parent (i.e. relative to the top-left of the parent)
parentThe locally unique identifier of the parent this element should becoe a child of.
_idA locally unique identifier for this element. Pass -1 (default) to let the GUIentity assign an id itself
styleIdThe identifier of the Style this element should be drawn in
Returns
A pointer to the newly created GUI_DynamicButton
GUI_Label * GUIentity::CreateLabel ( string  text,
RECT  _rect,
int  parent,
int  _id = -1,
GUI_STYLE  styleId = STYLE_HEADING 
)

Creates a new GUI_Label element.

Parameters
textThe text being displayed on the label
_rectThe drawing rectangle the page occupies in its parent (i.e. relative to the top-left of the parent)
parentThe locally unique identifier of the parent this element should becoe a child of.
_idA locally unique identifier for this element. Pass -1 (default) to let the GUIentity assign an id itself
styleIdThe identifier of the Style this element should be drawn in
Returns
A pointer to the newly created GUI_Label
See also
GUI_Label
GUI_LabelValuePair * GUIentity::CreateLabelValuePair ( string  label,
string  value,
RECT  _rect,
int  parent,
int  id = -1,
GUI_STYLE  styleId = STYLE_HEADING,
GUI_FONT  valueFontId = GUI_NO_FONT 
)

Creates a new GUI_LabelValuePair.

Parameters
labelThe text being displayed on the label
valueThe text being displayed as value
_rectThe drawing rectangle the element occupies in its parent (i.e. relative to the top-left of the parent)
parentThe locally unique identifier of the parent this element should become a child of.
idA locally unique identifier for this element. Pass -1 (default) to let the GUIentity assign an id itself
styleIdThe identifier of the Style this element should be drawn in
valueFontIdLets you choose an alternate font to render the value in
Returns
A pointer to the newly created GUI_LabelValuePair
See also
GUI_LabelValuePair
GUI_ListBox * GUIentity::CreateListBox ( RECT  _rect,
int  parent,
int  _id = -1,
GUI_STYLE  styleId = STYLE_LISTBOX,
GUI_STYLE  scrollbar_styleId = STYLE_LISTBOX,
bool  _multiselect = false,
bool  _noSelect = false 
)

Creates a new GUI_ListBox.

Parameters
_rectThe drawing rectangle the page occupies in its parent (i.e. relative to the top-left of the parent)
parentThe locally unique identifier of the parent this element should becoe a child of.
_idA locally unique identifier for this element. Pass -1 (default) to let the GUIentity assign an id itself
styleIdThe identifier of the Style this element should be drawn in
scrollbar_styleIdThe style the scrollbar should be drawn in
_multiselectPass true if the listbox should handle multi-select
_noSelectPass true if the listbox is just intended to list things, without the capability to actually select anything
Returns
Pointer to the newly created GUI_ListBox
See also
GUI_ListBox
GUI_Page * GUIentity::CreatePage ( RECT  _rect,
int  parent,
int  _id = -1,
GUI_STYLE  styleId = STYLE_DEFAULT,
bool  drawbackground = false 
)

Creates a new GUI_Page element.

Parameters
_rectThe drawing rectangle the page occupies in its parent (i.e. relative to the top-left of the parent)
parentThe locally unique identifier of the parent this element should become a child of.
_idA locally unique identifier for this element. Pass -1 (default) to let the GUIentity assign an id itself
styleIdThe identifier of the Style this element should be drawn in
drawbackgroundIf true, the page will draw a background in the passed style.
Note
drawbackground: The page by default will not draw anything and only serve as a grouping element. In most cases, this is perfectly sufficient. You should only draw the background on a page if you want the page itself to draw a border, or a fill color that's different from the default.
Returns
A pointer to the newly created GUI_Page.
See also
GUI_Page
GUI_RadioButton * GUIentity::CreateRadioButton ( string  text,
RECT  _rect,
int  parent,
int  _id = -1,
GUI_STYLE  styleId = STYLE_CHECKBOX 
)

Creates a new GUI_RadioButton.

Parameters
textThe text to be displayed next to the button
_rectThe drawing rectangle the button (and its text) occupies in its parent (i.e. relative to the top-left of the parent)
parentThe locally unique identifier of the parent this element should become a child of.
_idA locally unique identifier for this element. Pass -1 (default) to let the GUIentity assign an id itself
styleIdThe identifier of the Style this element should be drawn in
Returns
A pointer to the newly created GUI_RRadioButton
See also
GUI_RadioButton
GUI_StaticButton * GUIentity::CreateStaticButton ( RECT  _rect,
int  srcX,
int  srcY,
SURFHANDLE  _src,
int  parent,
int  _id = -1 
)

Creates a new GUI_StaticButton.

Parameters
_rectThe drawing rectangle the page occupies in its parent (i.e. relative to the top-left of the parent)
srcXThe coordinate of the lefthand edge on the texture the element takes its image from
srcYThe coordinate of the top edge on the texture the element takes its image from
_srcHandle to the texture surface the element takes its image from
parentThe locally unique identifier of the parent this element should becoe a child of.
_idA locally unique identifier for this element. Pass -1 (default) to let the GUIentity assign an id itself
Returns
Pointer to the newly created GUI_StaticButton
See also
GUI_StaticButton
int GUIentity::GetDynamicUID ( )
Returns
a new id unique to this GUIentity
GUI_BaseElement * GUIentity::GetElementById ( int  _id)
virtual
Returns
the GUI_Element with the passed id, NULL if not found

Reimplemented in GUImanager.

GUI_font * GUIentity::GetFont ( GUI_FONT  _fontid)
Returns
A pointer to the font matching the passed id
GUI_ElementStyle * GUIentity::GetStyle ( GUI_STYLE  _styleId = STYLE_DEFAULT)
Returns
A pointer to the style matching the passed id
void GUIentity::RegisterGuiElement ( GUI_BaseElement _element,
int  _parentId 
)

Registers a GUI element that has not been created by this GUIentity.

This is commonly used by specific submenu classes or other non-standard GUI elements for which the GUIentity doesn't have a factory.

Note
The GUIentity takes OWNERSHIP of the passed pointer and will deallocate it on destruction.
Destroying a registered element yourself WILL lead to mayhem!
Parameters
_elementA pointer to the element to be registered
_parentIdThe UID of the parent the registered element should become a child of
void GUIentity::SetStyleSet ( string  _styleset)

Sets the styleset this GUIentity uses.

Note
Currently only affects elements that are added after the call to this function!!
Parameters
_stylesetA string identifying the desired StyleSet
virtual bool GUIentity::Update ( )
pure virtual

checks if any children had an update NOT triggered by user input.

redraws the panel area if one did. should be called every frame. Exact behavior depends on Implementation

Returns
True if any o the elments in this entity have requested a redraw, false otherwise

Implemented in GUIplugin, and GUImanager.


The documentation for this class was generated from the following files: