Logo ROOT  
Reference Guide
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 #include "TGFrame.h"
17 
18 #include "TGWidget.h"
19 
20 #include "TGButton.h"
21 
22 #include "TGWindow.h"
23 
24 
25 class TGDockableFrame;
26 
27 
28 class TGDockButton : public TGButton {
29 protected:
30  Bool_t fMouseOn; ///< true when mouse on button
31  ULong_t fNormBg; ///< normal background color
32  ULong_t fHiBg; ///< highlighted background color
33 
34  virtual void DrawBorder();
35  virtual void DoRedraw();
36 
37 public:
38  TGDockButton(const TGCompositeFrame *p = nullptr, Int_t id = 1);
39  virtual ~TGDockButton();
40 
42 
43  ClassDef(TGDockButton,0) // Dock button
44 };
45 
46 
48 protected:
49  Int_t fAspectRatio; ///< triangle orientation
50 
51  virtual void DoRedraw();
52 
53 public:
54  TGDockHideButton(const TGCompositeFrame *p = nullptr);
55 
57 
58  ClassDef(TGDockHideButton,0) // Hide dock button
59 };
60 
61 
63 
64 private:
65  TGUndockedFrame(const TGUndockedFrame&) = delete;
67 
68 protected:
69  TGDockableFrame *fDockable; ///< orignal dockable frame
70 
71 public:
72  TGUndockedFrame(const TGWindow *p = 0, TGDockableFrame *dockable = 0);
73  virtual ~TGUndockedFrame();
74 
75  void FixSize();
76  void CloseWindow();
77 
78  ClassDef(TGUndockedFrame,0) // Undocked frame
79 };
80 
81 
82 class TGDockableFrame : public TGCompositeFrame, public TGWidget {
83 friend class TGUndockedFrame;
84 
85 private:
86  TGDockableFrame(const TGDockableFrame&) = delete;
88 
89 protected:
90  Bool_t fHidden; ///< if frame is hidden
91  Bool_t fEnableHide; ///< if frame can be hidden
92  Bool_t fEnableUndock; ///< if frame can be undocked
93  Bool_t fDeleted; ///< kTRUE if it is being deleted
94  Bool_t fFixedSize; ///< kTRUE if fixed size when undocked
95  TString fDockName; ///< name of frame
96  TGCompositeFrame *fContainer; ///< container containing dockable frame
97  TGCompositeFrame *fButtons; ///< container containing dock and hide buttons
98  TGDockButton *fDockButton; ///< dock button
99  TGDockHideButton *fHideButton; ///< hide button
100  TGUndockedFrame *fFrame; ///< undocked frame
101  TGLayoutHints *fHints; ///< layout hints
102  TGLayoutHints *fLb, *fLc; ///< layout hints
103 
104 public:
105  TGDockableFrame(const TGWindow *p = nullptr, Int_t id = -1,
106  UInt_t options = kHorizontalFrame);
107  virtual ~TGDockableFrame();
108 
109  virtual void AddFrame(TGFrame *f, TGLayoutHints *hints);
110 
112  virtual void Docked() { Emit("Docked()"); } //*SIGNAL*
113  virtual void Undocked() { Emit("Undocked()"); } //*SIGNAL*
114 
115  void UndockContainer();
116  void DockContainer(Int_t del = kTRUE);
117 
118  void HideContainer();
119  void ShowContainer();
120 
121  void EnableUndock(Bool_t onoff);
122  Bool_t EnableUndock() const { return fEnableUndock; }
123  void EnableHide(Bool_t onoff);
124  Bool_t EnableHide() const { return fEnableHide; }
125 
126  void SetWindowName(const char *name);
127 
128  Bool_t IsUndocked() const { return (fFrame != 0); }
129  Bool_t IsHidden() const { return fHidden; }
130 
131  Bool_t IsFixedSize() const { return fFixedSize; }
132  void SetFixedSize(Bool_t fixed) { fFixedSize = fixed; }
133 
135  TGUndockedFrame *GetUndocked() const { return fFrame; }
136 
137  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
138 
139  ClassDef(TGDockableFrame,0) // Dockable widget
140 };
141 
142 #endif
TGTransientFrame
Defines transient windows that typically are used for dialogs windows.
Definition: TGFrame.h:498
TGDockableFrame::~TGDockableFrame
virtual ~TGDockableFrame()
Cleanup dockable frame.
Definition: TGDockableFrame.cxx:263
TGWindow
ROOT GUI Window base class.
Definition: TGWindow.h:23
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:100
TGDockableFrame::operator=
TGDockableFrame & operator=(const TGDockableFrame &)=delete
TGDockButton::~TGDockButton
virtual ~TGDockButton()
Delete dock button.
Definition: TGDockableFrame.cxx:80
TGDockableFrame::UndockContainer
void UndockContainer()
Undock container.
Definition: TGDockableFrame.cxx:286
TGDockableFrame::fLb
TGLayoutHints * fLb
Definition: TGDockableFrame.h:102
TGDockableFrame::IsFixedSize
Bool_t IsFixedSize() const
Definition: TGDockableFrame.h:131
f
#define f(i)
Definition: RSha256.hxx:104
TGDockableFrame::fDeleted
Bool_t fDeleted
kTRUE if it is being deleted
Definition: TGDockableFrame.h:93
Option_t
const char Option_t
Definition: RtypesCore.h:66
TGDockHideButton::SetAspectRatio
void SetAspectRatio(Int_t a)
Definition: TGDockableFrame.h:56
TGDockButton::DrawBorder
virtual void DrawBorder()
Draw borders of dock button.
Definition: TGDockableFrame.cxx:104
TGDockableFrame::SetWindowName
void SetWindowName(const char *name)
Set window name so it appear as title of the undock window.
Definition: TGDockableFrame.cxx:445
TGUndockedFrame::~TGUndockedFrame
virtual ~TGUndockedFrame()
Delete undocked frame. Puts back dockable frame in its original container.
Definition: TGDockableFrame.cxx:193
TGDockButton::fHiBg
ULong_t fHiBg
highlighted background color
Definition: TGDockableFrame.h:32
TGDockableFrame::fFrame
TGUndockedFrame * fFrame
undocked frame
Definition: TGDockableFrame.h:100
TGDockHideButton
Definition: TGDockableFrame.h:47
TGDockableFrame::fDockName
TString fDockName
name of frame
Definition: TGDockableFrame.h:95
TGDockableFrame::Docked
virtual void Docked()
Definition: TGDockableFrame.h:112
Int_t
int Int_t
Definition: RtypesCore.h:45
TGWidget
The widget base class.
Definition: TGWidget.h:43
TGDockableFrame::fButtons
TGCompositeFrame * fButtons
container containing dock and hide buttons
Definition: TGDockableFrame.h:97
TGDockButton::TGDockButton
TGDockButton(const TGCompositeFrame *p=nullptr, Int_t id=1)
Create a dock button (i.e. button with two vertical bars).
Definition: TGDockableFrame.cxx:57
TGDockableFrame::fHints
TGLayoutHints * fHints
layout hints
Definition: TGDockableFrame.h:101
event
Definition: triangle.c:552
TGDockableFrame::TGDockableFrame
TGDockableFrame(const TGDockableFrame &)=delete
TGDockableFrame::fEnableHide
Bool_t fEnableHide
if frame can be hidden
Definition: TGDockableFrame.h:91
TGDockButton::HandleCrossing
virtual Bool_t HandleCrossing(Event_t *event)
Handle dock button crossing events.
Definition: TGDockableFrame.cxx:87
TGDockableFrame::IsHidden
Bool_t IsHidden() const
Definition: TGDockableFrame.h:129
TGDockHideButton::DoRedraw
virtual void DoRedraw()
Draw dock hide button.
Definition: TGDockableFrame.cxx:154
TGDockableFrame::fFixedSize
Bool_t fFixedSize
kTRUE if fixed size when undocked
Definition: TGDockableFrame.h:94
TString
Basic string class.
Definition: TString.h:136
TGFrame
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition: TGFrame.h:80
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TGUndockedFrame::TGUndockedFrame
TGUndockedFrame(const TGUndockedFrame &)=delete
TGDockableFrame::Undocked
virtual void Undocked()
Definition: TGDockableFrame.h:113
TGWindow.h
bool
TGDockableFrame::AddFrame
virtual void AddFrame(TGFrame *f, TGLayoutHints *hints)
Add frame to dockable frame container. Frame and hints are NOT adopted.
Definition: TGDockableFrame.cxx:276
TGDockableFrame::fLc
TGLayoutHints * fLc
layout hints
Definition: TGDockableFrame.h:102
TGUndockedFrame::CloseWindow
void CloseWindow()
Close undocked frame (called via WM close button).
Definition: TGDockableFrame.cxx:213
TGDockableFrame::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a dockable frame widget as a C++ statement(s) on output stream out.
Definition: TGDockableFrame.cxx:457
TGDockableFrame::fEnableUndock
Bool_t fEnableUndock
if frame can be undocked
Definition: TGDockableFrame.h:92
a
auto * a
Definition: textangle.C:12
TGDockableFrame::EnableHide
Bool_t EnableHide() const
Definition: TGDockableFrame.h:124
TGFrame.h
Long_t
long Long_t
Definition: RtypesCore.h:54
TGLayoutHints
This class describes layout hints used by the layout classes.
Definition: TGLayout.h:50
TGDockButton::fNormBg
ULong_t fNormBg
normal background color
Definition: TGDockableFrame.h:31
TGDockableFrame
A frame with handles that allow it to be undocked (i.e.
Definition: TGDockableFrame.h:82
TGUndockedFrame::operator=
TGUndockedFrame & operator=(const TGUndockedFrame &)=delete
ULong_t
unsigned long ULong_t
Definition: RtypesCore.h:55
TGDockableFrame::GetContainer
TGCompositeFrame * GetContainer() const
Definition: TGDockableFrame.h:134
TGUndockedFrame
Definition: TGDockableFrame.h:62
TGWidget.h
unsigned int
TGDockableFrame::EnableUndock
Bool_t EnableUndock() const
Definition: TGDockableFrame.h:122
TGDockHideButton::TGDockHideButton
TGDockHideButton(const TGCompositeFrame *p=nullptr)
Create a dock hide button (i.e. button with small triangle).
Definition: TGDockableFrame.cxx:143
kHorizontalFrame
@ kHorizontalFrame
Definition: GuiTypes.h:382
TGDockableFrame::ProcessMessage
virtual Bool_t ProcessMessage(Long_t, Long_t, Long_t)
Process dockable frame messages.
Definition: TGDockableFrame.cxx:391
TGDockableFrame::fDockButton
TGDockButton * fDockButton
dock button
Definition: TGDockableFrame.h:98
TGDockHideButton::fAspectRatio
Int_t fAspectRatio
triangle orientation
Definition: TGDockableFrame.h:49
TGDockableFrame::DockContainer
void DockContainer(Int_t del=kTRUE)
Dock container back to TGDockableFrame.
Definition: TGDockableFrame.cxx:325
TGDockableFrame::SetFixedSize
void SetFixedSize(Bool_t fixed)
Definition: TGDockableFrame.h:132
TGDockableFrame::ShowContainer
void ShowContainer()
Show dock container.
Definition: TGDockableFrame.cxx:357
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TGButton.h
Event_t
Event structure.
Definition: GuiTypes.h:174
TGDockableFrame::HideContainer
void HideContainer()
Hide dock container.
Definition: TGDockableFrame.cxx:374
name
char name[80]
Definition: TGX11.cxx:110
TGUndockedFrame::FixSize
void FixSize()
Fix the size of the undocked frame so it cannot be changed via the WM.
Definition: TGDockableFrame.cxx:203
TGDockableFrame::fContainer
TGCompositeFrame * fContainer
container containing dockable frame
Definition: TGDockableFrame.h:96
TGButton
A button abstract base class.
Definition: TGButton.h:68
TGUndockedFrame::fDockable
TGDockableFrame * fDockable
orignal dockable frame
Definition: TGDockableFrame.h:69
TGDockButton::DoRedraw
virtual void DoRedraw()
Draw the dock button, i.e. two vertical lines.
Definition: TGDockableFrame.cxx:126
TGDockButton
Definition: TGDockableFrame.h:28
TGCompositeFrame
The base class for composite widgets (menu bars, list boxes, etc.).
Definition: TGFrame.h:287
TGDockableFrame::fHidden
Bool_t fHidden
if frame is hidden
Definition: TGDockableFrame.h:90
TGDockableFrame::fHideButton
TGDockHideButton * fHideButton
hide button
Definition: TGDockableFrame.h:99
TGDockButton::fMouseOn
Bool_t fMouseOn
true when mouse on button
Definition: TGDockableFrame.h:30
TGDockableFrame::GetUndocked
TGUndockedFrame * GetUndocked() const
Definition: TGDockableFrame.h:135
TGDockableFrame::IsUndocked
Bool_t IsUndocked() const
Definition: TGDockableFrame.h:128
TQObject::Emit
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:164
int