Logo ROOT  
Reference Guide
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// //
17// TGMdiDecorFrame, TGMdiTitleBar, TGMdiButtons, TGMdiTitleIcon, //
18// TGMdiWinResizer, TGMdiVerticalWinResizer, TGMdiHorizontalWinResizer, //
19// and TGMdiCornerWinResizer. //
20// //
21// This header contains all different MDI frame decoration classes. //
22// //
23//////////////////////////////////////////////////////////////////////////
24
25#include "TGFrame.h"
26#include "TGMenu.h"
27#include "TGButton.h"
28#include "TGIcon.h"
29#include "TGLabel.h"
30#include "TGFont.h"
31#include "TGMdiMainFrame.h"
32#include "TGMdiFrame.h"
33
34
35// placement of window resizers
41};
42
43
44class TGMdiMainFrame;
45class TGMdiDecorFrame;
46class TGMdiFrame;
47class TGMdiTitleBar;
48class TGMdiTitleIcon;
49class TGMdiButtons;
50
51
52//----------------------------------------------------------------------
53
54class TGMdiWinResizer : public TGFrame, public TGWidget {
55
56friend class TGMdiMainFrame;
57
58protected:
59 const TGWindow *fMdiWin; // owner MDI Window
60 Int_t fWinX, fWinY, fWinW, fWinH; // MDI win position and dimension
61 Int_t fOldX, fOldY, fOldW, fOldH; // old MDI win position and dimension
62 Int_t fNewX, fNewY, fNewW, fNewH; // new MDI win position and dimension
63 Int_t fMinW, fMinH; // Min width and height of the MDI Win
64 Int_t fMdiOptions; // MDI options
65 Int_t fPos; // position of the resizer
66 Int_t fX0, fY0; // initial position of the mouse click
68
69 const TGGC *fBoxGC; // GC used for resizing rectangle
70 Int_t fLineW; // line width of resizing rectangle
71
72 void MoveResizeIt();
73 void DrawBox(Int_t x, Int_t y, UInt_t width, UInt_t height);
74
75public:
76 TGMdiWinResizer(const TGWindow *p, const TGWindow *mdiwin, Int_t pos,
77 const TGGC *boxGC, Int_t linew,
78 Int_t mdioptions = kMdiDefaultResizeMode,
79 Int_t w = 1, Int_t h = 1, UInt_t options = kOwnBackground);
80
81 virtual Bool_t HandleButton(Event_t *event);
82 virtual void DrawBorder() {};
83
84 void SetResizeMode(Int_t mode) { fMdiOptions = mode; }
85 void SetMinSize(Int_t w = 50, Int_t h = 20) { fMinW = w; fMinH = h; }
86
87 ClassDef(TGMdiWinResizer, 0) // Window Resizer
88};
89
90
92
93public:
94 TGMdiVerticalWinResizer(const TGWindow *p, const TGWindow *mdiwin,
95 Int_t pos, const TGGC *boxGC, Int_t linew,
96 Int_t mdioptions = kMdiDefaultResizeMode,
97 Int_t w = 4, Int_t h = 5);
98
99 virtual Bool_t HandleMotion(Event_t *event);
100 virtual void DrawBorder();
101
102 ClassDef(TGMdiVerticalWinResizer, 0) // Vertical Window Resizer
103};
104
105
107
108public:
109 TGMdiHorizontalWinResizer(const TGWindow *p, const TGWindow *mdiwin,
110 Int_t pos, const TGGC *boxGC, Int_t linew,
111 Int_t mdioptions = kMdiDefaultResizeMode,
112 Int_t w = 5, Int_t h = 4);
113
114 virtual Bool_t HandleMotion(Event_t *event);
115 virtual void DrawBorder();
116
117 ClassDef(TGMdiHorizontalWinResizer, 0) // Horizontal Window Resizer
118};
119
120
122
123public:
124 TGMdiCornerWinResizer(const TGWindow *p, const TGWindow *mdiwin,
125 Int_t pos, const TGGC *boxGC, Int_t linew,
126 Int_t mdioptions = kMdiDefaultResizeMode,
127 Int_t w = 20, Int_t h = 20);
128
129 virtual Bool_t HandleMotion(Event_t *event);
130 virtual void DrawBorder();
131
132 ClassDef(TGMdiCornerWinResizer, 0) // Corner Window Resizer
133};
134
135
136//----------------------------------------------------------------------
137
139
140friend class TGMdiTitleBar;
141
142protected:
143 TGPictureButton *fButton[5]; // MDI picture buttons
145 const TGWindow *fMsgWindow; // window handling container messages
146
147public:
148 TGMdiButtons(const TGWindow *p, const TGWindow *titlebar);
149 virtual ~TGMdiButtons();
150
151 TGPictureButton *GetButton(Int_t no) const { return fButton[no]; }
152
153 ClassDef(TGMdiButtons, 0) // MDI Buttons Frame
154};
155
156
157//----------------------------------------------------------------------
158
159class TGMdiTitleIcon : public TGIcon {
160
161friend class TGMdiFrame;
162friend class TGMdiTitleBar;
163
164protected:
165 const TGWindow *fMsgWindow; // window handling container messages
166 TGPopupMenu *fPopup; // Popup menu associated to the title icon
167
168 virtual void DoRedraw();
169
170public:
171 TGMdiTitleIcon(const TGWindow *p, const TGWindow *titlebar,
172 const TGPicture *pic, Int_t w, Int_t h);
173 virtual ~TGMdiTitleIcon();
174
175 virtual Bool_t HandleDoubleClick(Event_t *event);
176 virtual Bool_t HandleButton(Event_t *event);
177 TGPopupMenu *GetPopup() const { return fPopup; }
178
179 ClassDef(TGMdiTitleIcon, 0) // MDI Title Icon
180};
181
182
183//----------------------------------------------------------------------
184
186
187friend class TGMdiDecorFrame;
188friend class TGMdiMainFrame;
189
190protected:
191 const TGWindow *fMdiWin; // owner MDI window
192 TGMdiButtons *fButtons; // MDI buttons
193 TGMdiTitleIcon *fWinIcon; // title icon
194 TGLabel *fWinName; // window name label
195 TGCompositeFrame *fLFrame, *fMFrame,*fRFrame; // the three parts of the title bar
197 Int_t fX0, fY0; // initial position of the mouse click
199
200 TGMdiTitleBar(const TGWindow *p, const TGWindow *mdiwin,
201 const char *name = "Untitled");
202 void LayoutButtons(UInt_t buttonmask, Bool_t isMinimized,
203 Bool_t isMaximized);
204
205 void AddFrames(TGMdiTitleIcon *icon, TGMdiButtons *buttons);
206 void RemoveFrames(TGMdiTitleIcon *icon, TGMdiButtons *buttons);
207
208public:
209 virtual ~TGMdiTitleBar();
210
211 virtual Bool_t HandleButton(Event_t *event);
212 virtual Bool_t HandleDoubleClick(Event_t *event);
213 virtual Bool_t HandleMotion(Event_t *event);
214 virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
215
216 void SetTitleBarColors(UInt_t fore, UInt_t back, TGFont *f);
217 TGMdiButtons *GetButtons() const { return fButtons; }
218 TGMdiTitleIcon *GetWinIcon() const { return fWinIcon; }
219 TGLabel *GetWinName() const { return fWinName; }
220 Int_t GetX0() { return fX0; }
221 Int_t GetY0() { return fY0; }
225
226 void SetX0(Int_t x0) { fX0 = x0; }
227 void SetY0(Int_t y0) { fY0 = y0; }
230 void SetMidButPressed(Bool_t press = kTRUE) { fMidButPressed = press; }
231
232 ClassDef(TGMdiTitleBar, 0) // MDI Title Bar
233};
234
235
236//----------------------------------------------------------------------
237
239
240friend class TGMdiMainFrame;
241
242protected:
243 Int_t fPreResizeX, fPreResizeY; // position before resizing
244 Int_t fPreResizeWidth, fPreResizeHeight; // dimension before resizing
245 Int_t fMinimizedX, fMinimizedY; // minimized position
246 Bool_t fIsMinimized, fIsMaximized; // minimized and maximized flags
247 Bool_t fMinimizedUserPlacement; // user placement flag
248 Bool_t fIsCurrent; // current mdi window flag
249
250 TGMdiFrame *fFrame; // parent (owner) MDI frame
251 TGMdiMainFrame *fMdiMainFrame; // MDI main frame
252
253 TGMdiVerticalWinResizer *fUpperHR, *fLowerHR; // upper and lower vertical resizers
254 TGMdiCornerWinResizer *fUpperLeftCR, *fLowerLeftCR; // upper left and lower left resizers
255 TGMdiCornerWinResizer *fUpperRightCR, *fLowerRightCR; // upper right and lower right resizers
256 TGMdiHorizontalWinResizer *fLeftVR, *fRightVR; // left and right horizontal resizers
257 TGLayoutHints *fLHint, *fExpandHint; // layout hints
258
259 ULong_t fButtonMask; // mask used to display/hide buttons
260 TGMdiTitleBar *fTitlebar; // MDI window title bar
261
262public:
263 enum {
264 // border width of decorated windows
266 };
267
269 const TGGC *boxGC, UInt_t options = 0,
271 virtual ~TGMdiDecorFrame();
272
273 virtual Bool_t HandleButton(Event_t *event);
274 virtual Bool_t HandleConfigureNotify(Event_t *event);
275
276 virtual Int_t CloseWindow() { return fFrame->CloseWindow(); }
277 virtual void Layout();
278
279 virtual void Move(Int_t x, Int_t y);
280 virtual void MoveResize(Int_t x, Int_t y, UInt_t w, UInt_t h);
281
282 void SetMdiButtons(ULong_t buttons);
284
286
287 void SetWindowName(const char *name);
288 void SetWindowIcon(const TGPicture *pic);
289 const char *GetWindowName() {
290 return (const char *)fTitlebar->GetWinName()->GetText()->GetString();
291 }
293 Bool_t IsCurrent() const { return fIsCurrent; }
294 Bool_t IsMinimized() const { return fIsMinimized; }
295 Bool_t IsMaximized() const { return fIsMaximized; }
296 Int_t GetPreResizeX() const { return fPreResizeX; }
297 Int_t GetPreResizeY() const { return fPreResizeY; }
300 Int_t GetMinimizedX() const { return fMinimizedX; }
301 Int_t GetMinimizedY() const { return fMinimizedY; }
303
304 void SetCurrent(Bool_t cur = kTRUE) {fIsCurrent = cur; }
305 void SetDecorBorderWidth(Int_t bw);
312 void Minimize(Bool_t min = kTRUE) { fIsMinimized = min; }
313 void Maximize(Bool_t max = kTRUE) { fIsMaximized = max; }
315
316 TGMdiFrame *GetMdiFrame() const { return fFrame; }
318
327
328 ClassDef(TGMdiDecorFrame, 0) // MDI Decor Frame
329};
330
331#endif
@ kOwnBackground
Definition: GuiTypes.h:391
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
unsigned long ULong_t
Definition: RtypesCore.h:53
long Long_t
Definition: RtypesCore.h:52
bool Bool_t
Definition: RtypesCore.h:61
const Bool_t kTRUE
Definition: RtypesCore.h:89
#define ClassDef(name, id)
Definition: Rtypes.h:322
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
EMdiResizerPlacement
@ kMdiResizerRight
@ kMdiResizerLeft
@ kMdiResizerBottom
@ kMdiResizerTop
@ kMdiDefaultResizeMode
char name[80]
Definition: TGX11.cxx:109
Definition: TGFont.h:149
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:667
Definition: TGGC.h:31
Definition: TGIcon.h:30
const TGPicture * GetPicture() const
Definition: TGIcon.h:53
const TGString * GetText() const
Definition: TGLabel.h:82
TGPictureButton * fButton[5]
TGPictureButton * GetButton(Int_t no) const
TGMdiButtons(const TGWindow *p, const TGWindow *titlebar)
TGMdiButtons constructor.
TGLayoutHints * fCloseHint
virtual ~TGMdiButtons()
TGMdiButtons destructor.
TGLayoutHints * fDefaultHint
const TGWindow * fMsgWindow
virtual Bool_t HandleMotion(Event_t *event)
Handle motion events in resizer (resize associated MDI window).
TGMdiCornerWinResizer(const TGWindow *p, const TGWindow *mdiwin, Int_t pos, const TGGC *boxGC, Int_t linew, Int_t mdioptions=kMdiDefaultResizeMode, Int_t w=20, Int_t h=20)
TGMdiCornerWinResizer constructor.
virtual void DrawBorder()
Draw corner resizer frame border.
TGMdiTitleBar * fTitlebar
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
void SetMinimizedX(Int_t x)
const char * GetWindowName()
TGMdiVerticalWinResizer * fLowerHR
void SetResizeMode(Int_t mode=kMdiDefaultResizeMode)
Set resize mode (opaque or transparent)
virtual ~TGMdiDecorFrame()
TGMdiDecorFrame destructor.
TGMdiCornerWinResizer * fUpperLeftCR
TGMdiHorizontalWinResizer * fLeftVR
void Maximize(Bool_t max=kTRUE)
TGMdiCornerWinResizer * GetLowerRightCR() const
Int_t GetPreResizeWidth() const
TGLayoutHints * fLHint
Bool_t fMinimizedUserPlacement
void Minimize(Bool_t min=kTRUE)
const TGPicture * GetWindowIcon()
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)
void SetMinimizedY(Int_t y)
void SetPreResizeY(Int_t y)
TGMdiMainFrame * fMdiMainFrame
void SetWindowIcon(const TGPicture *pic)
Set Window icon (appearing in the title bar)
void SetMinUserPlacement(Bool_t place=kTRUE)
TGMdiFrame * fFrame
TGMdiDecorFrame(TGMdiMainFrame *main, TGMdiFrame *frame, Int_t w, Int_t h, const TGGC *boxGC, UInt_t options=0, Pixel_t back=GetDefaultFrameBackground())
TGMdiDecorFrame constructor.
TGMdiTitleBar * GetTitleBar() const
TGMdiCornerWinResizer * GetLowerLeftCR() const
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
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
TGMdiHorizontalWinResizer * fRightVR
virtual Bool_t CloseWindow()
Close MDI frame window.
Definition: TGMdiFrame.cxx:74
virtual Bool_t HandleMotion(Event_t *event)
Handle motion events in resizer (resize associated MDI window).
TGMdiHorizontalWinResizer(const TGWindow *p, const TGWindow *mdiwin, Int_t pos, const TGGC *boxGC, Int_t linew, Int_t mdioptions=kMdiDefaultResizeMode, Int_t w=5, Int_t h=4)
TGMdiHorizontalWinResizer constructor.
virtual void DrawBorder()
Draw horizontal resizer frame border.
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
TGMdiTitleBar(const TGWindow *p, const TGWindow *mdiwin, const char *name="Untitled")
TGMdiTitleBar constructor.
Bool_t IsRightButPressed()
Bool_t fRightButPressed
virtual ~TGMdiTitleBar()
TGMdiTitleBar destructor.
void RemoveFrames(TGMdiTitleIcon *icon, TGMdiButtons *buttons)
This is called from TGMdiMainFrame on Maximize().
TGCompositeFrame * fLFrame
void SetLeftButPressed(Bool_t press=kTRUE)
virtual Bool_t HandleDoubleClick(Event_t *event)
Handle double click in title bar (maximize window)
void AddFrames(TGMdiTitleIcon *icon, TGMdiButtons *buttons)
This is called from TGMdiMainFrame on Restore().
TGLabel * fWinName
Bool_t fLeftButPressed
const TGWindow * fMdiWin
void SetRightButPressed(Bool_t press=kTRUE)
void SetMidButPressed(Bool_t press=kTRUE)
void SetY0(Int_t y0)
Bool_t IsLeftButPressed()
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Process messages for title bar.
TGCompositeFrame * fMFrame
Bool_t IsMidButPressed()
TGMdiTitleIcon * fWinIcon
TGMdiButtons * fButtons
TGCompositeFrame * fRFrame
TGLayoutHints * fLHint
virtual Bool_t HandleButton(Event_t *event)
Handle mouse click on title bar.
TGLayoutHints * fRightHint
TGMdiButtons * GetButtons() const
virtual Bool_t HandleButton(Event_t *event)
Handle button event on MDI icon (popup menu)
TGMdiTitleIcon(const TGWindow *p, const TGWindow *titlebar, const TGPicture *pic, Int_t w, Int_t h)
TGMdiTitleIcon constructor.
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
TGPopupMenu * fPopup
virtual void DrawBorder()
Draw vertical resizer frame border.
TGMdiVerticalWinResizer(const TGWindow *p, const TGWindow *mdiwin, Int_t pos, const TGGC *boxGC, Int_t linew, Int_t mdioptions=kMdiDefaultResizeMode, Int_t w=4, Int_t h=5)
TGMdiVerticalWinResizer constructor.
virtual Bool_t HandleMotion(Event_t *event)
Handle motion events in resizer (resize associated MDI window).
const TGGC * fBoxGC
virtual Bool_t HandleButton(Event_t *event)
Handle button events in resizer (grab button and resize).
TGMdiWinResizer(const TGWindow *p, const TGWindow *mdiwin, Int_t pos, const TGGC *boxGC, Int_t linew, Int_t mdioptions=kMdiDefaultResizeMode, Int_t w=1, Int_t h=1, UInt_t options=kOwnBackground)
TGMdiWinResizer constructor.
const TGWindow * fMdiWin
void MoveResizeIt()
Move (resize) parent MDI window.
void SetResizeMode(Int_t mode)
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).
virtual void DrawBorder()
Draw frame border.
const char * GetString() const
Definition: TGString.h:40
int main(int argc, char **argv)
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17