00001 #ifndef FX_DISABLEGUI
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef FXAPP_H
00026 #define FXAPP_H
00027
00028 #ifndef FXOBJECT_H
00029 #include "FXObject.h"
00030 #endif
00031 #include "FXRectangle.h"
00032 #include "FXHash.h"
00033 #include "FXRectangle.h"
00034 #include "FXRegistry.h"
00035
00036 namespace FX {
00037
00038
00039
00040 class FXId;
00041
00042 class FXApp;
00043 class FXWindow;
00044 class FXIcon;
00045 class FXBitmap;
00046 class FXCursor;
00047 class FXRootWindow;
00048 class FXMainWindow;
00049 class FXPopup;
00050 class FXFont;
00051 class FXDC;
00052 class FXDCWindow;
00053 class FXVisual;
00054 class FXGLVisual;
00055 class FXGLContext;
00056
00057 class FXComposeContext;
00058
00059
00060 struct FXTimer;
00061 struct FXChore;
00062 struct FXSignal;
00063 struct FXRepaint;
00064 struct FXInput;
00065 struct FXAsyncMsg;
00066 struct FXInvocation;
00067 struct FXAppDestructUpcall;
00068
00069
00071 enum FXInputMode {
00072 INPUT_NONE = 0,
00073 INPUT_READ = 1,
00074 INPUT_WRITE = 2,
00075 INPUT_EXCEPT = 4
00076 };
00077
00078
00080 enum FXModality {
00081 MODAL_FOR_NONE,
00082 MODAL_FOR_WINDOW,
00083 MODAL_FOR_POPUP
00084 };
00085
00086
00088 enum FXDefaultCursor {
00089 DEF_ARROW_CURSOR,
00090 DEF_RARROW_CURSOR,
00091 DEF_TEXT_CURSOR,
00092 DEF_HSPLIT_CURSOR,
00093 DEF_VSPLIT_CURSOR,
00094 DEF_XSPLIT_CURSOR,
00095 DEF_SWATCH_CURSOR,
00096 DEF_MOVE_CURSOR,
00097 DEF_DRAGH_CURSOR,
00098 DEF_DRAGV_CURSOR,
00099 DEF_DRAGTL_CURSOR,
00100 DEF_DRAGBR_CURSOR=DEF_DRAGTL_CURSOR,
00101 DEF_DRAGTR_CURSOR,
00102 DEF_DRAGBL_CURSOR=DEF_DRAGTR_CURSOR,
00103 DEF_DNDSTOP_CURSOR,
00104 DEF_DNDCOPY_CURSOR,
00105 DEF_DNDMOVE_CURSOR,
00106 DEF_DNDLINK_CURSOR,
00107 DEF_CROSSHAIR_CURSOR,
00108 DEF_CORNERNE_CURSOR,
00109 DEF_CORNERNW_CURSOR,
00110 DEF_CORNERSE_CURSOR,
00111 DEF_CORNERSW_CURSOR,
00112 DEF_HELP_CURSOR,
00113 DEF_HAND_CURSOR,
00114 DEF_ROTATE_CURSOR,
00115 DEF_WAIT_CURSOR
00116 };
00117
00118
00119
00121 struct FXAPI FXEvent {
00122 FXuint type;
00123 FXuint time;
00124 FXint win_x;
00125 FXint win_y;
00126 FXint root_x;
00127 FXint root_y;
00128 FXint state;
00129 FXint code;
00130 FXString text;
00131 FXint last_x;
00132 FXint last_y;
00133 FXint click_x;
00134 FXint click_y;
00135 FXint rootclick_x;
00136 FXint rootclick_y;
00137 FXuint click_time;
00138 FXuint click_button;
00139 FXint click_count;
00140 FXbool moved;
00141 FXRectangle rect;
00142 FXbool synthetic;
00143 FXDragType target;
00144 };
00145
00146
00148 class FXAPI FXLockable {
00149 public:
00150 virtual ~FXLockable() { }
00151 virtual void lock() { }
00152 virtual void unlock() { }
00153 };
00154
00155
00157 class FXAPI FXEventLoop : public FXLockable, public FXObject {
00158 FXDECLARE(FXEventLoop)
00159
00160 protected:
00161 friend class FXApp;
00162 friend class FXPopup;
00163 friend class FXWindow;
00164 friend class FXDockHandler;
00165 template<typename type> friend class FXEventLoop_Static;
00166
00167 FXApp *app;
00168 FXHash hash;
00169 FXWindow *activeWindow;
00170 FXWindow *cursorWindow;
00171 FXWindow *mouseGrabWindow;
00172 FXWindow *keyboardGrabWindow;
00173 FXWindow *keyWindow;
00174 FXWindow *selectionWindow;
00175 FXWindow *clipboardWindow;
00176 FXWindow *dropWindow;
00177 FXWindow *dragWindow;
00178 FXWindow *refresher;
00179 FXWindow *refresherstop;
00180 FXPopup *popupWindow;
00181 FXRootWindow *root;
00182 FXTimer *timers;
00183 FXChore *chores;
00184 FXRepaint *repaints;
00185 FXTimer *timerrecs;
00186 FXChore *chorerecs;
00187 FXRepaint *repaintrecs;
00188 FXInvocation *invocation;
00189 FXSignal *signals;
00190 FXint nsignals;
00191 FXEvent event;
00192 FXInput *inputs;
00193 FXint ninputs;
00194 FXint maxinput;
00195 FXAsyncMsg *asyncmsgs;
00196 FXAsyncMsg *asyncmsgsrecs;
00197 bool &initialized;
00198 void *&display;
00199
00200
00201
00202 #ifndef WIN32
00203 void *&xim;
00204 void *r_fds;
00205 void *w_fds;
00206 void *e_fds;
00207 int latch[2];
00208
00209 #else
00210 void **handles;
00211 void *lastmovehwnd;
00212 long lastmovelParam;
00213 void *oldhwnd;
00214 void *latch;
00215 FXuint repostimer;
00216 FXuint msgloopcount;
00217 FXuint tickmsgloopcount;
00218
00219 #endif
00220
00221
00222 FXEventLoop(const FXEventLoop&);
00223 FXEventLoop &operator=(const FXEventLoop&);
00224 void setup();
00225 static void signalhandler(int sig);
00226 static void immediatesignalhandler(int sig);
00227 void leaveWindow(FXWindow *window,FXWindow *ancestor);
00228 void enterWindow(FXWindow *window,FXWindow *ancestor);
00229 void selectionSetData(const FXWindow* window,FXDragType type,FXuchar* data,FXuint size);
00230 void selectionGetData(const FXWindow* window,FXDragType type,FXuchar*& data,FXuint& size);
00231 void selectionGetTypes(const FXWindow* window,FXDragType*& types,FXuint& numtypes);
00232 void clipboardSetData(const FXWindow* window,FXDragType type,FXuchar* data,FXuint size);
00233 void clipboardGetData(const FXWindow* window,FXDragType type,FXuchar*& data,FXuint& size);
00234 void clipboardGetTypes(const FXWindow* window,FXDragType*& types,FXuint& numtypes);
00235 void dragdropSetData(const FXWindow* window,FXDragType type,FXuchar* data,FXuint size);
00236 void dragdropGetData(const FXWindow* window,FXDragType type,FXuchar*& data,FXuint& size);
00237 void dragdropGetTypes(const FXWindow* window,FXDragType*& types,FXuint& numtypes);
00238 #ifndef WIN32
00239 void addRepaint(FXID win,FXint x,FXint y,FXint w,FXint h,FXbool synth=0);
00240 void removeRepaints(FXID win,FXint x,FXint y,FXint w,FXint h);
00241 void scrollRepaints(FXID win,FXint dx,FXint dy);
00242 #else
00243 static long CALLBACK wndproc(FXID hwnd,unsigned int iMsg,unsigned int wParam,long lParam);
00244 protected:
00245 virtual long dispatchEvent(FXID hwnd,unsigned int iMsg,unsigned int wParam,long lParam);
00246 #endif
00247 private:
00248 FXbool doIdleProcessing();
00249 void doTimers();
00250 void doAsyncMsgs();
00251
00252 protected:
00253
00255 FXEventLoop(FXApp* app=NULL);
00256
00258 virtual bool getNextEvent(FXRawEvent& ev,bool blocking=true);
00259
00261 virtual bool dispatchEvent(FXRawEvent& ev);
00262
00264 virtual void latchLoop();
00265
00267 virtual void resetLoopLatch();
00268
00270 virtual bool getNextEventI(FXRawEvent& ev,bool blocking);
00271
00273 virtual bool peekEventI();
00274
00276 virtual void* makeStaticPtr(void* val);
00277
00279 virtual void deleteStaticPtr(void* ref);
00280
00282 virtual void* getStaticPtr(const void* ref) const;
00283
00285 virtual void setStaticPtr(void* ref,void* val);
00286
00287 public:
00288 enum {
00289 ID_ASYNCRECALC=1,
00290 ID_LAST
00291 };
00292 public:
00294 FXApp* getApp() const { return app; }
00295
00297 FXRootWindow* getRootWindow() const { return root; }
00298
00300 void setRootWindow(FXRootWindow* rt);
00301
00303 FXWindow *getFocusWindow() const;
00304
00306 FXWindow *getCursorWindow() const { return cursorWindow; }
00307
00309 FXWindow *getActiveWindow() const { return activeWindow; }
00310
00312 FXPopup* getPopupWindow() const { return popupWindow; }
00313
00315 FXWindow* findWindowWithId(FXID xid) const;
00316
00318 FXWindow* findWindowAt(FXint rx,FXint ry,FXID window=0) const;
00319
00327 void addTimeout(FXObject* tgt,FXSelector sel,FXuint ms=1000,void* ptr=NULL);
00328
00332 void removeTimeout(FXObject* tgt,FXSelector sel);
00333
00337 bool hasTimeout(FXObject *tgt,FXSelector sel) const;
00338
00344 FXuint remainingTimeout(FXObject *tgt,FXSelector sel);
00345
00349 void handleTimeouts();
00350
00358 void addChore(FXObject* tgt,FXSelector sel,void *ptr=NULL);
00359
00363 void removeChore(FXObject* tgt,FXSelector sel);
00364
00368 bool hasChore(FXObject *tgt,FXSelector sel) const;
00369
00377 void addSignal(FXint sig,FXObject* tgt,FXSelector sel,FXbool immediate=FALSE,FXuint flags=0);
00378
00380 void removeSignal(FXint sig);
00381
00388 bool addInput(FXInputHandle fd,FXuint mode,FXObject *tgt,FXSelector sel);
00389
00394 bool removeInput(FXInputHandle fd,FXuint mode);
00395
00397 bool getKeyState(FXuint keysym) const;
00398
00400 bool peekEvent();
00401
00403 bool runOneEvent(bool blocking=true);
00404
00409 FXint run();
00410
00415 FXint runUntil(FXuint& condition);
00416
00421 FXint runWhileEvents();
00422
00430 FXint runModalWhileEvents(FXWindow* window=NULL);
00431
00436 FXint runModal();
00437
00443 FXint runModalFor(FXWindow* window);
00444
00450 FXint runModalWhileShown(FXWindow* window);
00451
00456 FXint runPopup(FXWindow* window);
00457
00459 bool isModal(FXWindow* window) const;
00460
00462 FXWindow* getModalWindow() const;
00463
00465 FXModality getModality() const;
00466
00472 void stop(FXint value=0);
00473
00478 void stopModal(FXWindow* window,FXint value=0);
00479
00483 void stopModal(FXint value=0);
00484
00486 void forceRefresh();
00487
00489 void refresh();
00490
00492 void flush(bool sync=false);
00493
00498 void repaint();
00499
00501 FXWindow* getDragWindow() const { return dragWindow; }
00502
00503 virtual ~FXEventLoop();
00504
00505 public:
00506 long onCmdAsyncRecalc(FXObject*,FXSelector,void*);
00507
00509 void postAsyncMessage(FXObject* tgt,FXuint message,void *ptr=NULL,FXObject* src=NULL);
00510
00512 static void postAsyncMessage(FXId* tgt,FXuint message,void *ptr=NULL,FXObject* src=NULL);
00513
00515 virtual FXulong getThreadId() const { return 0; }
00516
00519 static void requestAsyncRecalc(FXWindow *what);
00520
00521 };
00522
00523 #ifdef _MSC_VER
00524 #pragma warning(push)
00525 #pragma warning(disable: 4251)
00526 #endif
00527
00529 class FXAPI FXApp : public FXLockable, public FXObject {
00530 FXDECLARE(FXApp)
00531
00532
00533 friend class FXEventLoop;
00534 friend class FXId;
00535 friend class FXBitmap;
00536 friend class FXImage;
00537 friend class FXIcon;
00538 friend class FXCursor;
00539 friend class FXDrawable;
00540 friend class FXWindow;
00541 friend class FXShell;
00542 friend class FXRootWindow;
00543 friend class FXTopWindow;
00544 friend class FXMainWindow;
00545 friend class FXPopup;
00546 friend class FXFont;
00547 friend class FXVisual;
00548 friend class FXGLVisual;
00549 friend class FXGLContext;
00550 friend class FXDC;
00551 friend class FXDCWindow;
00552 friend class FXEmbedderWindow;
00553 friend class FXDragCorner;
00554 friend class FXComposeContext;
00555 protected:
00556 mutable FXEventLoop *eventLoop;
00557
00558 private:
00559
00560
00561 void *display;
00562 const FXchar *dpy;
00563 FXRegistry registry;
00564 FXVisual *monoVisual;
00565 FXVisual *defaultVisual;
00566 FXFont *normalFont;
00567 FXFont *stockFont;
00568 FXuint stickyMods;
00569 FXuchar *ddeData;
00570 FXuint ddeSize;
00571 FXuint maxcolors;
00572 FXuint typingSpeed;
00573 FXuint clickSpeed;
00574 FXuint scrollSpeed;
00575 FXuint scrollDelay;
00576 FXuint blinkSpeed;
00577 FXuint animSpeed;
00578 FXuint menuPause;
00579 FXuint tooltipPause;
00580 FXuint tooltipTime;
00581 FXint dragDelta;
00582 FXint wheelLines;
00583 FXint scrollBarSize;
00584 FXColor borderColor;
00585 FXColor baseColor;
00586 FXColor hiliteColor;
00587 FXColor shadowColor;
00588 FXColor backColor;
00589 FXColor foreColor;
00590 FXColor selforeColor;
00591 FXColor selbackColor;
00592 FXColor tipforeColor;
00593 FXColor tipbackColor;
00594 FXColor selMenuTextColor;
00595 FXColor selMenuBackColor;
00596 FXCursor *waitCursor;
00597 FXuint waitCount;
00598 FXuint windowCount;
00599 FXCursor *cursor[DEF_WAIT_CURSOR+1];
00600
00601 FXint appArgc;
00602 const FXchar *const *appArgv;
00603 const FXchar *inputmethod;
00604 const FXchar *inputstyle;
00605 bool initialized;
00606 FXAppDestructUpcall *destructUpcalls;
00607
00608 private:
00609 static FXApp *app;
00610
00611
00612 #ifndef WIN32
00613 private:
00614 FXID wmDeleteWindow;
00615 FXID wmQuitApp;
00616 FXID wmProtocols;
00617 FXID wmMotifHints;
00618 FXID wmTakeFocus;
00619 FXID wmState;
00620 FXID wmNetState;
00621 FXID wmNetIconName;
00622 FXID wmNetWindowName;
00623 FXID wmNetSupported;
00624 FXID wmNetWindowType;
00625 FXID wmNetHMaximized;
00626 FXID wmNetVMaximized;
00627 FXID wmNetMoveResize;
00628 FXID wmNetPing;
00629 FXID wmNetTypes[8];
00630 FXID wmNetStates[12];
00631 FXID wmWindowRole;
00632 FXID wmClientLeader;
00633 FXID wmClientId;
00634 FXID embedAtom;
00635 FXID embedInfoAtom;
00636 FXID timestampAtom;
00637 FXID ddeTargets;
00638 FXID ddeAtom;
00639 FXID ddeDelete;
00640 FXID ddeIncr;
00641 FXDragType *ddeTypeList;
00642 FXuint ddeNumTypes;
00643 FXDragAction ddeAction;
00644 FXDragAction ansAction;
00645 FXID xcbSelection;
00646 FXDragType *xcbTypeList;
00647 FXuint xcbNumTypes;
00648 FXDragType *xselTypeList;
00649 FXuint xselNumTypes;
00650 FXDragType *xdndTypeList;
00651 FXuint xdndNumTypes;
00652 FXID xdndProxy;
00653 FXID xdndAware;
00654 FXID xdndEnter;
00655 FXID xdndLeave;
00656 FXID xdndPosition;
00657 FXID xdndStatus;
00658 FXID xdndDrop;
00659 FXID xdndFinished;
00660 FXID xdndSelection;
00661 FXID xdndActionMove;
00662 FXID xdndActionCopy;
00663 FXID xdndActionLink;
00664 FXID xdndActionPrivate;
00665 FXID xdndTypes;
00666 FXID xdndSource;
00667 FXID xdndTarget;
00668 FXID xdndProxyTarget;
00669 FXbool xdndStatusPending;
00670 FXbool xdndStatusReceived;
00671 FXbool xdndWantUpdates;
00672 FXbool xdndFinishSent;
00673 FXRectangle xdndRect;
00674 FXint xrreventbase;
00675 FXID stipples[23];
00676 void *xim;
00677 FXbool shmi;
00678 FXbool shmp;
00679 FXbool synchronize;
00680
00681 #else
00682
00683 FXushort ddeTargets;
00684 FXushort ddeAtom;
00685 FXDragType ddeDelete;
00686 FXDragType *ddeTypeList;
00687 FXuint ddeNumTypes;
00688 FXDragAction ddeAction;
00689 FXDragAction ansAction;
00690 FXDragType *xselTypeList;
00691 FXuint xselNumTypes;
00692 void* xdndTypes;
00693 FXushort xdndAware;
00694 FXID xdndSource;
00695 FXID xdndTarget;
00696 FXbool xdndStatusPending;
00697 FXbool xdndFinishPending;
00698 FXbool xdndStatusReceived;
00699 FXbool xdndFinishSent;
00700 FXRectangle xdndRect;
00701 FXID stipples[17];
00702
00703 #endif
00704
00705 private:
00706
00707
00708 FXApp(const FXApp&);
00709 FXApp &operator=(const FXApp&);
00710 #ifndef WIN32
00711 static void imcreatecallback(void*,FXApp*,void*);
00712 static void imdestroycallback(void*,FXApp*,void*);
00713 #else
00714 protected:
00715 virtual long dispatchEvent(FXID hwnd,unsigned int iMsg,unsigned int wParam,long lParam);
00716 #endif
00717
00718 protected:
00719
00721 virtual bool getNextEvent(FXRawEvent& ev,bool blocking=true);
00722
00724 virtual bool dispatchEvent(FXRawEvent& ev);
00725
00726 public:
00727 long onCmdQuit(FXObject*,FXSelector,void*);
00728 long onCmdDump(FXObject*,FXSelector,void*);
00729 long onCmdHover(FXObject*,FXSelector,void*);
00730
00731 public:
00732
00734 enum {
00735 ID_QUIT=1,
00736 ID_DUMP,
00737 ID_HOVER,
00738 ID_LAST
00739 };
00740
00741 public:
00742
00744 static const FXuchar *copyright;
00745
00746 public:
00747
00753 FXApp(const FXString& name="Application",const FXString& vendor="FoxDefault");
00754
00756 const FXString& getAppName() const { return registry.getAppKey(); }
00757
00759 const FXString& getVendorName() const { return registry.getVendorKey(); }
00760
00762 bool openDisplay(const FXchar* dpyname=NULL);
00763
00765 bool closeDisplay();
00766
00768 void* getDisplay() const { return display; }
00769
00771 bool isInitialized() const { return initialized; }
00772
00774 FXint getArgc() const { return appArgc; }
00775
00777 const FXchar *const *getArgv() const { return appArgv; }
00778
00780 virtual FXEventLoop* getEventLoop() const;
00781
00783 static FXEventLoop* getPrimaryEventLoop();
00784
00786 bool hasInputMethod() const;
00787
00789 FXVisual* getDefaultVisual() const { return defaultVisual; }
00790
00792 void setDefaultVisual(FXVisual* vis);
00793
00795 FXVisual* getMonoVisual() const { return monoVisual; }
00796
00798 FXRootWindow* getRootWindow() const { return getEventLoop()->getRootWindow(); }
00799
00801 void setRootWindow(FXRootWindow* rt) { return getEventLoop()->setRootWindow(rt); }
00802
00804 FXWindow *getFocusWindow() const { return getEventLoop()->getFocusWindow(); }
00805
00807 FXWindow *getCursorWindow() const { return getEventLoop()->getCursorWindow(); }
00808
00810 FXWindow *getActiveWindow() const { return getEventLoop()->getActiveWindow(); }
00811
00813 FXPopup* getPopupWindow() const { return getEventLoop()->getPopupWindow(); }
00814
00816 FXWindow* findWindowWithId(FXID xid) const { return getEventLoop()->findWindowWithId(xid); }
00817
00819 FXWindow* findWindowAt(FXint rx,FXint ry,FXID window=0) const { return getEventLoop()->findWindowAt(rx,ry,window); }
00820
00822 virtual void create();
00823
00825 virtual void destroy();
00826
00828 virtual void detach();
00829
00837 void addTimeout(FXObject* tgt,FXSelector sel,FXuint ms=1000,void* ptr=NULL) { return getEventLoop()->addTimeout(tgt,sel,ms,ptr); }
00838
00842 void removeTimeout(FXObject* tgt,FXSelector sel) { return getEventLoop()->removeTimeout(tgt,sel); }
00843
00847 bool hasTimeout(FXObject *tgt,FXSelector sel) const { return getEventLoop()->hasTimeout(tgt,sel); }
00848
00854 FXuint remainingTimeout(FXObject *tgt,FXSelector sel) const { return getEventLoop()->remainingTimeout(tgt,sel); }
00855
00859 void handleTimeouts() { return getEventLoop()->handleTimeouts(); }
00860
00868 void addChore(FXObject* tgt,FXSelector sel,void *ptr=NULL) { return getEventLoop()->addChore(tgt,sel,ptr); }
00869
00873 void removeChore(FXObject* tgt,FXSelector sel) { return getEventLoop()->removeChore(tgt,sel); }
00874
00878 FXbool hasChore(FXObject *tgt,FXSelector sel) const { return getEventLoop()->hasChore(tgt,sel); }
00879
00887 void addSignal(FXint sig,FXObject* tgt,FXSelector sel,FXbool immediate=FALSE,FXuint flags=0) { getEventLoop()->addSignal(sig,tgt,sel,immediate,flags); }
00888
00890 void removeSignal(FXint sig) { getEventLoop()->removeSignal(sig); }
00891
00898 bool addInput(FXInputHandle fd,FXuint mode,FXObject *tgt,FXSelector sel) { return getEventLoop()->addInput(fd,mode,tgt,sel); }
00899
00904 bool removeInput(FXInputHandle fd,FXuint mode) { return getEventLoop()->removeInput(fd,mode); }
00905
00907 bool getKeyState(FXuint keysym) const;
00908
00910 bool peekEvent() { return getEventLoop()->peekEvent(); }
00911
00913 bool runOneEvent(bool blocking=true) { return getEventLoop()->runOneEvent(blocking); }
00914
00919 FXint run() { return getEventLoop()->run(); }
00920
00925 FXint runUntil(FXuint& condition) { return getEventLoop()->runUntil(condition); }
00926
00931 FXint runWhileEvents() { return getEventLoop()->runWhileEvents(); }
00932
00940 FXint runModalWhileEvents(FXWindow* window=NULL) { return getEventLoop()->runModalWhileEvents(window); }
00941
00946 FXint runModal() { return getEventLoop()->runModal(); }
00947
00953 FXint runModalFor(FXWindow* window) { return getEventLoop()->runModalFor(window); }
00954
00960 FXint runModalWhileShown(FXWindow* window) { return getEventLoop()->runModalWhileShown(window); }
00961
00966 FXint runPopup(FXWindow* window) { return getEventLoop()->runPopup(window); }
00967
00969 FXbool isModal(FXWindow* window) const { return getEventLoop()->isModal(window); }
00970
00972 FXWindow* getModalWindow() const { return getEventLoop()->getModalWindow(); }
00973
00975 FXModality getModality() const { return getEventLoop()->getModality(); }
00976
00982 void stop(FXint value=0) { getEventLoop()->stop(value); }
00983
00988 void stopModal(FXWindow* window,FXint value=0) { getEventLoop()->stopModal(window, value); }
00989
00993 void stopModal(FXint value=0) { getEventLoop()->stopModal(value); }
00994
00996 void forceRefresh() { getEventLoop()->forceRefresh(); }
00997
00999 void refresh() { getEventLoop()->refresh(); }
01000
01002 void flush(bool sync=false) { getEventLoop()->flush(sync); }
01003
01008 void repaint() { getEventLoop()->repaint(); }
01009
01015 virtual void init(int& argc,char** argv,bool connect=true);
01016
01021 virtual void exit(FXint code=0);
01022
01029 FXRegistry& reg(){ return registry; }
01030
01032 FXDragType registerDragType(const FXString& name) const;
01033
01035 FXString getDragTypeName(FXDragType type) const;
01036
01038 FXWindow* getDragWindow() const { return getEventLoop()->getDragWindow(); }
01039
01041 void beep();
01042
01044 void errorBeep();
01045
01049 static FXlong time();
01050
01052 static inline FXApp* instance(){ return app; }
01053
01055 void setNormalFont(FXFont* font);
01056
01058 FXFont* getNormalFont() const { return normalFont; }
01059
01061 void beginWaitCursor();
01062
01064 void endWaitCursor();
01065
01067 void setWaitCursor(FXCursor *cur);
01068
01070 FXCursor* getWaitCursor() const { return waitCursor; }
01071
01073 FXCursor* getDefaultCursor(FXDefaultCursor which) const { return cursor[which]; }
01074
01076 void setDefaultCursor(FXDefaultCursor which,FXCursor* cur);
01077
01082 FXbool writeWindow(FXStream& store,FXWindow *window);
01083
01088 FXbool readWindow(FXStream& store,FXWindow*& window,FXWindow* father,FXWindow* owner);
01089
01090
01095
01096
01098
01099
01101 FXuint getTypingSpeed() const { return typingSpeed; }
01102 FXuint getClickSpeed() const { return clickSpeed; }
01103 FXuint getScrollSpeed() const { return scrollSpeed; }
01104 FXuint getScrollDelay() const { return scrollDelay; }
01105 FXuint getBlinkSpeed() const { return blinkSpeed; }
01106 FXuint getAnimSpeed() const { return animSpeed; }
01107 FXuint getMenuPause() const { return menuPause; }
01108 FXuint getTooltipPause() const { return tooltipPause; }
01109 FXuint getTooltipTime() const { return tooltipTime; }
01110 FXint getDragDelta() const { return dragDelta; }
01111 FXint getWheelLines() const { return wheelLines; }
01112 FXint getScrollBarSize() const { return scrollBarSize; }
01113
01115 void setTypingSpeed(FXuint speed);
01116 void setClickSpeed(FXuint speed);
01117 void setScrollSpeed(FXuint speed);
01118 void setScrollDelay(FXuint delay);
01119 void setBlinkSpeed(FXuint speed);
01120 void setAnimSpeed(FXuint speed);
01121 void setMenuPause(FXuint pause);
01122 void setTooltipPause(FXuint pause);
01123 void setTooltipTime(FXuint time);
01124 void setDragDelta(FXint delta);
01125 void setWheelLines(FXint lines);
01126 void setScrollBarSize(FXint size);
01127
01129 FXColor getBorderColor() const { return borderColor; }
01130 FXColor getBaseColor() const { return baseColor; }
01131 FXColor getHiliteColor() const { return hiliteColor; }
01132 FXColor getShadowColor() const { return shadowColor; }
01133 FXColor getBackColor() const { return backColor; }
01134 FXColor getForeColor() const { return foreColor; }
01135 FXColor getSelforeColor() const { return selforeColor; }
01136 FXColor getSelbackColor() const { return selbackColor; }
01137 FXColor getTipforeColor() const { return tipforeColor; }
01138 FXColor getTipbackColor() const { return tipbackColor; }
01139 FXColor getSelMenuTextColor() const { return selMenuTextColor; }
01140 FXColor getSelMenuBackColor() const { return selMenuBackColor; }
01141
01143 void setBorderColor(FXColor color);
01144 void setBaseColor(FXColor color);
01145 void setHiliteColor(FXColor color);
01146 void setShadowColor(FXColor color);
01147 void setBackColor(FXColor color);
01148 void setForeColor(FXColor color);
01149 void setSelforeColor(FXColor color);
01150 void setSelbackColor(FXColor color);
01151 void setTipforeColor(FXColor color);
01152 void setTipbackColor(FXColor color);
01153 void setSelMenuTextColor(FXColor color);
01154 void setSelMenuBackColor(FXColor color);
01155
01157 FXuint getWindowCount() const { return windowCount; }
01158
01160 virtual void save(FXStream& store) const;
01161
01163 virtual void load(FXStream& store);
01164
01166 void dumpWidgets() const;
01167
01169 void addDestructionUpcall(void (*func)(void *), void *data);
01170
01172 void removeDestructionUpcall(void (*func)(void *), void *data);
01173
01175 virtual ~FXApp();
01176 };
01177
01178 #ifdef _MSC_VER
01179 #pragma warning(pop)
01180 #endif
01181
01183 class FXAPI FXLockHold
01184 {
01185 FXbool locked;
01186 FXLockable *item;
01187 public:
01189 FXLockHold(FXLockable *obj) : locked(FALSE), item(obj) { relock(); }
01190
01192 FXLockHold(FXLockable &obj) : locked(FALSE), item(&obj) { relock(); }
01193
01195 ~FXLockHold() { unlock(); }
01196
01198 void relock(){
01199 if(!locked && item){
01200 item->lock();
01201 locked=TRUE;
01202 }
01203 }
01204
01205
01206 void unlock(){
01207 if(locked && item){
01208 item->unlock();
01209 locked=FALSE;
01210 }
01211 }
01212
01213 };
01214
01216 template<typename type> class FXEventLoop_Static
01217 {
01218 void *ref;
01219 public:
01220 FXEventLoop_Static(type *v=NULL) : ref(FXApp::instance()->getEventLoop()->makeStaticPtr(static_cast<void *>(v))) { }
01221 ~FXEventLoop_Static() { FXApp::instance()->getEventLoop()->deleteStaticPtr(ref); }
01223 type *operator=(type *v){
01224 FXApp::instance()->getEventLoop()->setStaticPtr(ref, static_cast<void *>(v));
01225 return v;
01226 }
01228 operator type *() const {
01229 return static_cast<type *>(FXApp::instance()->getEventLoop()->getStaticPtr(ref));
01230 }
01232 type *operator->() const {
01233 return static_cast<type *>(FXApp::instance()->getEventLoop()->getStaticPtr(ref));
01234 }
01235 };
01236
01237 }
01238
01239 #endif
01240 #endif