|
ubit
|
The Application Context. More...
#include <uappli.hpp>
Public Member Functions | |
| UAppli (int &argc, char **argv, UOption *command_line_options=null, const char *configuration_file=null) | |
| constructor for creating the Application Context. More... | |
| UMenu * | getOpenedMenu () |
| [impl] returns the menu that is currently opened (null otherwise). | |
| UStr & | initConf (int &argc, char **argv, UOption *, const char *confile) |
| [impl] parses the config specs, inits the global data of the appli, returns the display name. | |
Static Public Member Functions | |
| static UAppli & | appli () |
| returns a reference to the UAppli instance of the program. More... | |
| static UAppli * | getAppli () |
| returns a pointer the UAppli instance of the program. More... | |
| static UConf & | getConf () |
| returns the configuration of the application, More... | |
| static const char * | getVersion () |
| returns the version of the Ubit toolkit (for instance "6.0.0"). | |
| static bool | isUsingGL () |
| returns true if OpenGL is used for rendering graphics. | |
| static bool | isRunning () |
| returns true if the main loop is running. | |
| static bool | isExiting () |
| returns true if the applicating is exiting. | |
| static void | add (UWin &) |
| adds a window (UFrame, UDialog, etc) to the UAppli. More... | |
| static void | add (UWin *) |
| calls add(UWin&) if the argument is not null, produces an error otherwise. | |
| static void | remove (UWin &win, bool auto_delete=true) |
| removes or deletes a window from the UAppli. More... | |
| static void | remove (UWin *, bool auto_delete=true) |
| calls remove(UWin&) if the argument is not null, produces an error otherwise. | |
| static int | start () |
| starts the event main loop of the application. More... | |
| static void | quit (int status=0) |
| quits the main loop of the application. More... | |
| static UFrame * | getMainFrame () |
| returns the Main Frame (if any, null otherwise). More... | |
| static const UStr & | getName () |
| returns argv[0], the name of the application. | |
| static UStr | getTitle () |
| returns the title of the Main Frame ( More... | |
| static void | setTitle (const UStr &title) |
| changes the title of the Main Frame ( More... | |
| static void | setFocus (UView *) |
| gives the input focus to this view. More... | |
| static void | updateAll (const UUpdate &mode=UUpdate::layoutAndPaint) |
| updates all windows. More... | |
| static UErrorHandler & | getErrorHandler () |
| returns the current error handler (see UErrorHandler). | |
| static void | setErrorHandler (UErrorHandler &) |
| changes the current error handler (see UErrorHandler). | |
| static void | error (const char *funcname, const char *format,...) |
| raises an error; shortcut for raiseError(UError::ERROR ...). | |
| static void | warning (const char *funcname, const char *format,...) |
| raises a warning; shortcut for raiseError(UError::WARNING, ...). | |
| static void | fatalError (const char *funcname, const char *format,...) |
| raises a fatal error; shortcut for raiseError(UError::FATAL_ERROR, ...). | |
| static void | raiseError (int errnum, const UObject *, const char *funcname, const char *format,...) |
| raises an error: prints out a message and/or generate an exception. More... | |
| static void | raiseError (int errnum, const UObject *, const char *funcname, const char *format, va_list) |
| raises an error; see raiseError(). | |
| static unsigned long | getTime () |
| returns the current time. | |
| static void | setMotionLag (unsigned long app_lag, unsigned long nat_lag) |
| changes the motion lag. More... | |
| static void | addTimeout (unsigned long msec_delay, int ntimes, UCall &callback) |
| fire this callback after a given delay. More... | |
| static void | postpone (UCall &callback) |
| fire this callback when the main loop becomes idle. More... | |
| static UDisp * | getDisp () |
| returns the default display of the appplication. | |
| static UDisp * | getDisp (int ID) |
| returns the display with this ID. More... | |
| static const UDispList & | getDispList () |
| static UDisp * | openDisp (const UStr &display_name) |
| opens a connection on another X display. More... | |
| static void | closeDisp (UDisp *) |
| closes a connection with another X display. | |
| static UEventFlow * | getFlow (int ID=0) |
| returns the Event Flow corresponding to this ID (null if not found). More... | |
| static const UFlowList & | getFlowList () |
| returns the list of all event flows on all displays (see getFlow()). | |
| static USelection * | getSelection (int ID=0) |
| returns the text selection manager. More... | |
| static void | onMessage (const UStr &port_name, UCall &callback) |
| adds a callback that is fired when data is received on this port. More... | |
| static UMessagePort & | getMessagePort (const UStr &name) |
| Ubit Messages: More... | |
| static UMessagePort * | findMessagePort (const UStr &name) |
| Ubit Messages: More... | |
| static UMessagePortMap * | getMessagePortMap () |
| [impl] Ubit Messages. | |
| static const UStr & | getImaPath () |
| see setImaPath(). | |
| static void | setImaPath (const UStr &pathname) |
| get/set the default image path. More... | |
| static UStyleSheet & | getStyleSheet () |
| returns the style sheet of the application. | |
| static const UStyle & | getDefaultStyle () |
| returns the default element style. | |
| static bool | hasTelePointers () |
| [impl] returns true if the appli has telepointers. | |
| static void | internalError (const char *fun, const char *format,...) |
| static void | deleteNotify (UDisp *) |
| [impl] notifies that a display is being destroyed. | |
| static void | deleteNotify (UElem *) |
| [impl] notifies that an element is being destroyed. | |
| static void | deleteNotify (UView *) |
| [impl] notifies that a view is being destroyed. | |
Static Public Attributes | |
| static UConf | conf |
| configuration of the application, must be set BEFORE the UAppli is created. More... | |
| static class UAppliImpl & | impl = appli_impl |
| [impl] reference to the object that stores the application data. | |
Friends | |
| class | UEventFlow |
The Application Context.
A Ubit application must create one (and only one) UAppli object. This UAppli must be created as soon as the program is started by main() No Ubit function should be called before its creation nor after its deletion.
A UAppli can be parameterized:
A UAppli can open windows on several Displays (that can be controlled by remote machines): see UAppli::openDisp()). Window children can be shared by windows that belong to different displays. These children are automatically replicated (and synchronized) on the corresponding displays.
A UAppli can manage 1 or several Event Flows that are comptelety separated. This is useful for Two-handed interaction or groupware (each user controlling his own pointer on the screen(s)). Alternate event flows are automatically created when the UMS (Ubit Mouse Server) is running (see the 'umsd' program in directory ubit/ums). The UMS can manage several sources of events and send them as separate event flows to the UAppli. These event sources can be produced by a mouse or a MIMIo on the serial port or by an application running on a remote machine (see the 'uremote' program in ubit/ums). Finally, Event flows can be uniquely identified in callback functions through the getFlow() method of their UEvent& argument.
Classes UTimer and USource make it possible to fire callback functions after a given timeout or when the application receives data on a file source (such as a socket). UAppli::onTimeout() and UAppli::postpone() provide a simplified API for using timers. postpone() is used to fire CPU intensive methods when the event loop becomes idle.
Classes USocket and UServerSocket provide a simple mechanism to handle sockets. The are based on simple communication protocol that can be implemented in non Ubit programs. In addition, asynchronous messages can be exchanged between Ubit applications and the UMS server through the the UMessage protocol. See: UMessage, UAppli::onMessage() and UAppli::getMessagePort().
NOTE on colors: Ubit applications may not work properly on (obsolete) X11 displays that do not support True Colors. See UDisp::setTrueColors() and UDisp::setPseudoColors() for details.
See also the UDisp class for inherited methods.
| UAppli::UAppli | ( | int & | argc, |
| char ** | argv, | ||
| UOption * | command_line_options = null, |
||
| const char * | configuration_file = null |
||
| ) |
constructor for creating the Application Context.
Arguments:
Command line options:
$ myappli --help-x
$ myappli --scale 0.75 --display hendrix.tsne.fr:0
* the first line prints out the help message. The second line specifies a rendering scale and a X server display name.See also: UAppli::openDisp() and the man of classes UAppli and UDisp.
|
static |
adds a window (UFrame, UDialog, etc) to the UAppli.
Note that:
|
static |
fire this callback after a given delay.
Args:
|
static |
|
static |
Ubit Messages:
|
static |
returns a pointer the UAppli instance of the program.
same as UAppli::appli() except that no exception is thrown.
|
inlinestatic |
returns the configuration of the application,
|
static |
returns the display with this ID.
Ubit applications can open windows on multiple displays when X11 is used. this function returns the UDisp that has this ID, and numm otherwise. The ID of the default display is 0.
|
static |
returns the Event Flow corresponding to this ID (null if not found).
A UAppli can manage several separate Event Flows on one or multiple displays. This is useful for two-handed interaction or groupware, see UAppli for details.
Each event flow has a unique ID. 0 is the ID of the native event flow on the main display (ie. the display where the UAppli was launched).
|
static |
|
static |
Ubit Messages:
|
static |
returns the text selection manager.
return the text selection of the native event flow of the main display by default (ie. if ID = 0). However, an application may have several selections (it has as many selections as its number of event flows). The ID number then specifies the requested event flow.
|
static |
returns the title of the Main Frame (
adds a callback that is fired when data is received on this port.
Ubit messages makes it simple to exchange data between applications. See class UMessagePort.
opens a connection on another X display.
returns null if the connection failed. Otherwise, windows (UFrame, UDialog...) can be added to the returned UDisp by using its add() method.
|
static |
fire this callback when the main loop becomes idle.
this function is useful:
|
static |
quits the main loop of the application.
UAppli::start() will return the 'status' value
|
static |
raises an error: prints out a message and/or generate an exception.
this method:
see also:
|
static |
removes or deletes a window from the UAppli.
this function works as follows:
|
static |
gives the input focus to this view.
no object gets the focus if argument is null. The focus is reset when the user clicks on a the view of widget that can handle input from the keyboard
|
static |
get/set the default image path.
the default image pathn is prefixed to image file names that do not start with / or .
|
static |
changes the motion lag.
motion (drag, move) events are withdrawn if the time lag is hihgher than these values (default are 15 and 100 ms respectively).
|
static |
changes the title of the Main Frame (
|
static |
starts the event main loop of the application.
returns the value given to UAppli::quit()
|
static |
updates all windows.
see UWin::update() for details.
|
static |
configuration of the application, must be set BEFORE the UAppli is created.
'conf' is an object that is created when the program is launched. Its fields:
1.8.12