![]() |
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.22 2002/01/18 22:42:53 jeroen Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXMDICHILD_H 00025 #define FXMDICHILD_H 00026 00027 #ifndef FXCOMPOSITE_H 00028 #include "FXComposite.h" 00029 #endif 00030 00031 00032 00033 struct FXTimer; 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 }; 00046 00047 00048 00049 /** 00050 * The MDI child window contains the application 00051 * work area in a Multiple Document Interface application. 00052 */ 00053 class FXAPI FXMDIChild : public FXComposite { 00054 FXDECLARE(FXMDIChild) 00055 protected: 00056 FXString title; 00057 FXMenuButton *windowbtn; 00058 FXButton *minimizebtn; 00059 FXButton *restorebtn; 00060 FXButton *maximizebtn; 00061 FXButton *deletebtn; 00062 FXFont *font; 00063 FXColor baseColor; 00064 FXColor hiliteColor; 00065 FXColor shadowColor; 00066 FXColor borderColor; 00067 FXColor titleColor; 00068 FXColor titleBackColor; 00069 FXint iconPosX; 00070 FXint iconPosY; 00071 FXint iconWidth; 00072 FXint iconHeight; 00073 FXint normalPosX; 00074 FXint normalPosY; 00075 FXint normalWidth; 00076 FXint normalHeight; 00077 FXint xoff; 00078 FXint yoff; 00079 FXint oldx; 00080 FXint oldy; 00081 FXint oldw; 00082 FXint oldh; 00083 FXuchar action; 00084 private: 00085 FXMDIChild *mdinext; 00086 FXMDIChild *mdiprev; 00087 protected: 00088 FXMDIChild(); 00089 void drawRubberBox(FXint x,FXint y,FXint w,FXint h); 00090 void animateRectangles(FXint ox,FXint oy,FXint ow,FXint oh,FXint nx,FXint ny,FXint nw,FXint nh); 00091 FXuchar where(FXint x,FXint y); 00092 void changeCursor(FXint x,FXint y); 00093 void revertCursor(); 00094 virtual void layout(); 00095 private: 00096 FXMDIChild(const FXMDIChild&); 00097 FXMDIChild &operator=(const FXMDIChild&); 00098 public: 00099 long onPaint(FXObject*,FXSelector,void*); 00100 long onFocusSelf(FXObject*,FXSelector,void*); 00101 long onFocusIn(FXObject*,FXSelector,void*); 00102 long onFocusOut(FXObject*,FXSelector,void*); 00103 long onRightBtnPress(FXObject*,FXSelector,void*); 00104 long onRightBtnRelease(FXObject*,FXSelector,void*); 00105 long onLeftBtnPress(FXObject*,FXSelector,void*); 00106 long onLeftBtnRelease(FXObject*,FXSelector,void*); 00107 long onMiddleBtnPress(FXObject*,FXSelector,void*); 00108 long onMiddleBtnRelease(FXObject*,FXSelector,void*); 00109 long onMotion(FXObject*,FXSelector,void*); 00110 long onDelete(FXObject*,FXSelector,void*); 00111 long onClose(FXObject*,FXSelector,void*); 00112 long onCloseAll(FXObject*,FXSelector,void*); 00113 long onSelected(FXObject*,FXSelector,void*); 00114 long onDeselected(FXObject*,FXSelector,void*); 00115 long onMinimize(FXObject*,FXSelector,void*); 00116 long onRestore(FXObject*,FXSelector,void*); 00117 long onMaximize(FXObject*,FXSelector,void*); 00118 long onCmdRestore(FXObject*,FXSelector,void*); 00119 long onCmdMaximize(FXObject*,FXSelector,void*); 00120 long onCmdMinimize(FXObject*,FXSelector,void*); 00121 long onCmdClose(FXObject*,FXSelector,void*); 00122 long onCmdDelete(FXObject*,FXSelector,void*); 00123 long onUpdRestore(FXObject*,FXSelector,void*); 00124 long onUpdMaximize(FXObject*,FXSelector,void*); 00125 long onUpdMinimize(FXObject*,FXSelector,void*); 00126 long onUpdWindow(FXObject*,FXSelector,void*); 00127 long onUpdMenuRestore(FXObject*,FXSelector,void*); 00128 long onUpdMenuMinimize(FXObject*,FXSelector,void*); 00129 long onUpdMenuClose(FXObject*,FXSelector,void*); 00130 long onUpdMenuWindow(FXObject*,FXSelector,void*); 00131 long onUpdClose(FXObject*,FXSelector,void*); 00132 long onCmdSetStringValue(FXObject*,FXSelector,void*); 00133 virtual long onDefault(FXObject*,FXSelector,void*); 00134 public: 00135 00136 /// Construct MDI Child window with given name and icon 00137 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); 00138 00139 /// Create window 00140 virtual void create(); 00141 00142 /// Detach window 00143 virtual void detach(); 00144 00145 /// Get next MDI Child 00146 FXMDIChild* getMDINext() const { return mdinext; } 00147 00148 /// Get previous MDI Child 00149 FXMDIChild* getMDIPrev() const { return mdiprev; } 00150 00151 /// Compute default size 00152 virtual FXint getDefaultWidth(); 00153 virtual FXint getDefaultHeight(); 00154 00155 /// MDI Child can receive focus 00156 virtual FXbool canFocus() const; 00157 00158 /// Move this window to the specified position in the parent's coordinates 00159 virtual void move(FXint x,FXint y); 00160 00161 /// Resize this window to the specified width and height 00162 virtual void resize(FXint w,FXint h); 00163 00164 /// Move and resize this window in the parent's coordinates 00165 virtual void position(FXint x,FXint y,FXint w,FXint h); 00166 00167 /// Change normal (restored) position 00168 void setNormalX(FXint x){ normalPosX=x; } 00169 void setNormalY(FXint y){ normalPosY=y; } 00170 void setNormalWidth(FXint w){ normalWidth=w; } 00171 void setNormalHeight(FXint h){ normalHeight=h; } 00172 00173 /// Return normal (restored) position 00174 FXint getNormalX() const { return normalPosX; } 00175 FXint getNormalY() const { return normalPosY; } 00176 FXint getNormalWidth() const { return normalWidth; } 00177 FXint getNormalHeight() const { return normalHeight; } 00178 00179 /// Change iconified position 00180 void setIconX(FXint x){ iconPosX=x; } 00181 void setIconY(FXint y){ iconPosY=y; } 00182 void setIconWidth(FXint w){ iconWidth=w; } 00183 void setIconHeight(FXint h){ iconHeight=h; } 00184 00185 /// Return iconified position 00186 FXint getIconX() const { return iconPosX; } 00187 FXint getIconY() const { return iconPosY; } 00188 FXint getIconWidth() const { return iconWidth; } 00189 FXint getIconHeight() const { return iconHeight; } 00190 00191 /// Return content window 00192 FXWindow *contentWindow() const; 00193 00194 /// Change MDI Child's title 00195 void setTitle(const FXString& name); 00196 00197 /// Get current title 00198 FXString getTitle() const { return title; } 00199 00200 /// Get colors 00201 FXColor getHiliteColor() const { return hiliteColor; } 00202 FXColor getShadowColor() const { return shadowColor; } 00203 FXColor getBaseColor() const { return baseColor; } 00204 FXColor getBorderColor() const { return borderColor; } 00205 FXColor getTitleColor () const { return titleColor; } 00206 FXColor getTitleBackColor() const { return titleBackColor; } 00207 00208 /// Change colors 00209 void setHiliteColor(FXColor clr); 00210 void setShadowColor(FXColor clr); 00211 void setBaseColor(FXColor clr); 00212 void setBorderColor(FXColor clr); 00213 void setTitleColor(FXColor clr); 00214 void setTitleBackColor(FXColor clr); 00215 00216 /// Return TRUE if maximized 00217 FXbool isMaximized() const; 00218 00219 /// Return TRUE if minimized 00220 FXbool isMinimized() const; 00221 00222 /// Maximize MDI Child 00223 virtual void maximize(FXbool notify=FALSE); 00224 00225 /// Minimize/iconify MDI Child 00226 virtual void minimize(FXbool notify=FALSE); 00227 00228 /// Restore MDI Child to normal 00229 virtual void restore(FXbool notify=FALSE); 00230 00231 /// Get window icon 00232 FXIcon *getWindowIcon() const; 00233 00234 /// Set window icon 00235 void setWindowIcon(FXIcon* icon); 00236 00237 /// Get window menu 00238 FXPopup* getWindowMenu() const; 00239 00240 /// Set window menu 00241 void setWindowMenu(FXPopup* menu); 00242 00243 /// Set title font 00244 void setFont(FXFont *fnt); 00245 00246 /// Get title font 00247 FXFont* getFont() const { return font; } 00248 00249 /// Save to stream 00250 virtual void save(FXStream& store) const; 00251 00252 /// Load from stream 00253 virtual void load(FXStream& store); 00254 00255 /// Destroy 00256 virtual ~FXMDIChild(); 00257 }; 00258 00259 00260 #endif