Base class of GUI elements. All GUI elements must derive from this class.
More...
|
virtual void | DrawChildren (SURFHANDLE _tgt, RECT &drawablerect, int xoffset=0, int yoffset=0) |
| Draws all direct children of this element, and tells them to draw theirs. More...
|
|
virtual void | DrawMe (SURFHANDLE _tgt, int xoffset, int yoffset, RECT &drawablerect) |
| Draws this element. More...
|
|
virtual bool | ProcessMe (GUI_MOUSE_EVENT _event, int _x, int _y) |
| Processes events for this element. More...
|
|
virtual int | ProcessChildren (GUI_MOUSE_EVENT _event, int _x, int _y) |
| Forwards event to its children. More...
|
|
virtual bool | updateMe () |
| used for checking whether this element needs a redraw although it didn't have any user input More...
|
|
virtual bool | updateChildren () |
| checks if any of the children need a redraw More...
|
|
void | calculateBlitData (int xoffset, int yoffset, RECT &drawablerect, BLITDATA &OUT_blitdata) |
| Calculates the positional and dimensional data needed for blitting, both for source as well as target surface. More...
|
|
void | calculateMyDrawableRect (RECT &drawablerect_parent, int xoffset, int yoffset, RECT &OUT_mydrawablerect) |
| calculates the real drawable rect of this element considering the drawable rect of the parent. More...
|
|
|
GUI_ELEMENT_TYPE | type |
| The type of this element.
|
|
RECT | rect |
| Rect the element should draw on, relative to parent.
|
|
int | width |
| The width of the element.
|
|
int | height |
| The height of the element.
|
|
int | id |
| The locally unique identifier of the element.
|
|
SURFHANDLE | src = NULL |
| Source surface to draw the element on. When the element is drawn on the panel, it will be blitted from this surface.
|
|
bool | noBlitting = false |
| Some elements might not have to blit themselves because they are static part of the background. This is not the same as !visible, as the element still processes events and still draws children, it just doesn't draw itself.
|
|
vector< GUI_BaseElement * > | children |
| List containing all direct children of this element.
|
|
vector< GUIplugin * > | plugins |
| List containing all GUIplugins currently pluged into this element.
|
|
GUI_font * | font |
| The font used by this element.
|
|
GUI_ElementStyle * | style |
| The style used by this element.
|
|
bool | visible |
| Whether the element is visible or not (if false, element and any of its children will neither draw nor process events)
|
|
bool | isfixed = false |
| Whether the element retains a fixed position in a scrolling frame.
|
|
Base class of GUI elements. All GUI elements must derive from this class.
GUI_BaseElement::GUI_BaseElement |
( |
RECT |
_rect, |
|
|
int |
_id, |
|
|
GUI_ElementStyle * |
_style |
|
) |
| |
- Parameters
-
_rect | The rectangle of the element, relative to its parent. |
_id | The localy unique identifier of this GUI element (unique within the scope of its GUIentity). |
_style | The style the element should be rendered in |
Adds a child to this element.
- Parameters
-
child | A pointer to the element to add as a child of this. |
- Note
- It is technically possible for an element to be the child of multiple elements, but there's a high probability that it will lead to undesired side effects.
Reimplemented in GUI_ScrollablePage, and GUI_Page.
void GUI_BaseElement::AddPlugin |
( |
GUIplugin * |
plugin | ) |
|
Adds a GUIplugin as a child of this element.
- Parameters
-
plugin | The plugin to add to the element. |
void GUI_BaseElement::calculateBlitData |
( |
int |
xoffset, |
|
|
int |
yoffset, |
|
|
RECT & |
drawablerect, |
|
|
BLITDATA & |
OUT_blitdata |
|
) |
| |
|
protected |
Calculates the positional and dimensional data needed for blitting, both for source as well as target surface.
using the returned data for a blit operation results in the element being properly croped to not draw out of drawablerect
- Parameters
-
xoffset | The screen x coordinates at which the elments rect is placed |
yoffset | The screen y coordinates at which the elments rect is placed |
drawablerect | The rect the parent allows drawing operations in |
OUT_blitdata | Contains the proper blitting data after the function executes |
void GUI_BaseElement::calculateMyDrawableRect |
( |
RECT & |
drawablerect_parent, |
|
|
int |
xoffset, |
|
|
int |
yoffset, |
|
|
RECT & |
OUT_mydrawablerect |
|
) |
| |
|
protected |
calculates the real drawable rect of this element considering the drawable rect of the parent.
- Parameters
-
drawablerect_parent | The drawable rect the element received from its parent |
xoffset | The left screen coordinate of this element |
yoffset | The top screen coordinate of this element |
OUT_mydrawablerect | the RECT that is to receive the real drawable rect |
void GUI_BaseElement::Draw |
( |
SURFHANDLE |
_tgt, |
|
|
RECT & |
drawablerect, |
|
|
int |
xoffset = 0 , |
|
|
int |
yoffset = 0 |
|
) |
| |
|
virtual |
Draws the element and its children to a SURFHANDLE.
- Parameters
-
_tgt | The SURFHANDLE to draw to |
drawablerect | The drawable rect of the parent element (serves as clipping rect) |
xoffset | The x-coordinate of the left edge of this elements rect, relative to the panel |
yoffset | The y-coordinate of the top edge of this elements rect, relative to the panel |
Reimplemented in GUI_ListBox.
void GUI_BaseElement::DrawChildren |
( |
SURFHANDLE |
_tgt, |
|
|
RECT & |
drawablerect, |
|
|
int |
xoffset = 0 , |
|
|
int |
yoffset = 0 |
|
) |
| |
|
protectedvirtual |
Draws all direct children of this element, and tells them to draw theirs.
- Parameters
-
_tgt | The target surface to draw on |
drawablerect | The total drawable rect of this element. Serves as clipping rect for the children |
xoffset | The offset between this element rects left edge and the left panel edge, in pixel |
yoffset | The offset between this element rects top edge and the top panel edge, in pixel |
- Note
- Does not get called if this element is not visible.
Reimplemented in GUI_ScrollablePage.
void GUI_BaseElement::DrawMe |
( |
SURFHANDLE |
_tgt, |
|
|
int |
xoffset, |
|
|
int |
yoffset, |
|
|
RECT & |
drawablerect |
|
) |
| |
|
protectedvirtual |
Draws this element.
Separated from DrawChildren so it can be freely overloaded
- Parameters
-
_tgt | The target surface to draw to |
xoffset | The offset between this element rects left edge and the left panel edge, in pixel |
yoffset | The offset between this element rects top edge and the top panel edge, in pixel |
drawablerect | The total drawable rect of this element. Serves as clipping rect. |
Reimplemented in GUI_ScrollablePage, GUI_CheckBox, GUI_Label, GUI_DynamicButton, GUI_StaticButton, GUI_Page, and GUI_ScrollBar.
bool GUI_BaseElement::GetFixed |
( |
| ) |
|
|
inline |
- Returns
- True if the element has a fixed positon inside a scrollable frame (like for example scrollbars or popups)
int GUI_BaseElement::GetHeight |
( |
| ) |
|
|
inline |
- Returns
- The height of this element in pixel
int GUI_BaseElement::GetId |
( |
| ) |
|
- Returns
- The id of this element
bool GUI_BaseElement::GetNoBlit |
( |
| ) |
|
|
inline |
- Returns
- True if the NoBlit flag for this element was set, false otherwise
void GUI_BaseElement::GetRect |
( |
RECT & |
mRect | ) |
|
Copies the elements rect to the passed reference.
- Parameters
-
mRect | The element to receive the data |
- Returns
- A pointer to the style used by this element
SURFHANDLE GUI_BaseElement::GetSurface |
( |
| ) |
|
|
inline |
- Returns
- The SURFHANDLE on which the element has its memory image
return The type of this element
bool GUI_BaseElement::GetVisible |
( |
| ) |
|
- Returns
- True if this element is visible, false if not.
int GUI_BaseElement::GetWidth |
( |
| ) |
|
|
inline |
- Returns
- The width of this element in pixel
int GUI_BaseElement::ProcessChildren |
( |
GUI_MOUSE_EVENT |
_event, |
|
|
int |
_x, |
|
|
int |
_y |
|
) |
| |
|
protectedvirtual |
Forwards event to its children.
Separated from ProcessMe() so either can be freely overloaded without the other If you are implementing a menu as a GUI_element, overload this function to intercept the children's events.
- Parameters
-
_event | The mouse event that triggered the call |
_x | the x coordinate of the click, relative to the panel |
_y | the y coordinate of the click, relative to the panel |
- Returns
- True if this element has consumed the event
Reimplemented in GUI_ScrollablePage, and GUI_ModuleFunction_Base.
int GUI_BaseElement::ProcessMouse |
( |
GUI_MOUSE_EVENT |
_event, |
|
|
int |
_x, |
|
|
int |
_y |
|
) |
| |
Checks if the element or any of its children have been clicked.
- Parameters
-
_event | The mouse event that triggered the call |
_x | the x coordinate of the click, relative to the panel |
_y | the y coordinate of the click, relative to the panel |
- Returns
- The id of the element that consumed the event, or -1 if no element consumed it.
void GUI_BaseElement::RemovePlugin |
( |
GUIplugin * |
plugin | ) |
|
Unplugs a plugin from this element.
- Parameters
-
plugin | The plugin to unplugg. The plugin itself will be unaffected by the operation |
virtual void GUI_BaseElement::SetFixed |
( |
bool |
fixed | ) |
|
|
inlinevirtual |
- Parameters
-
fixed | Pass true to fix an elements position even if it is inside a scrollable element. |
virtual void GUI_BaseElement::SetNoBlit |
( |
bool |
noblit | ) |
|
|
inlinevirtual |
Sets the drawing behavior of the element without influencing its response behavior
- Parameters
-
noblit | If set to true, The element will not draw, but still process events. |
- See also
- SetVisible()
void GUI_BaseElement::SetVisible |
( |
bool |
_visible | ) |
|
|
virtual |
Sets if the elements and its children are drawn or not.
- Parameters
-
_visible | Pass True to draw the element, false to hide it |
- Note
- Invisible elmenets will not process events. If you want an an element to not draw, but still pprocess events, use SetNoBlit() instead
- See also
- SetNoBlit()
bool GUI_BaseElement::Update |
( |
| ) |
|
|
virtual |
Checks if this element or any of its children need to be redrawn.
Gets checked every frame. Overload this method only if your element needs to update visuals at intervals without direct user input. Panel Area redraws are expensive, and there's no way to just redraw one single element!
- Returns
- True if the element needs to redraw, false otherwise
bool GUI_BaseElement::updateChildren |
( |
| ) |
|
|
protectedvirtual |
checks if any of the children need a redraw
Called every frame.
- Returns
- True if any of the children need a redraw, false otherwise.
virtual bool GUI_BaseElement::updateMe |
( |
| ) |
|
|
inlineprotectedvirtual |
used for checking whether this element needs a redraw although it didn't have any user input
Called every frame. Overload to implement "animations"
- Returns
- True if the element needs a redraw, false otherwise. In baseclass, always false.
The documentation for this class was generated from the following files:
- C:/Orbiter2016/Orbitersdk/IMS2/GUI_BaseElement.h
- C:/Orbiter2016/Orbitersdk/IMS2/GUI_BaseElement.cpp