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();
64 void DrawBox(Int_t x, Int_t y, UInt_t width, UInt_t height);
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
73 virtual void DrawBorder() {};
74
75 void SetResizeMode(Int_t mode) { fMdiOptions = mode; }
76 void SetMinSize(Int_t w = 50, Int_t h = 20) { fMinW = w; fMinH = h; }
77
78 ClassDef(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
91 virtual void DrawBorder();
92
93 ClassDef(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
106 virtual void DrawBorder();
107
108 ClassDef(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
121 virtual void DrawBorder();
122
123 ClassDef(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 virtual ~TGMdiButtons();
141
142 TGPictureButton *GetButton(Int_t no) const { return fButton[no]; }
143
144 ClassDef(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 virtual void DoRedraw();
160
161public:
162 TGMdiTitleIcon(const TGWindow *p, const TGWindow *titlebar,
163 const TGPicture *pic, Int_t w, Int_t h);
164 virtual ~TGMdiTitleIcon();
165
168 TGPopupMenu *GetPopup() const { return fPopup; }
169
170 ClassDef(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 virtual ~TGMdiTitleBar();
201
205 virtual Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2);
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 ClassDef(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 virtual ~TGMdiDecorFrame();
263
266
267 virtual Int_t CloseWindow() { return fFrame->CloseWindow(); }
268 virtual void Layout();
269
270 virtual void Move(Int_t x, Int_t y);
271 virtual void MoveResize(Int_t x, Int_t y, UInt_t w, UInt_t h);
272
273 void SetMdiButtons(ULong_t buttons);
275
277
278 void SetWindowName(const char *name);
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 ClassDef(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
int Int_t
Definition RtypesCore.h:45
long Longptr_t
Definition RtypesCore.h:82
unsigned int UInt_t
Definition RtypesCore.h:46
unsigned long ULong_t
Definition RtypesCore.h:55
bool Bool_t
Definition RtypesCore.h:63
const Bool_t kTRUE
Definition RtypesCore.h:100
#define ClassDef(name, id)
Definition Rtypes.h:325
include TDocParser_001 C image html pict1_TDocParser_001 png width
EMdiResizerPlacement
placement of window resizers
@ kMdiResizerRight
@ kMdiResizerLeft
@ kMdiResizerBottom
@ kMdiResizerTop
@ kMdiDefaultResizeMode
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
TGPictureButton * fButton[5]
MDI picture buttons.
TGPictureButton * GetButton(Int_t no) const
TGLayoutHints * fCloseHint
Layout hints.
virtual ~TGMdiButtons()
TGMdiButtons destructor.
TGLayoutHints * fDefaultHint
const TGWindow * fMsgWindow
window handling container messages
virtual Bool_t HandleMotion(Event_t *event)
Handle motion events in resizer (resize associated MDI window).
virtual void DrawBorder()
Draw corner resizer frame border.
This file contains all different MDI frame decoration classes.
TGMdiTitleBar * fTitlebar
MDI window title bar.
virtual void MoveResize(Int_t x, Int_t y, UInt_t w, UInt_t h)
Move the MDI window at position x, y and set size to w, h.
TGMdiFrame * GetMdiFrame() const
TGMdiVerticalWinResizer * fUpperHR
TGMdiHorizontalWinResizer * GetLeftVR() const
Int_t GetMinimizedY() const
virtual void Layout()
Recalculates the postion and the size of all decor frame components.
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
virtual ~TGMdiDecorFrame()
TGMdiDecorFrame destructor.
Int_t fPreResizeHeight
dimension before resizing
TGMdiCornerWinResizer * fUpperLeftCR
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)
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button events.
Int_t GetPreResizeX() const
ULong_t GetMdiButtons() const
TGMdiHorizontalWinResizer * GetRightVR() const
void SetPreResizeWidth(Int_t w)
void SetWindowName(const char *name)
Set MDI Window name (appearing in the title bar)
Int_t fPreResizeY
position before resizing
void SetMinimizedY(Int_t y)
void SetPreResizeY(Int_t y)
TGMdiMainFrame * fMdiMainFrame
MDI main frame.
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
Int_t fMinimizedY
minimized position
virtual Int_t CloseWindow()
virtual void Move(Int_t x, Int_t y)
Move the MDI window at position x, y.
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)
virtual Bool_t HandleConfigureNotify(Event_t *event)
Handle configure notify event.
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
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:44
virtual Bool_t CloseWindow()
Close MDI frame window.
virtual Bool_t HandleMotion(Event_t *event)
Handle motion events in resizer (resize associated MDI window).
virtual void DrawBorder()
Draw horizontal resizer frame border.
This file contains the TGMdiMainFrame class.
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).
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion events in title bar (used to move MDI window).
TGLabel * GetWinName() const
TGLayoutHints * fMiddleHint
Bool_t IsRightButPressed()
virtual ~TGMdiTitleBar()
TGMdiTitleBar destructor.
void RemoveFrames(TGMdiTitleIcon *icon, TGMdiButtons *buttons)
This is called from TGMdiMainFrame on Maximize().
TGCompositeFrame * fLFrame
virtual Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Process messages for title bar.
Int_t fY0
initial position of the mouse click
void SetLeftButPressed(Bool_t press=kTRUE)
virtual Bool_t HandleDoubleClick(Event_t *event)
Handle double click in title bar (maximize window)
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)
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
virtual Bool_t HandleButton(Event_t *event)
Handle mouse click on title bar.
TGLayoutHints * fRightHint
layout hints
TGMdiButtons * GetButtons() const
virtual Bool_t HandleButton(Event_t *event)
Handle button event on MDI icon (popup menu)
virtual ~TGMdiTitleIcon()
TGMdiTitleIcon destructor.
virtual void DoRedraw()
Redraw icon.
TGPopupMenu * GetPopup() const
virtual Bool_t HandleDoubleClick(Event_t *event)
Handle double click event on MDI icon (close the window)
const TGWindow * fMsgWindow
window handling container messages
TGPopupMenu * fPopup
Popup menu associated to the title icon.
virtual void DrawBorder()
Draw vertical resizer frame border.
virtual Bool_t HandleMotion(Event_t *event)
Handle motion events in resizer (resize associated MDI window).
Int_t fPos
position of the resizer
const TGGC * fBoxGC
GC used for resizing rectangle.
virtual Bool_t HandleButton(Event_t *event)
Handle button events in resizer (grab button and resize).
Int_t fNewH
new MDI win position and dimension
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 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.
virtual void DrawBorder()
Draw frame border.
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