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

A GUIplugin is a GUIentity that can be a child of a GUI_BaseElement. More...

Inheritance diagram for GUIplugin:
GUIentity GUIpopup GUIalert GUIlistPopup

Public Member Functions

virtual bool ProcessChildren (GUI_MOUSE_EVENT _event, int _x, int _y)
 Sends an event received from the containing GUI_BaseElement to its children. More...
 
void DrawChildren (SURFHANDLE _tgt, RECT &drawablerect, int xoffset=0, int yoffset=0)
 Draws all visible children of the GUIplugin. More...
 
bool IsVisible ()
 
void SetVisible (bool visible)
 
bool IsFixed ()
 
void SetFixed (bool fixed)
 
GUI_BaseElementGetFirstVisibleChild ()
 
bool Update ()
 checks all children if any of them need a redraw. More...
 
- Public Member Functions inherited from GUIentity
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)
 

Protected Member Functions

bool AddChildToParent (GUI_BaseElement *child, int parentId)
 Adds a child to an element in this GUIplugin child: Pointer to the GUI element to be added to a parent parentId: uid of the intended parent. pass -1 if the element is a root element in this plugin. More...
 

Protected Attributes

bool isvisible = false
 Tells the plugin whether to draw its elements or not.
 
bool isfixed = false
 Whether the plugin has a fixed position inside a scrollable element.
 
vector< GUI_BaseElement * > rootelements
 The GUImanager can assume that all its registered GUI_Surfaces are root elements. The plugin doesn't have that luxury, but still needs to know which elements are at the root.
 
- Protected Attributes inherited from GUIentity
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

A GUIplugin is a GUIentity that can be a child of a GUI_BaseElement.

They are designed to be a self-managed subbranch of a GUI that can be integrated into the normal GUI flow by plugging them into a GUI element. The underlying GUImanager of the vessel has NO awareness of the plugin, thus enabling the plugin to be added and removed from a vessel GUI while affecting only a single GUI element. Since the GUIplugin manages its own children, it can be added and removed to a GUI without its own children being affected in any way by the process.

Member Function Documentation

bool GUIplugin::AddChildToParent ( GUI_BaseElement child,
int  parentId 
)
protectedvirtual

Adds a child to an element in this GUIplugin child: Pointer to the GUI element to be added to a parent parentId: uid of the intended parent. pass -1 if the element is a root element in this plugin.

Note
Contrary to a GUImanager, where every element must be the child of a GUI_surface, GUIplugins can have direct decendants.

Implements GUIentity.

void GUIplugin::DrawChildren ( SURFHANDLE  _tgt,
RECT &  drawablerect,
int  xoffset = 0,
int  yoffset = 0 
)

Draws all visible children of the GUIplugin.

Parameters
_tgtThe SURFHANDLE to draw to
drawablerectThe drawable rect of the parent, in screen coordinates. Serves as clipping rect
xoffsetby how much to offset the plugin from screen 0 in the x axis
yoffsetby how much to offset the plugin from screen 0 in the y axis
GUI_BaseElement * GUIplugin::GetFirstVisibleChild ( )
Returns
returns the first root child in this plugin that is visible (which is usually the active page), NULL if the plugin has no visible children
bool GUIplugin::IsFixed ( )
inline
Returns
True if the element has a fixed positon inside a scrollable frame (like for example scrollbars or popups)
bool GUIplugin::IsVisible ( )
inline
Returns
True if the GUIplugin is visible, false if not
bool GUIplugin::ProcessChildren ( GUI_MOUSE_EVENT  _event,
int  _x,
int  _y 
)
virtual

Sends an event received from the containing GUI_BaseElement to its children.

Does NOT return the uid of the triggered element! First of all uids are local to GUIentities, so there is no guarantee that the trigered uid will refer to another element in the underlying GUIentity. Second, the underlying GUIentity isn't aware of individual elements in this plugin, so it couldn't do anything with the element even if it could reliably identify it. The underlying element will report itself as triggering element to its underlying GUIentity.

Parameters
_eventThe event that got fired in the GUI_Surface
_xThe x-position of the mouse click relative to the parent
_ythe y-position of the mouse click relative to the parent
Returns
True if a child of this plugin has been clicked.

Reimplemented in GUIalert, and GUIlistPopup.

void GUIplugin::SetFixed ( bool  fixed)
inline
Parameters
fixedPass true to fix an elements position even if it is inside a scrollable element.
void GUIplugin::SetVisible ( bool  visible)
inline
Parameters
visiblePass True to render the plugin and its children, false to hide it.
bool GUIplugin::Update ( )
virtual

checks all children if any of them need a redraw.

This is used to facilitate "animations", like blinkenlights or regularly updating text data. Basically, it is an opportunity for the Element to say "hey, I need a redraw" even though it wasn't clicked. Gets called every frame.

Returns
True if the element needs to redraw, false otherwise.

Implements GUIentity.


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