Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TGMdiMainFrame.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/gui:$Id$
0002 // Author: Bertrand Bellenot   20/08/2004
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 /**************************************************************************
0013 
0014     This file is part of TGMdi, an extension to the xclass toolkit.
0015     Copyright (C) 1998-2002 by Harald Radke, Hector Peraza.
0016 
0017     This application is free software; you can redistribute it and/or
0018     modify it under the terms of the GNU Library General Public
0019     License as published by the Free Software Foundation; either
0020     version 2 of the License, or (at your option) any later version.
0021 
0022     This application is distributed in the hope that it will be useful,
0023     but WITHOUT ANY WARRANTY; without even the implied warranty of
0024     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0025     Library General Public License for more details.
0026 
0027     You should have received a copy of the GNU Library General Public
0028     License along with this library; if not, write to the Free
0029     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
0030 
0031 **************************************************************************/
0032 
0033 #ifndef ROOT_TGMdiMainFrame
0034 #define ROOT_TGMdiMainFrame
0035 
0036 
0037 #include "TGCanvas.h"
0038 #include "TGMenu.h"
0039 #include "TGFont.h"
0040 
0041 
0042 /// MDI resizing modes
0043 enum EMdiResizingModes {
0044    kMdiOpaque            = 1,
0045    kMdiNonOpaque         = 2,
0046    kMdiDefaultResizeMode = kMdiOpaque
0047 };
0048 
0049 /// MDI hints, also used to identify titlebar buttons
0050 enum EMdiHints {
0051    kMdiClose         = 4,
0052    kMdiRestore       = 8,
0053    kMdiMove          = 16,
0054    kMdiSize          = 32,
0055    kMdiMinimize      = 64,
0056    kMdiMaximize      = 128,
0057    kMdiHelp          = 256,
0058    kMdiMenu          = 512,
0059    kMdiDefaultHints  = kMdiMenu | kMdiMinimize | kMdiRestore |
0060                        kMdiMaximize | kMdiSize | kMdiClose
0061 };
0062 
0063 /// window arrangement modes
0064 enum EMdiArrangementModes {
0065    kMdiTileHorizontal = 1,
0066    kMdiTileVertical   = 2,
0067    kMdiCascade        = 3
0068 };
0069 
0070 /// geometry value masks for ConfigureWindow() call
0071 enum EMdiGeometryMask {
0072    kMdiClientGeometry = BIT(0),
0073    kMdiDecorGeometry  = BIT(1),
0074    kMdiIconGeometry   = BIT(2)
0075 };
0076 
0077 
0078 class TGGC;
0079 class TGMdiMenuBar;
0080 class TGMdiContainer;
0081 class TGMdiDecorFrame;
0082 class TGMdiFrame;
0083 
0084 //----------------------------------------------------------------------
0085 
0086 class TGMdiFrameList {
0087 
0088 friend class TGMdiMainFrame;
0089 
0090 protected:
0091    UInt_t            fFrameId;                  ///< TGMdiFrameList Id
0092    TGMdiDecorFrame  *fDecor;                    ///< MDI decor frame
0093    TGMdiFrameList   *fPrev, *fNext;             ///< pointers on previous and next TGMdiFrameList
0094    TGMdiFrameList   *fCyclePrev, *fCycleNext;   ///< pointers on previous and next TGMdiFrameList
0095 
0096 public:
0097    virtual ~TGMdiFrameList() { }
0098 
0099    UInt_t            GetFrameId() const { return fFrameId; }
0100    TGMdiDecorFrame  *GetDecorFrame() const { return fDecor; }
0101    TGMdiFrameList   *GetPrev() const { return fPrev; }
0102    TGMdiFrameList   *GetNext() const { return fNext; }
0103    TGMdiFrameList   *GetCyclePrev() const { return fCyclePrev; }
0104    TGMdiFrameList   *GetCycleNext() const { return fCycleNext; }
0105 
0106    void              SetFrameId(UInt_t id) { fFrameId = id; }
0107    void              SetDecorFrame(TGMdiDecorFrame *decor) { fDecor = decor; }
0108    void              SetPrev(TGMdiFrameList *prev) { fPrev = prev; }
0109    void              SetNext(TGMdiFrameList *next) { fNext = next; }
0110    void              SetCyclePrev(TGMdiFrameList *prev) { fCyclePrev = prev; }
0111    void              SetCycleNext(TGMdiFrameList *next) { fCycleNext = next; }
0112 
0113    ClassDef(TGMdiFrameList, 0) // MDI Frame list
0114 };
0115 
0116 
0117 class TGMdiGeometry {
0118 
0119 public:
0120    Int_t            fValueMask;                    ///< MDI hints mask
0121    TGRectangle      fClient, fDecoration, fIcon;   ///< client, decoration and icon rectangles
0122 
0123    virtual ~TGMdiGeometry() {}
0124 
0125    ClassDef(TGMdiGeometry, 0) // MDI Geometry
0126 };
0127 
0128 
0129 //----------------------------------------------------------------------
0130 
0131 class TGMdiMainFrame : public TGCanvas {
0132 
0133 friend class TGMdiFrame;
0134 
0135 protected:
0136    enum {
0137       // the width of minimized windows, in "height" units
0138       kMinimizedWidth = 5
0139    };
0140 
0141    Int_t            fCurrentX, fCurrentY, fResizeMode;   ///< current MDI child XY position and resize mode
0142    Int_t            fArrangementMode;                    ///< MDI children arrangement mode
0143    TGFont          *fFontCurrent, *fFontNotCurrent;      ///< fonts for active and inactive MDI children
0144    Pixel_t          fBackCurrent, fForeCurrent;          ///< back and fore colors for active MDI children
0145    Pixel_t          fBackNotCurrent, fForeNotCurrent;    ///< back and fore colors for inactive MDI children
0146 
0147    TGGC            *fBoxGC;                              ///< GC used to draw resizing box (rectangle)
0148 
0149    Long_t           fNumberOfFrames;                     ///< number of MDI child windows
0150    TGMdiMenuBar    *fMenuBar;                            ///< menu bar
0151    TGFrame         *fContainer;                          ///< MDI container
0152    TGPopupMenu     *fWinListMenu;                        ///< popup menu with list of MDI child windows
0153    TGMdiFrameList  *fChildren;                           ///< list of MDI child windows
0154    TGMdiFrameList  *fCurrent;                            ///< current list of MDI child windows
0155 
0156    void             AddMdiFrame(TGMdiFrame *f);
0157    Bool_t           RemoveMdiFrame(TGMdiFrame *f);
0158 
0159    Bool_t           SetCurrent(TGMdiFrameList *newcurrent);
0160    TGMdiDecorFrame *GetDecorFrame(UInt_t id) const;
0161    TGMdiDecorFrame *GetDecorFrame(TGMdiFrame *frame) const;
0162 
0163    void             UpdateWinListMenu();
0164 
0165 public:
0166    TGMdiMainFrame(const TGWindow *p, TGMdiMenuBar *menu, Int_t w, Int_t h,
0167                   UInt_t options = 0,
0168                   Pixel_t back = GetDefaultFrameBackground());
0169    ~TGMdiMainFrame() override;
0170 
0171    Bool_t           HandleKey(Event_t *event) override;
0172    Bool_t           ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override;
0173 
0174    void             Layout() override;
0175 
0176    virtual void     FreeMove(TGMdiFrame *frame);
0177    virtual void     FreeSize(TGMdiFrame *frame);
0178    virtual void     Restore(TGMdiFrame *frame);
0179    virtual void     Maximize(TGMdiFrame *frame);
0180    virtual void     Minimize(TGMdiFrame *frame);
0181    virtual Int_t    Close(TGMdiFrame *frame);
0182    virtual Int_t    ContextHelp(TGMdiFrame *frame);
0183    virtual void     CloseAll();
0184 
0185    virtual void     Cascade() { ArrangeFrames(kMdiCascade); }
0186    virtual void     TileHorizontal() { ArrangeFrames(kMdiTileHorizontal); }
0187    virtual void     TileVertical() { ArrangeFrames(kMdiTileVertical); }
0188 
0189    virtual void     ArrangeFrames(Int_t mode);
0190    virtual void     ArrangeMinimized();
0191 
0192    virtual void     CirculateUp();
0193    virtual void     CirculateDown();
0194 
0195    TGMdiFrame      *GetCurrent() const;
0196    TGMdiFrame      *GetMdiFrame(UInt_t id) const;
0197    TGFrame         *GetContainer() const { return fContainer; }
0198    Bool_t           SetCurrent(UInt_t newcurrent);
0199    Bool_t           SetCurrent(TGMdiFrame *f);  //*SIGNAL*
0200 
0201    TGPopupMenu     *GetWinListMenu() const { return fWinListMenu; }
0202    TGMdiMenuBar    *GetMenu() const { return fMenuBar; }
0203 
0204    TGMdiFrameList  *GetWindowList(Int_t current = kFALSE) const
0205                      { return current ? fCurrent : fChildren; }
0206    Long_t           GetNumberOfFrames() const { return fNumberOfFrames; }
0207 
0208    void             SetResizeMode(Int_t mode = kMdiDefaultResizeMode);
0209    void             UpdateMdiButtons();
0210 
0211    TGRectangle      GetBBox() const;
0212    TGRectangle      GetMinimizedBBox() const;
0213 
0214    TGMdiGeometry    GetWindowGeometry(TGMdiFrame *f) const;
0215    void             ConfigureWindow(TGMdiFrame *f, TGMdiGeometry &geom);
0216 
0217    Bool_t           IsMaximized(TGMdiFrame *f);
0218    Bool_t           IsMinimized(TGMdiFrame *f);
0219 
0220    virtual void     FrameCreated(Int_t id) { Emit("FrameCreated(Int_t)", id); } //*SIGNAL*
0221    virtual void     FrameClosed(Int_t id) { Emit("FrameClosed(Int_t)", id); } //*SIGNAL*
0222    virtual void     FrameMaximized(Int_t id) { Emit("FrameMaximized(Int_t)", id); } //*SIGNAL*
0223    virtual void     FrameMinimized(Int_t id) { Emit("FrameMinimized(Int_t)", id); } //*SIGNAL*
0224    virtual void     FrameRestored(Int_t id) { Emit("FrameRestored(Int_t)", id); } //*SIGNAL*
0225    virtual void     FramesArranged(Int_t mode) { Emit("FramesArranged(Int_t)", mode); } //*SIGNAL*
0226 
0227    void             SavePrimitive(std::ostream &out, Option_t *option = "") override;
0228 
0229    ClassDefOverride(TGMdiMainFrame, 0) // MDI main frame
0230 };
0231 
0232 
0233 //----------------------------------------------------------------------
0234 
0235 class TGMdiContainer : public TGFrame {
0236 
0237 protected:
0238    const TGMdiMainFrame *fMain;     // pointer to MDI main frame
0239 
0240 public:
0241    TGMdiContainer(const TGMdiMainFrame *p, Int_t w, Int_t h,
0242                   UInt_t options = 0,
0243                   ULong_t back = GetDefaultFrameBackground());
0244 
0245    Bool_t HandleConfigureNotify(Event_t *event) override;
0246    TGDimension GetDefaultSize() const override;
0247 
0248    ClassDefOverride(TGMdiContainer, 0) // MDI container
0249 };
0250 
0251 #endif