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