Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGDockableFrame.h
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Abdelhalim Ssadik 07/07/04
3
4/*************************************************************************
5 * Copyright (C) 1995-2021, 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_TGDockableFrame
13#define ROOT_TGDockableFrame
14
15
16//////////////////////////////////////////////////////////////////////////
17// //
18// A TGDockableFrame is a frame with handles that allow it to be //
19// undocked (i.e. put in a transient frame of its own) and to be docked //
20// again or hidden and shown again. It uses the TGDockButton, which is //
21// a button with two vertical bars (||) and TGDockHideButton, which is //
22// a button with a small triangle. The TGUndockedFrame is a transient //
23// frame that on closure will put the frame back in the dock. //
24// //
25//////////////////////////////////////////////////////////////////////////
26
27#include "TGFrame.h"
28
29#include "TGWidget.h"
30
31#include "TGButton.h"
32
33#include "TGWindow.h"
34
35
36class TGDockableFrame;
37
38
39class TGDockButton : public TGButton {
40protected:
41 Bool_t fMouseOn; // true when mouse on button
42 ULong_t fNormBg; // normal background color
43 ULong_t fHiBg; // highlighted background color
44
45 virtual void DrawBorder();
46 virtual void DoRedraw();
47
48public:
49 TGDockButton(const TGCompositeFrame *p = nullptr, Int_t id = 1);
50 virtual ~TGDockButton();
51
52 virtual Bool_t HandleCrossing(Event_t *event);
53
54 ClassDef(TGDockButton,0) // Dock button
55};
56
57
59protected:
60 Int_t fAspectRatio; // triangle orientation
61
62 virtual void DoRedraw();
63
64public:
65 TGDockHideButton(const TGCompositeFrame *p = nullptr);
66
68
69 ClassDef(TGDockHideButton,0) // Hide dock button
70};
71
72
74
75private:
78
79protected:
80 TGDockableFrame *fDockable; // orignal dockable frame
81
82public:
83 TGUndockedFrame(const TGWindow *p = 0, TGDockableFrame *dockable = 0);
84 virtual ~TGUndockedFrame();
85
86 void FixSize();
87 void CloseWindow();
88
89 ClassDef(TGUndockedFrame,0) // Undocked frame
90};
91
92
94friend class TGUndockedFrame;
95
96private:
99
100protected:
101 Bool_t fHidden; // if frame is hidden
102 Bool_t fEnableHide; // if frame can be hidden
103 Bool_t fEnableUndock; // if frame can be undocked
104 Bool_t fDeleted; // kTRUE if it is being deleted
105 Bool_t fFixedSize; // kTRUE if fixed size when undocked
106 TString fDockName; // name of frame
107 TGCompositeFrame *fContainer; // container containing dockable frame
108 TGCompositeFrame *fButtons; // container containing dock and hide buttons
109 TGDockButton *fDockButton; // dock button
111 TGUndockedFrame *fFrame; // undocked frame
112 TGLayoutHints *fHints; // layout hints
113 TGLayoutHints *fLb, *fLc; // layout hints
114
115public:
116 TGDockableFrame(const TGWindow *p = nullptr, Int_t id = -1,
117 UInt_t options = kHorizontalFrame);
118 virtual ~TGDockableFrame();
119
120 virtual void AddFrame(TGFrame *f, TGLayoutHints *hints);
121
123 virtual void Docked() { Emit("Docked()"); } //*SIGNAL*
124 virtual void Undocked() { Emit("Undocked()"); } //*SIGNAL*
125
126 void UndockContainer();
127 void DockContainer(Int_t del = kTRUE);
128
129 void HideContainer();
130 void ShowContainer();
131
132 void EnableUndock(Bool_t onoff);
134 void EnableHide(Bool_t onoff);
135 Bool_t EnableHide() const { return fEnableHide; }
136
137 void SetWindowName(const char *name);
138
139 Bool_t IsUndocked() const { return (fFrame != 0); }
140 Bool_t IsHidden() const { return fHidden; }
141
142 Bool_t IsFixedSize() const { return fFixedSize; }
143 void SetFixedSize(Bool_t fixed) { fFixedSize = fixed; }
144
146 TGUndockedFrame *GetUndocked() const { return fFrame; }
147
148 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
149
150 ClassDef(TGDockableFrame,0) // Dockable widget
151};
152
153#endif
@ kHorizontalFrame
Definition GuiTypes.h:382
#define f(i)
Definition RSha256.hxx:104
#define a(i)
Definition RSha256.hxx:99
int Int_t
Definition RtypesCore.h:45
unsigned long ULong_t
Definition RtypesCore.h:55
long Long_t
Definition RtypesCore.h:54
bool Bool_t
Definition RtypesCore.h:63
const Bool_t kTRUE
Definition RtypesCore.h:91
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:325
char name[80]
Definition TGX11.cxx:110
virtual Bool_t HandleCrossing(Event_t *event)
Handle dock button crossing events.
virtual void DrawBorder()
Draw borders of dock button.
virtual ~TGDockButton()
Delete dock button.
virtual void DoRedraw()
Draw the dock button, i.e. two vertical lines.
virtual void DoRedraw()
Draw dock hide button.
void SetAspectRatio(Int_t a)
void DockContainer(Int_t del=kTRUE)
Dock container back to TGDockableFrame.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a dockable frame widget as a C++ statement(s) on output stream out.
TGCompositeFrame * fButtons
virtual ~TGDockableFrame()
Cleanup dockable frame.
TGUndockedFrame * fFrame
TGLayoutHints * fLb
Bool_t IsHidden() const
TGCompositeFrame * GetContainer() const
virtual void AddFrame(TGFrame *f, TGLayoutHints *hints)
Add frame to dockable frame container. Frame and hints are NOT adopted.
TGCompositeFrame * fContainer
TGDockableFrame(const TGDockableFrame &)=delete
void UndockContainer()
Undock container.
virtual void Undocked()
void HideContainer()
Hide dock container.
virtual Bool_t ProcessMessage(Long_t, Long_t, Long_t)
Process dockable frame messages.
void SetFixedSize(Bool_t fixed)
Bool_t EnableUndock() const
Bool_t IsFixedSize() const
TGDockableFrame & operator=(const TGDockableFrame &)=delete
TGLayoutHints * fHints
void SetWindowName(const char *name)
Set window name so it appear as title of the undock window.
Bool_t EnableHide() const
TGDockButton * fDockButton
void ShowContainer()
Show dock container.
TGDockHideButton * fHideButton
virtual void Docked()
TGUndockedFrame * GetUndocked() const
TGLayoutHints * fLc
Bool_t IsUndocked() const
TGUndockedFrame & operator=(const TGUndockedFrame &)=delete
void FixSize()
Fix the size of the undocked frame so it cannot be changed via the WM.
virtual ~TGUndockedFrame()
Delete undocked frame. Puts back dockable frame in its original container.
TGDockableFrame * fDockable
TGUndockedFrame(const TGUndockedFrame &)=delete
void CloseWindow()
Close undocked frame (called via WM close button).
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition TQObject.h:164
Basic string class.
Definition TString.h:136
Event structure.
Definition GuiTypes.h:174