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

FXWindow.h

00001 /********************************************************************************
00002 *                                                                               *
00003 *                            W i n d o w   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: FXWindow.h,v 1.88 2002/09/30 13:06:56 fox Exp $                          *
00023 ********************************************************************************/
00024 #ifndef FXWINDOW_H
00025 #define FXWINDOW_H
00026 
00027 #ifndef FXDRAWABLE_H
00028 #include "FXDrawable.h"
00029 #endif
00030 
00031 
00032 namespace FX {
00033 
00034 
00035 /// Layout hints for child widgets
00036 enum {
00037   LAYOUT_NORMAL      = 0,                                   /// Default layout mode
00038   LAYOUT_SIDE_TOP    = 0,                                   /// Pack on top side (default)
00039   LAYOUT_SIDE_BOTTOM = 0x00000001,                          /// Pack on bottom side
00040   LAYOUT_SIDE_LEFT   = 0x00000002,                          /// Pack on left side
00041   LAYOUT_SIDE_RIGHT  = LAYOUT_SIDE_LEFT|LAYOUT_SIDE_BOTTOM, /// Pack on right side
00042   LAYOUT_FILL_COLUMN = 0x00000001,                          /// Matrix column is stretchable
00043   LAYOUT_FILL_ROW    = 0x00000002,                          /// Matrix row is stretchable
00044   LAYOUT_LEFT        = 0,                                   /// Stick on left (default)
00045   LAYOUT_RIGHT       = 0x00000004,                          /// Stick on right
00046   LAYOUT_CENTER_X    = 0x00000008,                          /// Center horizontally
00047   LAYOUT_FIX_X       = LAYOUT_RIGHT|LAYOUT_CENTER_X,        /// X fixed
00048   LAYOUT_TOP         = 0,                                   /// Stick on top (default)
00049   LAYOUT_BOTTOM      = 0x00000010,                          /// Stick on bottom
00050   LAYOUT_CENTER_Y    = 0x00000020,                          /// Center vertically
00051   LAYOUT_FIX_Y       = LAYOUT_BOTTOM|LAYOUT_CENTER_Y,       /// Y fixed
00052   LAYOUT_RESERVED_1  = 0x00000040,
00053   LAYOUT_RESERVED_2  = 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 FXCursor;
00087 class FXAccelTable;
00088 class FXComposite;
00089 
00090 
00091 /// Base class for all windows
00092 class FXAPI FXWindow : public FXDrawable {
00093   FXDECLARE(FXWindow)
00094 private:
00095   FXWindow     *parent;                 // Parent Window
00096   FXWindow     *owner;                  // Owner Window
00097   FXWindow     *first;                  // First Child
00098   FXWindow     *last;                   // Last Child
00099   FXWindow     *next;                   // Next Sibling
00100   FXWindow     *prev;                   // Previous Sibling
00101   FXWindow     *focus;                  // Focus Child
00102   FXuint        wk;                     // Window Key
00103 protected:
00104   FXCursor     *defaultCursor;          // Normal Cursor
00105   FXCursor     *dragCursor;             // Cursor during drag
00106   FXAccelTable *accelTable;             // Accelerator table
00107   FXObject     *target;                 // Target object
00108   FXSelector    message;                // Message ID
00109   FXint         xpos;                   // Window X Position
00110   FXint         ypos;                   // Window Y Position
00111   FXColor       backColor;              // Window background color
00112   FXString      tag;                    // Help tag
00113   FXuint        flags;                  // Window state flags
00114   FXuint        options;                // Window options
00115 public:
00116 
00117   // Common DND types
00118   static FXDragType deleteType;         // Delete request
00119   static FXDragType textType;           // Ascii text request
00120   static FXDragType stringType;         // Clipboard text type (pre-registered)
00121   static FXDragType colorType;          // Color
00122   static FXDragType urilistType;        // URI List
00123 
00124 protected:
00125 #ifdef WIN32
00126   virtual FXID GetDC() const;
00127   virtual int ReleaseDC(FXID) const;
00128   virtual const char* GetClass() const;
00129 #else
00130   void addColormapWindows();
00131   void remColormapWindows();
00132 #endif
00133 
00134 protected:
00135   FXWindow();
00136   FXWindow(FXApp* a,FXVisual *vis);
00137   FXWindow(FXApp* a,FXWindow* own,FXuint opts,FXint x,FXint y,FXint w,FXint h);
00138   static FXWindow* findDefault(FXWindow* window);
00139   static FXWindow* findInitial(FXWindow* window);
00140   virtual FXbool doesOverrideRedirect() const;
00141   virtual void layout();
00142 private:
00143   FXWindow(const FXWindow&);
00144   FXWindow& operator=(const FXWindow&);
00145 
00146 protected:
00147 
00148   // Window state flags
00149   enum {
00150     FLAG_SHOWN        = 0x00000001,     // Is shown
00151     FLAG_ENABLED      = 0x00000002,     // Able to receive input
00152     FLAG_UPDATE       = 0x00000004,     // Is subject to GUI update
00153     FLAG_DROPTARGET   = 0x00000008,     // Drop target
00154     FLAG_FOCUSED      = 0x00000010,     // Has focus
00155     FLAG_DIRTY        = 0x00000020,     // Needs layout
00156     FLAG_RECALC       = 0x00000040,     // Needs recalculation
00157     FLAG_TIP          = 0x00000080,     // Show tip
00158     FLAG_HELP         = 0x00000100,     // Show help
00159     FLAG_DEFAULT      = 0x00000200,     // Default widget
00160     FLAG_INITIAL      = 0x00000400,     // Initial widget
00161     FLAG_SHELL        = 0x00000800,     // Shell window
00162     FLAG_ACTIVE       = 0x00001000,     // Window is active
00163     FLAG_PRESSED      = 0x00002000,     // Button has been pressed
00164     FLAG_KEY          = 0x00004000,     // Keyboard key pressed
00165     FLAG_CARET        = 0x00008000,     // Caret is on
00166     FLAG_CHANGED      = 0x00010000,     // Window data changed
00167     FLAG_LASSO        = 0x00020000,     // Lasso mode
00168     FLAG_TRYDRAG      = 0x00040000,     // Tentative drag mode
00169     FLAG_DODRAG       = 0x00080000,     // Doing drag mode
00170     FLAG_SCROLLINSIDE = 0x00100000,     // Scroll only when inside
00171     FLAG_SCROLLING    = 0x00200000      // Right mouse scrolling
00172     };
00173 
00174 public:
00175 
00176   // Message handlers
00177   long onPaint(FXObject*,FXSelector,void*);
00178   long onMap(FXObject*,FXSelector,void*);
00179   long onUnmap(FXObject*,FXSelector,void*);
00180   long onConfigure(FXObject*,FXSelector,void*);
00181   long onUpdate(FXObject*,FXSelector,void*);
00182   long onMotion(FXObject*,FXSelector,void*);
00183   long onMouseWheel(FXObject*,FXSelector,void*);
00184   long onEnter(FXObject*,FXSelector,void*);
00185   long onLeave(FXObject*,FXSelector,void*);
00186   long onLeftBtnPress(FXObject*,FXSelector,void*);
00187   long onLeftBtnRelease(FXObject*,FXSelector,void*);
00188   long onMiddleBtnPress(FXObject*,FXSelector,void*);
00189   long onMiddleBtnRelease(FXObject*,FXSelector,void*);
00190   long onRightBtnPress(FXObject*,FXSelector,void*);
00191   long onRightBtnRelease(FXObject*,FXSelector,void*);
00192   long onBeginDrag(FXObject*,FXSelector,void*);
00193   long onEndDrag(FXObject*,FXSelector,void*);
00194   long onDragged(FXObject*,FXSelector,void*);
00195   long onKeyPress(FXObject*,FXSelector,void*);
00196   long onKeyRelease(FXObject*,FXSelector,void*);
00197   long onUngrabbed(FXObject*,FXSelector,void*);
00198   long onDestroy(FXObject*,FXSelector,void*);
00199   long onFocusSelf(FXObject*,FXSelector,void*);
00200   long onFocusIn(FXObject*,FXSelector,void*);
00201   long onFocusOut(FXObject*,FXSelector,void*);
00202   long onSelectionLost(FXObject*,FXSelector,void*);
00203   long onSelectionGained(FXObject*,FXSelector,void*);
00204   long onSelectionRequest(FXObject*,FXSelector,void*);
00205   long onClipboardLost(FXObject*,FXSelector,void*);
00206   long onClipboardGained(FXObject*,FXSelector,void*);
00207   long onClipboardRequest(FXObject*,FXSelector,void*);
00208   long onDNDEnter(FXObject*,FXSelector,void*);
00209   long onDNDLeave(FXObject*,FXSelector,void*);
00210   long onDNDMotion(FXObject*,FXSelector,void*);
00211   long onDNDDrop(FXObject*,FXSelector,void*);
00212   long onDNDRequest(FXObject*,FXSelector,void*);
00213   long onCmdShow(FXObject*,FXSelector,void*);
00214   long onCmdHide(FXObject*,FXSelector,void*);
00215   long onUpdToggleShown(FXObject*,FXSelector,void*);
00216   long onCmdToggleShown(FXObject*,FXSelector,void*);
00217   long onCmdRaise(FXObject*,FXSelector,void*);
00218   long onCmdLower(FXObject*,FXSelector,void*);
00219   long onCmdEnable(FXObject*,FXSelector,void*);
00220   long onCmdDisable(FXObject*,FXSelector,void*);
00221   long onCmdUpdate(FXObject*,FXSelector,void*);
00222   long onUpdYes(FXObject*,FXSelector,void*);
00223   long onCmdDelete(FXObject*,FXSelector,void*);
00224 
00225 public:
00226 
00227   // Message ID's common to most Windows
00228   enum {
00229     ID_NONE,
00230     ID_HIDE,
00231     ID_SHOW,
00232     ID_TOGGLESHOWN,
00233     ID_LOWER,
00234     ID_RAISE,
00235     ID_DELETE,
00236     ID_DISABLE,
00237     ID_ENABLE,
00238     ID_UNCHECK,
00239     ID_CHECK,
00240     ID_UNKNOWN,
00241     ID_UPDATE,
00242     ID_AUTOSCROLL,
00243     ID_HSCROLLED,
00244     ID_VSCROLLED,
00245     ID_SETVALUE,
00246     ID_SETINTVALUE,
00247     ID_SETREALVALUE,
00248     ID_SETSTRINGVALUE,
00249     ID_SETINTRANGE,
00250     ID_SETREALRANGE,
00251     ID_GETINTVALUE,
00252     ID_GETREALVALUE,
00253     ID_GETSTRINGVALUE,
00254     ID_GETINTRANGE,
00255     ID_GETREALRANGE,
00256     ID_QUERY_TIP,
00257     ID_QUERY_HELP,
00258     ID_QUERY_MENU,
00259     ID_HOTKEY,
00260     ID_ACCEL,
00261     ID_UNPOST,
00262     ID_POST,
00263     ID_MDI_TILEHORIZONTAL,
00264     ID_MDI_TILEVERTICAL,
00265     ID_MDI_CASCADE,
00266     ID_MDI_MAXIMIZE,
00267     ID_MDI_MINIMIZE,
00268     ID_MDI_RESTORE,
00269     ID_MDI_CLOSE,
00270     ID_MDI_WINDOW,
00271     ID_MDI_MENUWINDOW,
00272     ID_MDI_MENUMINIMIZE,
00273     ID_MDI_MENURESTORE,
00274     ID_MDI_MENUCLOSE,
00275     ID_MDI_NEXT,
00276     ID_MDI_PREV,
00277     ID_CLOSE_DOCUMENT,
00278     ID_CLOSE_ALL_DOCUMENTS,
00279     ID_LAST
00280     };
00281 
00282 public:
00283 
00284   // Common DND type names
00285   static const FXchar deleteTypeName[];
00286   static const FXchar textTypeName[];
00287   static const FXchar colorTypeName[];
00288   static const FXchar urilistTypeName[];
00289 
00290 public:
00291 
00292   /// Constructor
00293   FXWindow(FXComposite* p,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00294 
00295   /// Return a pointer to the parent window
00296   FXWindow* getParent() const { return parent; }
00297 
00298   /// Return a pointer to the owner window
00299   FXWindow* getOwner() const { return owner; }
00300 
00301   /// Return a pointer to the shell window
00302   FXWindow* getShell() const;
00303 
00304   /// Return a pointer to the root window
00305   FXWindow* getRoot() const;
00306 
00307   /// Return a pointer to the next (sibling) window, if any
00308   FXWindow* getNext() const { return next; }
00309 
00310   /// Return a pointer to the previous (sibling) window , if any
00311   FXWindow* getPrev() const { return prev; }
00312 
00313   /// Return a pointer to this window's first child window , if any
00314   FXWindow* getFirst() const { return first; }
00315 
00316   /// Return a pointer to this window's last child window, if any
00317   FXWindow* getLast() const { return last; }
00318 
00319   /// Return a pointer to the currently focused child window
00320   FXWindow* getFocus() const { return focus; }
00321 
00322   /// Change window key
00323   void setKey(FXuint k){ wk=k; }
00324 
00325   /// Return window key
00326   FXuint getKey() const { return wk; }
00327 
00328   /// Set the message target object for this window
00329   void setTarget(FXObject *t){ target=t; }
00330 
00331   /// Get the message target object for this window, if any
00332   FXObject* getTarget() const { return target; }
00333 
00334   /// Set the message identifier for this window
00335   void setSelector(FXSelector sel){ message=sel; }
00336 
00337   /// Get the message identifier for this window
00338   FXSelector getSelector() const { return message; }
00339 
00340   /// Get this window's x-coordinate, in the parent's coordinate system
00341   FXint getX() const { return xpos; }
00342 
00343   /// Get this window's y-coordinate, in the parent's coordinate system
00344   FXint getY() const { return ypos; }
00345 
00346   /// Return the default width of this window
00347   virtual FXint getDefaultWidth();
00348 
00349   /// Return the default height of this window
00350   virtual FXint getDefaultHeight();
00351 
00352   /// Return width for given height
00353   virtual FXint getWidthForHeight(FXint givenheight);
00354 
00355   /// Return height for given width
00356   virtual FXint getHeightForWidth(FXint givenwidth);
00357 
00358   /// Set this window's x-coordinate, in the parent's coordinate system
00359   void setX(FXint x);
00360 
00361   /// Set this window's y-coordinate, in the parent's coordinate system
00362   void setY(FXint y);
00363 
00364   /// Set the window width
00365   void setWidth(FXint w);
00366 
00367   /// Set the window height
00368   void setHeight(FXint h);
00369 
00370   /// Set layout hints for this window
00371   void setLayoutHints(FXuint lout);
00372 
00373   /// Get layout hints for this window
00374   FXuint getLayoutHints() const;
00375 
00376   /// Return a pointer to the accelerator table
00377   FXAccelTable* getAccelTable() const { return accelTable; }
00378 
00379   /// Set the accelerator table
00380   void setAccelTable(FXAccelTable* acceltable){ accelTable=acceltable; }
00381 
00382   /// Add a hot key
00383   void addHotKey(FXHotKey code);
00384 
00385   /// Remove a hot key
00386   void remHotKey(FXHotKey code);
00387 
00388   /// Change help tag for this widget
00389   void setHelpTag(const FXString&  text){ tag=text; }
00390 
00391   /// Get the help tag for this widget
00392   const FXString& getHelpTag() const { return tag; }
00393 
00394   /// Return true if window is a shell window
00395   FXbool isShell() const;
00396 
00397   /// Return true if specified window is owned by this window
00398   FXbool isOwnerOf(const FXWindow* window) const;
00399 
00400   /// Return true if specified window is this window's parent
00401   FXbool isChildOf(const FXWindow* window) const;
00402 
00403   /// Return true if specified window is a child of this window
00404   FXbool containsChild(const FXWindow* child) const;
00405 
00406   /// Return the child window at specified coordinates
00407   FXWindow* getChildAt(FXint x,FXint y) const;
00408 
00409   /// Return the number of child windows for this window
00410   FXint numChildren() const;
00411 
00412   /**
00413   * Return the index (starting from zero) of the specified child window,
00414   * or -1 if the window is not a child or NULL
00415   */
00416   FXint indexOfChild(const FXWindow *window) const;
00417 
00418   /**
00419   * Return the child window at specified index,
00420   * or NULL if the index is negative or out of range
00421   */
00422   FXWindow* childAtIndex(FXint index) const;
00423 
00424   /// Return the common ancestor of window a and window b
00425   static FXWindow* commonAncestor(FXWindow* a,FXWindow* b);
00426 
00427   /// Set the default cursor for this window
00428   void setDefaultCursor(FXCursor* cur);
00429 
00430   /// Return the default cursor for this window
00431   FXCursor* getDefaultCursor() const { return defaultCursor; }
00432 
00433   /// Set the drag cursor for this window
00434   void setDragCursor(FXCursor* cur);
00435 
00436   /// Return the drag cursor for this window
00437   FXCursor* getDragCursor() const { return dragCursor; }
00438 
00439   /// Return the cursor position and mouse button-state
00440   FXint getCursorPosition(FXint& x,FXint& y,FXuint& buttons) const;
00441 
00442   /// Warp the cursor to the new position
00443   FXint setCursorPosition(FXint x,FXint y);
00444 
00445   /// Return true if this window is able to receive mouse and keyboard events
00446   FXbool isEnabled() const;
00447 
00448   /// Return true if the window is active
00449   FXbool isActive() const;
00450 
00451   /// Return true if this window is a control capable of receiving the focus
00452   virtual FXbool canFocus() const;
00453 
00454   /// Return true if this window has the focus
00455   FXbool hasFocus() const;
00456 
00457   /// Move the focus to this window
00458   virtual void setFocus();
00459 
00460   /// Remove the focus from this window
00461   virtual void killFocus();
00462 
00463   /**
00464   * This changes the default window which responds to the Return
00465   * key in a dialog. If enable is TRUE, this window becomes the default
00466   * window; when enable is FALSE, this window will be no longer the
00467   * default window.  Finally, when enable is MAYBE, the default window
00468   * will revert to the initial default window.
00469   */
00470   virtual void setDefault(FXbool enable=TRUE);
00471 
00472   /// Return true if this is the default window
00473   FXbool isDefault() const;
00474 
00475   /// Make this window the initial default window
00476   void setInitial(FXbool enable=TRUE);
00477 
00478   /// Return true if this is the initial default window
00479   FXbool isInitial() const;
00480 
00481   /// Enable the window to receive mouse and keyboard events
00482   virtual void enable();
00483 
00484   /// Disable the window from receiving mouse and keyboard events
00485   virtual void disable();
00486 
00487   /// Create all of the server-side resources for this window
00488   virtual void create();
00489 
00490   /// Detach the server-side resources for this window
00491   virtual void detach();
00492 
00493   /// Destroy the server-side resources for this window
00494   virtual void destroy();
00495 
00496   /// Raise this window to the top of the stacking order
00497   virtual void raise();
00498 
00499   /// Lower this window to the bottom of the stacking order
00500   virtual void lower();
00501 
00502   /// Move this window to the specified position in the parent's coordinates
00503   virtual void move(FXint x,FXint y);
00504 
00505   /// Resize this window to the specified width and height
00506   virtual void resize(FXint w,FXint h);
00507 
00508   /// Move and resize this window in the parent's coordinates
00509   virtual void position(FXint x,FXint y,FXint w,FXint h);
00510 
00511   /// Mark this window's layout as dirty
00512   virtual void recalc();
00513 
00514   /// Force a GUI update of this window and its children
00515   void forceRefresh();
00516 
00517   /// Change the parent for this window
00518   virtual void reparent(FXWindow* newparent);
00519 
00520   /// Scroll rectangle x,y,w,h by a shift of dx,dy
00521   void scroll(FXint x,FXint y,FXint w,FXint h,FXint dx,FXint dy) const;
00522 
00523   /// Mark the specified rectangle dirty, i.e. to be repainted
00524   void update(FXint x,FXint y,FXint w,FXint h) const;
00525 
00526   /// Mark the entire window client area dirty
00527   void update() const;
00528 
00529   /// If marked but not yet painted, paint the given area
00530   void repaint(FXint x,FXint y,FXint w,FXint h) const;
00531 
00532   /// If marked but not yet painted, paint the entire window
00533   void repaint() const;
00534 
00535   /**
00536   * Grab the mouse to this window; future mouse events will be
00537   * reported to this window even while the cursor goes outside of this window
00538   */
00539   void grab();
00540 
00541   /// Release the mouse grab
00542   void ungrab();
00543 
00544   /// Return true if the window has been grabbed
00545   FXbool grabbed() const;
00546 
00547   /// Grab keyboard device
00548   void grabKeyboard();
00549 
00550   /// Ungrab keyboard device
00551   void ungrabKeyboard();
00552 
00553   /// Return true if active grab is in effect
00554   FXbool grabbedKeyboard() const;
00555 
00556   /// Show this window
00557   virtual void show();
00558 
00559   /// Hide this window
00560   virtual void hide();
00561 
00562   /// Return true if the window is shown
00563   FXbool shown() const;
00564 
00565   /// Return true if the window is composite
00566   virtual FXbool isComposite() const;
00567 
00568   /// Return true if the window is under the cursor
00569   FXbool underCursor() const;
00570 
00571   /// Return true if this window owns the primary selection
00572   FXbool hasSelection() const;
00573 
00574   /// Try to acquire the primary selection, given a list of drag types
00575   FXbool acquireSelection(const FXDragType *types,FXuint numtypes);
00576 
00577   /// Release the primary selection
00578   FXbool releaseSelection();
00579 
00580   /// Return true if this window owns the clipboard
00581   FXbool hasClipboard() const;
00582 
00583   /// Try to acquire the clipboard, given a list of drag types
00584   FXbool acquireClipboard(const FXDragType *types,FXuint numtypes);
00585 
00586   /// Release the clipboard
00587   FXbool releaseClipboard();
00588 
00589   /// Enable this window to receive drops
00590   void dropEnable();
00591 
00592   /// Disable this window from receiving drops
00593   void dropDisable();
00594 
00595   /// Return true if this window is able to receive drops
00596   FXbool isDropEnabled() const;
00597 
00598   /// Return true if a drag operaion has been initiated from this window
00599   FXbool isDragging() const;
00600 
00601   /// Initiate a drag operation with a list of previously registered drag types
00602   FXbool beginDrag(const FXDragType *types,FXuint numtypes);
00603 
00604   /**
00605   * When dragging, inform the drop-target of the new position and
00606   * the drag action
00607   */
00608   FXbool handleDrag(FXint x,FXint y,FXDragAction action=DRAG_COPY);
00609 
00610   /// Terminate the drag operation with or without actually dropping the data
00611   FXbool endDrag(FXbool drop=TRUE);
00612 
00613   /// Return true if this window is the target of a drop
00614   FXbool isDropTarget() const;
00615 
00616   /**
00617   * When being dragged over, indicate that no further SEL_DND_MOTION messages
00618   * are required while the cursor is inside the given rectangle
00619   */
00620   void setDragRectangle(FXint x,FXint y,FXint w,FXint h,FXbool wantupdates=TRUE) const;
00621 
00622   /**
00623   * When being dragged over, indicate we want to receive SEL_DND_MOTION messages
00624   * every time the cursor moves
00625   */
00626   void clearDragRectangle() const;
00627 
00628   /// When being dragged over, indicate acceptance or rejection of the dragged data
00629   void acceptDrop(FXDragAction action=DRAG_ACCEPT) const;
00630 
00631   /// The target accepted our drop
00632   FXDragAction didAccept() const;
00633 
00634   /// When being dragged over, inquire the drag types which are being offered
00635   FXbool inquireDNDTypes(FXDNDOrigin origin,FXDragType*& types,FXuint& numtypes) const;
00636 
00637   /// When being dragged over, return true if we are offered the given drag type
00638   FXbool offeredDNDType(FXDNDOrigin origin,FXDragType type) const;
00639 
00640   /// When being dragged over, return the drag action
00641   FXDragAction inquireDNDAction() const;
00642 
00643   /**
00644   * Set DND data; the array must be allocated with FXMALLOC and ownership is
00645   * transferred to the system
00646   */
00647   FXbool setDNDData(FXDNDOrigin origin,FXDragType type,FXuchar* data,FXuint size) const;
00648 
00649   /**
00650   * Get DND data; the caller becomes the owner of the array and must free it
00651   * with FXFREE
00652   */
00653   FXbool getDNDData(FXDNDOrigin origin,FXDragType type,FXuchar*& data,FXuint& size) const;
00654 
00655   /// Return true if window logically contains the given point
00656   virtual FXbool contains(FXint parentx,FXint parenty) const;
00657 
00658   /// Translate coordinates from fromwindow's coordinate space to this window's coordinate space
00659   void translateCoordinatesFrom(FXint& tox,FXint& toy,const FXWindow* fromwindow,FXint fromx,FXint fromy) const;
00660 
00661   /// Translate coordinates from this window's coordinate space to towindow's coordinate space
00662   void translateCoordinatesTo(FXint& tox,FXint& toy,const FXWindow* towindow,FXint fromx,FXint fromy) const;
00663 
00664   /// Set window background color
00665   virtual void setBackColor(FXColor clr);
00666 
00667   /// Get background color
00668   FXColor getBackColor() const { return backColor; }
00669 
00670   /// Relink this window before sibling in the window list
00671   void linkBefore(FXWindow* sibling);
00672 
00673   /// Relink this window after sibling in the window list
00674   void linkAfter(FXWindow* sibling);
00675 
00676   virtual FXbool doesSaveUnder() const;
00677 
00678   /// Save window to stream
00679   virtual void save(FXStream& store) const;
00680 
00681   /// Restore window from stream
00682   virtual void load(FXStream& store);
00683 
00684   /// Destroy window
00685   virtual ~FXWindow();
00686   };
00687 
00688 }
00689 
00690 #endif