Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

/home/jeroen/FOX/fox/fox-1.7.33/include/FXMDIChild.h
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,2012 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or modify          *
00009 * it under the terms of the GNU Lesser General Public License as published by   *
00010 * the Free Software Foundation; either version 3 of the License, or             *
00011 * (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                 *
00016 * GNU Lesser General Public License for more details.                           *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public License      *
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
00020 ********************************************************************************/
00021 #ifndef FXMDICHILD_H
00022 #define FXMDICHILD_H
00023 
00024 #ifndef FXCOMPOSITE_H
00025 #include "FXComposite.h"
00026 #endif
00027 
00028 namespace FX {
00029 
00030 
00031 class FXMDIClient;
00032 class FXMenuButton;
00033 class FXButton;
00034 class FXFont;
00035 
00036 
00038 enum {
00039   MDI_NORMAL    = 0,                
00040   MDI_MAXIMIZED = 0x00001000,       
00041   MDI_MINIMIZED = 0x00002000,       
00042   MDI_TRACKING  = 0x00004000        
00043   };
00044 
00045 
00046 
00078 class FXAPI FXMDIChild : public FXComposite {
00079   FXDECLARE(FXMDIChild)
00080 protected:
00081   FXString      title;                  // Window title
00082   FXMenuButton *windowbtn;              // Window button
00083   FXButton     *minimizebtn;            // Minimize button
00084   FXButton     *restorebtn;             // Restore button
00085   FXButton     *maximizebtn;            // Maximize buton
00086   FXButton     *deletebtn;              // Close button
00087   FXFont       *font;                   // Title font
00088   FXColor       baseColor;              // Colors
00089   FXColor       hiliteColor;
00090   FXColor       shadowColor;
00091   FXColor       borderColor;
00092   FXColor       titleColor;
00093   FXColor       titleBackColor;
00094   FXint         iconPosX;               // Saved icon position
00095   FXint         iconPosY;
00096   FXint         iconWidth;
00097   FXint         iconHeight;
00098   FXint         normalPosX;             // Saved normal position
00099   FXint         normalPosY;
00100   FXint         normalWidth;
00101   FXint         normalHeight;
00102   FXint         spotx;                  // Grab-spot of mouse on window
00103   FXint         spoty;
00104   FXint         xoff;                   // Mouse offset to add
00105   FXint         yoff;
00106   FXint         newx;                   // New location of window
00107   FXint         newy;
00108   FXint         neww;
00109   FXint         newh;
00110   FXuchar       mode;                   // Dragging mode
00111 protected:
00112   FXMDIChild();
00113   void drawRubberBox(FXint x,FXint y,FXint w,FXint h);
00114   void animateRectangles(FXint ox,FXint oy,FXint ow,FXint oh,FXint nx,FXint ny,FXint nw,FXint nh);
00115   FXuchar where(FXint x,FXint y) const;
00116   void changeCursor(FXuchar which);
00117 protected:
00118   enum {
00119     DRAG_NONE        = 0,
00120     DRAG_TOP         = 1,
00121     DRAG_BOTTOM      = 2,
00122     DRAG_LEFT        = 4,
00123     DRAG_RIGHT       = 8,
00124     DRAG_TOPLEFT     = (DRAG_TOP|DRAG_LEFT),
00125     DRAG_TOPRIGHT    = (DRAG_TOP|DRAG_RIGHT),
00126     DRAG_BOTTOMLEFT  = (DRAG_BOTTOM|DRAG_LEFT),
00127     DRAG_BOTTOMRIGHT = (DRAG_BOTTOM|DRAG_RIGHT),
00128     DRAG_INVERTED    = 16,
00129     DRAG_TITLE       = 32
00130     };
00131 private:
00132   FXMDIChild(const FXMDIChild&);
00133   FXMDIChild &operator=(const FXMDIChild&);
00134 public:
00135   long onPaint(FXObject*,FXSelector,void*);
00136   long onEnter(FXObject*,FXSelector,void*);
00137   long onLeave(FXObject*,FXSelector,void*);
00138   long onFocusSelf(FXObject*,FXSelector,void*);
00139   long onFocusIn(FXObject*,FXSelector,void*);
00140   long onFocusOut(FXObject*,FXSelector,void*);
00141   long onRightBtnPress(FXObject*,FXSelector,void*);
00142   long onRightBtnRelease(FXObject*,FXSelector,void*);
00143   long onLeftBtnPress(FXObject*,FXSelector,void*);
00144   long onLeftBtnRelease(FXObject*,FXSelector,void*);
00145   long onMiddleBtnPress(FXObject*,FXSelector,void*);
00146   long onMiddleBtnRelease(FXObject*,FXSelector,void*);
00147   long onMotion(FXObject*,FXSelector,void*);
00148   long onSelected(FXObject*,FXSelector,void*);
00149   long onDeselected(FXObject*,FXSelector,void*);
00150   long onCmdClose(FXObject*,FXSelector,void*);
00151   long onUpdClose(FXObject*,FXSelector,void*);
00152   long onCmdRestore(FXObject*,FXSelector,void*);
00153   long onUpdRestore(FXObject*,FXSelector,void*);
00154   long onUpdMaximize(FXObject*,FXSelector,void*);
00155   long onUpdMinimize(FXObject*,FXSelector,void*);
00156   long onCmdMaximize(FXObject*,FXSelector,void*);
00157   long onCmdMinimize(FXObject*,FXSelector,void*);
00158   long onUpdWindow(FXObject*,FXSelector,void*);
00159   long onUpdMenuRestore(FXObject*,FXSelector,void*);
00160   long onUpdMenuMinimize(FXObject*,FXSelector,void*);
00161   long onUpdMenuClose(FXObject*,FXSelector,void*);
00162   long onUpdMenuWindow(FXObject*,FXSelector,void*);
00163   long onCmdSetStringValue(FXObject*,FXSelector,void*);
00164   long onCmdGetStringValue(FXObject*,FXSelector,void*);
00165   long onCmdSetIconValue(FXObject*,FXSelector,void*);
00166   long onCmdGetIconValue(FXObject*,FXSelector,void*);
00167   virtual long onDefault(FXObject*,FXSelector,void*);
00168 public:
00169 
00171   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);
00172 
00174   virtual void create();
00175 
00177   virtual void detach();
00178 
00180   virtual void layout();
00181 
00183   virtual FXint getDefaultWidth();
00184 
00186   virtual FXint getDefaultHeight();
00187 
00189   virtual void setFocus();
00190 
00192   virtual FXbool canFocus() const;
00193 
00195   virtual void move(FXint x,FXint y);
00196 
00198   virtual void resize(FXint w,FXint h);
00199 
00201   virtual void position(FXint x,FXint y,FXint w,FXint h);
00202 
00204   void setNormalX(FXint x){ normalPosX=x; }
00205   void setNormalY(FXint y){ normalPosY=y; }
00206   void setNormalWidth(FXint w){ normalWidth=w; }
00207   void setNormalHeight(FXint h){ normalHeight=h; }
00208 
00210   FXint getNormalX() const { return normalPosX; }
00211   FXint getNormalY() const { return normalPosY; }
00212   FXint getNormalWidth() const { return normalWidth; }
00213   FXint getNormalHeight() const { return normalHeight; }
00214 
00216   void setIconX(FXint x){ iconPosX=x; }
00217   void setIconY(FXint y){ iconPosY=y; }
00218   void setIconWidth(FXint w){ iconWidth=w; }
00219   void setIconHeight(FXint h){ iconHeight=h; }
00220 
00222   FXint getIconX() const { return iconPosX; }
00223   FXint getIconY() const { return iconPosY; }
00224   FXint getIconWidth() const { return iconWidth; }
00225   FXint getIconHeight() const { return iconHeight; }
00226 
00228   FXWindow *contentWindow() const;
00229 
00231   void setTitle(const FXString& name);
00232 
00234   FXString getTitle() const { return title; }
00235 
00237   FXColor getHiliteColor() const { return hiliteColor; }
00238   FXColor getShadowColor() const { return shadowColor; }
00239   FXColor getBaseColor() const { return baseColor; }
00240   FXColor getBorderColor() const { return borderColor; }
00241   FXColor getTitleColor () const { return titleColor; }
00242   FXColor getTitleBackColor() const { return titleBackColor; }
00243 
00245   void setHiliteColor(FXColor clr);
00246   void setShadowColor(FXColor clr);
00247   void setBaseColor(FXColor clr);
00248   void setBorderColor(FXColor clr);
00249   void setTitleColor(FXColor clr);
00250   void setTitleBackColor(FXColor clr);
00251 
00253   virtual FXbool restore(FXbool notify=false);
00254 
00256   virtual FXbool maximize(FXbool notify=false);
00257 
00259   virtual FXbool minimize(FXbool notify=false);
00260 
00262   virtual FXbool close(FXbool notify=false);
00263 
00265   FXbool isMaximized() const;
00266 
00268   FXbool isMinimized() const;
00269 
00271   FXIcon *getIcon() const;
00272 
00274   void setIcon(FXIcon* icon);
00275 
00277   FXPopup* getMenu() const;
00278 
00280   void setMenu(FXPopup* menu);
00281 
00283   void setTracking(FXbool tracking=true);
00284 
00286   FXbool getTracking() const;
00287 
00289   void setFont(FXFont *fnt);
00290 
00292   FXFont* getFont() const { return font; }
00293 
00295   virtual void save(FXStream& store) const;
00296 
00298   virtual void load(FXStream& store);
00299 
00301   virtual ~FXMDIChild();
00302   };
00303 
00304 }
00305 
00306 #endif

Copyright © 1997-2011 Jeroen van der Zijp