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

Copyright © 1997-2005 Jeroen van der Zijp