![]() |
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,2002 by Jeroen van der Zijp. All Rights Reserved. * 00007 ********************************************************************************* 00008 * This library is free software; you can redistribute it and/or * 00009 * modify it under the terms of the GNU Lesser General Public * 00010 * License as published by the Free Software Foundation; either * 00011 * version 2.1 of the License, or (at your option) any later version. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00016 * Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public * 00019 * License along with this library; if not, write to the Free Software * 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * 00021 ********************************************************************************* 00022 * $Id: FXMDIChild.h,v 1.28 2002/06/20 12:22:38 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 struct FXTimer; 00035 class FXMDIClient; 00036 class FXMenuButton; 00037 class FXButton; 00038 class FXFont; 00039 00040 00041 /// MDI Child Window styles 00042 enum { 00043 MDI_NORMAL = 0, /// Normal display mode 00044 MDI_MAXIMIZED = 0x00001000, /// Window appears maximized 00045 MDI_MINIMIZED = 0x00002000 /// Window is iconified or minimized 00046 }; 00047 00048 00049 00050 /** 00051 * The MDI child window contains the application 00052 * work area in a Multiple Document Interface application. 00053 */ 00054 class FXAPI FXMDIChild : public FXComposite { 00055 FXDECLARE(FXMDIChild) 00056 protected: 00057 FXString title; 00058 FXMenuButton *windowbtn; 00059 FXButton *minimizebtn; 00060 FXButton *restorebtn; 00061 FXButton *maximizebtn; 00062 FXButton *deletebtn; 00063 FXFont *font; 00064 FXColor baseColor; 00065 FXColor hiliteColor; 00066 FXColor shadowColor; 00067 FXColor borderColor; 00068 FXColor titleColor; 00069 FXColor titleBackColor; 00070 FXint iconPosX; 00071 FXint iconPosY; 00072 FXint iconWidth; 00073 FXint iconHeight; 00074 FXint normalPosX; 00075 FXint normalPosY; 00076 FXint normalWidth; 00077 FXint normalHeight; 00078 FXint xoff; 00079 FXint yoff; 00080 FXint oldx; 00081 FXint oldy; 00082 FXint oldw; 00083 FXint oldh; 00084 FXuchar action; 00085 protected: 00086 FXMDIChild(); 00087 void drawRubberBox(FXint x,FXint y,FXint w,FXint h); 00088 void animateRectangles(FXint ox,FXint oy,FXint ow,FXint oh,FXint nx,FXint ny,FXint nw,FXint nh); 00089 FXuchar where(FXint x,FXint y); 00090 void changeCursor(FXint x,FXint y); 00091 void revertCursor(); 00092 virtual void layout(); 00093 private: 00094 FXMDIChild(const FXMDIChild&); 00095 FXMDIChild &operator=(const FXMDIChild&); 00096 public: 00097 long onPaint(FXObject*,FXSelector,void*); 00098 long onFocusSelf(FXObject*,FXSelector,void*); 00099 long onFocusIn(FXObject*,FXSelector,void*); 00100 long onFocusOut(FXObject*,FXSelector,void*); 00101 long onRightBtnPress(FXObject*,FXSelector,void*); 00102 long onRightBtnRelease(FXObject*,FXSelector,void*); 00103 long onLeftBtnPress(FXObject*,FXSelector,void*); 00104 long onLeftBtnRelease(FXObject*,FXSelector,void*); 00105 long onMiddleBtnPress(FXObject*,FXSelector,void*); 00106 long onMiddleBtnRelease(FXObject*,FXSelector,void*); 00107 long onMotion(FXObject*,FXSelector,void*); 00108 long onDelete(FXObject*,FXSelector,void*); 00109 long onClose(FXObject*,FXSelector,void*); 00110 long onCloseAll(FXObject*,FXSelector,void*); 00111 long onSelected(FXObject*,FXSelector,void*); 00112 long onDeselected(FXObject*,FXSelector,void*); 00113 long onCmdRestore(FXObject*,FXSelector,void*); 00114 long onCmdMaximize(FXObject*,FXSelector,void*); 00115 long onCmdMinimize(FXObject*,FXSelector,void*); 00116 long onCmdClose(FXObject*,FXSelector,void*); 00117 long onCmdDelete(FXObject*,FXSelector,void*); 00118 long onUpdRestore(FXObject*,FXSelector,void*); 00119 long onUpdMaximize(FXObject*,FXSelector,void*); 00120 long onUpdMinimize(FXObject*,FXSelector,void*); 00121 long onUpdWindow(FXObject*,FXSelector,void*); 00122 long onUpdMenuRestore(FXObject*,FXSelector,void*); 00123 long onUpdMenuMinimize(FXObject*,FXSelector,void*); 00124 long onUpdMenuClose(FXObject*,FXSelector,void*); 00125 long onUpdMenuWindow(FXObject*,FXSelector,void*); 00126 long onUpdClose(FXObject*,FXSelector,void*); 00127 long onCmdSetStringValue(FXObject*,FXSelector,void*); 00128 long onCmdGetStringValue(FXObject*,FXSelector,void*); 00129 virtual long onDefault(FXObject*,FXSelector,void*); 00130 public: 00131 00132 /// Construct MDI Child window with given name and icon 00133 FXMDIChild(FXMDIClient* p,const FXString& name,FXIcon* ic=NULL,FXMenuPane* mn=NULL,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0); 00134 00135 /// Create window 00136 virtual void create(); 00137 00138 /// Detach window 00139 virtual void detach(); 00140 00141 /// Compute default size 00142 virtual FXint getDefaultWidth(); 00143 virtual FXint getDefaultHeight(); 00144 00145 /// MDI Child can receive focus 00146 virtual FXbool canFocus() const; 00147 00148 /// Move this window to the specified position in the parent's coordinates 00149 virtual void move(FXint x,FXint y); 00150 00151 /// Resize this window to the specified width and height 00152 virtual void resize(FXint w,FXint h); 00153 00154 /// Move and resize this window in the parent's coordinates 00155 virtual void position(FXint x,FXint y,FXint w,FXint h); 00156 00157 /// Change normal (restored) position 00158 void setNormalX(FXint x){ normalPosX=x; } 00159 void setNormalY(FXint y){ normalPosY=y; } 00160 void setNormalWidth(FXint w){ normalWidth=w; } 00161 void setNormalHeight(FXint h){ normalHeight=h; } 00162 00163 /// Return normal (restored) position 00164 FXint getNormalX() const { return normalPosX; } 00165 FXint getNormalY() const { return normalPosY; } 00166 FXint getNormalWidth() const { return normalWidth; } 00167 FXint getNormalHeight() const { return normalHeight; } 00168 00169 /// Change iconified position 00170 void setIconX(FXint x){ iconPosX=x; } 00171 void setIconY(FXint y){ iconPosY=y; } 00172 void setIconWidth(FXint w){ iconWidth=w; } 00173 void setIconHeight(FXint h){ iconHeight=h; } 00174 00175 /// Return iconified position 00176 FXint getIconX() const { return iconPosX; } 00177 FXint getIconY() const { return iconPosY; } 00178 FXint getIconWidth() const { return iconWidth; } 00179 FXint getIconHeight() const { return iconHeight; } 00180 00181 /// Return content window 00182 FXWindow *contentWindow() const; 00183 00184 /// Change MDI Child's title 00185 void setTitle(const FXString& name); 00186 00187 /// Get current title 00188 FXString getTitle() const { return title; } 00189 00190 /// Get colors 00191 FXColor getHiliteColor() const { return hiliteColor; } 00192 FXColor getShadowColor() const { return shadowColor; } 00193 FXColor getBaseColor() const { return baseColor; } 00194 FXColor getBorderColor() const { return borderColor; } 00195 FXColor getTitleColor () const { return titleColor; } 00196 FXColor getTitleBackColor() const { return titleBackColor; } 00197 00198 /// Change colors 00199 void setHiliteColor(FXColor clr); 00200 void setShadowColor(FXColor clr); 00201 void setBaseColor(FXColor clr); 00202 void setBorderColor(FXColor clr); 00203 void setTitleColor(FXColor clr); 00204 void setTitleBackColor(FXColor clr); 00205 00206 /// Maximize MDI window, return TRUE if maximized 00207 virtual FXbool maximize(FXbool notify=FALSE); 00208 00209 /// Minimize/iconify MDI window, return TRUE if minimized 00210 virtual FXbool minimize(FXbool notify=FALSE); 00211 00212 /// Restore MDI window to normal, return TRUE if restored 00213 virtual FXbool restore(FXbool notify=FALSE); 00214 00215 /// Close MDI window, return TRUE if actually closed 00216 virtual FXbool close(FXbool notify=FALSE); 00217 00218 /// Return TRUE if maximized 00219 FXbool isMaximized() const; 00220 00221 /// Return TRUE if minimized 00222 FXbool isMinimized() const; 00223 00224 /// Get window icon 00225 FXIcon *getWindowIcon() const; 00226 00227 /// Set window icon 00228 void setWindowIcon(FXIcon* icon); 00229 00230 /// Get window menu 00231 FXPopup* getWindowMenu() const; 00232 00233 /// Set window menu 00234 void setWindowMenu(FXPopup* menu); 00235 00236 /// Set title font 00237 void setFont(FXFont *fnt); 00238 00239 /// Get title font 00240 FXFont* getFont() const { return font; } 00241 00242 /// Save to stream 00243 virtual void save(FXStream& store) const; 00244 00245 /// Load from stream 00246 virtual void load(FXStream& store); 00247 00248 /// Destroy 00249 virtual ~FXMDIChild(); 00250 }; 00251 00252 } 00253 00254 #endif