Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGMdiDecorFrame.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#ifndef ROOT_TGMdiDecorFrame
13#define ROOT_TGMdiDecorFrame
14
15
16#include "TGFrame.h"
17#include "TGMenu.h"
18#include "TGButton.h"
19#include "TGIcon.h"
20#include "TGLabel.h"
21#include "TGFont.h"
22#include "TGMdiMainFrame.h"
23#include "TGMdiFrame.h"
24
25
26/// placement of window resizers
32};
33
34
35class TGMdiMainFrame;
36class TGMdiDecorFrame;
37class TGMdiFrame;
38class TGMdiTitleBar;
39class TGMdiTitleIcon;
40class TGMdiButtons;
41
42
43//----------------------------------------------------------------------
44
45class TGMdiWinResizer : public TGFrame, public TGWidget {
46
47friend class TGMdiMainFrame;
48
49protected:
50 const TGWindow *fMdiWin; ///< owner MDI Window
51 Int_t fWinX, fWinY, fWinW, fWinH; ///< MDI win position and dimension
52 Int_t fOldX, fOldY, fOldW, fOldH; ///< old MDI win position and dimension
53 Int_t fNewX, fNewY, fNewW, fNewH; ///< new MDI win position and dimension
54 Int_t fMinW, fMinH; ///< Min width and height of the MDI Win
55 Int_t fMdiOptions; ///< MDI options
56 Int_t fPos; ///< position of the resizer
57 Int_t fX0, fY0; ///< initial position of the mouse click
59
60 const TGGC *fBoxGC; ///< GC used for resizing rectangle
61 Int_t fLineW; ///< line width of resizing rectangle
62
63 void MoveResizeIt();
65
66public:
67 TGMdiWinResizer(const TGWindow *p, const TGWindow *mdiwin, Int_t pos,
68 const TGGC *boxGC, Int_t linew,
69 Int_t mdioptions = kMdiDefaultResizeMode,
70 Int_t w = 1, Int_t h = 1, UInt_t options = kOwnBackground);
71
72 Bool_t HandleButton(Event_t *event) override;
73 void DrawBorder() override {}
74
76 void SetMinSize(Int_t w = 50, Int_t h = 20) { fMinW = w; fMinH = h; }
77
78 ClassDefOverride(TGMdiWinResizer, 0) // Window Resizer
79};
80
81
83
84public:
85 TGMdiVerticalWinResizer(const TGWindow *p, const TGWindow *mdiwin,
86 Int_t pos, const TGGC *boxGC, Int_t linew,
87 Int_t mdioptions = kMdiDefaultResizeMode,
88 Int_t w = 4, Int_t h = 5);
89
90 Bool_t HandleMotion(Event_t *event) override;
91 void DrawBorder() override;
92
93 ClassDefOverride(TGMdiVerticalWinResizer, 0) // Vertical Window Resizer
94};
95
96
98
99public:
100 TGMdiHorizontalWinResizer(const TGWindow *p, const TGWindow *mdiwin,
101 Int_t pos, const TGGC *boxGC, Int_t linew,
102 Int_t mdioptions = kMdiDefaultResizeMode,
103 Int_t w = 5, Int_t h = 4);
104
105 Bool_t HandleMotion(Event_t *event) override;
106 void DrawBorder() override;
107
108 ClassDefOverride(TGMdiHorizontalWinResizer, 0) // Horizontal Window Resizer
109};
110
111
113
114public:
115 TGMdiCornerWinResizer(const TGWindow *p, const TGWindow *mdiwin,
116 Int_t pos, const TGGC *boxGC, Int_t linew,
117 Int_t mdioptions = kMdiDefaultResizeMode,
118 Int_t w = 20, Int_t h = 20);
119
120 Bool_t HandleMotion(Event_t *event) override;
121 void DrawBorder() override;
122
123 ClassDefOverride(TGMdiCornerWinResizer, 0) // Corner Window Resizer
124};
125
126
127//----------------------------------------------------------------------
128
130
131friend class TGMdiTitleBar;
132
133protected:
134 TGPictureButton *fButton[5]; ///< MDI picture buttons
136 const TGWindow *fMsgWindow; ///< window handling container messages
137
138public:
139 TGMdiButtons(const TGWindow *p, const TGWindow *titlebar);
140 ~TGMdiButtons() override;
141
142 TGPictureButton *GetButton(Int_t no) const { return fButton[no]; }
143
144 ClassDefOverride(TGMdiButtons, 0) // MDI Buttons Frame
145};
146
147
148//----------------------------------------------------------------------
149
150class TGMdiTitleIcon : public TGIcon {
151
152friend class TGMdiFrame;
153friend class TGMdiTitleBar;
154
155protected:
156 const TGWindow *fMsgWindow; ///< window handling container messages
157 TGPopupMenu *fPopup; ///< Popup menu associated to the title icon
158
159 void DoRedraw() override;
160
161public:
162 TGMdiTitleIcon(const TGWindow *p, const TGWindow *titlebar,
163 const TGPicture *pic, Int_t w, Int_t h);
164 ~TGMdiTitleIcon() override;
165
166 Bool_t HandleDoubleClick(Event_t *event) override;
167 Bool_t HandleButton(Event_t *event) override;
168 TGPopupMenu *GetPopup() const { return fPopup; }
169
170 ClassDefOverride(TGMdiTitleIcon, 0) // MDI Title Icon
171};
172
173
174//----------------------------------------------------------------------
175
177
178friend class TGMdiDecorFrame;
179friend class TGMdiMainFrame;
180
181protected:
182 const TGWindow *fMdiWin; ///< owner MDI window
183 TGMdiButtons *fButtons; ///< MDI buttons
184 TGMdiTitleIcon *fWinIcon; ///< title icon
185 TGLabel *fWinName; ///< window name label
186 TGCompositeFrame *fLFrame, *fMFrame,*fRFrame; ///< the three parts of the title bar
188 Int_t fX0, fY0; ///< initial position of the mouse click
190
191 TGMdiTitleBar(const TGWindow *p, const TGWindow *mdiwin,
192 const char *name = "Untitled");
193 void LayoutButtons(UInt_t buttonmask, Bool_t isMinimized,
194 Bool_t isMaximized);
195
196 void AddFrames(TGMdiTitleIcon *icon, TGMdiButtons *buttons);
197 void RemoveFrames(TGMdiTitleIcon *icon, TGMdiButtons *buttons);
198
199public:
200 ~TGMdiTitleBar() override;
201
202 Bool_t HandleButton(Event_t *event) override;
203 Bool_t HandleDoubleClick(Event_t *event) override;
204 Bool_t HandleMotion(Event_t *event) override;
205 Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override;
206
207 void SetTitleBarColors(UInt_t fore, UInt_t back, TGFont *f);
208 TGMdiButtons *GetButtons() const { return fButtons; }
209 TGMdiTitleIcon *GetWinIcon() const { return fWinIcon; }
210 TGLabel *GetWinName() const { return fWinName; }
211 Int_t GetX0() { return fX0; }
212 Int_t GetY0() { return fY0; }
216
217 void SetX0(Int_t x0) { fX0 = x0; }
218 void SetY0(Int_t y0) { fY0 = y0; }
221 void SetMidButPressed(Bool_t press = kTRUE) { fMidButPressed = press; }
222
223 ClassDefOverride(TGMdiTitleBar, 0) // MDI Title Bar
224};
225
226
227//----------------------------------------------------------------------
228
230
231friend class TGMdiMainFrame;
232
233protected:
234 Int_t fPreResizeX, fPreResizeY; ///< position before resizing
235 Int_t fPreResizeWidth, fPreResizeHeight; ///< dimension before resizing
236 Int_t fMinimizedX, fMinimizedY; ///< minimized position
237 Bool_t fIsMinimized, fIsMaximized; ///< minimized and maximized flags
238 Bool_t fMinimizedUserPlacement; ///< user placement flag
239 Bool_t fIsCurrent; ///< current mdi window flag
240
241 TGMdiFrame *fFrame; ///< parent (owner) MDI frame
242 TGMdiMainFrame *fMdiMainFrame; ///< MDI main frame
243
244 TGMdiVerticalWinResizer *fUpperHR, *fLowerHR; ///< upper and lower vertical resizers
245 TGMdiCornerWinResizer *fUpperLeftCR, *fLowerLeftCR; ///< upper left and lower left resizers
246 TGMdiCornerWinResizer *fUpperRightCR, *fLowerRightCR; ///< upper right and lower right resizers
247 TGMdiHorizontalWinResizer *fLeftVR, *fRightVR; ///< left and right horizontal resizers
248 TGLayoutHints *fLHint, *fExpandHint; ///< layout hints
249
250 ULong_t fButtonMask; ///< mask used to display/hide buttons
251 TGMdiTitleBar *fTitlebar; ///< MDI window title bar
252
253public:
254 enum {
255 // border width of decorated windows
257 };
258
260 const TGGC *boxGC, UInt_t options = 0,
262 ~TGMdiDecorFrame() override;
263
264 Bool_t HandleButton(Event_t *event) override;
265 Bool_t HandleConfigureNotify(Event_t *event) override;
266
267 virtual Int_t CloseWindow() { return fFrame->CloseWindow(); }
268 void Layout() override;
269
270 void Move(Int_t x, Int_t y) override;
271 void MoveResize(Int_t x, Int_t y, UInt_t w, UInt_t h) override;
272
273 void SetMdiButtons(ULong_t buttons);
275
277
278 void SetWindowName(const char *name) override;
279 void SetWindowIcon(const TGPicture *pic);
280 const char *GetWindowName() {
281 return (const char *)fTitlebar->GetWinName()->GetText()->GetString();
282 }
284 Bool_t IsCurrent() const { return fIsCurrent; }
285 Bool_t IsMinimized() const { return fIsMinimized; }
286 Bool_t IsMaximized() const { return fIsMaximized; }
287 Int_t GetPreResizeX() const { return fPreResizeX; }
288 Int_t GetPreResizeY() const { return fPreResizeY; }
291 Int_t GetMinimizedX() const { return fMinimizedX; }
292 Int_t GetMinimizedY() const { return fMinimizedY; }
294
295 void SetCurrent(Bool_t cur = kTRUE) {fIsCurrent = cur; }
296 void SetDecorBorderWidth(Int_t bw);
303 void Minimize(Bool_t min = kTRUE) { fIsMinimized = min; }
304 void Maximize(Bool_t max = kTRUE) { fIsMaximized = max; }
306
307 TGMdiFrame *GetMdiFrame() const { return fFrame; }
309
318
319 ClassDefOverride(TGMdiDecorFrame, 0) // MDI Decor Frame
320};
321
322#endif
@ kOwnBackground
Definition GuiTypes.h:391
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
int main()
Definition Prototype.cxx:12
#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:75
unsigned long ULong_t
Definition RtypesCore.h:55
unsigned int UInt_t
Definition RtypesCore.h:46
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
EMdiResizerPlacement
placement of window resizers
@ kMdiResizerRight
@ kMdiResizerLeft
@ kMdiResizerBottom
@ kMdiResizerTop
@ kMdiDefaultResizeMode
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
char name[80]
Definition TGX11.cxx:110
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:287
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
This class handles GUI icons.
Definition TGIcon.h:22
const TGPicture * GetPicture() const
Definition TGIcon.h:45
This class handles GUI labels.
Definition TGLabel.h:24
const TGString * GetText() const
Definition TGLabel.h:74
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
~TGMdiButtons() override
TGMdiButtons destructor.
TGPictureButton * fButton[5]
MDI picture buttons.
TGPictureButton * GetButton(Int_t no) const
TGLayoutHints * fCloseHint
Layout hints.
TGLayoutHints * fDefaultHint
const TGWindow * fMsgWindow
window handling container messages
Bool_t HandleMotion(Event_t *event) override
Handle motion events in resizer (resize associated MDI window).
void DrawBorder() override
Draw corner resizer frame border.
This file contains all different MDI frame decoration classes.
Bool_t HandleConfigureNotify(Event_t *event) override
Handle configure notify event.
TGMdiTitleBar * fTitlebar
MDI window title bar.
TGMdiFrame * GetMdiFrame() const
~TGMdiDecorFrame() override
TGMdiDecorFrame destructor.
TGMdiVerticalWinResizer * fUpperHR
TGMdiHorizontalWinResizer * GetLeftVR() const
Int_t GetMinimizedY() const
Bool_t IsCurrent() const
Int_t GetMinimizedX() const
Bool_t IsMaximized() const
Bool_t IsMinimized() const
TGLayoutHints * fExpandHint
layout hints
void SetMinimizedX(Int_t x)
const char * GetWindowName()
TGMdiVerticalWinResizer * fLowerHR
upper and lower vertical resizers
void SetResizeMode(Int_t mode=kMdiDefaultResizeMode)
Set resize mode (opaque or transparent)
ULong_t fButtonMask
mask used to display/hide buttons
Int_t fPreResizeHeight
dimension before resizing
TGMdiCornerWinResizer * fUpperLeftCR
void Layout() override
Recalculates the postion and the size of all decor frame components.
TGMdiHorizontalWinResizer * fLeftVR
void Maximize(Bool_t max=kTRUE)
TGMdiCornerWinResizer * GetLowerRightCR() const
Int_t GetPreResizeWidth() const
TGLayoutHints * fLHint
Bool_t fIsMaximized
minimized and maximized flags
Bool_t fMinimizedUserPlacement
user placement flag
void Minimize(Bool_t min=kTRUE)
const TGPicture * GetWindowIcon()
Bool_t fIsCurrent
current mdi window flag
void SetPreResizeX(Int_t x)
Int_t GetPreResizeX() const
ULong_t GetMdiButtons() const
TGMdiHorizontalWinResizer * GetRightVR() const
void SetPreResizeWidth(Int_t w)
Int_t fPreResizeY
position before resizing
void SetMinimizedY(Int_t y)
void SetPreResizeY(Int_t y)
TGMdiMainFrame * fMdiMainFrame
MDI main frame.
void SetWindowName(const char *name) override
Set MDI Window name (appearing in the title bar)
void SetWindowIcon(const TGPicture *pic)
Set Window icon (appearing in the title bar)
void SetMinUserPlacement(Bool_t place=kTRUE)
TGMdiFrame * fFrame
parent (owner) MDI frame
TGMdiTitleBar * GetTitleBar() const
TGMdiCornerWinResizer * GetLowerLeftCR() const
void MoveResize(Int_t x, Int_t y, UInt_t w, UInt_t h) override
Move the MDI window at position x, y and set size to w, h.
Int_t fMinimizedY
minimized position
virtual Int_t CloseWindow()
Int_t GetPreResizeY() const
TGMdiVerticalWinResizer * GetUpperHR() const
Int_t GetPreResizeHeight() const
TGMdiVerticalWinResizer * GetLowerHR() const
void SetCurrent(Bool_t cur=kTRUE)
void SetPreResizeHeight(Int_t h)
void Move(Int_t x, Int_t y) override
Move the MDI window at position x, y.
void SetMdiButtons(ULong_t buttons)
Set-up MDI buttons.
TGMdiCornerWinResizer * fLowerRightCR
upper right and lower right resizers
TGMdiCornerWinResizer * GetUpperRightCR() const
Bool_t GetMinUserPlacement() const
TGMdiCornerWinResizer * fUpperRightCR
TGMdiCornerWinResizer * GetUpperLeftCR() const
Bool_t HandleButton(Event_t *event) override
Handle mouse button events.
void SetDecorBorderWidth(Int_t bw)
Set border width of the decor.
TGMdiCornerWinResizer * fLowerLeftCR
upper left and lower left resizers
TGMdiHorizontalWinResizer * fRightVR
left and right horizontal resizers
This file contains the TGMdiFrame class.
Definition TGMdiFrame.h:42
virtual Bool_t CloseWindow()
Close MDI frame window.
void DrawBorder() override
Draw horizontal resizer frame border.
Bool_t HandleMotion(Event_t *event) override
Handle motion events in resizer (resize associated MDI window).
This file contains the TGMdiMainFrame class.
Bool_t HandleButton(Event_t *event) override
Handle mouse click on title bar.
void LayoutButtons(UInt_t buttonmask, Bool_t isMinimized, Bool_t isMaximized)
Recalculates the position of every enabled (displayed) buttons.
TGMdiTitleIcon * GetWinIcon() const
TGLayoutHints * fLeftHint
void SetX0(Int_t x0)
void SetTitleBarColors(UInt_t fore, UInt_t back, TGFont *f)
Set title bar color (blue or grey, depends on active state).
TGLabel * GetWinName() const
TGLayoutHints * fMiddleHint
Bool_t IsRightButPressed()
void RemoveFrames(TGMdiTitleIcon *icon, TGMdiButtons *buttons)
This is called from TGMdiMainFrame on Maximize().
TGCompositeFrame * fLFrame
Int_t fY0
initial position of the mouse click
Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override
Process messages for title bar.
Bool_t HandleDoubleClick(Event_t *event) override
Handle double click in title bar (maximize window)
Bool_t HandleMotion(Event_t *event) override
Handle mouse motion events in title bar (used to move MDI window).
void SetLeftButPressed(Bool_t press=kTRUE)
Bool_t fMidButPressed
mouse button pressed
void AddFrames(TGMdiTitleIcon *icon, TGMdiButtons *buttons)
This is called from TGMdiMainFrame on Restore().
TGLabel * fWinName
window name label
const TGWindow * fMdiWin
owner MDI window
void SetRightButPressed(Bool_t press=kTRUE)
void SetMidButPressed(Bool_t press=kTRUE)
void SetY0(Int_t y0)
~TGMdiTitleBar() override
TGMdiTitleBar destructor.
Bool_t IsLeftButPressed()
TGCompositeFrame * fMFrame
Bool_t IsMidButPressed()
TGMdiTitleIcon * fWinIcon
title icon
TGMdiButtons * fButtons
MDI buttons.
TGCompositeFrame * fRFrame
the three parts of the title bar
TGLayoutHints * fLHint
TGLayoutHints * fRightHint
layout hints
TGMdiButtons * GetButtons() const
Bool_t HandleDoubleClick(Event_t *event) override
Handle double click event on MDI icon (close the window)
Bool_t HandleButton(Event_t *event) override
Handle button event on MDI icon (popup menu)
TGPopupMenu * GetPopup() const
void DoRedraw() override
Redraw icon.
~TGMdiTitleIcon() override
TGMdiTitleIcon destructor.
const TGWindow * fMsgWindow
window handling container messages
TGPopupMenu * fPopup
Popup menu associated to the title icon.
void DrawBorder() override
Draw vertical resizer frame border.
Bool_t HandleMotion(Event_t *event) override
Handle motion events in resizer (resize associated MDI window).
Int_t fPos
position of the resizer
const TGGC * fBoxGC
GC used for resizing rectangle.
Int_t fNewH
new MDI win position and dimension
Bool_t HandleButton(Event_t *event) override
Handle button events in resizer (grab button and resize).
Int_t fMdiOptions
MDI options.
Int_t fLineW
line width of resizing rectangle
const TGWindow * fMdiWin
owner MDI Window
void MoveResizeIt()
Move (resize) parent MDI window.
void SetResizeMode(Int_t mode)
Int_t fY0
initial position of the mouse click
Bool_t fMidButPressed
mouse buttons flags
void DrawBorder() override
Draw frame border.
void SetMinSize(Int_t w=50, Int_t h=20)
void DrawBox(Int_t x, Int_t y, UInt_t width, UInt_t height)
Draw resize box (rectangle).
Int_t fWinH
MDI win position and dimension.
Int_t fOldH
old MDI win position and dimension
Int_t fMinH
Min width and height of the MDI Win.
Yield an action as soon as it is clicked.
Definition TGButton.h:228
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition TGPicture.h:25
This class creates a popup menu object.
Definition TGMenu.h:110
const char * GetString() const
Definition TGString.h:30
The widget base class.
Definition TGWidget.h:43
ROOT GUI Window base class.
Definition TGWindow.h:23
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
Event structure.
Definition GuiTypes.h:174