IMS2  Pre-Alpha
An Orbiter add-on to allow on-runtime construction of spacecraft from predefined modules
GUI_Surface Class Referenceabstract
Inheritance diagram for GUI_Surface:
EventHandler

Public Member Functions

 GUI_Surface (IMS2 *_vessel, GUI_ElementStyle *_style, int _panelid)
 
virtual void Init (RECT &surfacePos, int _id)
 Creates the surfaces visuals in memory. More...
 
virtual void PostInit ()=0
 Overload in inheriting classes to do things necessary after initialising, like registering children. More...
 
bool ProcessMouse2D (GUI_MOUSE_EVENT _event, int mx, int my)
 Receives mouse events and sends it to children. More...
 
bool Update ()
 Checks all children for visual updates. More...
 
void AddChild (GUI_BaseElement *child)
 Adds a GUI element as a child of this surface. More...
 
bool Redraw2D (SURFHANDLE surf)
 Redraws the surface and all of its children.
 
int GetId ()
 
int GetPanelId ()
 
- Public Member Functions inherited from EventHandler
void ConnectToMyEventGenerator (EventSink *sink, EVENTPIPE pipe)
 connects an EventSink to the EventGenerator of this in the appropriate pipe. More...
 
void ConnectToMyEventSink (EventSink *sink, EVENTPIPE pipe)
 Connects an EventSink on this to the passed event sink. More...
 
void ConnectMySinkToYourNode (EventNode *node, EVENTPIPE pipe)
 Connects an EventSink on this to the passed EventNode, no matter whether generator or another sink. More...
 
EVENTHANDLERTYPE GetEventHandlerType ()
 Returns the EVENTHANDLERTYPE of this event handler.
 
UINT GetUID ()
 Returns the globaly unique identifier of this event handler.
 

Protected Member Functions

virtual void RedrawBackground (SURFHANDLE surf)
 Redraws this surfaces background. More...
 
virtual void RedrawElements (SURFHANDLE surf)
 Redraws all this surface's children. More...
 
void createGuiSurface ()
 
int ProcessChildren (GUI_MOUSE_EVENT _event, int _x, int _y)
 Sends a mouse event to all children of this surface. More...
 
virtual bool ProcessMe (int eventId)
 Trigers a redraw if any children consumed a mouse event. More...
 
- Protected Member Functions inherited from EventHandler
EventGeneratorcreateEventGenerator (EVENTPIPE pipe)
 Creates a new EventGenerator for this handler instance. More...
 
EventSinkcreateEventSink (EVENTPIPE pipe)
 creates a new EventSink in this handler instance More...
 
void disconnect (EventHandler *handler, bool bidirectional=true)
 Completely severs connections to and from the passed EventHandler, all sinks, all generators. More...
 
void sendEvents ()
 Tells all event generators in this event handler to advance their event cue. More...
 
void processWaitingQueue ()
 processes all events in the waiting queue. More...
 
void addEvent (Event_Base *_event, EVENTPIPE _pipe=DEFAULT_PIPE)
 Adds an event to the eventcue of an eventpipe. More...
 
void addEventToWaitingQueue (Event_Base *_event)
 Adds an event to this handlers waiting queue. More...
 
void relayEvent (Event_Base *_event, EVENTPIPE _pipe)
 Relays an event to another event pipe. More...
 
EventSinkgetEventSink (EVENTPIPE pipe)
 returns the EventSink on this EventHandler that belongs to the passed event pipe More...
 
EventGeneratorgetEventGenerator (EVENTPIPE pipe)
 Returns the EventGenerator on this EventHandler that belongs to the passed event pipe. More...
 
virtual bool ProcessEvent (Event_Base *e)=0
 Receives all events coming through this EventHandler. More...
 

Protected Attributes

IMS2 * vessel
 The vessel this surface is a part of.
 
RECT rect
 The rectangle of this surface on the panel.
 
SURFHANDLE src
 Stores the surfaces backgroud visuals.
 
int width
 width of the surface in pixel
 
int height
 height of the surface in pixel
 
int id
 The locally unique identifier of this surface inside its containing GUImanager.
 
int panelId
 The id of the orbiter panel this surface is drawn on.
 
vector< GUI_BaseElement * > children
 List of children of this surface.
 
bool isInitialised
 True if this surface was initialised.
 
GUI_ElementStylestyle
 The style this surface is drawn in.
 
- Protected Attributes inherited from EventHandler
EVENTPIPE defaultpipe = DEFAULT_PIPE
 Use this to set the defualt event pipe of this event handler.
 
EVENTHANDLERTYPE eventhandlertype
 An identifier that offers a group identification.
 

Friends

class GUImanager
 

Detailed Description

Class that embeds the IMS GUI into an Orbiter PanelElement.

This is the class that actually receives input and redwaw events from Orbiter, so every GUI element must be a child of a GUI_Surface at the root of its branch

Todo:
Derives from PanelElement, but how necessary that really is will be revealed when MFDs are implemented. It might be possible to discard that dependency.
Note
All GUI surfaces (that is, major control elements on a panel, or "screens" if you will) must derive from this class
See also
GUImanager

Constructor & Destructor Documentation

GUI_Surface::GUI_Surface ( IMS2 *  _vessel,
GUI_ElementStyle _style,
int  _panelid 
)
Parameters
_vesselThe vessel this GUI_Surface runs on
_styleThe style for this surface
_panelidThe orbiter id of the panel this surface is visible on

Member Function Documentation

void GUI_Surface::AddChild ( GUI_BaseElement child)

Adds a GUI element as a child of this surface.

Parameters
childthe element to be adopted, obviously.
void GUI_Surface::createGuiSurface ( )
protected

brief Creates the surface's background in video memory

int GUI_Surface::GetId ( )
Returns
The locally unique identifier of the surface inside its containing GUImanager
int GUI_Surface::GetPanelId ( )
Returns
The id of the orbiter panel this surface is visible on
void GUI_Surface::Init ( RECT &  surfacePos,
int  _id 
)
virtual

Creates the surfaces visuals in memory.

Parameters
surfacePosPanel coordinates at which this surface should show up
_idLocally unique identifier of the surface inside its containing GUImanager
virtual void GUI_Surface::PostInit ( )
pure virtual

Overload in inheriting classes to do things necessary after initialising, like registering children.

Note
Should only be called from GUImanager::RegisterGuiSurface()
int GUI_Surface::ProcessChildren ( GUI_MOUSE_EVENT  _event,
int  _x,
int  _y 
)
protected

Sends a mouse event to all children of this surface.

Parameters
_eventThe kind of mouse event
_xcursor X position relative to this element
_ycursor Y position relative to this element
bool GUI_Surface::ProcessMe ( int  eventId)
protectedvirtual

Trigers a redraw if any children consumed a mouse event.

Parameters
eventIdThe Id of the child that consumed the event, -1 if event was not consumed
Returns
True if a redraw was triggered, false otherwise
bool GUI_Surface::ProcessMouse2D ( GUI_MOUSE_EVENT  _event,
int  mx,
int  my 
)

Receives mouse events and sends it to children.

Parameters
_eventThe kind of mouse event
mxcursor X position relative to this element
mycursor Y position relative to this element
void GUI_Surface::RedrawBackground ( SURFHANDLE  surf)
protectedvirtual

Redraws this surfaces background.

Parameters
surfThe target surface to draw on
void GUI_Surface::RedrawElements ( SURFHANDLE  surf)
protectedvirtual

Redraws all this surface's children.

Parameters
surfThe target surface to draw on
bool GUI_Surface::Update ( )

Checks all children for visual updates.

Note
Should be called every frame.

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