IMS2  Pre-Alpha
An Orbiter add-on to allow on-runtime construction of spacecraft from predefined modules
GUI_ScrollablePage Class Reference
Inheritance diagram for GUI_ScrollablePage:
GUI_Page GUI_BaseElement GUI_Module

Public Member Functions

 GUI_ScrollablePage (RECT mRect, int _id, GUI_ElementStyle *_style, GUI_ElementStyle *_scrollbarstyle=NULL)
 
void SetContentHeight (int cheight)
 Manually sets the height of the content in pixel, which influences the scrollrange. More...
 
void CalculateScrollRange ()
 Calculates the scrollrange for the scrollbar based on the children.
 
- Public Member Functions inherited from GUI_Page
 GUI_Page (RECT mRect, int _id, GUI_ElementStyle *_style, bool drawbackground=false)
 
- Public Member Functions inherited from GUI_BaseElement
 GUI_BaseElement (RECT _rect, int _id, GUI_ElementStyle *_style)
 
virtual void Draw (SURFHANDLE _tgt, RECT &drawablerect, int xoffset=0, int yoffset=0)
 Draws the element and its children to a SURFHANDLE. More...
 
virtual bool Update ()
 Checks if this element or any of its children need to be redrawn. More...
 
int ProcessMouse (GUI_MOUSE_EVENT _event, int _x, int _y)
 Checks if the element or any of its children have been clicked. More...
 
void GetRect (RECT &mRect)
 Copies the elements rect to the passed reference. More...
 
GUI_ElementStyleGetStyle ()
 
int GetWidth ()
 
int GetHeight ()
 
int GetId ()
 
GUI_ELEMENT_TYPE GetType ()
 
virtual void SetVisible (bool _visible)
 Sets if the elements and its children are drawn or not. More...
 
bool GetVisible ()
 
virtual void SetFixed (bool fixed)
 
bool GetFixed ()
 
virtual void SetNoBlit (bool noblit)
 
bool GetNoBlit ()
 
SURFHANDLE GetSurface ()
 
void AddPlugin (GUIplugin *plugin)
 Adds a GUIplugin as a child of this element. More...
 
void RemovePlugin (GUIplugin *plugin)
 Unplugs a plugin from this element. More...
 

Protected Member Functions

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 void AddChild (GUI_BaseElement *child)
 Adds a child to this element. More...
 
virtual int ProcessChildren (GUI_MOUSE_EVENT _event, int _x, int _y)
 Forwards event to its children. More...
 
- Protected Member Functions inherited from GUI_Page
bool ProcessMe (GUI_MOUSE_EVENT _event, int _x, int _y)
 Processes events for this element. More...
 
void reSize ()
 Forces the page to stretch its size to include all current children. More...
 
- Protected Member Functions inherited from GUI_BaseElement
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...
 

Protected Attributes

GUI_ScrollBarscrollbar
 Stores a pointer to the scrollbar element.
 
- Protected Attributes inherited from GUI_Page
bool expandwithchildren = false
 If true, the page will expand its own size when a child is added that does not fit. This is merely used to avoid clipping problems. If the page is set to draw a background, there will be problems!
 
- Protected Attributes inherited from GUI_BaseElement
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_fontfont
 The font used by this element.
 
GUI_ElementStylestyle
 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.
 

Private Member Functions

void createScrollablePage (GUI_ElementStyle *scrollbarstyle)
 Draws the ScrollablePage and its children to the source surface.
 

Detailed Description

A GUI_Page that can scroll its children

See also
GUI_Page

Constructor & Destructor Documentation

GUI_ScrollablePage::GUI_ScrollablePage ( RECT  mRect,
int  _id,
GUI_ElementStyle _style,
GUI_ElementStyle _scrollbarstyle = NULL 
)
Parameters
mRectParent-relative position and dimensions
_idIdentifier of the element, locally unique to the containing GUIentity
_styleThe style to render the checkbox in
_scrollbarstyleAn alternate style to draw the scrollbar in

Member Function Documentation

void GUI_ScrollablePage::AddChild ( GUI_BaseElement child)
protectedvirtual

Adds a child to this element.

Parameters
childA 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 from GUI_Page.

void GUI_ScrollablePage::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
_tgtThe target surface to draw on
drawablerectThe total drawable rect of this element. Serves as clipping rect for the children
xoffsetThe offset between this element rects left edge and the left panel edge, in pixel
yoffsetThe 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 from GUI_BaseElement.

void GUI_ScrollablePage::DrawMe ( SURFHANDLE  _tgt,
int  xoffset,
int  yoffset,
RECT &  drawablerect 
)
protectedvirtual

Draws this element.

Separated from DrawChildren so it can be freely overloaded

Parameters
_tgtThe target surface to draw to
xoffsetThe offset between this element rects left edge and the left panel edge, in pixel
yoffsetThe offset between this element rects top edge and the top panel edge, in pixel
drawablerectThe total drawable rect of this element. Serves as clipping rect.

Reimplemented from GUI_Page.

int GUI_ScrollablePage::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
_eventThe mouse event that triggered the call
_xthe x coordinate of the click, relative to the panel
_ythe y coordinate of the click, relative to the panel
Returns
True if this element has consumed the event

Reimplemented from GUI_BaseElement.

void GUI_ScrollablePage::SetContentHeight ( int  cheight)

Manually sets the height of the content in pixel, which influences the scrollrange.

In general, the content height will be adjusted when new elements are added. However, if children are added to a child of this that exceeds the childs height, The content height has to be set manually

Parameters
cheightthe height of the content

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