FXMDIChild.h

Go to the documentation of this file.
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 FX_DISABLEMDI
00025 
00026 #ifndef FXMDICHILD_H
00027 #define FXMDICHILD_H
00028 
00029 #ifndef FXCOMPOSITE_H
00030 #include "FXComposite.h"
00031 #endif
00032 
00033 namespace FX {
00034 
00035 
00036 class FXMDIClient;
00037 class FXMenuButton;
00038 class FXButton;
00039 class FXFont;
00040 
00041 
00043 enum {
00044   MDI_NORMAL    = 0,                
00045   MDI_MAXIMIZED = 0x00001000,       
00046   MDI_MINIMIZED = 0x00002000,       
00047   MDI_TRACKING  = 0x00004000        
00048   };
00049 
00050 
00051 
00075 class FXAPI FXMDIChild : public FXComposite {
00076   FXDECLARE(FXMDIChild)
00077 protected:
00078   FXString      title;                  // Window title
00079   FXMenuButton *windowbtn;              // Window button
00080   FXButton     *minimizebtn;            // Minimize button
00081   FXButton     *restorebtn;             // Restore button
00082   FXButton     *maximizebtn;            // Maximize buton
00083   FXButton     *deletebtn;              // Close button
00084   FXFont       *font;                   // Title font
00085   FXColor       baseColor;              // Colors
00086   FXColor       hiliteColor;
00087   FXColor       shadowColor;
00088   FXColor       borderColor;
00089   FXColor       titleColor;
00090   FXColor       titleBackColor;
00091   FXint         iconPosX;               // Saved icon position
00092   FXint         iconPosY;
00093   FXint         iconWidth;
00094   FXint         iconHeight;
00095   FXint         normalPosX;             // Saved normal position
00096   FXint         normalPosY;
00097   FXint         normalWidth;
00098   FXint         normalHeight;
00099   FXint         spotx;                  // Grab-spot of mouse on window
00100   FXint         spoty;
00101   FXint         xoff;                   // Mouse offset to add
00102   FXint         yoff;
00103   FXint         newx;                   // New location of window
00104   FXint         newy;
00105   FXint         neww;
00106   FXint         newh;
00107   FXuchar       mode;                   // Dragging mode
00108 protected:
00109   FXMDIChild();
00110   void drawRubberBox(FXint x,FXint y,FXint w,FXint h);
00111   void animateRectangles(FXint ox,FXint oy,FXint ow,FXint oh,FXint nx,FXint ny,FXint nw,FXint nh);
00112   FXuchar where(FXint x,FXint y);
00113   void changeCursor(FXint x,FXint y);
00114   void revertCursor();
00115 protected:
00116   enum {
00117     DRAG_NONE        = 0,
00118     DRAG_TOP         = 1,
00119     DRAG_BOTTOM      = 2,
00120     DRAG_LEFT        = 4,
00121     DRAG_RIGHT       = 8,
00122     DRAG_TOPLEFT     = (DRAG_TOP|DRAG_LEFT),
00123     DRAG_TOPRIGHT    = (DRAG_TOP|DRAG_RIGHT),
00124     DRAG_BOTTOMLEFT  = (DRAG_BOTTOM|DRAG_LEFT),
00125     DRAG_BOTTOMRIGHT = (DRAG_BOTTOM|DRAG_RIGHT),
00126     DRAG_INVERTED    = 16,
00127     DRAG_TITLE       = 32
00128     };
00129 private:
00130   FXMDIChild(const FXMDIChild&);
00131   FXMDIChild &operator=(const FXMDIChild&);
00132 public:
00133   long onPaint(FXObject*,FXSelector,void*);
00134   long onFocusSelf(FXObject*,FXSelector,void*);
00135   long onFocusIn(FXObject*,FXSelector,void*);
00136   long onFocusOut(FXObject*,FXSelector,void*);
00137   long onRightBtnPress(FXObject*,FXSelector,void*);
00138   long onRightBtnRelease(FXObject*,FXSelector,void*);
00139   long onLeftBtnPress(FXObject*,FXSelector,void*);
00140   long onLeftBtnRelease(FXObject*,FXSelector,void*);
00141   long onMiddleBtnPress(FXObject*,FXSelector,void*);
00142   long onMiddleBtnRelease(FXObject*,FXSelector,void*);
00143   long onMotion(FXObject*,FXSelector,void*);
00144   long onSelected(FXObject*,FXSelector,void*);
00145   long onDeselected(FXObject*,FXSelector,void*);
00146   long onCmdClose(FXObject*,FXSelector,void*);
00147   long onUpdClose(FXObject*,FXSelector,void*);
00148   long onCmdRestore(FXObject*,FXSelector,void*);
00149   long onUpdRestore(FXObject*,FXSelector,void*);
00150   long onUpdMaximize(FXObject*,FXSelector,void*);
00151   long onUpdMinimize(FXObject*,FXSelector,void*);
00152   long onCmdMaximize(FXObject*,FXSelector,void*);
00153   long onCmdMinimize(FXObject*,FXSelector,void*);
00154   long onUpdWindow(FXObject*,FXSelector,void*);
00155   long onUpdMenuRestore(FXObject*,FXSelector,void*);
00156   long onUpdMenuMinimize(FXObject*,FXSelector,void*);
00157   long onUpdMenuClose(FXObject*,FXSelector,void*);
00158   long onUpdMenuWindow(FXObject*,FXSelector,void*);
00159   long onCmdSetStringValue(FXObject*,FXSelector,void*);
00160   long onCmdGetStringValue(FXObject*,FXSelector,void*);
00161   long onCmdSetIconValue(FXObject*,FXSelector,void*);
00162   long onCmdGetIconValue(FXObject*,FXSelector,void*);
00163   virtual long onDefault(FXObject*,FXSelector,void*);
00164 public:
00165 
00167   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);
00168 
00170   virtual void create();
00171 
00173   virtual void detach();
00174 
00176   virtual void layout();
00177 
00179   virtual FXint getDefaultWidth();
00180 
00182   virtual FXint getDefaultHeight();
00183 
00185   virtual void setFocus();
00186 
00188   virtual bool canFocus() const;
00189 
00191   virtual void move(FXint x,FXint y);
00192 
00194   virtual void resize(FXint w,FXint h);
00195 
00197   virtual void position(FXint x,FXint y,FXint w,FXint h);
00198 
00200   void setNormalX(FXint x){ normalPosX=x; }
00201   void setNormalY(FXint y){ normalPosY=y; }
00202   void setNormalWidth(FXint w){ normalWidth=w; }
00203   void setNormalHeight(FXint h){ normalHeight=h; }
00204 
00206   FXint getNormalX() const { return normalPosX; }
00207   FXint getNormalY() const { return normalPosY; }
00208   FXint getNormalWidth() const { return normalWidth; }
00209   FXint getNormalHeight() const { return normalHeight; }
00210 
00212   void setIconX(FXint x){ iconPosX=x; }
00213   void setIconY(FXint y){ iconPosY=y; }
00214   void setIconWidth(FXint w){ iconWidth=w; }
00215   void setIconHeight(FXint h){ iconHeight=h; }
00216 
00218   FXint getIconX() const { return iconPosX; }
00219   FXint getIconY() const { return iconPosY; }
00220   FXint getIconWidth() const { return iconWidth; }
00221   FXint getIconHeight() const { return iconHeight; }
00222 
00224   FXWindow *contentWindow() const;
00225 
00227   void setTitle(const FXString& name);
00228 
00230   FXString getTitle() const { return title; }
00231 
00233   FXColor getHiliteColor() const { return hiliteColor; }
00234   FXColor getShadowColor() const { return shadowColor; }
00235   FXColor getBaseColor() const { return baseColor; }
00236   FXColor getBorderColor() const { return borderColor; }
00237   FXColor getTitleColor () const { return titleColor; }
00238   FXColor getTitleBackColor() const { return titleBackColor; }
00239 
00241   void setHiliteColor(FXColor clr);
00242   void setShadowColor(FXColor clr);
00243   void setBaseColor(FXColor clr);
00244   void setBorderColor(FXColor clr);
00245   void setTitleColor(FXColor clr);
00246   void setTitleBackColor(FXColor clr);
00247 
00249   virtual FXbool maximize(FXbool notify=FALSE);
00250 
00252   virtual FXbool minimize(FXbool notify=FALSE);
00253 
00255   virtual FXbool restore(FXbool notify=FALSE);
00256 
00258   virtual FXbool close(FXbool notify=FALSE);
00259 
00261   FXbool isMaximized() const;
00262 
00264   FXbool isMinimized() const;
00265 
00267   FXIcon *getIcon() const;
00268 
00270   void setIcon(FXIcon* icon);
00271 
00273   FXPopup* getMenu() const;
00274 
00276   void setMenu(FXPopup* menu);
00277 
00279   void setTracking(FXbool tracking=TRUE);
00280 
00282   FXbool getTracking() const;
00283 
00285   void setFont(FXFont *fnt);
00286 
00288   FXFont* getFont() const { return font; }
00289 
00291   virtual void save(FXStream& store) const;
00292 
00294   virtual void load(FXStream& store);
00295 
00297   virtual ~FXMDIChild();
00298   };
00299 
00300 }
00301 
00302 #endif
00303 #endif

(C) 2002-2009 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Nov 20 18:31:23 2009 for TnFOX by doxygen v1.4.7