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