VirtualGui represents interface to implement simple virtualized GUI desktop. By implementing a handful of methods client gets working GUI desktop over given surface.
VirtualGUI mostly represents 'event' part of GUI. Client also has to implement or use some Draw to paint on surface and some font system to measure fonts (e.g. DrawGL and plugin/FT_fontsys).
virtual Size GetSize() = 0
Returns the size of GUI surface.
virtual dword GetMouseButtons() = 0
Returns the current state of mouse buttons.
virtual dword GetModKeys() = 0
Returns the current state of modifier keys.
virtual bool IsMouseIn() = 0
Returns true if mouse pointer is on GUI surface.
virtual bool IsWaitingEvent() = 0
Returns true if there are any input events to be processed.
virtual bool ProcessEvent(bool *quit) = 0
Processes input event. This function should use Ctrl::DoKeyFB and Ctrl::DoMouseFB static functions to pass events to virtual GUI. It can also use Ctrl::PaintAll and Ctrl::EndSession if approrate. It can set quit to true indicate the end of session initiated by host (quit can be NULL, so it is necessary to test it before setting it).
virtual void WaitEvent(int ms) = 0
Waits up to ms milliseconds until next input event is available.
virtual void WakeUpGuiThread() = 0
This should work as if 'empty' input event comes to the queue, so that WithEvent returns immediately. This function can be called from different thread.
virtual void SetMouseCursor(const Image& image) = 0
Changes the mouse cursor. This is only used if SystemCursor flag is active.
virtual void Quit() = 0
Called when end of GUI operation is required.
virtual SystemDraw& BeginDraw() = 0
Starts drawing on the surface. VirtualGui only requires single instance of SystemDraw to exist at any time, so it is ok to have corresponding Draw as instance variable of VirtualGui implementation.
virtual void CommitDraw() = 0
Ends drawing operations, commits the result to be visible.
void RunVirtualGui(VirtualGui& gui, Event<> app_main)
This function executes virtual GUI session.