Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

UAppli Class Reference

Application Context. More...

#include <uappli.hpp>

Inheritance diagram for UAppli:

UDisp List of all members.

Public Member Functions

 UAppli (UConf &conf)
 UAppli (int *argc, char **argv)
 UAppli (int &argc, char **argv)
 constructors for creating the Application Context
virtual ~UAppli ()
 destructor.
const class UConfgetConf () const
 returns the configuration of this Display.
const char * getCommandName () const
const char * getCommandPath () const
 returns the name or full path of the command that started the appli
UFramegetMainFrame () const
 returns the Main Frame
void setTitle (const UStr &title)
 changes the title of the Main Frame
virtual int mainLoop ()
virtual int start ()
 starts the event main loop of the application
virtual void quitLoop (int status)
virtual void realize ()
 realizes this application (allocates the X resources)
virtual bool isRealized () const
 is the X data initialized?.
virtual void add (class UWin *)
virtual void add (class UWin &)
 add a window (UFrame, UDialog) to the application
virtual void remove (UWin &child, int remove_mode)
virtual void remove (UWin *child, int remove_mode)
 same as UGroup::remove().
virtual void updateAll ()
virtual void updateAll (UUpdate upmode)
 updates all windows (see UWin::update()).
UGroupgetOpenedMenu ()
 returns the menu that is currently opened (null otherwise).

Static Public Member Functions

static const class UConfgetDefaults ()
 configuration of the Appli context
static class UAppligetApp ()
 returns the default UAppli context
static void quit (int status)
 quits the main loop of the application
static class UInputopenInput (int input_source)
 this input source (file, socket) will call callback functions when it receives data
static void closeInput (class UInput *)
 closes this input source
static UTimeropenTimer (u_time delay, int ntimes=1)
 opens a new Timer that calls callback functions
static void closeTimer (class UTimer *)
 closes this Timer
static class UDispopenDisp (const UStr &display_name)
 opens a connection on a new X display
static void closeDisp (class UDisp *)
 [unstable].
static class UDispgetDefaultDisp ()
static class UDispgetDisp (int disp_id)
static unsigned int getDispCount ()
static const UDispList & getDisps ()
static class UMSclient * openUMS (const UStr &ums_hostname, int ums_port=0)
 opens a connection with the UMS (Ubit Multiple Mouse/Message Server)
static const char * getVar (const char *name, bool get_from_shell=true)
 retreives a value from a variable name
static const char * getImaPath ()
 gets the value of the UIMA_PATH variable (the DEFAULT location of images)
static const char * setVar (const char *name, const char *value)
 adds a variable/value pair to the Application variable database
static const char * setImaPath (const UStr &value)
static const char * setImaPath (const char *value)
 sets the value of the UIMA_PATH variable (the DEFAULT location of images)
static char * makeImaPath (const char *filename)
 creates a full image file path name

Detailed Description

Application Context.

Notes:


Constructor & Destructor Documentation

UAppli::UAppli int &  argc,
char **  argv
 

constructors for creating the Application Context

Arguments:

  • 'argc' and 'argv' : the parameters of the main() function
  • 'conf' : configuration of the UAppli (see UConf). this argument must *not* be deleted. Exception:
  • UError exception thrown if the X server can't be opened.

Options on the command line:

  • see class UConf or launch a Ubit appli with option: --help-ubit on the command line to see all options
  • some useful options:
     --help-ubit, --help-x      : prints help message"
     --conf <option>            : sets configuration option
     --disp[lay] <displayname>  : starts the appli on this X-server display
     --doubleb[uffering], --dbf : double buffering (avoids flickering)
     --scale <int>              : scale: 0=default, > 0 larger, < 0 smaller
     --group[ware]              : groupware mode (--softwin and --tele)
     --soft[win]                : soft window mode
     --tele[pointers]           : tele pointer mode
     --no-transps[crollbars], --no-tsb: no transparent scrollbars"
     debug:
     --no-grab                : disables mouse grabs
     --sync                   : synchronous mode
     
  • example: myappli -doublebuf -scale -2 -display myserver:0

See also: classes UAppli and UDisp for important info.


Member Function Documentation

void UAppli::add class UWin  )  [virtual]
 

add a window (UFrame, UDialog) to the application

notes:

  • at least one Window (typically an UFrame) should be added to the UAppli
  • the "Main Frame" is the first UFrame that is added to the UAppli
  • windows are initially closed (including the Main Frame) : you must first add their subcomponents (using add(), addlist() etc.) THEN open them (when needed) by calling their UWin::show() method.
  • by default their size won't change once their show() method has been called. See classes: UWin, UFrame, UDialog.

Reimplemented from UDisp.

void UAppli::closeInput class UInput  )  [static]
 

closes this input source

Note: the UInput is destroyed except if is still pointed by an 'uptr'

void UAppli::closeTimer class UTimer  )  [static]
 

closes this Timer

Note: the UTimer is destroyed except if is still pointed by an 'uptr'

UAppli * UAppli::getApp  )  [static]
 

returns the default UAppli context

the "default" UAppli is *the* UAppli (as there is only one UAppli for a given program).

Note: it's illegal to call this function before the UAppli has been created (this will throw an UError exception)

const char * UAppli::getCommandPath  )  const
 

returns the name or full path of the command that started the appli

Note: name = path without the directory

const char * UAppli::getImaPath  )  [static]
 

gets the value of the UIMA_PATH variable (the DEFAULT location of images)

see: setImaPath() and getVar()

UFrame * UAppli::getMainFrame  )  const
 

returns the Main Frame

the main frame is the first UFrame that was added to the UAppli (if any)

const char * UAppli::getVar const char *  name,
bool  get_from_shell = true
[static]
 

retreives a value from a variable name

searches variable in the Application variable database, then, if not found and 'get_from_shell' is true, in the Unix SHELL environment.

  • note: when a variable is retrieved from the SHELL, it is copied in the application database and is never searched again in the SHELL

char * UAppli::makeImaPath const char *  filename  )  [static]
 

creates a full image file path name

prefixes 'filename' with UIMA_PATH value if not starting by / . or $ and expands 'filename' if starting by $

UDisp * UAppli::openDisp const UStr display_name  )  [static]
 

opens a connection on a new X display

'display_name' name of the X Window server:

  • syntax: hostname[:screen_number]
  • hostname:0 is the default if [:screen_number] is omitted

UInput * UAppli::openInput int  input_source  )  [static]
 

this input source (file, socket) will call callback functions when it receives data

Example:

 uptr<UInput> in = appli.openInput(socket_desc);
 if (in) in->onAction( ucall(...) );
 
Note: the UInput is automatically destroyed when the source (file, socket) is closed except if it is still pointed by an 'uptr'.

static UTimer* UAppli::openTimer u_time  delay,
int  ntimes = 1
[static]
 

opens a new Timer that calls callback functions

Args:

  • 'delay' is in milliseconds
  • 'ntimes' specifies how many times the callbacks are called (each time after the specified 'delay'). -1 means always, 0 never. Example:
     uptr<UTimer> t = appli.openTimer(1000, 10); // 10 times separed by 1s
     if (t) t->onAction( ucall(...) );
     
    Notes:
  • the UTimer is automatically destroyed when over except if it is still pointed by an 'uptr'.
  • if 'delay' = 0, the callback is immediately called when the main loop becomes idle. This is useful for postponing callbacks that take a long time to execute. if 'ntimes' = 1 the functions are aclled once, if 'ntimes' = -1 they are called until program termination.

UMSclient * UAppli::openUMS const UStr ums_hostname,
int  ums_port = 0
[static]
 

opens a connection with the UMS (Ubit Multiple Mouse/Message Server)

This makes it possible to control the mouse pointer(s) and to send events and messages to X applications on the remote display where the UMS is running. Args:

  • ums_hostname: the host where the UMS is running
  • ums_port: the port used by the UMS (uses UMS_DEFAULT_PORT if 0) Note:
  • the 'umsd' program must already be running

void UAppli::quit int  status  )  [static]
 

quits the main loop of the application

Notes:

  • this status is returned by the mainLoop() method (it should typically be 0 for normal termination and > 0 otherwise)
  • this method can be redefined by clients for appropriate behaviors (eg. saving data before quitting etc.)

void UAppli::realize  )  [virtual]
 

realizes this application (allocates the X resources)

this function does not need to be explicitely called except if you need to draw Graphics before calling the mainLoop

Exception:

  • UError exception thrown if the application can't be realized

Reimplemented from UDisp.

const char * UAppli::setImaPath const char *  value  )  [static]
 

sets the value of the UIMA_PATH variable (the DEFAULT location of images)

the value of the UIMA_PATH variable is prefixed to image file names that do not start with / or . or $
Examples:

  • uima("my_image.gif") will load: $UIMA_PATH/my_image.gif
  • uima("./my_image.gif") will load: ./my_image.gif
  • uima("$MYDIR/my_image.gif") will load: $MYDIR/my_image.gif where $XXX is replaced by the value of variable XXX

void UAppli::setTitle const UStr title  ) 
 

changes the title of the Main Frame

see also: UTitle

const char * UAppli::setVar const char *  name,
const char *  value
[static]
 

adds a variable/value pair to the Application variable database

Notes:

  • the 'name' and 'value' strings are internally duplicated.
  • this fct. returns the duplicated value (null if memory is exhausted)
  • variables can be used for defining image file prefixes: uima("$MYDIR/my_image.gif") => MYDIR is expanded to its actual value
  • see: setImaPath() (and special variable UIMA_PATH)

virtual int UAppli::start  )  [virtual]
 

starts the event main loop of the application

returns the status argument given as an arg of the quit() method


The documentation for this class was generated from the following files:
Generated on Thu Mar 3 06:40:19 2005 for Ubit[Eric.Lecolinet@enst.fr] by  doxygen 1.4.1