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

FXWindow.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                            W i n d o w   O b j e c t                          *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1997,2009 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or modify          *
00009 * it under the terms of the GNU Lesser General Public License as published by   *
00010 * the Free Software Foundation; either version 3 of the License, or             *
00011 * (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                 *
00016 * GNU Lesser General Public License for more details.                           *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public License      *
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
00020 *********************************************************************************
00021 * $Id: FXWindow.h,v 1.171 2009/01/06 13:07:29 fox Exp $                         *
00022 ********************************************************************************/
00023 #ifndef FXWINDOW_H
00024 #define FXWINDOW_H
00025 
00026 #ifndef FXDRAWABLE_H
00027 #include "FXDrawable.h"
00028 #endif
00029 
00030 
00031 namespace FX {
00032 
00033 
00034 /// Layout hints for child widgets
00035 enum {
00036   LAYOUT_NORMAL      = 0,                                   /// Default layout mode
00037   LAYOUT_SIDE_TOP    = 0,                                   /// Pack on top side (default)
00038   LAYOUT_SIDE_BOTTOM = 0x00000001,                          /// Pack on bottom side
00039   LAYOUT_SIDE_LEFT   = 0x00000002,                          /// Pack on left side
00040   LAYOUT_SIDE_RIGHT  = LAYOUT_SIDE_LEFT|LAYOUT_SIDE_BOTTOM, /// Pack on right side
00041   LAYOUT_FILL_COLUMN = 0x00000001,                          /// Matrix column is stretchable
00042   LAYOUT_FILL_ROW    = 0x00000002,                          /// Matrix row is stretchable
00043   LAYOUT_LEFT        = 0,                                   /// Stick on left (default)
00044   LAYOUT_RIGHT       = 0x00000004,                          /// Stick on right
00045   LAYOUT_CENTER_X    = 0x00000008,                          /// Center horizontally
00046   LAYOUT_FIX_X       = LAYOUT_RIGHT|LAYOUT_CENTER_X,        /// X fixed
00047   LAYOUT_TOP         = 0,                                   /// Stick on top (default)
00048   LAYOUT_BOTTOM      = 0x00000010,                          /// Stick on bottom
00049   LAYOUT_CENTER_Y    = 0x00000020,                          /// Center vertically
00050   LAYOUT_FIX_Y       = LAYOUT_BOTTOM|LAYOUT_CENTER_Y,       /// Y fixed
00051   LAYOUT_DOCK_SAME   = 0,                                   /// Dock on same galley if it fits
00052   LAYOUT_DOCK_NEXT   = 0x00000040,                          /// Dock on next galley
00053   LAYOUT_RESERVED_1  = 0x00000080,
00054   LAYOUT_FIX_WIDTH   = 0x00000100,                          /// Width fixed
00055   LAYOUT_FIX_HEIGHT  = 0x00000200,                          /// height fixed
00056   LAYOUT_MIN_WIDTH   = 0,                                   /// Minimum width is the default
00057   LAYOUT_MIN_HEIGHT  = 0,                                   /// Minimum height is the default
00058   LAYOUT_FILL_X      = 0x00000400,                          /// Stretch or shrink horizontally
00059   LAYOUT_FILL_Y      = 0x00000800,                          /// Stretch or shrink vertically
00060   LAYOUT_FILL        = LAYOUT_FILL_X|LAYOUT_FILL_Y,         /// Stretch or shrink in both directions
00061   LAYOUT_EXPLICIT    = LAYOUT_FIX_X|LAYOUT_FIX_Y|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT   /// Explicit placement
00062   };
00063 
00064 
00065 /// Frame border appearance styles (for subclasses)
00066 enum {
00067   FRAME_NONE   = 0,                                     /// Default is no frame
00068   FRAME_SUNKEN = 0x00001000,                            /// Sunken border
00069   FRAME_RAISED = 0x00002000,                            /// Raised border
00070   FRAME_THICK  = 0x00004000,                            /// Thick border
00071   FRAME_GROOVE = FRAME_THICK,                           /// A groove or etched-in border
00072   FRAME_RIDGE  = FRAME_THICK|FRAME_RAISED|FRAME_SUNKEN, /// A ridge or embossed border
00073   FRAME_LINE   = FRAME_RAISED|FRAME_SUNKEN,             /// Simple line border
00074   FRAME_NORMAL = FRAME_SUNKEN|FRAME_THICK               /// Regular raised/thick border
00075   };
00076 
00077 
00078 /// Packing style (for packers)
00079 enum {
00080   PACK_NORMAL         = 0,              /// Default is each its own size
00081   PACK_UNIFORM_HEIGHT = 0x00008000,     /// Uniform height
00082   PACK_UNIFORM_WIDTH  = 0x00010000      /// Uniform width
00083   };
00084 
00085 
00086 class FXIcon;
00087 class FXBitmap;
00088 class FXCursor;
00089 class FXRegion;
00090 class FXComposite;
00091 class FXAccelTable;
00092 class FXComposeContext;
00093 
00094 
00095 /// Base class for all windows
00096 class FXAPI FXWindow : public FXDrawable {
00097   FXDECLARE(FXWindow)
00098   friend class FXApp;
00099 private:
00100   FXWindow         *parent;             // Parent Window
00101   FXWindow         *owner;              // Owner Window
00102   FXWindow         *first;              // First Child
00103   FXWindow         *last;               // Last Child
00104   FXWindow         *next;               // Next Sibling
00105   FXWindow         *prev;               // Previous Sibling
00106   FXWindow         *focus;              // Focus Child
00107   FXuint            wk;                 // Window Key
00108 protected:
00109   FXComposeContext *composeContext;     // Compose context
00110   FXCursor         *defaultCursor;      // Normal Cursor
00111   FXCursor         *dragCursor;         // Cursor during drag
00112   FXAccelTable     *accelTable;         // Accelerator table
00113   FXObject         *target;             // Target object
00114   FXSelector        message;            // Message ID
00115   FXint             xpos;               // Window X Position
00116   FXint             ypos;               // Window Y Position
00117   FXColor           backColor;          // Window background color
00118   FXString          tag;                // Help tag
00119   FXuint            flags;              // Window state flags
00120   FXuint            options;            // Window options
00121 public:
00122   static FXDragType octetType;          // Raw octet stream
00123   static FXDragType deleteType;         // Delete request
00124   static FXDragType textType;           // Ascii text request
00125   static FXDragType colorType;          // Color request
00126   static FXDragType urilistType;        // URI list request
00127   static FXDragType utf8Type;           // UTF-8 text request
00128   static FXDragType utf16Type;          // UTF-16 text request
00129   static FXDragType actionType;         // Clipboard action
00130   static const FXDragType stringType;   // Clipboard text type (pre-registered)
00131   static const FXDragType imageType;    // Clipboard image type (pre-registered)
00132 protected:
00133   FXWindow();
00134   FXWindow(FXApp* a,FXVisual *vis);
00135   FXWindow(FXApp* a,FXWindow* own,FXuint opts,FXint x,FXint y,FXint w,FXint h);
00136   static FXWindow* findDefault(FXWindow* window);
00137   static FXWindow* findInitial(FXWindow* window);
00138   virtual FXbool doesOverrideRedirect() const;
00139 protected:
00140 #ifdef WIN32
00141   virtual FXID GetDC() const;
00142   virtual int ReleaseDC(FXID) const;
00143   virtual const void* GetClass() const;
00144 #else
00145   void addColormapWindows();
00146   void remColormapWindows();
00147 #endif
00148 private:
00149   FXWindow(const FXWindow&);
00150   FXWindow& operator=(const FXWindow&);
00151 protected:
00152 
00153   // Window state flags
00154   enum {
00155     FLAG_SHOWN        = 0x00000001,     // Is shown
00156     FLAG_ENABLED      = 0x00000002,     // Able to receive input
00157     FLAG_UPDATE       = 0x00000004,     // Is subject to GUI update
00158     FLAG_DROPTARGET   = 0x00000008,     // Drop target
00159     FLAG_FOCUSED      = 0x00000010,     // Has focus
00160     FLAG_DIRTY        = 0x00000020,     // Needs layout
00161     FLAG_RECALC       = 0x00000040,     // Needs recalculation
00162     FLAG_TIP          = 0x00000080,     // Show tip
00163     FLAG_HELP         = 0x00000100,     // Show help
00164     FLAG_DEFAULT      = 0x00000200,     // Default widget
00165     FLAG_INITIAL      = 0x00000400,     // Initial widget
00166     FLAG_SHELL        = 0x00000800,     // Shell window
00167     FLAG_ACTIVE       = 0x00001000,     // Window is active
00168     FLAG_PRESSED      = 0x00002000,     // Button has been pressed
00169     FLAG_KEY          = 0x00004000,     // Keyboard key pressed
00170     FLAG_CARET        = 0x00008000,     // Caret is on
00171     FLAG_CHANGED      = 0x00010000,     // Window data changed
00172     FLAG_LASSO        = 0x00020000,     // Lasso mode
00173     FLAG_TRYDRAG      = 0x00040000,     // Tentative drag mode
00174     FLAG_DODRAG       = 0x00080000,     // Doing drag mode
00175     FLAG_SCROLLINSIDE = 0x00100000,     // Scroll only when inside
00176     FLAG_SCROLLING    = 0x00200000,     // Right mouse scrolling
00177     FLAG_OWNED        = 0x00400000,     // Owned window handle
00178     FLAG_CURSOR       = 0x00800000      // Showing cursor
00179     };
00180 
00181 public:
00182 
00183   // Message handlers
00184   long onPaint(FXObject*,FXSelector,void*);
00185   long onMap(FXObject*,FXSelector,void*);
00186   long onUnmap(FXObject*,FXSelector,void*);
00187   long onConfigure(FXObject*,FXSelector,void*);
00188   long onUpdate(FXObject*,FXSelector,void*);
00189   long onMotion(FXObject*,FXSelector,void*);
00190   long onMouseWheel(FXObject*,FXSelector,void*);
00191   long onEnter(FXObject*,FXSelector,void*);
00192   long onLeave(FXObject*,FXSelector,void*);
00193   long onLeftBtnPress(FXObject*,FXSelector,void*);
00194   long onLeftBtnRelease(FXObject*,FXSelector,void*);
00195   long onMiddleBtnPress(FXObject*,FXSelector,void*);
00196   long onMiddleBtnRelease(FXObject*,FXSelector,void*);
00197   long onRightBtnPress(FXObject*,FXSelector,void*);
00198   long onRightBtnRelease(FXObject*,FXSelector,void*);
00199   long onSpaceBallMotion(FXObject*,FXSelector,void*);
00200   long onSpaceBallButtonPress(FXObject*,FXSelector,void*);
00201   long onSpaceBallButtonRelease(FXObject*,FXSelector,void*);
00202   long onBeginDrag(FXObject*,FXSelector,void*);
00203   long onEndDrag(FXObject*,FXSelector,void*);
00204   long onDragged(FXObject*,FXSelector,void*);
00205   long onKeyPress(FXObject*,FXSelector,void*);
00206   long onKeyRelease(FXObject*,FXSelector,void*);
00207   long onUngrabbed(FXObject*,FXSelector,void*);
00208   long onDestroy(FXObject*,FXSelector,void*);
00209   long onFocusSelf(FXObject*,FXSelector,void*);
00210   long onFocusIn(FXObject*,FXSelector,void*);
00211   long onFocusOut(FXObject*,FXSelector,void*);
00212   long onSelectionLost(FXObject*,FXSelector,void*);
00213   long onSelectionGained(FXObject*,FXSelector,void*);
00214   long onSelectionRequest(FXObject*,FXSelector,void*);
00215   long onClipboardLost(FXObject*,FXSelector,void*);
00216   long onClipboardGained(FXObject*,FXSelector,void*);
00217   long onClipboardRequest(FXObject*,FXSelector,void*);
00218   long onDNDEnter(FXObject*,FXSelector,void*);
00219   long onDNDLeave(FXObject*,FXSelector,void*);
00220   long onDNDMotion(FXObject*,FXSelector,void*);
00221   long onDNDDrop(FXObject*,FXSelector,void*);
00222   long onDNDRequest(FXObject*,FXSelector,void*);
00223   long onQueryHelp(FXObject*,FXSelector,void*);
00224   long onQueryTip(FXObject*,FXSelector,void*);
00225   long onCmdShow(FXObject*,FXSelector,void*);
00226   long onCmdHide(FXObject*,FXSelector,void*);
00227   long onUpdToggleShown(FXObject*,FXSelector,void*);
00228   long onCmdToggleShown(FXObject*,FXSelector,void*);
00229   long onCmdRaise(FXObject*,FXSelector,void*);
00230   long onCmdLower(FXObject*,FXSelector,void*);
00231   long onCmdEnable(FXObject*,FXSelector,void*);
00232   long onCmdDisable(FXObject*,FXSelector,void*);
00233   long onUpdToggleEnabled(FXObject*,FXSelector,void*);
00234   long onCmdToggleEnabled(FXObject*,FXSelector,void*);
00235   long onCmdUpdate(FXObject*,FXSelector,void*);
00236   long onUpdYes(FXObject*,FXSelector,void*);
00237   long onCmdDelete(FXObject*,FXSelector,void*);
00238 
00239 public:
00240 
00241   // Message ID's common to most Windows
00242   enum {
00243     ID_NONE,
00244     ID_HIDE,            // ID_HIDE+FALSE
00245     ID_SHOW,            // ID_HIDE+TRUE
00246     ID_TOGGLESHOWN,
00247     ID_LOWER,
00248     ID_RAISE,
00249     ID_DELETE,
00250     ID_DISABLE,         // ID_DISABLE+FALSE
00251     ID_ENABLE,          // ID_DISABLE+TRUE
00252     ID_TOGGLEENABLED,
00253     ID_UNCHECK,         // ID_UNCHECK+FALSE
00254     ID_CHECK,           // ID_UNCHECK+TRUE
00255     ID_UNKNOWN,         // ID_UNCHECK+MAYBE
00256     ID_UPDATE,
00257     ID_AUTOSCROLL,
00258     ID_TIPTIMER,
00259     ID_HSCROLLED,
00260     ID_VSCROLLED,
00261     ID_SETVALUE,
00262     ID_SETINTVALUE,
00263     ID_SETLONGVALUE,
00264     ID_SETREALVALUE,
00265     ID_SETSTRINGVALUE,
00266     ID_SETICONVALUE,
00267     ID_SETINTRANGE,
00268     ID_SETREALRANGE,
00269     ID_GETINTVALUE,
00270     ID_GETLONGVALUE,
00271     ID_GETREALVALUE,
00272     ID_GETSTRINGVALUE,
00273     ID_GETICONVALUE,
00274     ID_GETINTRANGE,
00275     ID_GETREALRANGE,
00276     ID_SETHELPSTRING,
00277     ID_GETHELPSTRING,
00278     ID_SETTIPSTRING,
00279     ID_GETTIPSTRING,
00280     ID_QUERY_MENU,
00281     ID_HOTKEY,
00282     ID_ACCEL,
00283     ID_UNPOST,
00284     ID_POST,
00285     ID_MDI_TILEHORIZONTAL,
00286     ID_MDI_TILEVERTICAL,
00287     ID_MDI_CASCADE,
00288     ID_MDI_MAXIMIZE,
00289     ID_MDI_MINIMIZE,
00290     ID_MDI_RESTORE,
00291     ID_MDI_CLOSE,
00292     ID_MDI_WINDOW,
00293     ID_MDI_MENUWINDOW,
00294     ID_MDI_MENUMINIMIZE,
00295     ID_MDI_MENURESTORE,
00296     ID_MDI_MENUCLOSE,
00297     ID_MDI_NEXT,
00298     ID_MDI_PREV,
00299     ID_LAST
00300     };
00301 
00302 public:
00303 
00304   // Common DND type names
00305   static const FXchar octetTypeName[];
00306   static const FXchar deleteTypeName[];
00307   static const FXchar textTypeName[];
00308   static const FXchar colorTypeName[];
00309   static const FXchar urilistTypeName[];
00310   static const FXchar utf8TypeName[];
00311   static const FXchar utf16TypeName[];
00312   static const FXchar actionTypeName[];
00313 
00314 public:
00315 
00316   /// Constructor
00317   FXWindow(FXComposite* p,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00318 
00319   /// Return a pointer to the parent window
00320   FXWindow* getParent() const { return parent; }
00321 
00322   /// Return a pointer to the owner window
00323   FXWindow* getOwner() const { return owner; }
00324 
00325   /// Return a pointer to the shell window
00326   FXWindow* getShell() const;
00327 
00328   /// Return a pointer to the root window
00329   FXWindow* getRoot() const;
00330 
00331   /// Return a pointer to the next (sibling) window, if any
00332   FXWindow* getNext() const { return next; }
00333 
00334   /// Return a pointer to the previous (sibling) window , if any
00335   FXWindow* getPrev() const { return prev; }
00336 
00337   /// Return a pointer to this window's first child window , if any
00338   FXWindow* getFirst() const { return first; }
00339 
00340   /// Return a pointer to this window's last child window, if any
00341   FXWindow* getLast() const { return last; }
00342 
00343   /// Return a pointer to the currently focused child window
00344   FXWindow* getFocus() const { return focus; }
00345 
00346   /// Change window key
00347   void setKey(FXuint k){ wk=k; }
00348 
00349   /// Return window key
00350   FXuint getKey() const { return wk; }
00351 
00352   /// Return child window with given window key
00353   FXWindow* getChildWithKey(FXuint k) const;
00354 
00355   /// Set the message target object for this window
00356   void setTarget(FXObject *t){ target=t; }
00357 
00358   /// Get the message target object for this window, if any
00359   FXObject* getTarget() const { return target; }
00360 
00361   /// Set the message identifier for this window
00362   void setSelector(FXSelector sel){ message=sel; }
00363 
00364   /// Get the message identifier for this window
00365   FXSelector getSelector() const { return message; }
00366 
00367   /// Get this window's x-coordinate, in the parent's coordinate system
00368   FXint getX() const { return xpos; }
00369 
00370   /// Get this window's y-coordinate, in the parent's coordinate system
00371   FXint getY() const { return ypos; }
00372 
00373   /// Return the default width of this window
00374   virtual FXint getDefaultWidth();
00375 
00376   /// Return the default height of this window
00377   virtual FXint getDefaultHeight();
00378 
00379   /// Return width for given height
00380   virtual FXint getWidthForHeight(FXint givenheight);
00381 
00382   /// Return height for given width
00383   virtual FXint getHeightForWidth(FXint givenwidth);
00384 
00385   /// Set this window's x-coordinate, in the parent's coordinate system
00386   void setX(FXint x);
00387 
00388   /// Set this window's y-coordinate, in the parent's coordinate system
00389   void setY(FXint y);
00390 
00391   /**
00392   * Set the window width; and flag the widget as being in need of
00393   * layout by its parent.  This does not immediately update the server-
00394   * side representation of the widget.
00395   */
00396   void setWidth(FXint w);
00397 
00398   /**
00399   * Set the window height; and flag the widget as being in need of
00400   * layout by its parent.  This does not immediately update the server-
00401   * side representation of the widget.
00402   */
00403   void setHeight(FXint h);
00404 
00405   /// Set layout hints for this window
00406   void setLayoutHints(FXuint lout);
00407 
00408   /// Get layout hints for this window
00409   FXuint getLayoutHints() const;
00410 
00411   /// Return a pointer to the accelerator table
00412   FXAccelTable* getAccelTable() const { return accelTable; }
00413 
00414   /// Set the accelerator table
00415   void setAccelTable(FXAccelTable* acceltable){ accelTable=acceltable; }
00416 
00417   /// Add a hot key
00418   void addHotKey(FXHotKey code);
00419 
00420   /// Remove a hot key
00421   void remHotKey(FXHotKey code);
00422 
00423   /// Change help tag for this widget
00424   void setHelpTag(const FXString&  text){ tag=text; }
00425 
00426   /// Get the help tag for this widget
00427   const FXString& getHelpTag() const { return tag; }
00428 
00429   /// Return true if window is a shell window
00430   FXbool isShell() const;
00431 
00432   /// Return true if specified window is owned by this window
00433   FXbool isOwnerOf(const FXWindow* window) const;
00434 
00435   /// Return true if specified window is ancestor of this window
00436   FXbool isChildOf(const FXWindow* window) const;
00437 
00438   /// Return true if this window contains child in its subtree
00439   FXbool containsChild(const FXWindow* child) const;
00440 
00441   /// Return the child window at specified coordinates
00442   FXWindow* getChildAt(FXint x,FXint y) const;
00443 
00444   /// Return the number of child windows for this window
00445   FXint numChildren() const;
00446 
00447   /**
00448   * Return the index (starting from zero) of the specified child window,
00449   * or -1 if the window is not a child or NULL
00450   */
00451   FXint indexOfChild(const FXWindow *window) const;
00452 
00453   /**
00454   * Return the child window at specified index,
00455   * or NULL if the index is negative or out of range
00456   */
00457   FXWindow* childAtIndex(FXint index) const;
00458 
00459   /// Return the common ancestor of window a and window b
00460   static FXWindow* commonAncestor(FXWindow* a,FXWindow* b);
00461 
00462   /// Return TRUE if sibling a <= sibling b in list
00463   static FXbool before(const FXWindow *a,const FXWindow* b);
00464 
00465   /// Return TRUE if sibling a >= sibling b in list
00466   static FXbool after(const FXWindow *a,const FXWindow* b);
00467 
00468   /// Return compose context
00469   FXComposeContext* getComposeContext() const { return composeContext; }
00470 
00471   /// Create compose context
00472   void createComposeContext();
00473 
00474   /// Destroy compose context
00475   void destroyComposeContext();
00476 
00477   /// Is cursor shown
00478   FXbool cursorShown() const;
00479 
00480   /// Show or hide the cursor
00481   void showCursor(FXbool flag=true);
00482 
00483   /// Set the default cursor for this window
00484   void setDefaultCursor(FXCursor* cur);
00485 
00486   /// Return the default cursor for this window
00487   FXCursor* getDefaultCursor() const { return defaultCursor; }
00488 
00489   /// Set the drag cursor for this window
00490   void setDragCursor(FXCursor* cur);
00491 
00492   /// Return the drag cursor for this window
00493   FXCursor* getDragCursor() const { return dragCursor; }
00494 
00495   /// Return the cursor position and mouse button-state
00496   FXbool getCursorPosition(FXint& x,FXint& y,FXuint& buttons) const;
00497 
00498   /// Warp the cursor to the new position
00499   FXbool setCursorPosition(FXint x,FXint y);
00500 
00501   /// Return true if this window is able to receive mouse and keyboard events
00502   FXbool isEnabled() const;
00503 
00504   /// Return true if the window is active
00505   FXbool isActive() const;
00506 
00507   /// Return true if this window is a control capable of receiving the focus
00508   virtual FXbool canFocus() const;
00509 
00510   /// Return true if this window has the focus
00511   FXbool hasFocus() const;
00512 
00513   /// Return true if this window is in focus chain
00514   FXbool inFocusChain() const;
00515 
00516   /// Move the focus to this window
00517   virtual void setFocus();
00518 
00519   /// Remove the focus from this window
00520   virtual void killFocus();
00521 
00522   /// Notification that focus moved to new child
00523   virtual void changeFocus(FXWindow *child);
00524 
00525   /**
00526   * This changes the default window which responds to the Return
00527   * key in a dialog. If enable is TRUE, this window becomes the default
00528   * window; when enable is FALSE, this window will be no longer the
00529   * default window.  Finally, when enable is MAYBE, the default window
00530   * will revert to the initial default window.
00531   */
00532   virtual void setDefault(FXuchar flag=TRUE);
00533 
00534   /// Return true if this is the default window
00535   FXbool isDefault() const;
00536 
00537   /// Make this window the initial default window
00538   void setInitial(FXbool flag=true);
00539 
00540   /// Return true if this is the initial default window
00541   FXbool isInitial() const;
00542 
00543   /// Enable the window to receive mouse and keyboard events
00544   virtual void enable();
00545 
00546   /// Disable the window from receiving mouse and keyboard events
00547   virtual void disable();
00548 
00549   /// Create all of the server-side resources for this window
00550   virtual void create();
00551 
00552   /// Attach foreign window handle to this window
00553   virtual void attach(FXID w);
00554 
00555   /// Detach the server-side resources for this window
00556   virtual void detach();
00557 
00558   /// Destroy the server-side resources for this window
00559   virtual void destroy();
00560 
00561   /// Set window shape by means of region
00562   virtual void setShape(const FXRegion& region);
00563 
00564   /// Set window shape by means of bitmap
00565   virtual void setShape(FXBitmap* bitmap);
00566 
00567   /// Set window shape by means of icon
00568   virtual void setShape(FXIcon* icon);
00569 
00570   /// Clear window shape
00571   virtual void clearShape();
00572 
00573   /// Raise this window to the top of the stacking order
00574   virtual void raise();
00575 
00576   /// Lower this window to the bottom of the stacking order
00577   virtual void lower();
00578 
00579   /**
00580   * Move the window immediately, in the parent's coordinate system.
00581   * Update the server representation as well if the window is realized.
00582   * Perform layout of the children when necessary.
00583   */
00584   virtual void move(FXint x,FXint y);
00585 
00586   /**
00587   * Resize the window to the specified width and height immediately,
00588   * updating the server representation as well, if the window was realized.
00589   * Perform layout of the children when necessary.
00590   */
00591   virtual void resize(FXint w,FXint h);
00592 
00593   /**
00594   * Move and resize the window immediately, in the parent's coordinate system.
00595   * Update the server representation as well if the window is realized.
00596   * Perform layout of the children when necessary.
00597   */
00598   virtual void position(FXint x,FXint y,FXint w,FXint h);
00599 
00600   /// Mark this window's layout as dirty for later layout
00601   virtual void recalc();
00602 
00603   /// Perform layout immediately
00604   virtual void layout();
00605 
00606   /// Generate a SEL_UPDATE message for the window and its children
00607   void forceRefresh();
00608 
00609   /// Reparent this window under new father before other
00610   virtual void reparent(FXWindow* father,FXWindow *other=NULL);
00611 
00612   /// Scroll rectangle x,y,w,h by a shift of dx,dy
00613   void scroll(FXint x,FXint y,FXint w,FXint h,FXint dx,FXint dy) const;
00614 
00615   /// Mark the specified rectangle to be repainted later
00616   void update(FXint x,FXint y,FXint w,FXint h) const;
00617 
00618   /// Mark the entire window to be repainted later
00619   void update() const;
00620 
00621   /// Process any outstanding repaint messages immediately, for the given rectangle
00622   void repaint(FXint x,FXint y,FXint w,FXint h) const;
00623 
00624   /// Process any outstanding repaint messages immediately
00625   void repaint() const;
00626 
00627   /**
00628   * Grab the mouse to this window; future mouse events will be
00629   * reported to this window even while the cursor goes outside of this window
00630   */
00631   void grab();
00632 
00633   /// Release the mouse grab
00634   void ungrab();
00635 
00636   /// Return true if the window has been grabbed
00637   FXbool grabbed() const;
00638 
00639   /// Grab keyboard device
00640   void grabKeyboard();
00641 
00642   /// Ungrab keyboard device
00643   void ungrabKeyboard();
00644 
00645   /// Return true if active grab is in effect
00646   FXbool grabbedKeyboard() const;
00647 
00648   /// Show this window
00649   virtual void show();
00650 
00651   /// Hide this window
00652   virtual void hide();
00653 
00654   /// Return true if the window is shown
00655   FXbool shown() const;
00656 
00657   /// Return true if the window is composite
00658   virtual FXbool isComposite() const;
00659 
00660   /// Return true if the window is under the cursor
00661   FXbool underCursor() const;
00662 
00663   /// Return true if this window owns the primary selection
00664   FXbool hasSelection() const;
00665 
00666   /// Try to acquire the primary selection, given a list of drag types
00667   FXbool acquireSelection(const FXDragType *types,FXuint numtypes);
00668 
00669   /// Release the primary selection
00670   FXbool releaseSelection();
00671 
00672   /// Return true if this window owns the clipboard
00673   FXbool hasClipboard() const;
00674 
00675   /// Try to acquire the clipboard, given a list of drag types
00676   FXbool acquireClipboard(const FXDragType *types,FXuint numtypes);
00677 
00678   /// Release the clipboard
00679   FXbool releaseClipboard();
00680 
00681   /// Enable this window to receive drops
00682   virtual void dropEnable();
00683 
00684   /// Disable this window from receiving drops
00685   virtual void dropDisable();
00686 
00687   /// Return true if this window is able to receive drops
00688   FXbool isDropEnabled() const;
00689 
00690   /// Return true if a drag operaion has been initiated from this window
00691   FXbool isDragging() const;
00692 
00693   /// Initiate a drag operation with a list of previously registered drag types
00694   FXbool beginDrag(const FXDragType *types,FXuint numtypes);
00695 
00696   /**
00697   * When dragging, inform the drop-target of the new position and
00698   * the drag action
00699   */
00700   FXbool handleDrag(FXint x,FXint y,FXDragAction action=DRAG_COPY);
00701 
00702   /**
00703   * Terminate the drag operation with or without actually dropping the data
00704   * Returns the action performed by the target
00705   */
00706   FXDragAction endDrag(FXbool drop=true);
00707 
00708   /// Return true if this window is the target of a drop
00709   FXbool isDropTarget() const;
00710 
00711   /**
00712   * When being dragged over, indicate that no further SEL_DND_MOTION messages
00713   * are required while the cursor is inside the given rectangle
00714   */
00715   void setDragRectangle(FXint x,FXint y,FXint w,FXint h,FXbool wantupdates=true) const;
00716 
00717   /**
00718   * When being dragged over, indicate we want to receive SEL_DND_MOTION messages
00719   * every time the cursor moves
00720   */
00721   void clearDragRectangle() const;
00722 
00723   /// When being dragged over, indicate acceptance or rejection of the dragged data
00724   void acceptDrop(FXDragAction action=DRAG_ACCEPT) const;
00725 
00726   /// The target accepted our drop
00727   FXDragAction didAccept() const;
00728 
00729   /**
00730   * Sent by the drop target in response to SEL_DND_DROP.  The drag action
00731   * should be the same as the action the drop target reported to the drag
00732   * source in reponse to the SEL_DND_MOTION message.
00733   * This function notifies the drag source that its part of the drop transaction
00734   * is finished, and that it is free to release any resources involved in the
00735   * drag operation.
00736   * Calling dropFinished() is advisable in cases where the drop target needs
00737   * to perform complex processing on the data received from the drag source,
00738   * prior to returning from the SEL_DND_DROP message handler.
00739   */
00740   void dropFinished(FXDragAction action=DRAG_REJECT) const;
00741 
00742   /// When being dragged over, inquire the drag types which are being offered
00743   FXbool inquireDNDTypes(FXDNDOrigin origin,FXDragType*& types,FXuint& numtypes) const;
00744 
00745   /// When being dragged over, return true if we are offered the given drag type
00746   FXbool offeredDNDType(FXDNDOrigin origin,FXDragType type) const;
00747 
00748   /// When being dragged over, return the drag action
00749   FXDragAction inquireDNDAction() const;
00750 
00751   /**
00752   * Set DND data; the array must be allocated with FXMALLOC and ownership is
00753   * transferred to the system
00754   */
00755   FXbool setDNDData(FXDNDOrigin origin,FXDragType type,FXuchar* data,FXuint size) const;
00756 
00757   /**
00758   * Set DND data from string value.
00759   */
00760   FXbool setDNDData(FXDNDOrigin origin,FXDragType type,const FXString& string) const;
00761 
00762   /**
00763   * Get DND data; the caller becomes the owner of the array and must free it
00764   * with FXFREE
00765   */
00766   FXbool getDNDData(FXDNDOrigin origin,FXDragType type,FXuchar*& data,FXuint& size) const;
00767 
00768   /**
00769   * Get DND data into string value.
00770   */
00771   FXbool getDNDData(FXDNDOrigin origin,FXDragType type,FXString& string) const;
00772 
00773   /// Return true if window logically contains the given point
00774   virtual FXbool contains(FXint parentx,FXint parenty) const;
00775 
00776   /// Translate coordinates from fromwindow's coordinate space to this window's coordinate space
00777   void translateCoordinatesFrom(FXint& tox,FXint& toy,const FXWindow* fromwindow,FXint fromx,FXint fromy) const;
00778 
00779   /// Translate coordinates from this window's coordinate space to towindow's coordinate space
00780   void translateCoordinatesTo(FXint& tox,FXint& toy,const FXWindow* towindow,FXint fromx,FXint fromy) const;
00781 
00782   /// Set window background color
00783   virtual void setBackColor(FXColor clr);
00784 
00785   /// Get background color
00786   FXColor getBackColor() const { return backColor; }
00787 
00788   /// Does save-unders
00789   virtual FXbool doesSaveUnder() const;
00790 
00791   /**
00792   * Translate message for localization; using the current FXTranslator,
00793   * an attempt is made to translate the given message into the current
00794   * language.  An optional hint may be passed to break any ties in case
00795   * more than one tranlation is possible for the given message text.
00796   * In addition, the name of the widget is passed as context name so
00797   * that translations for a single dialog may be grouped together.
00798   */
00799   virtual const FXchar* tr(const FXchar* text,const FXchar* hint=NULL,FXint count=-1) const;
00800 
00801   /// Save window to stream
00802   virtual void save(FXStream& store) const;
00803 
00804   /// Restore window from stream
00805   virtual void load(FXStream& store);
00806 
00807   /// Destroy window
00808   virtual ~FXWindow();
00809   };
00810 
00811 }
00812 
00813 #endif

Copyright © 1997-2009 Jeroen van der Zijp