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,2006 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.149 2006/01/22 17:58:12 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 class FXComposeContext; 00094 00095 00096 /// Base class for all windows 00097 class FXAPI FXWindow : public FXDrawable { 00098 FXDECLARE(FXWindow) 00099 friend class FXApp; 00100 private: 00101 FXWindow *parent; // Parent Window 00102 FXWindow *owner; // Owner Window 00103 FXWindow *first; // First Child 00104 FXWindow *last; // Last Child 00105 FXWindow *next; // Next Sibling 00106 FXWindow *prev; // Previous Sibling 00107 FXWindow *focus; // Focus Child 00108 FXuint wk; // Window Key 00109 protected: 00110 FXComposeContext *composeContext; // Compose context 00111 FXCursor *defaultCursor; // Normal Cursor 00112 FXCursor *dragCursor; // Cursor during drag 00113 FXAccelTable *accelTable; // Accelerator table 00114 FXObject *target; // Target object 00115 FXSelector message; // Message ID 00116 FXint xpos; // Window X Position 00117 FXint ypos; // Window Y Position 00118 FXColor backColor; // Window background color 00119 FXString tag; // Help tag 00120 FXuint flags; // Window state flags 00121 FXuint options; // Window options 00122 public: 00123 static FXDragType octetType; // Raw octet stream 00124 static FXDragType deleteType; // Delete request 00125 static FXDragType textType; // Ascii text request 00126 static FXDragType utf8Type; // UTF-8 text request 00127 static FXDragType utf16Type; // UTF-16 text request 00128 static FXDragType colorType; // Color 00129 static FXDragType urilistType; // URI List 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 bool doesOverrideRedirect() const; 00139 protected: 00140 #ifdef WIN32 00141 virtual FXID GetDC() const; 00142 virtual int ReleaseDC(FXID) const; 00143 virtual const char* 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 00178 }; 00179 00180 public: 00181 00182 // Message handlers 00183 long onPaint(FXObject*,FXSelector,void*); 00184 long onMap(FXObject*,FXSelector,void*); 00185 long onUnmap(FXObject*,FXSelector,void*); 00186 long onConfigure(FXObject*,FXSelector,void*); 00187 long onUpdate(FXObject*,FXSelector,void*); 00188 long onMotion(FXObject*,FXSelector,void*); 00189 long onMouseWheel(FXObject*,FXSelector,void*); 00190 long onEnter(FXObject*,FXSelector,void*); 00191 long onLeave(FXObject*,FXSelector,void*); 00192 long onLeftBtnPress(FXObject*,FXSelector,void*); 00193 long onLeftBtnRelease(FXObject*,FXSelector,void*); 00194 long onMiddleBtnPress(FXObject*,FXSelector,void*); 00195 long onMiddleBtnRelease(FXObject*,FXSelector,void*); 00196 long onRightBtnPress(FXObject*,FXSelector,void*); 00197 long onRightBtnRelease(FXObject*,FXSelector,void*); 00198 long onBeginDrag(FXObject*,FXSelector,void*); 00199 long onEndDrag(FXObject*,FXSelector,void*); 00200 long onDragged(FXObject*,FXSelector,void*); 00201 long onKeyPress(FXObject*,FXSelector,void*); 00202 long onKeyRelease(FXObject*,FXSelector,void*); 00203 long onUngrabbed(FXObject*,FXSelector,void*); 00204 long onDestroy(FXObject*,FXSelector,void*); 00205 long onFocusSelf(FXObject*,FXSelector,void*); 00206 long onFocusIn(FXObject*,FXSelector,void*); 00207 long onFocusOut(FXObject*,FXSelector,void*); 00208 long onSelectionLost(FXObject*,FXSelector,void*); 00209 long onSelectionGained(FXObject*,FXSelector,void*); 00210 long onSelectionRequest(FXObject*,FXSelector,void*); 00211 long onClipboardLost(FXObject*,FXSelector,void*); 00212 long onClipboardGained(FXObject*,FXSelector,void*); 00213 long onClipboardRequest(FXObject*,FXSelector,void*); 00214 long onDNDEnter(FXObject*,FXSelector,void*); 00215 long onDNDLeave(FXObject*,FXSelector,void*); 00216 long onDNDMotion(FXObject*,FXSelector,void*); 00217 long onDNDDrop(FXObject*,FXSelector,void*); 00218 long onDNDRequest(FXObject*,FXSelector,void*); 00219 long onQueryHelp(FXObject*,FXSelector,void*); 00220 long onQueryTip(FXObject*,FXSelector,void*); 00221 long onCmdShow(FXObject*,FXSelector,void*); 00222 long onCmdHide(FXObject*,FXSelector,void*); 00223 long onUpdToggleShown(FXObject*,FXSelector,void*); 00224 long onCmdToggleShown(FXObject*,FXSelector,void*); 00225 long onCmdRaise(FXObject*,FXSelector,void*); 00226 long onCmdLower(FXObject*,FXSelector,void*); 00227 long onCmdEnable(FXObject*,FXSelector,void*); 00228 long onCmdDisable(FXObject*,FXSelector,void*); 00229 long onUpdToggleEnabled(FXObject*,FXSelector,void*); 00230 long onCmdToggleEnabled(FXObject*,FXSelector,void*); 00231 long onCmdUpdate(FXObject*,FXSelector,void*); 00232 long onUpdYes(FXObject*,FXSelector,void*); 00233 long onCmdDelete(FXObject*,FXSelector,void*); 00234 00235 public: 00236 00237 // Message ID's common to most Windows 00238 enum { 00239 ID_NONE, 00240 ID_HIDE, // ID_HIDE+FALSE 00241 ID_SHOW, // ID_HIDE+TRUE 00242 ID_TOGGLESHOWN, 00243 ID_LOWER, 00244 ID_RAISE, 00245 ID_DELETE, 00246 ID_DISABLE, // ID_DISABLE+FALSE 00247 ID_ENABLE, // ID_DISABLE+TRUE 00248 ID_TOGGLEENABLED, 00249 ID_UNCHECK, // ID_UNCHECK+FALSE 00250 ID_CHECK, // ID_UNCHECK+TRUE 00251 ID_UNKNOWN, // ID_UNCHECK+MAYBE 00252 ID_UPDATE, 00253 ID_AUTOSCROLL, 00254 ID_TIPTIMER, 00255 ID_HSCROLLED, 00256 ID_VSCROLLED, 00257 ID_SETVALUE, 00258 ID_SETINTVALUE, 00259 ID_SETREALVALUE, 00260 ID_SETSTRINGVALUE, 00261 ID_SETICONVALUE, 00262 ID_SETINTRANGE, 00263 ID_SETREALRANGE, 00264 ID_GETINTVALUE, 00265 ID_GETREALVALUE, 00266 ID_GETSTRINGVALUE, 00267 ID_GETICONVALUE, 00268 ID_GETINTRANGE, 00269 ID_GETREALRANGE, 00270 ID_SETHELPSTRING, 00271 ID_GETHELPSTRING, 00272 ID_SETTIPSTRING, 00273 ID_GETTIPSTRING, 00274 ID_QUERY_MENU, 00275 ID_HOTKEY, 00276 ID_ACCEL, 00277 ID_UNPOST, 00278 ID_POST, 00279 ID_MDI_TILEHORIZONTAL, 00280 ID_MDI_TILEVERTICAL, 00281 ID_MDI_CASCADE, 00282 ID_MDI_MAXIMIZE, 00283 ID_MDI_MINIMIZE, 00284 ID_MDI_RESTORE, 00285 ID_MDI_CLOSE, 00286 ID_MDI_WINDOW, 00287 ID_MDI_MENUWINDOW, 00288 ID_MDI_MENUMINIMIZE, 00289 ID_MDI_MENURESTORE, 00290 ID_MDI_MENUCLOSE, 00291 ID_MDI_NEXT, 00292 ID_MDI_PREV, 00293 ID_LAST 00294 }; 00295 00296 public: 00297 00298 // Common DND type names 00299 static const FXchar octetTypeName[]; 00300 static const FXchar deleteTypeName[]; 00301 static const FXchar textTypeName[]; 00302 static const FXchar colorTypeName[]; 00303 static const FXchar urilistTypeName[]; 00304 static const FXchar utf8TypeName[]; 00305 static const FXchar utf16TypeName[]; 00306 00307 public: 00308 00309 /// Constructor 00310 FXWindow(FXComposite* p,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0); 00311 00312 /// Return a pointer to the parent window 00313 FXWindow* getParent() const { return parent; } 00314 00315 /// Return a pointer to the owner window 00316 FXWindow* getOwner() const { return owner; } 00317 00318 /// Return a pointer to the shell window 00319 FXWindow* getShell() const; 00320 00321 /// Return a pointer to the root window 00322 FXWindow* getRoot() const; 00323 00324 /// Return a pointer to the next (sibling) window, if any 00325 FXWindow* getNext() const { return next; } 00326 00327 /// Return a pointer to the previous (sibling) window , if any 00328 FXWindow* getPrev() const { return prev; } 00329 00330 /// Return a pointer to this window's first child window , if any 00331 FXWindow* getFirst() const { return first; } 00332 00333 /// Return a pointer to this window's last child window, if any 00334 FXWindow* getLast() const { return last; } 00335 00336 /// Return a pointer to the currently focused child window 00337 FXWindow* getFocus() const { return focus; } 00338 00339 /// Change window key 00340 void setKey(FXuint k){ wk=k; } 00341 00342 /// Return window key 00343 FXuint getKey() const { return wk; } 00344 00345 /// Set the message target object for this window 00346 void setTarget(FXObject *t){ target=t; } 00347 00348 /// Get the message target object for this window, if any 00349 FXObject* getTarget() const { return target; } 00350 00351 /// Set the message identifier for this window 00352 void setSelector(FXSelector sel){ message=sel; } 00353 00354 /// Get the message identifier for this window 00355 FXSelector getSelector() const { return message; } 00356 00357 /// Get this window's x-coordinate, in the parent's coordinate system 00358 FXint getX() const { return xpos; } 00359 00360 /// Get this window's y-coordinate, in the parent's coordinate system 00361 FXint getY() const { return ypos; } 00362 00363 /// Return the default width of this window 00364 virtual FXint getDefaultWidth(); 00365 00366 /// Return the default height of this window 00367 virtual FXint getDefaultHeight(); 00368 00369 /// Return width for given height 00370 virtual FXint getWidthForHeight(FXint givenheight); 00371 00372 /// Return height for given width 00373 virtual FXint getHeightForWidth(FXint givenwidth); 00374 00375 /// Set this window's x-coordinate, in the parent's coordinate system 00376 void setX(FXint x); 00377 00378 /// Set this window's y-coordinate, in the parent's coordinate system 00379 void setY(FXint y); 00380 00381 /** 00382 * Set the window width; and flag the widget as being in need of 00383 * layout by its parent. This does not immediately update the server- 00384 * side representation of the widget. 00385 */ 00386 void setWidth(FXint w); 00387 00388 /** 00389 * Set the window height; and flag the widget as being in need of 00390 * layout by its parent. This does not immediately update the server- 00391 * side representation of the widget. 00392 */ 00393 void setHeight(FXint h); 00394 00395 /// Set layout hints for this window 00396 void setLayoutHints(FXuint lout); 00397 00398 /// Get layout hints for this window 00399 FXuint getLayoutHints() const; 00400 00401 /// Return a pointer to the accelerator table 00402 FXAccelTable* getAccelTable() const { return accelTable; } 00403 00404 /// Set the accelerator table 00405 void setAccelTable(FXAccelTable* acceltable){ accelTable=acceltable; } 00406 00407 /// Add a hot key 00408 void addHotKey(FXHotKey code); 00409 00410 /// Remove a hot key 00411 void remHotKey(FXHotKey code); 00412 00413 /// Change help tag for this widget 00414 void setHelpTag(const FXString& text){ tag=text; } 00415 00416 /// Get the help tag for this widget 00417 const FXString& getHelpTag() const { return tag; } 00418 00419 /// Return true if window is a shell window 00420 bool isShell() const; 00421 00422 /// Return true if specified window is owned by this window 00423 bool isOwnerOf(const FXWindow* window) const; 00424 00425 /// Return true if specified window is ancestor of this window 00426 bool isChildOf(const FXWindow* window) const; 00427 00428 /// Return true if this window contains child in its subtree 00429 bool containsChild(const FXWindow* child) const; 00430 00431 /// Return the child window at specified coordinates 00432 FXWindow* getChildAt(FXint x,FXint y) const; 00433 00434 /// Return the number of child windows for this window 00435 FXint numChildren() const; 00436 00437 /** 00438 * Return the index (starting from zero) of the specified child window, 00439 * or -1 if the window is not a child or NULL 00440 */ 00441 FXint indexOfChild(const FXWindow *window) const; 00442 00443 /** 00444 * Return the child window at specified index, 00445 * or NULL if the index is negative or out of range 00446 */ 00447 FXWindow* childAtIndex(FXint index) const; 00448 00449 /// Return the common ancestor of window a and window b 00450 static FXWindow* commonAncestor(FXWindow* a,FXWindow* b); 00451 00452 /// Return TRUE if sibling a <= sibling b in list 00453 static bool before(const FXWindow *a,const FXWindow* b); 00454 00455 /// Return TRUE if sibling a >= sibling b in list 00456 static bool after(const FXWindow *a,const FXWindow* b); 00457 00458 /// Return compose context 00459 FXComposeContext* getComposeContext() const { return composeContext; } 00460 00461 /// Create compose context 00462 void createComposeContext(); 00463 00464 /// Destroy compose context 00465 void destroyComposeContext(); 00466 00467 /// Set the default cursor for this window 00468 void setDefaultCursor(FXCursor* cur); 00469 00470 /// Return the default cursor for this window 00471 FXCursor* getDefaultCursor() const { return defaultCursor; } 00472 00473 /// Set the drag cursor for this window 00474 void setDragCursor(FXCursor* cur); 00475 00476 /// Return the drag cursor for this window 00477 FXCursor* getDragCursor() const { return dragCursor; } 00478 00479 /// Return the cursor position and mouse button-state 00480 FXint getCursorPosition(FXint& x,FXint& y,FXuint& buttons) const; 00481 00482 /// Warp the cursor to the new position 00483 FXint setCursorPosition(FXint x,FXint y); 00484 00485 /// Return true if this window is able to receive mouse and keyboard events 00486 bool isEnabled() const; 00487 00488 /// Return true if the window is active 00489 bool isActive() const; 00490 00491 /// Return true if this window is a control capable of receiving the focus 00492 virtual bool canFocus() const; 00493 00494 /// Return true if this window has the focus 00495 bool hasFocus() const; 00496 00497 /// Return true if this window is in focus chain 00498 bool inFocusChain() const; 00499 00500 /// Move the focus to this window 00501 virtual void setFocus(); 00502 00503 /// Remove the focus from this window 00504 virtual void killFocus(); 00505 00506 /// Notification that focus moved to new child 00507 virtual void changeFocus(FXWindow *child); 00508 00509 /** 00510 * This changes the default window which responds to the Return 00511 * key in a dialog. If enable is TRUE, this window becomes the default 00512 * window; when enable is FALSE, this window will be no longer the 00513 * default window. Finally, when enable is MAYBE, the default window 00514 * will revert to the initial default window. 00515 */ 00516 virtual void setDefault(FXbool enable=TRUE); 00517 00518 /// Return true if this is the default window 00519 bool isDefault() const; 00520 00521 /// Make this window the initial default window 00522 void setInitial(bool enable=true); 00523 00524 /// Return true if this is the initial default window 00525 bool isInitial() const; 00526 00527 /// Enable the window to receive mouse and keyboard events 00528 virtual void enable(); 00529 00530 /// Disable the window from receiving mouse and keyboard events 00531 virtual void disable(); 00532 00533 /// Create all of the server-side resources for this window 00534 virtual void create(); 00535 00536 /// Attach foreign window handle to this window 00537 virtual void attach(FXID w); 00538 00539 /// Detach the server-side resources for this window 00540 virtual void detach(); 00541 00542 /// Destroy the server-side resources for this window 00543 virtual void destroy(); 00544 00545 /// Set window shape by means of region 00546 virtual void setShape(const FXRegion& region); 00547 00548 /// Set window shape by means of bitmap 00549 virtual void setShape(FXBitmap* bitmap); 00550 00551 /// Set window shape by means of icon 00552 virtual void setShape(FXIcon* icon); 00553 00554 /// Clear window shape 00555 virtual void clearShape(); 00556 00557 /// Raise this window to the top of the stacking order 00558 virtual void raise(); 00559 00560 /// Lower this window to the bottom of the stacking order 00561 virtual void lower(); 00562 00563 /** 00564 * Move the window immediately, in the parent's coordinate system. 00565 * Update the server representation as well if the window is realized. 00566 * Perform layout of the children when necessary. 00567 */ 00568 virtual void move(FXint x,FXint y); 00569 00570 /** 00571 * Resize the window to the specified width and height immediately, 00572 * updating the server representation as well, if the window was realized. 00573 * Perform layout of the children when necessary. 00574 */ 00575 virtual void resize(FXint w,FXint h); 00576 00577 /** 00578 * Move and resize the window immediately, in the parent's coordinate system. 00579 * Update the server representation as well if the window is realized. 00580 * Perform layout of the children when necessary. 00581 */ 00582 virtual void position(FXint x,FXint y,FXint w,FXint h); 00583 00584 /// Mark this window's layout as dirty for later layout 00585 virtual void recalc(); 00586 00587 /// Perform layout immediately 00588 virtual void layout(); 00589 00590 /// Generate a SEL_UPDATE message for the window and its children 00591 void forceRefresh(); 00592 00593 /// Reparent this window under new father before other 00594 virtual void reparent(FXWindow* father,FXWindow *other=NULL); 00595 00596 /// Scroll rectangle x,y,w,h by a shift of dx,dy 00597 void scroll(FXint x,FXint y,FXint w,FXint h,FXint dx,FXint dy) const; 00598 00599 /// Mark the specified rectangle to be repainted later 00600 void update(FXint x,FXint y,FXint w,FXint h) const; 00601 00602 /// Mark the entire window to be repainted later 00603 void update() const; 00604 00605 /// Process any outstanding repaint messages immediately, for the given rectangle 00606 void repaint(FXint x,FXint y,FXint w,FXint h) const; 00607 00608 /// Process any outstanding repaint messages immediately 00609 void repaint() const; 00610 00611 /** 00612 * Grab the mouse to this window; future mouse events will be 00613 * reported to this window even while the cursor goes outside of this window 00614 */ 00615 void grab(); 00616 00617 /// Release the mouse grab 00618 void ungrab(); 00619 00620 /// Return true if the window has been grabbed 00621 bool grabbed() const; 00622 00623 /// Grab keyboard device 00624 void grabKeyboard(); 00625 00626 /// Ungrab keyboard device 00627 void ungrabKeyboard(); 00628 00629 /// Return true if active grab is in effect 00630 bool grabbedKeyboard() const; 00631 00632 /// Show this window 00633 virtual void show(); 00634 00635 /// Hide this window 00636 virtual void hide(); 00637 00638 /// Return true if the window is shown 00639 bool shown() const; 00640 00641 /// Return true if the window is composite 00642 virtual bool isComposite() const; 00643 00644 /// Return true if the window is under the cursor 00645 bool underCursor() const; 00646 00647 /// Return true if this window owns the primary selection 00648 bool hasSelection() const; 00649 00650 /// Try to acquire the primary selection, given a list of drag types 00651 bool acquireSelection(const FXDragType *types,FXuint numtypes); 00652 00653 /// Release the primary selection 00654 bool releaseSelection(); 00655 00656 /// Return true if this window owns the clipboard 00657 bool hasClipboard() const; 00658 00659 /// Try to acquire the clipboard, given a list of drag types 00660 bool acquireClipboard(const FXDragType *types,FXuint numtypes); 00661 00662 /// Release the clipboard 00663 bool releaseClipboard(); 00664 00665 /// Enable this window to receive drops 00666 virtual void dropEnable(); 00667 00668 /// Disable this window from receiving drops 00669 virtual void dropDisable(); 00670 00671 /// Return true if this window is able to receive drops 00672 bool isDropEnabled() const; 00673 00674 /// Return true if a drag operaion has been initiated from this window 00675 bool isDragging() const; 00676 00677 /// Initiate a drag operation with a list of previously registered drag types 00678 bool beginDrag(const FXDragType *types,FXuint numtypes); 00679 00680 /** 00681 * When dragging, inform the drop-target of the new position and 00682 * the drag action 00683 */ 00684 bool handleDrag(FXint x,FXint y,FXDragAction action=DRAG_COPY); 00685 00686 /** 00687 * Terminate the drag operation with or without actually dropping the data 00688 * Returns the action performed by the target 00689 */ 00690 FXDragAction endDrag(bool drop=true); 00691 00692 /// Return true if this window is the target of a drop 00693 bool isDropTarget() const; 00694 00695 /** 00696 * When being dragged over, indicate that no further SEL_DND_MOTION messages 00697 * are required while the cursor is inside the given rectangle 00698 */ 00699 void setDragRectangle(FXint x,FXint y,FXint w,FXint h,bool wantupdates=true) const; 00700 00701 /** 00702 * When being dragged over, indicate we want to receive SEL_DND_MOTION messages 00703 * every time the cursor moves 00704 */ 00705 void clearDragRectangle() const; 00706 00707 /// When being dragged over, indicate acceptance or rejection of the dragged data 00708 void acceptDrop(FXDragAction action=DRAG_ACCEPT) const; 00709 00710 /// The target accepted our drop 00711 FXDragAction didAccept() const; 00712 00713 /** 00714 * Sent by the drop target in response to SEL_DND_DROP. The drag action 00715 * should be the same as the action the drop target reported to the drag 00716 * source in reponse to the SEL_DND_MOTION message. 00717 * This function notifies the drag source that its part of the drop transaction 00718 * is finished, and that it is free to release any resources involved in the 00719 * drag operation. 00720 * Calling dropFinished() is advisable in cases where the drop target needs 00721 * to perform complex processing on the data received from the drag source, 00722 * prior to returning from the SEL_DND_DROP message handler. 00723 */ 00724 void dropFinished(FXDragAction action=DRAG_REJECT) const; 00725 00726 /// When being dragged over, inquire the drag types which are being offered 00727 bool inquireDNDTypes(FXDNDOrigin origin,FXDragType*& types,FXuint& numtypes) const; 00728 00729 /// When being dragged over, return true if we are offered the given drag type 00730 bool offeredDNDType(FXDNDOrigin origin,FXDragType type) const; 00731 00732 /// When being dragged over, return the drag action 00733 FXDragAction inquireDNDAction() const; 00734 00735 /** 00736 * Set DND data; the array must be allocated with FXMALLOC and ownership is 00737 * transferred to the system 00738 */ 00739 bool setDNDData(FXDNDOrigin origin,FXDragType type,FXuchar* data,FXuint size) const; 00740 00741 /** 00742 * Set DND data from string value. 00743 */ 00744 bool setDNDData(FXDNDOrigin origin,FXDragType type,const FXString& string) const; 00745 00746 /** 00747 * Get DND data; the caller becomes the owner of the array and must free it 00748 * with FXFREE 00749 */ 00750 bool getDNDData(FXDNDOrigin origin,FXDragType type,FXuchar*& data,FXuint& size) const; 00751 00752 /** 00753 * Get DND data into string value. 00754 */ 00755 bool getDNDData(FXDNDOrigin origin,FXDragType type,FXString& string) const; 00756 00757 /// Return true if window logically contains the given point 00758 virtual bool contains(FXint parentx,FXint parenty) const; 00759 00760 /// Translate coordinates from fromwindow's coordinate space to this window's coordinate space 00761 void translateCoordinatesFrom(FXint& tox,FXint& toy,const FXWindow* fromwindow,FXint fromx,FXint fromy) const; 00762 00763 /// Translate coordinates from this window's coordinate space to towindow's coordinate space 00764 void translateCoordinatesTo(FXint& tox,FXint& toy,const FXWindow* towindow,FXint fromx,FXint fromy) const; 00765 00766 /// Set window background color 00767 virtual void setBackColor(FXColor clr); 00768 00769 /// Get background color 00770 FXColor getBackColor() const { return backColor; } 00771 00772 virtual bool doesSaveUnder() const; 00773 00774 /** 00775 * Translate message for localization; using the current FXTranslator, 00776 * an attempt is made to translate the given message into the current 00777 * language. An optional hint may be passed to break any ties in case 00778 * more than one tranlation is possible for the given message text. 00779 * In addition, the name of the widget is passed as context name so 00780 * that controls in a single dialog may be grouped together. 00781 */ 00782 virtual const FXchar* tr(const FXchar* message,const FXchar* hint=NULL) const; 00783 00784 /// Save window to stream 00785 virtual void save(FXStream& store) const; 00786 00787 /// Restore window from stream 00788 virtual void load(FXStream& store); 00789 00790 /// Destroy window 00791 virtual ~FXWindow(); 00792 }; 00793 00794 } 00795 00796 #endif
Copyright © 1997-2005 Jeroen van der Zijp |