last update 20 Sep 2009 |
#include <cvrGuiServer.h>
Public Types | |
enum | eServerState { NotStarted, Running, Stopped } |
Static Public Member Functions | |
static bool | start () |
static eServerState | state () |
static bool | stop () |
static bool | representsGuiThread () |
The guiServer holds the one an only thread which executes the main loop of the used GUI Toolkit, like GTK+, GTKMM, WxWidgets, QT or MFC. If you are just using the viewers and other GUI related classes, this server should never come in your way.
No one can create an instance of the guiServer, which is a monostate object. Some public static functions are provided to check and alter the state of the main loop:
The server can be started only once in the whole program, and this will occur automatically when you use any viewer or GUI element in the library. If you are writting a new GUI element, then you have to ensure that the server is running just before you have to interact with any interface related event. It is a bad idea to start the server too early, since it will waste some time.
The stop() method is provided for completeness and debugging purposes only. This method should never ever be called, as the main loop cannot be started again, due to limitation of some toolkits.
The general implementation of the current classes is divided in the files cvrGuiServer.cpp and lti???Server.cpp, where the latter provides the toolkit specific issues (the methods toolkitInit(), toolkitMainLoop() and toolkitStop()).
static bool cvr::guiServer::representsGuiThread | ( | ) | [static] |
Returns true if called within the thread attending the main loop.
static bool cvr::guiServer::start | ( | ) | [static] |
Start the server.
This method returns until the server is running and ready to attend requests.
static eServerState cvr::guiServer::state | ( | ) | [static] |
Check for the server state.
static bool cvr::guiServer::stop | ( | ) | [static] |
Stop the server.
If the server has not been started at all, this method does nothing, but to return false, as it cannot be stopped!