Logo ROOT  
Reference Guide
TGMdiMainFrame.h
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Bertrand Bellenot 20/08/2004
3
4/*************************************************************************
5 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12/**************************************************************************
13
14 This file is part of TGMdi, an extension to the xclass toolkit.
15 Copyright (C) 1998-2002 by Harald Radke, Hector Peraza.
16
17 This application is free software; you can redistribute it and/or
18 modify it under the terms of the GNU Library General Public
19 License as published by the Free Software Foundation; either
20 version 2 of the License, or (at your option) any later version.
21
22 This application is distributed in the hope that it will be useful,
23 but WITHOUT ANY WARRANTY; without even the implied warranty of
24 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 Library General Public License for more details.
26
27 You should have received a copy of the GNU Library General Public
28 License along with this library; if not, write to the Free
29 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30
31**************************************************************************/
32
33#ifndef ROOT_TGMdiMainFrame
34#define ROOT_TGMdiMainFrame
35
36//////////////////////////////////////////////////////////////////////////
37// //
38// TGMdiMainFrame. //
39// //
40// This file contains the TGMdiMainFrame class. //
41// //
42//////////////////////////////////////////////////////////////////////////
43
44#include "TGCanvas.h"
45#include "TGMenu.h"
46#include "TGFont.h"
47
48
49// MDI resizing modes
54};
55
56// MDI hints, also used to identify titlebar buttons
64 kMdiHelp = 256,
65 kMdiMenu = 512,
68};
69
70// window arrangement modes
74 kMdiCascade = 3
75};
76
77// geometry value masks for ConfigureWindow() call
82};
83
84
85class TGGC;
86class TGMdiMenuBar;
87class TGMdiContainer;
88class TGMdiDecorFrame;
89class TGMdiFrame;
90
91//----------------------------------------------------------------------
92
94
95friend class TGMdiMainFrame;
96
97protected:
98 UInt_t fFrameId; // TGMdiFrameList Id
99 TGMdiDecorFrame *fDecor; // MDI decor frame
100 TGMdiFrameList *fPrev, *fNext; // pointers on previous and next TGMdiFrameList
101 TGMdiFrameList *fCyclePrev, *fCycleNext; // pointers on previous and next TGMdiFrameList
102
103public:
104 virtual ~TGMdiFrameList() { }
105
106 UInt_t GetFrameId() const { return fFrameId; }
108 TGMdiFrameList *GetPrev() const { return fPrev; }
109 TGMdiFrameList *GetNext() const { return fNext; }
112
113 void SetFrameId(UInt_t id) { fFrameId = id; }
114 void SetDecorFrame(TGMdiDecorFrame *decor) { fDecor = decor; }
115 void SetPrev(TGMdiFrameList *prev) { fPrev = prev; }
116 void SetNext(TGMdiFrameList *next) { fNext = next; }
117 void SetCyclePrev(TGMdiFrameList *prev) { fCyclePrev = prev; }
118 void SetCycleNext(TGMdiFrameList *next) { fCycleNext = next; }
119
120 ClassDef(TGMdiFrameList, 0) // MDI Frame list
121};
122
123
125
126public:
127 Int_t fValueMask; // MDI hints mask
128 TGRectangle fClient, fDecoration, fIcon; // client, decoration and icon rectangles
129
130 virtual ~TGMdiGeometry() { }
131
132 ClassDef(TGMdiGeometry, 0) // MDI Geometry
133};
134
135
136//----------------------------------------------------------------------
137
138class TGMdiMainFrame : public TGCanvas {
139
140friend class TGMdiFrame;
141
142protected:
143 enum {
144 // the width of minimized windows, in "height" units
146 };
147
148 Int_t fCurrentX, fCurrentY, fResizeMode; // current MDI child XY position and resize mode
149 Int_t fArrangementMode; // MDI children arrangement mode
150 TGFont *fFontCurrent, *fFontNotCurrent; // fonts for active and inactive MDI children
151 Pixel_t fBackCurrent, fForeCurrent; // back and fore colors for active MDI children
152 Pixel_t fBackNotCurrent, fForeNotCurrent; // back and fore colors for inactive MDI children
153
154 TGGC *fBoxGC; // GC used to draw resizing box (rectangle)
155
156 Long_t fNumberOfFrames; // number of MDI child windows
157 TGMdiMenuBar *fMenuBar; // menu bar
158 TGFrame *fContainer; // MDI container
159 TGPopupMenu *fWinListMenu; // popup menu with list of MDI child windows
160 TGMdiFrameList *fChildren; // list of MDI child windows
161 TGMdiFrameList *fCurrent; // current list of MDI child windows
162
163 void AddMdiFrame(TGMdiFrame *f);
165
166 Bool_t SetCurrent(TGMdiFrameList *newcurrent);
169
170 void UpdateWinListMenu();
171
172public:
173 TGMdiMainFrame(const TGWindow *p, TGMdiMenuBar *menu, Int_t w, Int_t h,
174 UInt_t options = 0,
176 virtual ~TGMdiMainFrame();
177
178 virtual Bool_t HandleKey(Event_t *event);
179 virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
180
181 virtual void Layout();
182
183 virtual void FreeMove(TGMdiFrame *frame);
184 virtual void FreeSize(TGMdiFrame *frame);
185 virtual void Restore(TGMdiFrame *frame);
186 virtual void Maximize(TGMdiFrame *frame);
187 virtual void Minimize(TGMdiFrame *frame);
188 virtual Int_t Close(TGMdiFrame *frame);
189 virtual Int_t ContextHelp(TGMdiFrame *frame);
190 virtual void CloseAll();
191
192 virtual void Cascade() { ArrangeFrames(kMdiCascade); }
195
196 virtual void ArrangeFrames(Int_t mode);
197 virtual void ArrangeMinimized();
198
199 virtual void CirculateUp();
200 virtual void CirculateDown();
201
202 TGMdiFrame *GetCurrent() const;
203 TGMdiFrame *GetMdiFrame(UInt_t id) const;
204 TGFrame *GetContainer() const { return fContainer; }
205 Bool_t SetCurrent(UInt_t newcurrent);
206 Bool_t SetCurrent(TGMdiFrame *f); //*SIGNAL*
207
209 TGMdiMenuBar *GetMenu() const { return fMenuBar; }
210
212 { return current ? fCurrent : fChildren; }
214
216 void UpdateMdiButtons();
217
218 TGRectangle GetBBox() const;
220
223
226
227 virtual void FrameCreated(Int_t id) { Emit("FrameCreated(Int_t)", id); } //*SIGNAL*
228 virtual void FrameClosed(Int_t id) { Emit("FrameClosed(Int_t)", id); } //*SIGNAL*
229 virtual void FrameMaximized(Int_t id) { Emit("FrameMaximized(Int_t)", id); } //*SIGNAL*
230 virtual void FrameMinimized(Int_t id) { Emit("FrameMinimized(Int_t)", id); } //*SIGNAL*
231 virtual void FrameRestored(Int_t id) { Emit("FrameRestored(Int_t)", id); } //*SIGNAL*
232 virtual void FramesArranged(Int_t mode) { Emit("FramesArranged(Int_t)", mode); } //*SIGNAL*
233
234 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
235
236 ClassDef(TGMdiMainFrame, 0) // MDI main frame
237};
238
239
240//----------------------------------------------------------------------
241
242class TGMdiContainer : public TGFrame {
243
244protected:
245 const TGMdiMainFrame *fMain; // pointer to MDI main frame
246
247public:
249 UInt_t options = 0,
251
252 virtual Bool_t HandleConfigureNotify(Event_t *event);
253 virtual TGDimension GetDefaultSize() const;
254
255 ClassDef(TGMdiContainer, 0) // MDI container
256};
257
258#endif
ULong_t Pixel_t
Definition: GuiTypes.h:39
#define f(i)
Definition: RSha256.hxx:104
#define h(i)
Definition: RSha256.hxx:106
int Int_t
Definition: RtypesCore.h:43
unsigned int UInt_t
Definition: RtypesCore.h:44
const Bool_t kFALSE
Definition: RtypesCore.h:90
unsigned long ULong_t
Definition: RtypesCore.h:53
long Long_t
Definition: RtypesCore.h:52
bool Bool_t
Definition: RtypesCore.h:61
const char Option_t
Definition: RtypesCore.h:64
#define ClassDef(name, id)
Definition: Rtypes.h:322
#define BIT(n)
Definition: Rtypes.h:83
EMdiGeometryMask
@ kMdiDecorGeometry
@ kMdiIconGeometry
@ kMdiClientGeometry
EMdiResizingModes
@ kMdiDefaultResizeMode
@ kMdiNonOpaque
@ kMdiOpaque
EMdiArrangementModes
@ kMdiTileVertical
@ kMdiCascade
@ kMdiTileHorizontal
EMdiHints
@ kMdiMinimize
@ kMdiMove
@ kMdiHelp
@ kMdiMenu
@ kMdiSize
@ kMdiRestore
@ kMdiMaximize
@ kMdiClose
@ kMdiDefaultHints
XFontStruct * id
Definition: TGX11.cxx:108
Definition: TGFont.h:149
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:667
Definition: TGGC.h:31
virtual Bool_t HandleConfigureNotify(Event_t *event)
Handle configure notify events for MDI container.
virtual TGDimension GetDefaultSize() const
Return dimension of MDI container.
TGMdiContainer(const TGMdiMainFrame *p, Int_t w, Int_t h, UInt_t options=0, ULong_t back=GetDefaultFrameBackground())
TGMdiContainer constructor.
const TGMdiMainFrame * fMain
void SetCyclePrev(TGMdiFrameList *prev)
UInt_t GetFrameId() const
void SetFrameId(UInt_t id)
TGMdiFrameList * fCyclePrev
void SetDecorFrame(TGMdiDecorFrame *decor)
TGMdiFrameList * GetCyclePrev() const
void SetPrev(TGMdiFrameList *prev)
TGMdiFrameList * fPrev
void SetNext(TGMdiFrameList *next)
virtual ~TGMdiFrameList()
TGMdiDecorFrame * fDecor
TGMdiFrameList * fCycleNext
TGMdiFrameList * GetCycleNext() const
TGMdiDecorFrame * GetDecorFrame() const
TGMdiFrameList * GetNext() const
TGMdiFrameList * GetPrev() const
TGMdiFrameList * fNext
void SetCycleNext(TGMdiFrameList *next)
TGRectangle fIcon
TGRectangle fDecoration
TGRectangle fClient
virtual ~TGMdiGeometry()
TGMdiMenuBar * GetMenu() const
virtual void ArrangeFrames(Int_t mode)
Automatic repositionning and resizing of every MDI child window.
virtual void FramesArranged(Int_t mode)
TGMdiGeometry GetWindowGeometry(TGMdiFrame *f) const
Get MDI geometry of MDI child window f.
void AddMdiFrame(TGMdiFrame *f)
Add new MDI child window.
virtual void Restore(TGMdiFrame *frame)
Restore size of MDI child window mdiframe.
virtual void FrameMinimized(Int_t id)
TGMdiMenuBar * fMenuBar
virtual void FreeMove(TGMdiFrame *frame)
Allow to move MDI child window mdiframe.
Bool_t SetCurrent(TGMdiFrameList *newcurrent)
Set current (active) MDI child window (by frame list).
TGFont * fFontNotCurrent
Bool_t IsMinimized(TGMdiFrame *f)
Check if MDI child window f is minimized;.
virtual void FrameCreated(Int_t id)
TGMdiMainFrame(const TGWindow *p, TGMdiMenuBar *menu, Int_t w, Int_t h, UInt_t options=0, Pixel_t back=GetDefaultFrameBackground())
Create a MDI main frame.
TGFrame * fContainer
virtual void CirculateDown()
Send the highest window to the bottom.
TGRectangle GetBBox() const
Return resizing box (rectangle) for current MDI child.
void SetResizeMode(Int_t mode=kMdiDefaultResizeMode)
Set MDI windows resize mode (opaque or transparent).
TGMdiFrame * GetMdiFrame(UInt_t id) const
Return frame of MDI child window (by id).
Pixel_t fForeCurrent
Long_t fNumberOfFrames
Long_t GetNumberOfFrames() const
TGMdiFrameList * GetWindowList(Int_t current=kFALSE) const
Bool_t RemoveMdiFrame(TGMdiFrame *f)
Remove MDI child window.
virtual void FrameRestored(Int_t id)
virtual void Minimize(TGMdiFrame *frame)
Minimize MDI child window mdiframe.
virtual void CloseAll()
Close all MDI child windows.
virtual void CirculateUp()
Bring the lowest window to the top.
virtual ~TGMdiMainFrame()
MDI main frame destructor.
virtual void FrameClosed(Int_t id)
Pixel_t fBackNotCurrent
TGPopupMenu * fWinListMenu
TGMdiFrame * GetCurrent() const
Return pointer on current (active) MDI child window.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a MDI main frame as a C++ statement(s) on output stream out.
virtual void ArrangeMinimized()
This is an attempt to an "smart" minimized window re-arrangement.
Bool_t IsMaximized(TGMdiFrame *f)
Check if MDI child window f is maximized;.
TGPopupMenu * GetWinListMenu() const
Pixel_t fBackCurrent
virtual void TileHorizontal()
virtual void FrameMaximized(Int_t id)
virtual void TileVertical()
virtual void Maximize(TGMdiFrame *frame)
Maximize MDI child window mdiframe.
TGMdiFrameList * fChildren
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Process messages MDI main frame.
TGRectangle GetMinimizedBBox() const
Return minimized box (rectangle) for current MDI child.
virtual void Cascade()
virtual Bool_t HandleKey(Event_t *event)
Handle keyboards events into MDI main frame.
void ConfigureWindow(TGMdiFrame *f, TGMdiGeometry &geom)
Set MDI geometry for MDI child window f.
virtual Int_t Close(TGMdiFrame *frame)
Close MDI child window mdiframe.
TGMdiFrameList * fCurrent
virtual void FreeSize(TGMdiFrame *frame)
Allow to resize MDI child window mdiframe.
TGFrame * GetContainer() const
TGFont * fFontCurrent
virtual void Layout()
Recalculates the postion and the size of all MDI child windows.
TGMdiDecorFrame * GetDecorFrame(UInt_t id) const
Return decor frame of MDI child window (by id).
void UpdateWinListMenu()
Update MDI menu entries with current list of MDI child windows.
Pixel_t fForeNotCurrent
virtual Int_t ContextHelp(TGMdiFrame *frame)
Calls Help() method of MDI child window mdiframe.
void UpdateMdiButtons()
Update the status of MDI buttons in the decor frame of all children.
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:164