#ifndef ROOT_TGMdiMainFrame
#define ROOT_TGMdiMainFrame
#ifndef ROOT_TGCanvas
#include "TGCanvas.h"
#endif
#ifndef ROOT_TGMenu
#include "TGMenu.h"
#endif
#ifndef ROOT_TGFont
#include "TGFont.h"
#endif
enum EMdiResizingModes {
kMdiOpaque = 1,
kMdiNonOpaque = 2,
kMdiDefaultResizeMode = kMdiOpaque
};
enum EMdiHints {
kMdiClose = 4,
kMdiRestore = 8,
kMdiMove = 16,
kMdiSize = 32,
kMdiMinimize = 64,
kMdiMaximize = 128,
kMdiHelp = 256,
kMdiMenu = 512,
kMdiDefaultHints = kMdiMenu | kMdiMinimize | kMdiRestore |
kMdiMaximize | kMdiSize | kMdiClose
};
enum EMdiArrangementModes {
kMdiTileHorizontal = 1,
kMdiTileVertical = 2,
kMdiCascade = 3
};
enum EMdiGeometryMask {
kMdiClientGeometry = BIT(0),
kMdiDecorGeometry = BIT(1),
kMdiIconGeometry = BIT(2)
};
class TGGC;
class TGMdiMenuBar;
class TGMdiContainer;
class TGMdiDecorFrame;
class TGMdiFrame;
class TGMdiFrameList {
friend class TGMdiMainFrame;
protected:
UInt_t fFrameId;
TGMdiDecorFrame *fDecor;
TGMdiFrameList *fPrev, *fNext;
TGMdiFrameList *fCyclePrev, *fCycleNext;
public:
virtual ~TGMdiFrameList() { }
UInt_t GetFrameId() const { return fFrameId; }
TGMdiDecorFrame *GetDecorFrame() const { return fDecor; }
TGMdiFrameList *GetPrev() const { return fPrev; }
TGMdiFrameList *GetNext() const { return fNext; }
TGMdiFrameList *GetCyclePrev() const { return fCyclePrev; }
TGMdiFrameList *GetCycleNext() const { return fCycleNext; }
void SetFrameId(UInt_t id) { fFrameId = id; }
void SetDecorFrame(TGMdiDecorFrame *decor) { fDecor = decor; }
void SetPrev(TGMdiFrameList *prev) { fPrev = prev; }
void SetNext(TGMdiFrameList *next) { fNext = next; }
void SetCyclePrev(TGMdiFrameList *prev) { fCyclePrev = prev; }
void SetCycleNext(TGMdiFrameList *next) { fCycleNext = next; }
ClassDef(TGMdiFrameList, 0)
};
class TGMdiGeometry {
public:
Int_t fValueMask;
TGRectangle fClient, fDecoration, fIcon;
virtual ~TGMdiGeometry() { }
ClassDef(TGMdiGeometry, 0)
};
class TGMdiMainFrame : public TGCanvas {
friend class TGMdiFrame;
protected:
enum {
kMinimizedWidth = 5
};
Int_t fCurrentX, fCurrentY, fResizeMode;
Int_t fArrangementMode;
TGFont *fFontCurrent, *fFontNotCurrent;
Pixel_t fBackCurrent, fForeCurrent;
Pixel_t fBackNotCurrent, fForeNotCurrent;
TGGC *fBoxGC;
Long_t fNumberOfFrames;
TGMdiMenuBar *fMenuBar;
TGFrame *fContainer;
TGPopupMenu *fWinListMenu;
TGMdiFrameList *fChildren;
TGMdiFrameList *fCurrent;
void AddMdiFrame(TGMdiFrame *f);
Bool_t RemoveMdiFrame(TGMdiFrame *f);
Bool_t SetCurrent(TGMdiFrameList *newcurrent);
TGMdiDecorFrame *GetDecorFrame(UInt_t id) const;
TGMdiDecorFrame *GetDecorFrame(TGMdiFrame *frame) const;
void UpdateWinListMenu();
public:
TGMdiMainFrame(const TGWindow *p, TGMdiMenuBar *menu, Int_t w, Int_t h,
UInt_t options = 0,
Pixel_t back = GetDefaultFrameBackground());
virtual ~TGMdiMainFrame();
virtual Bool_t HandleKey(Event_t *event);
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
virtual void Layout();
virtual void FreeMove(TGMdiFrame *frame);
virtual void FreeSize(TGMdiFrame *frame);
virtual void Restore(TGMdiFrame *frame);
virtual void Maximize(TGMdiFrame *frame);
virtual void Minimize(TGMdiFrame *frame);
virtual Int_t Close(TGMdiFrame *frame);
virtual Int_t ContextHelp(TGMdiFrame *frame);
virtual void CloseAll();
virtual void Cascade() { ArrangeFrames(kMdiCascade); }
virtual void TileHorizontal() { ArrangeFrames(kMdiTileHorizontal); }
virtual void TileVertical() { ArrangeFrames(kMdiTileVertical); }
virtual void ArrangeFrames(Int_t mode);
virtual void ArrangeMinimized();
virtual void CirculateUp();
virtual void CirculateDown();
TGMdiFrame *GetCurrent() const;
TGMdiFrame *GetMdiFrame(UInt_t id) const;
TGFrame *GetContainer() const { return fContainer; }
Bool_t SetCurrent(UInt_t newcurrent);
Bool_t SetCurrent(TGMdiFrame *f);
TGPopupMenu *GetWinListMenu() const { return fWinListMenu; }
TGMdiMenuBar *GetMenu() const { return fMenuBar; }
TGMdiFrameList *GetWindowList(Int_t current = kFALSE) const
{ return current ? fCurrent : fChildren; }
Long_t GetNumberOfFrames() const { return fNumberOfFrames; }
void SetResizeMode(Int_t mode = kMdiDefaultResizeMode);
void UpdateMdiButtons();
TGRectangle GetBBox() const;
TGRectangle GetMinimizedBBox() const;
TGMdiGeometry GetWindowGeometry(TGMdiFrame *f) const;
void ConfigureWindow(TGMdiFrame *f, TGMdiGeometry &geom);
Bool_t IsMaximized(TGMdiFrame *f);
Bool_t IsMinimized(TGMdiFrame *f);
virtual void FrameCreated(Int_t id) { Emit("FrameCreated(Int_t)", id); }
virtual void FrameClosed(Int_t id) { Emit("FrameClosed(Int_t)", id); }
virtual void FrameMaximized(Int_t id) { Emit("FrameMaximized(Int_t)", id); }
virtual void FrameMinimized(Int_t id) { Emit("FrameMinimized(Int_t)", id); }
virtual void FrameRestored(Int_t id) { Emit("FrameRestored(Int_t)", id); }
virtual void FramesArranged(Int_t mode) { Emit("FramesArranged(Int_t)", mode); }
virtual void SavePrimitive(ostream &out, Option_t *option = "");
ClassDef(TGMdiMainFrame, 0)
};
class TGMdiContainer : public TGFrame {
protected:
const TGMdiMainFrame *fMain;
public:
TGMdiContainer(const TGMdiMainFrame *p, Int_t w, Int_t h,
UInt_t options = 0,
ULong_t back = GetDefaultFrameBackground());
virtual Bool_t HandleConfigureNotify(Event_t *event);
virtual TGDimension GetDefaultSize() const;
ClassDef(TGMdiContainer, 0)
};
#endif