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#include "TGCanvas.h"
38#include "TGMenu.h"
39#include "TGFont.h"
40
41
42/// MDI resizing modes
47};
48
49/// MDI hints, also used to identify titlebar buttons
57 kMdiHelp = 256,
58 kMdiMenu = 512,
61};
62
63/// window arrangement modes
67 kMdiCascade = 3
68};
69
70/// geometry value masks for ConfigureWindow() call
75};
76
77
78class TGGC;
79class TGMdiMenuBar;
80class TGMdiContainer;
81class TGMdiDecorFrame;
82class TGMdiFrame;
83
84//----------------------------------------------------------------------
85
87
88friend class TGMdiMainFrame;
89
90protected:
91 UInt_t fFrameId; ///< TGMdiFrameList Id
92 TGMdiDecorFrame *fDecor; ///< MDI decor frame
93 TGMdiFrameList *fPrev, *fNext; ///< pointers on previous and next TGMdiFrameList
94 TGMdiFrameList *fCyclePrev, *fCycleNext; ///< pointers on previous and next TGMdiFrameList
95
96public:
97 virtual ~TGMdiFrameList() { }
98
99 UInt_t GetFrameId() const { return fFrameId; }
101 TGMdiFrameList *GetPrev() const { return fPrev; }
102 TGMdiFrameList *GetNext() const { return fNext; }
105
106 void SetFrameId(UInt_t id) { fFrameId = id; }
107 void SetDecorFrame(TGMdiDecorFrame *decor) { fDecor = decor; }
108 void SetPrev(TGMdiFrameList *prev) { fPrev = prev; }
109 void SetNext(TGMdiFrameList *next) { fNext = next; }
110 void SetCyclePrev(TGMdiFrameList *prev) { fCyclePrev = prev; }
111 void SetCycleNext(TGMdiFrameList *next) { fCycleNext = next; }
112
113 ClassDef(TGMdiFrameList, 0) // MDI Frame list
114};
115
116
118
119public:
120 Int_t fValueMask; ///< MDI hints mask
121 TGRectangle fClient, fDecoration, fIcon; ///< client, decoration and icon rectangles
122
123 virtual ~TGMdiGeometry() {}
124
125 ClassDef(TGMdiGeometry, 0) // MDI Geometry
126};
127
128
129//----------------------------------------------------------------------
130
131class TGMdiMainFrame : public TGCanvas {
132
133friend class TGMdiFrame;
134
135protected:
136 enum {
137 // the width of minimized windows, in "height" units
139 };
140
141 Int_t fCurrentX, fCurrentY, fResizeMode; ///< current MDI child XY position and resize mode
142 Int_t fArrangementMode; ///< MDI children arrangement mode
143 TGFont *fFontCurrent, *fFontNotCurrent; ///< fonts for active and inactive MDI children
144 Pixel_t fBackCurrent, fForeCurrent; ///< back and fore colors for active MDI children
145 Pixel_t fBackNotCurrent, fForeNotCurrent; ///< back and fore colors for inactive MDI children
146
147 TGGC *fBoxGC; ///< GC used to draw resizing box (rectangle)
148
149 Long_t fNumberOfFrames; ///< number of MDI child windows
150 TGMdiMenuBar *fMenuBar; ///< menu bar
151 TGFrame *fContainer; ///< MDI container
152 TGPopupMenu *fWinListMenu; ///< popup menu with list of MDI child windows
153 TGMdiFrameList *fChildren; ///< list of MDI child windows
154 TGMdiFrameList *fCurrent; ///< current list of MDI child windows
155
156 void AddMdiFrame(TGMdiFrame *f);
158
159 Bool_t SetCurrent(TGMdiFrameList *newcurrent);
162
163 void UpdateWinListMenu();
164
165public:
167 UInt_t options = 0,
169 virtual ~TGMdiMainFrame();
170
171 Bool_t HandleKey(Event_t *event) override;
172 Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override;
173
174 void Layout() override;
175
176 virtual void FreeMove(TGMdiFrame *frame);
177 virtual void FreeSize(TGMdiFrame *frame);
178 virtual void Restore(TGMdiFrame *frame);
179 virtual void Maximize(TGMdiFrame *frame);
180 virtual void Minimize(TGMdiFrame *frame);
181 virtual Int_t Close(TGMdiFrame *frame);
182 virtual Int_t ContextHelp(TGMdiFrame *frame);
183 virtual void CloseAll();
184
185 virtual void Cascade() { ArrangeFrames(kMdiCascade); }
188
189 virtual void ArrangeFrames(Int_t mode);
190 virtual void ArrangeMinimized();
191
192 virtual void CirculateUp();
193 virtual void CirculateDown();
194
195 TGMdiFrame *GetCurrent() const;
196 TGMdiFrame *GetMdiFrame(UInt_t id) const;
197 TGFrame *GetContainer() const { return fContainer; }
198 Bool_t SetCurrent(UInt_t newcurrent);
199 Bool_t SetCurrent(TGMdiFrame *f); //*SIGNAL*
200
202 TGMdiMenuBar *GetMenu() const { return fMenuBar; }
203
205 { return current ? fCurrent : fChildren; }
207
209 void UpdateMdiButtons();
210
211 TGRectangle GetBBox() const;
213
216
219
220 virtual void FrameCreated(Int_t id) { Emit("FrameCreated(Int_t)", id); } //*SIGNAL*
221 virtual void FrameClosed(Int_t id) { Emit("FrameClosed(Int_t)", id); } //*SIGNAL*
222 virtual void FrameMaximized(Int_t id) { Emit("FrameMaximized(Int_t)", id); } //*SIGNAL*
223 virtual void FrameMinimized(Int_t id) { Emit("FrameMinimized(Int_t)", id); } //*SIGNAL*
224 virtual void FrameRestored(Int_t id) { Emit("FrameRestored(Int_t)", id); } //*SIGNAL*
225 virtual void FramesArranged(Int_t mode) { Emit("FramesArranged(Int_t)", mode); } //*SIGNAL*
226
227 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
228
229 ClassDefOverride(TGMdiMainFrame, 0) // MDI main frame
230};
231
232
233//----------------------------------------------------------------------
234
235class TGMdiContainer : public TGFrame {
236
237protected:
238 const TGMdiMainFrame *fMain; // pointer to MDI main frame
239
240public:
242 UInt_t options = 0,
244
246 TGDimension GetDefaultSize() const override;
247
248 ClassDefOverride(TGMdiContainer, 0) // MDI container
249};
250
251#endif
ULong_t Pixel_t
Pixel value.
Definition: GuiTypes.h:40
#define f(i)
Definition: RSha256.hxx:104
#define h(i)
Definition: RSha256.hxx:106
bool Bool_t
Definition: RtypesCore.h:63
int Int_t
Definition: RtypesCore.h:45
long Longptr_t
Definition: RtypesCore.h:82
const Bool_t kFALSE
Definition: RtypesCore.h:101
long Long_t
Definition: RtypesCore.h:54
unsigned int UInt_t
Definition: RtypesCore.h:46
unsigned long ULong_t
Definition: RtypesCore.h:55
const char Option_t
Definition: RtypesCore.h:66
#define ClassDef(name, id)
Definition: Rtypes.h:335
#define BIT(n)
Definition: Rtypes.h:85
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
EMdiGeometryMask
geometry value masks for ConfigureWindow() call
@ kMdiDecorGeometry
@ kMdiIconGeometry
@ kMdiClientGeometry
EMdiResizingModes
MDI resizing modes.
@ kMdiDefaultResizeMode
@ kMdiNonOpaque
@ kMdiOpaque
EMdiArrangementModes
window arrangement modes
@ kMdiTileVertical
@ kMdiCascade
@ kMdiTileHorizontal
EMdiHints
MDI hints, also used to identify titlebar buttons.
@ kMdiMinimize
@ kMdiMove
@ kMdiHelp
@ kMdiMenu
@ kMdiSize
@ kMdiRestore
@ kMdiMaximize
@ kMdiClose
@ kMdiDefaultHints
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char mode
A frame containing two scrollbars (a horizontal and a vertical) and a viewport.
Definition: TGCanvas.h:192
Encapsulate fonts used in the GUI system.
Definition: TGFont.h:140
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition: TGFrame.h:80
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:683
Encapsulate a graphics context used in the low level graphics.
Definition: TGGC.h:22
TGDimension GetDefaultSize() const override
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.
Bool_t HandleConfigureNotify(Event_t *event) override
Handle configure notify events for MDI container.
const TGMdiMainFrame * fMain
This file contains all different MDI frame decoration classes.
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
MDI decor frame.
TGMdiFrameList * fCycleNext
pointers on previous and next TGMdiFrameList
TGMdiFrameList * GetCycleNext() const
TGMdiDecorFrame * GetDecorFrame() const
UInt_t fFrameId
TGMdiFrameList Id.
TGMdiFrameList * GetNext() const
TGMdiFrameList * GetPrev() const
TGMdiFrameList * fNext
pointers on previous and next TGMdiFrameList
void SetCycleNext(TGMdiFrameList *next)
This file contains the TGMdiFrame class.
Definition: TGMdiFrame.h:42
TGRectangle fIcon
client, decoration and icon rectangles
Int_t fValueMask
MDI hints mask.
TGRectangle fDecoration
TGRectangle fClient
virtual ~TGMdiGeometry()
This file contains the TGMdiMainFrame class.
TGMdiMenuBar * GetMenu() const
virtual void ArrangeFrames(Int_t mode)
Automatic repositioning and resizing of every MDI child window.
virtual void FramesArranged(Int_t mode)
Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override
Process messages MDI main frame.
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
menu bar
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
fonts for active and inactive MDI children
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
MDI container.
TGGC * fBoxGC
GC used to draw resizing box (rectangle)
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
back and fore colors for active MDI children
Long_t fNumberOfFrames
number of MDI child windows
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
popup menu with list of MDI child windows
TGMdiFrame * GetCurrent() const
Return pointer on current (active) MDI child window.
void SavePrimitive(std::ostream &out, Option_t *option="") override
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
list of MDI child windows
Int_t fResizeMode
current MDI child XY position and resize mode
Bool_t HandleKey(Event_t *event) override
Handle keyboards events into MDI main frame.
TGRectangle GetMinimizedBBox() const
Return minimized box (rectangle) for current MDI child.
virtual void Cascade()
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
current list of MDI child windows
virtual void FreeSize(TGMdiFrame *frame)
Allow to resize MDI child window mdiframe.
TGFrame * GetContainer() const
TGFont * fFontCurrent
TGMdiDecorFrame * GetDecorFrame(UInt_t id) const
Return decor frame of MDI child window (by id).
void Layout() override
Recalculates the postion and the size of all MDI child windows.
void UpdateWinListMenu()
Update MDI menu entries with current list of MDI child windows.
Pixel_t fForeNotCurrent
back and fore colors for inactive MDI children
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.
Int_t fArrangementMode
MDI children arrangement mode.
This class creates a popup menu object.
Definition: TGMenu.h:110
ROOT GUI Window base class.
Definition: TGWindow.h:23
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:164
Event structure.
Definition: GuiTypes.h:174