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
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
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
0043 enum EMdiResizingModes {
0044 kMdiOpaque = 1,
0045 kMdiNonOpaque = 2,
0046 kMdiDefaultResizeMode = kMdiOpaque
0047 };
0048
0049
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
0064 enum EMdiArrangementModes {
0065 kMdiTileHorizontal = 1,
0066 kMdiTileVertical = 2,
0067 kMdiCascade = 3
0068 };
0069
0070
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;
0092 TGMdiDecorFrame *fDecor;
0093 TGMdiFrameList *fPrev, *fNext;
0094 TGMdiFrameList *fCyclePrev, *fCycleNext;
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)
0114 };
0115
0116
0117 class TGMdiGeometry {
0118
0119 public:
0120 Int_t fValueMask;
0121 TGRectangle fClient, fDecoration, fIcon;
0122
0123 virtual ~TGMdiGeometry() {}
0124
0125 ClassDef(TGMdiGeometry, 0)
0126 };
0127
0128
0129
0130
0131 class TGMdiMainFrame : public TGCanvas {
0132
0133 friend class TGMdiFrame;
0134
0135 protected:
0136 enum {
0137
0138 kMinimizedWidth = 5
0139 };
0140
0141 Int_t fCurrentX, fCurrentY, fResizeMode;
0142 Int_t fArrangementMode;
0143 TGFont *fFontCurrent, *fFontNotCurrent;
0144 Pixel_t fBackCurrent, fForeCurrent;
0145 Pixel_t fBackNotCurrent, fForeNotCurrent;
0146
0147 TGGC *fBoxGC;
0148
0149 Long_t fNumberOfFrames;
0150 TGMdiMenuBar *fMenuBar;
0151 TGFrame *fContainer;
0152 TGPopupMenu *fWinListMenu;
0153 TGMdiFrameList *fChildren;
0154 TGMdiFrameList *fCurrent;
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);
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); }
0221 virtual void FrameClosed(Int_t id) { Emit("FrameClosed(Int_t)", id); }
0222 virtual void FrameMaximized(Int_t id) { Emit("FrameMaximized(Int_t)", id); }
0223 virtual void FrameMinimized(Int_t id) { Emit("FrameMinimized(Int_t)", id); }
0224 virtual void FrameRestored(Int_t id) { Emit("FrameRestored(Int_t)", id); }
0225 virtual void FramesArranged(Int_t mode) { Emit("FramesArranged(Int_t)", mode); }
0226
0227 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
0228
0229 ClassDefOverride(TGMdiMainFrame, 0)
0230 };
0231
0232
0233
0234
0235 class TGMdiContainer : public TGFrame {
0236
0237 protected:
0238 const TGMdiMainFrame *fMain;
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)
0249 };
0250
0251 #endif