Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
|
00001 /******************************************************************************** 00002 * * 00003 * M u l t i p l e D o c u m e n t C h i l d W i n d o w * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 1998,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: FXMDIChild.h,v 1.42 2006/01/22 17:58:05 fox Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXMDICHILD_H 00025 #define FXMDICHILD_H 00026 00027 #ifndef FXCOMPOSITE_H 00028 #include "FXComposite.h" 00029 #endif 00030 00031 namespace FX { 00032 00033 00034 class FXMDIClient; 00035 class FXMenuButton; 00036 class FXButton; 00037 class FXFont; 00038 00039 00040 /// MDI Child Window styles 00041 enum { 00042 MDI_NORMAL = 0, /// Normal display mode 00043 MDI_MAXIMIZED = 0x00001000, /// Window appears maximized 00044 MDI_MINIMIZED = 0x00002000, /// Window is iconified or minimized 00045 MDI_TRACKING = 0x00004000 /// Track continuously during dragging 00046 }; 00047 00048 00049 00050 /** 00051 * The MDI child window contains the application work area in a Multiple Document 00052 * Interface application. GUI Controls are connected to the MDI child via delegation 00053 * through the MDI client, which forwards messages it receives to the active MDI child. 00054 * The MDI child itself tries to further delegate messages to its single content window, 00055 * and if not handled there, to its target object. 00056 * When the MDI child is maximized, it sends a SEL_MAXIMIZE message; when the MDI 00057 * child is minimized, it sends a SEL_MINIMIZE message. When it is restored, it 00058 * sends a SEL_RESTORE message to its target. The MDI child also notifies its 00059 * target when it becomes the active MDI child, via the SEL_SELECTED message. 00060 * The void* in the SEL_SELECTED message refers to the previously active MDI child, 00061 * if any. When an MDI child ceases to be the active one, a SEL_DESELECTED message 00062 * is sent. The void* in the SEL_DESELECTED message refers to the newly activated 00063 * MDI child, if any. Thus, interception of SEL_SELECTED and SEL_DESELECTED allows 00064 * the target object to determine whether the user switched between MDI windows of 00065 * the same document (target) or between MDI windows belonging to the same document. 00066 * When the MDI child is closed, it sends a SEL_CLOSE message to its target. 00067 * The target has an opportunity to object to the closing; if the MDI child should 00068 * not be closed, it should return 1 (objection). If the MDI child should be closed, 00069 * the target can either just return 0 or simply not handle the SEL_CLOSE message. 00070 * The SEL_UPDATE message can be used to modify the MDI child's title (via 00071 * ID_SETSTRINGVALUE), and window icon (via ID_SETICONVALUE). 00072 */ 00073 class FXAPI FXMDIChild : public FXComposite { 00074 FXDECLARE(FXMDIChild) 00075 protected: 00076 FXString title; // Window title 00077 FXMenuButton *windowbtn; // Window button 00078 FXButton *minimizebtn; // Minimize button 00079 FXButton *restorebtn; // Restore button 00080 FXButton *maximizebtn; // Maximize buton 00081 FXButton *deletebtn; // Close button 00082 FXFont *font; // Title font 00083 FXColor baseColor; // Colors 00084 FXColor hiliteColor; 00085 FXColor shadowColor; 00086 FXColor borderColor; 00087 FXColor titleColor; 00088 FXColor titleBackColor; 00089 FXint iconPosX; // Saved icon position 00090 FXint iconPosY; 00091 FXint iconWidth; 00092 FXint iconHeight; 00093 FXint normalPosX; // Saved normal position 00094 FXint normalPosY; 00095 FXint normalWidth; 00096 FXint normalHeight; 00097 FXint spotx; // Grab-spot of mouse on window 00098 FXint spoty; 00099 FXint xoff; // Mouse offset to add 00100 FXint yoff; 00101 FXint newx; // New location of window 00102 FXint newy; 00103 FXint neww; 00104 FXint newh; 00105 FXuchar mode; // Dragging mode 00106 protected: 00107 FXMDIChild(); 00108 void drawRubberBox(FXint x,FXint y,FXint w,FXint h); 00109 void animateRectangles(FXint ox,FXint oy,FXint ow,FXint oh,FXint nx,FXint ny,FXint nw,FXint nh); 00110 FXuchar where(FXint x,FXint y); 00111 void changeCursor(FXint x,FXint y); 00112 void revertCursor(); 00113 protected: 00114 enum { 00115 DRAG_NONE = 0, 00116 DRAG_TOP = 1, 00117 DRAG_BOTTOM = 2, 00118 DRAG_LEFT = 4, 00119 DRAG_RIGHT = 8, 00120 DRAG_TOPLEFT = (DRAG_TOP|DRAG_LEFT), 00121 DRAG_TOPRIGHT = (DRAG_TOP|DRAG_RIGHT), 00122 DRAG_BOTTOMLEFT = (DRAG_BOTTOM|DRAG_LEFT), 00123 DRAG_BOTTOMRIGHT = (DRAG_BOTTOM|DRAG_RIGHT), 00124 DRAG_INVERTED = 16, 00125 DRAG_TITLE = 32 00126 }; 00127 private: 00128 FXMDIChild(const FXMDIChild&); 00129 FXMDIChild &operator=(const FXMDIChild&); 00130 public: 00131 long onPaint(FXObject*,FXSelector,void*); 00132 long onFocusSelf(FXObject*,FXSelector,void*); 00133 long onFocusIn(FXObject*,FXSelector,void*); 00134 long onFocusOut(FXObject*,FXSelector,void*); 00135 long onRightBtnPress(FXObject*,FXSelector,void*); 00136 long onRightBtnRelease(FXObject*,FXSelector,void*); 00137 long onLeftBtnPress(FXObject*,FXSelector,void*); 00138 long onLeftBtnRelease(FXObject*,FXSelector,void*); 00139 long onMiddleBtnPress(FXObject*,FXSelector,void*); 00140 long onMiddleBtnRelease(FXObject*,FXSelector,void*); 00141 long onMotion(FXObject*,FXSelector,void*); 00142 long onSelected(FXObject*,FXSelector,void*); 00143 long onDeselected(FXObject*,FXSelector,void*); 00144 long onCmdClose(FXObject*,FXSelector,void*); 00145 long onUpdClose(FXObject*,FXSelector,void*); 00146 long onCmdRestore(FXObject*,FXSelector,void*); 00147 long onUpdRestore(FXObject*,FXSelector,void*); 00148 long onUpdMaximize(FXObject*,FXSelector,void*); 00149 long onUpdMinimize(FXObject*,FXSelector,void*); 00150 long onCmdMaximize(FXObject*,FXSelector,void*); 00151 long onCmdMinimize(FXObject*,FXSelector,void*); 00152 long onUpdWindow(FXObject*,FXSelector,void*); 00153 long onUpdMenuRestore(FXObject*,FXSelector,void*); 00154 long onUpdMenuMinimize(FXObject*,FXSelector,void*); 00155 long onUpdMenuClose(FXObject*,FXSelector,void*); 00156 long onUpdMenuWindow(FXObject*,FXSelector,void*); 00157 long onCmdSetStringValue(FXObject*,FXSelector,void*); 00158 long onCmdGetStringValue(FXObject*,FXSelector,void*); 00159 long onCmdSetIconValue(FXObject*,FXSelector,void*); 00160 long onCmdGetIconValue(FXObject*,FXSelector,void*); 00161 virtual long onDefault(FXObject*,FXSelector,void*); 00162 public: 00163 00164 /// Construct MDI Child window with given name and icon 00165 FXMDIChild(FXMDIClient* p,const FXString& name,FXIcon* ic=NULL,FXPopup* pup=NULL,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0); 00166 00167 /// Create window 00168 virtual void create(); 00169 00170 /// Detach window 00171 virtual void detach(); 00172 00173 /// Perform layout 00174 virtual void layout(); 00175 00176 /// Return the default width of this window 00177 virtual FXint getDefaultWidth(); 00178 00179 /// Return the default height of this window 00180 virtual FXint getDefaultHeight(); 00181 00182 /// Move the focus to this window 00183 virtual void setFocus(); 00184 00185 /// MDI Child can receive focus 00186 virtual bool canFocus() const; 00187 00188 /// Move this window to the specified position in the parent's coordinates 00189 virtual void move(FXint x,FXint y); 00190 00191 /// Resize this window to the specified width and height 00192 virtual void resize(FXint w,FXint h); 00193 00194 /// Move and resize this window in the parent's coordinates 00195 virtual void position(FXint x,FXint y,FXint w,FXint h); 00196 00197 /// Change normal (restored) position 00198 void setNormalX(FXint x){ normalPosX=x; } 00199 void setNormalY(FXint y){ normalPosY=y; } 00200 void setNormalWidth(FXint w){ normalWidth=w; } 00201 void setNormalHeight(FXint h){ normalHeight=h; } 00202 00203 /// Return normal (restored) position 00204 FXint getNormalX() const { return normalPosX; } 00205 FXint getNormalY() const { return normalPosY; } 00206 FXint getNormalWidth() const { return normalWidth; } 00207 FXint getNormalHeight() const { return normalHeight; } 00208 00209 /// Change iconified position 00210 void setIconX(FXint x){ iconPosX=x; } 00211 void setIconY(FXint y){ iconPosY=y; } 00212 void setIconWidth(FXint w){ iconWidth=w; } 00213 void setIconHeight(FXint h){ iconHeight=h; } 00214 00215 /// Return iconified position 00216 FXint getIconX() const { return iconPosX; } 00217 FXint getIconY() const { return iconPosY; } 00218 FXint getIconWidth() const { return iconWidth; } 00219 FXint getIconHeight() const { return iconHeight; } 00220 00221 /// Return content window 00222 FXWindow *contentWindow() const; 00223 00224 /// Change MDI Child's title 00225 void setTitle(const FXString& name); 00226 00227 /// Get current title 00228 FXString getTitle() const { return title; } 00229 00230 /// Get colors 00231 FXColor getHiliteColor() const { return hiliteColor; } 00232 FXColor getShadowColor() const { return shadowColor; } 00233 FXColor getBaseColor() const { return baseColor; } 00234 FXColor getBorderColor() const { return borderColor; } 00235 FXColor getTitleColor () const { return titleColor; } 00236 FXColor getTitleBackColor() const { return titleBackColor; } 00237 00238 /// Change colors 00239 void setHiliteColor(FXColor clr); 00240 void setShadowColor(FXColor clr); 00241 void setBaseColor(FXColor clr); 00242 void setBorderColor(FXColor clr); 00243 void setTitleColor(FXColor clr); 00244 void setTitleBackColor(FXColor clr); 00245 00246 /// Maximize MDI window, return TRUE if maximized 00247 virtual FXbool maximize(FXbool notify=FALSE); 00248 00249 /// Minimize/iconify MDI window, return TRUE if minimized 00250 virtual FXbool minimize(FXbool notify=FALSE); 00251 00252 /// Restore MDI window to normal, return TRUE if restored 00253 virtual FXbool restore(FXbool notify=FALSE); 00254 00255 /// Close MDI window, return TRUE if actually closed 00256 virtual FXbool close(FXbool notify=FALSE); 00257 00258 /// Return TRUE if maximized 00259 FXbool isMaximized() const; 00260 00261 /// Return TRUE if minimized 00262 FXbool isMinimized() const; 00263 00264 /// Get window icon 00265 FXIcon *getIcon() const; 00266 00267 /// Set window icon 00268 void setIcon(FXIcon* icon); 00269 00270 /// Get window menu 00271 FXPopup* getMenu() const; 00272 00273 /// Set window menu 00274 void setMenu(FXPopup* menu); 00275 00276 /// Set tracking instead of just outline 00277 void setTracking(FXbool tracking=TRUE); 00278 00279 /// Return true if tracking 00280 FXbool getTracking() const; 00281 00282 /// Set title font 00283 void setFont(FXFont *fnt); 00284 00285 /// Get title font 00286 FXFont* getFont() const { return font; } 00287 00288 /// Save to stream 00289 virtual void save(FXStream& store) const; 00290 00291 /// Load from stream 00292 virtual void load(FXStream& store); 00293 00294 /// Destroy 00295 virtual ~FXMDIChild(); 00296 }; 00297 00298 } 00299 00300 #endif
Copyright © 1997-2005 Jeroen van der Zijp |