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

FXApp.h

00001 /********************************************************************************
00002 *                                                                               *
00003 *                     A p p l i c a t i o n   O b j e c t                       *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1997,2002 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 of the License, or (at your option) any later version.            *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
00016 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public              *
00019 * License along with this library; if not, write to the Free Software           *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00021 *********************************************************************************
00022 * $Id: FXApp.h,v 1.147 2002/08/23 18:59:56 fox Exp $                            *
00023 ********************************************************************************/
00024 #ifndef FXAPP_H
00025 #define FXAPP_H
00026 
00027 #ifndef FXOBJECT_H
00028 #include "FXObject.h"
00029 #endif
00030 
00031 namespace FX {
00032 
00033 
00034 // Forward declarations
00035 class FXWindow;
00036 class FXIcon;
00037 class FXBitmap;
00038 class FXCursor;
00039 class FXRootWindow;
00040 class FXMainWindow;
00041 class FXPopup;
00042 class FXFont;
00043 class FXDC;
00044 class FXDCWindow;
00045 class FXVisual;
00046 class FXGLVisual;
00047 class FXGLContext;
00048 
00049 
00050 // Opaque FOX objects
00051 struct FXTimer;
00052 struct FXChore;
00053 struct FXSignal;
00054 struct FXRepaint;
00055 struct FXInput;
00056 struct FXInvocation;
00057 
00058 
00059 
00060 /// File input modes for addInput
00061 enum FXInputMode {
00062   INPUT_NONE   = 0,                 /// Inactive
00063   INPUT_READ   = 1,                 /// Read input fd
00064   INPUT_WRITE  = 2,                 /// Write input fd
00065   INPUT_EXCEPT = 4                  /// Except input fd
00066   };
00067 
00068 
00069 /// All ways of being modal
00070 enum FXModality {
00071   MODAL_FOR_NONE,                 /// Non modal event loop (dispatch normally)
00072   MODAL_FOR_WINDOW,               /// Modal dialog (beep if outside of modal dialog)
00073   MODAL_FOR_POPUP                 /// Modal for popup (always dispatch to popup)
00074   };
00075 
00076 
00077 /// Default cursors provided by the application
00078 enum FXDefaultCursor {
00079   DEF_ARROW_CURSOR,                     /// Arrow cursor
00080   DEF_RARROW_CURSOR,                    /// Reverse arrow cursor
00081   DEF_TEXT_CURSOR,                      /// Text cursor
00082   DEF_HSPLIT_CURSOR,                    /// Horizontal split cursor
00083   DEF_VSPLIT_CURSOR,                    /// Vertical split cursor
00084   DEF_XSPLIT_CURSOR,                    /// Cross split cursor
00085   DEF_SWATCH_CURSOR,                    /// Color swatch drag cursor
00086   DEF_MOVE_CURSOR,                      /// Move cursor
00087   DEF_DRAGH_CURSOR,                     /// Resize horizontal edge
00088   DEF_DRAGV_CURSOR,                     /// Resize vertical edge
00089   DEF_DRAGTL_CURSOR,                    /// Resize upper-leftcorner
00090   DEF_DRAGBR_CURSOR=DEF_DRAGTL_CURSOR,  /// Resize bottom-right corner
00091   DEF_DRAGTR_CURSOR,                    /// Resize upper-right corner
00092   DEF_DRAGBL_CURSOR=DEF_DRAGTR_CURSOR,  /// Resize bottom-left corner
00093   DEF_DNDSTOP_CURSOR,                   /// Drag and drop stop
00094   DEF_DNDCOPY_CURSOR,                   /// Drag and drop copy
00095   DEF_DNDMOVE_CURSOR,                   /// Drag and drop move
00096   DEF_DNDLINK_CURSOR,                   /// Drag and drop link
00097   DEF_CROSSHAIR_CURSOR,                 /// Cross hair cursor
00098   DEF_CORNERNE_CURSOR,                  /// North-east cursor
00099   DEF_CORNERNW_CURSOR,                  /// North-west cursor
00100   DEF_CORNERSE_CURSOR,                  /// South-east cursor
00101   DEF_CORNERSW_CURSOR,                  /// South-west cursor
00102   DEF_HELP_CURSOR,                      /// Help arrow cursor
00103   DEF_ROTATE_CURSOR                     /// Rotate cursor
00104   };
00105 
00106 
00107 
00108 /// FOX Event
00109 struct FXAPI FXEvent {
00110   FXuint      type;           /// Event type
00111   FXuint      time;           /// Time of last event
00112   FXint       win_x;          /// Window-relative x-coord
00113   FXint       win_y;          /// Window-relative y-coord
00114   FXint       root_x;         /// Root x-coord
00115   FXint       root_y;         /// Root y-coord
00116   FXint       state;          /// Keyboard/Modifier state
00117   FXint       code;           /// Button, Keysym, or mode; DDE Source
00118   FXString    text;           /// Text of keyboard event
00119   FXint       last_x;         /// Window-relative x-coord of previous mouse location
00120   FXint       last_y;         /// Window-relative y-coord of previous mouse location
00121   FXint       click_x;        /// Window-relative x-coord of mouse press
00122   FXint       click_y;        /// Window-relative y-coord of mouse press
00123   FXint       rootclick_x;    /// Root-relative x-coord of mouse press
00124   FXint       rootclick_y;    /// Root-relative y-coord of mouse press
00125   FXuint      click_time;     /// Time of mouse button press
00126   FXuint      click_button;   /// Mouse button pressed
00127   FXint       click_count;    /// Click-count
00128   FXbool      moved;          /// Moved cursor since press
00129   FXRectangle rect;           /// Rectangle
00130   FXbool      synthetic;      /// True if synthetic expose event
00131   FXDragType  target;         /// Target drag type being requested
00132   };
00133 
00134 
00135 /// Application Object
00136 class FXAPI FXApp : public FXObject {
00137   FXDECLARE(FXApp)
00138 
00139   // We've got many friends
00140   friend class FXId;
00141   friend class FXBitmap;
00142   friend class FXImage;
00143   friend class FXIcon;
00144   friend class FXCursor;
00145   friend class FXDrawable;
00146   friend class FXWindow;
00147   friend class FXShell;
00148   friend class FXRootWindow;
00149   friend class FXTopWindow;
00150   friend class FXMainWindow;
00151   friend class FXPopup;
00152   friend class FXFont;
00153   friend class FXVisual;
00154   friend class FXGLVisual;
00155   friend class FXGLContext;
00156   friend class FXDC;
00157   friend class FXDCWindow;
00158 
00159 private:
00160 
00161   // Platform independent private data
00162   void            *display;             // Display we're talking to
00163   const FXchar    *dpy;                 // Initial display guess
00164   FXRegistry       registry;            // Application setting registry
00165   FXWindow        *focusWindow;         // Window which has the focus
00166   FXWindow        *cursorWindow;        // Window under the cursor
00167   FXWindow        *mouseGrabWindow;     // Window which grabbed the mouse
00168   FXWindow        *keyboardGrabWindow;  // Window which grabbed the keyboard
00169   FXWindow        *keyWindow;           // Window in which keyboard key was pressed
00170   FXWindow        *selectionWindow;     // Selection window
00171   FXWindow        *clipboardWindow;     // Clipboard window
00172   FXWindow        *dropWindow;          // Drop target window
00173   FXWindow        *dragWindow;          // Drag source window
00174   FXWindow        *refresher;           // GUI refresher pointer
00175   FXPopup         *popupWindow;         // Current popup window
00176   FXRootWindow    *root;                // Root window
00177   FXVisual        *monoVisual;          // Monochrome visual
00178   FXVisual        *defaultVisual;       // Default [color] visual
00179   FXTimer         *timers;              // List of timers, sorted by time
00180   FXChore         *chores;              // List of chores
00181   FXRepaint       *repaints;            // Unhandled repaint rectangles
00182   FXTimer         *timerrecs;           // List of recycled timer records
00183   FXChore         *chorerecs;           // List of recycled chore records
00184   FXRepaint       *repaintrecs;         // List of recycled repaint records
00185   FXInvocation    *invocation;          // Modal loop invocation
00186   FXSignal        *signals;             // Array of signal records
00187   FXint            nsignals;            // Number of signals
00188   FXFont          *normalFont;          // Normal font
00189   FXFont          *stockFont;           // Stock font
00190   FXuint           maxcolors;           // Maximum number of colors to allocate
00191   FXEvent          event;               // Event
00192   FXInput         *inputs;              // Input file descriptors being watched
00193   FXint            ninputs;             // Number of inputs
00194   FXint            maxinput;            // Maximum input number
00195   FXuchar         *ddeData;             // DDE array
00196   FXuint           ddeSize;             // DDE array size
00197   FXbool           again;               // Refresher goes again
00198   FXuint           typingSpeed;         // Typing speed
00199   FXuint           clickSpeed;          // Double click speed
00200   FXuint           scrollSpeed;         // Scroll speed
00201   FXuint           scrollDelay;         // Scroll delay
00202   FXuint           blinkSpeed;          // Cursor blink speed
00203   FXuint           animSpeed;           // Animation speed
00204   FXuint           menuPause;           // Menu popup delay
00205   FXuint           tooltipPause;        // Tooltip popup delay
00206   FXuint           tooltipTime;         // Tooltip display time
00207   FXint            dragDelta;           // Minimum distance considered a move
00208   FXint            wheelLines;          // Scroll by this many lines
00209   FXColor          borderColor;         // Border color
00210   FXColor          baseColor;           // Background color of GUI controls
00211   FXColor          hiliteColor;         // Highlight color of GUI controls
00212   FXColor          shadowColor;         // Shadow color of GUI controls
00213   FXColor          backColor;           // Background color
00214   FXColor          foreColor;           // Foreground color
00215   FXColor          selforeColor;        // Select foreground color
00216   FXColor          selbackColor;        // Select background color
00217   FXColor          tipforeColor;        // Tooltip foreground color
00218   FXColor          tipbackColor;        // Tooltip background color
00219   FXCursor        *waitCursor;          // Current wait cursor
00220   FXuint           waitcount;           // Number of times wait cursor was called
00221   FXCursor        *cursor[DEF_ROTATE_CURSOR+1];
00222   FXint                appArgc;         // Argument count
00223   const FXchar *const *appArgv;         // Argument vector
00224   FXbool           initialized;         // Has been initialized
00225 
00226 private:
00227   static FXApp    *app;                 // Application pointer
00228 
00229   // Platform dependent private stuff
00230 #ifndef WIN32
00231 private:
00232   int              wcontext;            // Window hash context
00233   FXID             wmDeleteWindow;      // Catch delete window
00234   FXID             wmQuitApp;           // Catch quit application
00235   FXID             wmProtocols;         // Window manager protocols
00236   FXID             wmMotifHints;        // Motif hints
00237   FXID             wmTakeFocus;         // Focus explicitly set by app
00238   FXID             wmState;             // Window state
00239   FXID             wmNetSupported;      // Extended Window Manager states list
00240   FXID             wmNetState;          // Extended Window Manager window state
00241   FXID             wmNetHMaximized;     // Extended Window Manager horizontally maximized
00242   FXID             wmNetVMaximized;     // Extended Window Manager vertically maximized
00243   FXID             ddeTargets;          // DDE targets atom
00244   FXID             ddeAtom;             // DDE exchange atom
00245   FXID             ddeDelete;           // DDE delete target atom
00246   FXDragType      *ddeTypeList;         // DDE drop type list
00247   FXuint           ddeNumTypes;         // DDE number of drop types
00248   FXDragAction     ddeAction;           // DDE action
00249   FXDragAction     ansAction;           // Reply action
00250   FXID             xcbSelection;        // Clipboard selection
00251   FXDragType      *xcbTypeList;         // Clipboard type list
00252   FXuint           xcbNumTypes;         // Clipboard number of types on list
00253   FXDragType      *xselTypeList;        // Selection type list
00254   FXuint           xselNumTypes;        // Selection number of types on list
00255   FXDragType      *xdndTypeList;        // XDND type list
00256   FXuint           xdndNumTypes;        // XDND number of types
00257   FXID             xdndProxy;           // XDND proxy atom
00258   FXID             xdndAware;           // XDND awareness atom
00259   FXID             xdndEnter;           // XDND enter window message
00260   FXID             xdndLeave;           // XDND leave window message
00261   FXID             xdndPosition;        // XDND position update message
00262   FXID             xdndStatus;          // XDND status feedback message
00263   FXID             xdndDrop;            // XDND drop message
00264   FXID             xdndFinished;        // XDND finished message
00265   FXID             xdndSelection;       // XDND selection atom
00266   FXID             xdndActionMove;      // XDND Move action
00267   FXID             xdndActionCopy;      // XDND Copy action
00268   FXID             xdndActionLink;      // XDND Link action
00269   FXID             xdndActionPrivate;   // XDND Private action
00270   FXID             xdndTypes;           // XDND types list atom
00271   FXID             xdndSource;          // XDND drag source window
00272   FXID             xdndTarget;          // XDND drop target window
00273   FXID             xdndProxyTarget;     // XDND window to set messages to
00274   FXbool           xdndStatusPending;   // XDND waiting for status feedback
00275   FXbool           xdndStatusReceived;  // XDND received at least one status
00276   FXbool           xdndWantUpdates;     // XDND target wants new positions while in rect
00277   FXRectangle      xdndRect;            // XDND rectangle bounding target
00278   FXID             stipples[23];        // Standard stipple patterns
00279   void            *r_fds;               // Set of file descriptors for read
00280   void            *w_fds;               // Set of file descriptors for write
00281   void            *e_fds;               // Set of file descriptors for exceptions
00282   void            *xim;                 // Input method
00283   void            *xic;                 // Input method context
00284   FXbool           shmi;                // Use XSHM Image possible
00285   FXbool           shmp;                // Use XSHM Pixmap possible
00286   FXbool           synchronize;         // Synchronized
00287 
00288 #else
00289 
00290   FXushort         ddeTargets;          // DDE targets atom
00291   FXushort         ddeAtom;             // DDE Exchange Atom
00292   FXDragType       ddeDelete;           // DDE Delete Target Atom
00293   FXDragType      *ddeTypeList;         // DDE drop type list
00294   FXuint           ddeNumTypes;         // DDE number of drop types
00295   FXDragAction     ddeAction;           // DDE action
00296   FXDragAction     ansAction;           // Reply action
00297   FXDragType      *xselTypeList;        // Selection type list
00298   FXuint           xselNumTypes;        // Selection number of types on list
00299   void*            xdndTypes;           // Handle to file mapping object for types list
00300   FXushort         xdndAware;           // XDND awareness atom
00301   FXID             xdndSource;          // XDND drag source window
00302   FXID             xdndTarget;          // XDND drop target window
00303   FXbool           xdndStatusPending;   // XDND waiting for status feedback
00304   FXbool           xdndFinishPending;   // XDND waiting for drop-confirmation
00305   FXbool           xdndStatusReceived;  // XDND received at least one status
00306   FXRectangle      xdndRect;            // XDND rectangle bounding target
00307   FXID             stipples[17];        // Standard stipple bitmaps
00308   void           **handles;             // Waitable object handles
00309 
00310 #endif
00311 
00312 private:
00313 
00314   // Internal helper functions
00315   FXApp(const FXApp&);
00316   FXApp &operator=(const FXApp&);
00317   static void signalhandler(int sig);
00318   static void immediatesignalhandler(int sig);
00319   void dragdropSetData(const FXWindow* window,FXDragType type,FXuchar* data,FXuint size);
00320   void dragdropGetData(const FXWindow* window,FXDragType type,FXuchar*& data,FXuint& size);
00321   void dragdropGetTypes(const FXWindow* window,FXDragType*& types,FXuint& numtypes);
00322   void selectionSetData(const FXWindow* window,FXDragType type,FXuchar* data,FXuint size);
00323   void selectionGetData(const FXWindow* window,FXDragType type,FXuchar*& data,FXuint& size);
00324   void selectionGetTypes(const FXWindow* window,FXDragType*& types,FXuint& numtypes);
00325   void clipboardSetData(const FXWindow* window,FXDragType type,FXuchar* data,FXuint size);
00326   void clipboardGetData(const FXWindow* window,FXDragType type,FXuchar*& data,FXuint& size);
00327   void clipboardGetTypes(const FXWindow* window,FXDragType*& types,FXuint& numtypes);
00328 #ifndef WIN32
00329   void addRepaint(FXID win,FXint x,FXint y,FXint w,FXint h,FXbool synth=0);
00330   void removeRepaints(FXID win,FXint x,FXint y,FXint w,FXint h);
00331   void scrollRepaints(FXID win,FXint dx,FXint dy);
00332 #else
00333   void leaveWindow(FXWindow *win,FXWindow *anc);
00334   void enterWindow(FXWindow *win,FXWindow *anc);
00335   static long CALLBACK wndproc(FXID hwnd,unsigned int iMsg,unsigned int wParam,long lParam);
00336 protected:
00337   virtual long dispatchEvent(FXID hwnd,unsigned int iMsg,unsigned int wParam,long lParam);
00338 #endif
00339 
00340 protected:
00341 
00342   /// Return TRUE when new raw event is available
00343   virtual FXbool getNextEvent(FXRawEvent& ev,FXbool blocking=TRUE);
00344 
00345   /// Dispatch raw event
00346   virtual FXbool dispatchEvent(FXRawEvent& ev);
00347 
00348 public:
00349   long onCmdQuit(FXObject*,FXSelector,void*);
00350   long onCmdDump(FXObject*,FXSelector,void*);
00351 
00352 public:
00353 
00354   /// Messages applications understand
00355   enum {
00356     ID_QUIT=0,    /// Terminate the application normally
00357     ID_DUMP,      /// Dump the current widget tree
00358     ID_LAST
00359     };
00360 
00361 public:
00362 
00363   /// Information
00364   static const FXuchar copyright[];     /// Copyright notice of library
00365 
00366 public:
00367 
00368   /**
00369   * Construct application object; the name and vendor strings are used
00370   * as keys into the registry database for this application's settings
00371   */
00372   FXApp(const FXString& name="Application",const FXString& vendor="FoxDefault");
00373 
00374   /// Get application name
00375   const FXString& getAppName() const { return registry.getAppKey(); }
00376 
00377   /// Get vendor name
00378   const FXString& getVendorName() const { return registry.getVendorKey(); }
00379 
00380   /// Connection to display; this is called by init()
00381   FXbool openDisplay(const FXchar* dpyname=NULL);
00382 
00383   /// Close connection to the display
00384   FXbool closeDisplay();
00385 
00386   /// Return pointer
00387   void* getDisplay() const { return display; }
00388 
00389   /// Get argument count
00390   FXint getArgc() const { return appArgc; }
00391 
00392   /// Get argument vector
00393   const FXchar *const *getArgv() const { return appArgv; }
00394 
00395   /// Get default visual
00396   FXVisual* getDefaultVisual() const { return defaultVisual; }
00397 
00398   /// Change default visual
00399   void setDefaultVisual(FXVisual* vis);
00400 
00401   /// Get monochrome visual
00402   FXVisual* getMonoVisual() const { return monoVisual; }
00403 
00404   /// Get root Window
00405   FXRootWindow* getRootWindow() const { return root; }
00406 
00407   /// Get the window under the cursor, if any
00408   FXWindow *getCursorWindow() const { return cursorWindow; }
00409 
00410   /// Get the window which has the focus, if any
00411   FXWindow *getFocusWindow() const { return focusWindow; }
00412 
00413   /// Get current popup window, if any
00414   FXPopup* getPopupWindow() const { return popupWindow; }
00415 
00416   /// Find window from id
00417   FXWindow* findWindowWithId(FXID xid) const;
00418 
00419   /// Find window from root x,y, starting from given window
00420   FXWindow* findWindowAt(FXint rx,FXint ry,FXID window=0) const;
00421 
00422   /**
00423   * Add timeout message to be sent to target object in ms milliseconds;
00424   * the timer fires only once after the interval expires.
00425   */
00426   FXTimer* addTimeout(FXint ms,FXObject* tgt,FXSelector sel);
00427 
00428   /// Remove timeout, returns NULL
00429   FXTimer* removeTimeout(FXTimer *t);
00430 
00431   /**
00432   * Add a idle processing message to be sent to target object when
00433   * the system becomes idle, i.e. there are no events to be processed.
00434   */
00435   FXChore* addChore(FXObject* tgt,FXSelector sel);
00436 
00437   /// Remove idle processing message
00438   FXChore* removeChore(FXChore *c);
00439 
00440   /**
00441   * Add signal processing message to be sent to target object when
00442   * the signal sig is raised; flags are to be set as per POSIX definitions.
00443   * When immediate is TRUE, the message will be sent to the target right away;
00444   * this should be used with extreme care as the application is interrupted
00445   * at an unknown point in its execution.
00446   */
00447   void addSignal(FXint sig,FXObject* tgt,FXSelector sel,FXbool immediate=FALSE,FXuint flags=0);
00448 
00449   /// Remove signal message for signal sig
00450   void removeSignal(FXint sig);
00451 
00452   /**
00453   * Add a file descriptor fd to be watched for activity as determined
00454   * by mode, where mode is a bitwise OR (INPUT_READ, INPUT_WRITE, INPUT_EXCEPT).
00455   * A message of type SEL_IO_READ, SEL_IO_WRITE, or SEL_IO_EXCEPT will be sent
00456   * to the target when the specified activity is detected on the file descriptor.
00457   */
00458   FXbool addInput(FXInputHandle fd,FXuint mode,FXObject *tgt,FXSelector sel);
00459 
00460   /**
00461   * Remove input message and target object for the specified file descriptor
00462   * and mode, which is a bitwise OR of (INPUT_READ, INPUT_WRITE, INPUT_EXCEPT).
00463   */
00464   FXbool removeInput(FXInputHandle fd,FXuint mode);
00465 
00466   /// Create application's windows
00467   virtual void create();
00468 
00469   /// Destroy application's windows
00470   virtual void destroy();
00471 
00472   /// Detach application's windows
00473   virtual void detach();
00474 
00475   /// Peek to determine if there's an event
00476   FXbool peekEvent();
00477 
00478   /// Perform one event dispatch
00479   void runOneEvent();
00480 
00481   /**
00482   * Run the main application event loop until stop() is called,
00483   * and return the exit code passed as argument to stop().
00484   */
00485   FXint run();
00486 
00487   /// Run an event loop till some flag becomes non-zero
00488   FXint runUntil(FXuint& condition);
00489 
00490   /**
00491   * Run event loop while there are events are available in the queue.
00492   * Returns 1 when all events in the queue have been handled, and 0 when
00493   * the event loop was terminated due to stop() or stopModal().
00494   * Except for the modal window and its children, user input to all windows
00495   * is blocked; if the modal window is NULL all user input is blocked.
00496   */
00497   FXint runWhileEvents(FXWindow* window=NULL);
00498 
00499   /**
00500   * Run modal event loop, blocking keyboard and mouse events to all windows
00501   * until stopModal is called.
00502   */
00503   FXint runModal();
00504 
00505   /**
00506   * Run a modal event loop for the given window, until stop() or stopModal() is
00507   * called. Except for the modal window and its children, user input to all
00508   * windows is blocked; if the modal window is NULL all user input is blocked.
00509   */
00510   FXint runModalFor(FXWindow* window);
00511 
00512   /**
00513   * Run modal while window is shown, or until stop() or stopModal() is called.
00514   * Except for the modal window and its children, user input to all windows
00515   * is blocked; if the modal window is NULL all user input is blocked.
00516   */
00517   FXint runModalWhileShown(FXWindow* window);
00518 
00519   /**
00520   * Run popup menu while shown, until stop() or stopModal() is called.
00521   * Also returns when entering previous cascading popup menu.
00522   */
00523   FXint runPopup(FXWindow* window);
00524 
00525   /// True if the window is modal
00526   FXbool isModal(FXWindow* window) const;
00527 
00528   /// Return window of current modal loop
00529   FXWindow* getModalWindow() const;
00530 
00531   /// Return mode of current modal loop
00532   FXModality getModality() const;
00533 
00534   /**
00535   * Terminate the outermost event loop, and all inner modal loops;
00536   * All more deeper nested event loops will be terminated with code equal
00537   * to 0, while the outermost event loop will return code equal to value.
00538   */
00539   void stop(FXint value=0);
00540 
00541   /**
00542   * Break out of the matching modal loop, returning code equal to value.
00543   * All deeper nested event loops are terminated with code equal to 0.
00544   */
00545   void stopModal(FXWindow* window,FXint value=0);
00546 
00547   /**
00548   * Break out of the innermost modal loop, returning code equal to value.
00549   */
00550   void stopModal(FXint value=0);
00551 
00552   /// Force GUI refresh
00553   void forceRefresh();
00554 
00555   /// Schedule a refresh
00556   void refresh();
00557 
00558   /// Flush pending repaints
00559   void flush(FXbool sync=FALSE);
00560 
00561   /**
00562   * Paint all windows marked for repainting.
00563   * On return all the applications windows have been painted.
00564   */
00565   void repaint();
00566 
00567   /**
00568   * Initialize application.
00569   * Parses and removes common command line arguments, reads the registry.
00570   * Finally, if connect is TRUE, it opens the display.
00571   */
00572   virtual void init(int& argc,char** argv,FXbool connect=TRUE);
00573 
00574   /**
00575   * Exit application.
00576   * Closes the display and writes the registry.
00577   */
00578   virtual void exit(FXint code=0);
00579 
00580   /// Get registry
00581   FXRegistry& reg(){ return registry; }
00582 
00583   /// Register new DND type
00584   FXDragType registerDragType(const FXString& name) const;
00585 
00586   /// Get drag type name
00587   FXString getDragTypeName(FXDragType type) const;
00588 
00589   /// Beep
00590   void beep();
00591 
00592   /// Return application instance
00593   static inline FXApp* instance(){ return app; }
00594 
00595   /// Change default font
00596   void setNormalFont(FXFont* font);
00597 
00598   /// Return default font
00599   FXFont* getNormalFont() const { return normalFont; }
00600 
00601   /// Begin of wait-cursor block; wait-cursor blocks may be nested.
00602   void beginWaitCursor();
00603 
00604   /// End of wait-cursor block
00605   void endWaitCursor();
00606 
00607   /// Change to a new wait cursor
00608   void setWaitCursor(FXCursor *cur);
00609 
00610   /// Return current wait cursor
00611   FXCursor* getWaitCursor() const { return waitCursor; }
00612 
00613   /// Obtain a default cursor
00614   FXCursor* getDefaultCursor(FXDefaultCursor which) const { return cursor[which]; }
00615 
00616   /// Change default cursor
00617   void setDefaultCursor(FXDefaultCursor which,FXCursor* cur);
00618 
00619   /// Obtain application-wide settings
00620   FXuint getTypingSpeed() const { return typingSpeed; }
00621   FXuint getClickSpeed() const { return clickSpeed; }
00622   FXuint getScrollSpeed() const { return scrollSpeed; }
00623   FXuint getScrollDelay() const { return scrollDelay; }
00624   FXuint getBlinkSpeed() const { return blinkSpeed; }
00625   FXuint getAnimSpeed() const { return animSpeed; }
00626   FXuint getMenuPause() const { return menuPause; }
00627   FXuint getTooltipPause() const { return tooltipPause; }
00628   FXuint getTooltipTime() const { return tooltipTime; }
00629   FXint getDragDelta() const { return dragDelta; }
00630   FXint getWheelLines() const { return wheelLines; }
00631 
00632   /// Change application-wide settings
00633   void setTypingSpeed(FXuint speed);
00634   void setClickSpeed(FXuint speed);
00635   void setScrollSpeed(FXuint speed);
00636   void setScrollDelay(FXuint delay);
00637   void setBlinkSpeed(FXuint speed);
00638   void setAnimSpeed(FXuint speed);
00639   void setMenuPause(FXuint pause);
00640   void setTooltipPause(FXuint pause);
00641   void setTooltipTime(FXuint time);
00642   void setDragDelta(FXint delta);
00643   void setWheelLines(FXint lines);
00644 
00645   /// Obtain default colors
00646   FXColor getBorderColor() const { return borderColor; }
00647   FXColor getBaseColor() const { return baseColor; }
00648   FXColor getHiliteColor() const { return hiliteColor; }
00649   FXColor getShadowColor() const { return shadowColor; }
00650   FXColor getBackColor() const { return backColor; }
00651   FXColor getForeColor() const { return foreColor; }
00652   FXColor getSelforeColor() const { return selforeColor; }
00653   FXColor getSelbackColor() const { return selbackColor; }
00654   FXColor getTipforeColor() const { return tipforeColor; }
00655   FXColor getTipbackColor() const { return tipbackColor; }
00656 
00657   /// Change default colors
00658   void setBorderColor(FXColor color);
00659   void setBaseColor(FXColor color);
00660   void setHiliteColor(FXColor color);
00661   void setShadowColor(FXColor color);
00662   void setBackColor(FXColor color);
00663   void setForeColor(FXColor color);
00664   void setSelforeColor(FXColor color);
00665   void setSelbackColor(FXColor color);
00666   void setTipforeColor(FXColor color);
00667   void setTipbackColor(FXColor color);
00668 
00669   /// Save
00670   virtual void save(FXStream& store) const;
00671 
00672   /// Load
00673   virtual void load(FXStream& store);
00674 
00675   /// Dump widget information
00676   void dumpWidgets() const;
00677 
00678   /// Destroy the application and all reachable resources
00679   virtual ~FXApp();
00680   };
00681 
00682 }
00683 
00684 #endif