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
25class TGDockableFrame;
26
27
28class TGDockButton : public TGButton {
29protected:
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
37public:
38 TGDockButton(const TGCompositeFrame *p = nullptr, Int_t id = 1);
39 virtual ~TGDockButton();
40
42
43 ClassDef(TGDockButton,0) // Dock button
44};
45
46
48protected:
49 Int_t fAspectRatio; ///< triangle orientation
50
51 virtual void DoRedraw();
52
53public:
54 TGDockHideButton(const TGCompositeFrame *p = nullptr);
55
57
58 ClassDef(TGDockHideButton,0) // Hide dock button
59};
60
61
63
64private:
67
68protected:
69 TGDockableFrame *fDockable; ///< orignal dockable frame
70
71public:
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
83friend class TGUndockedFrame;
84
85private:
88
89protected:
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
104public:
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);
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
int Int_t
Definition: CPyCppyy.h:43
unsigned int UInt_t
Definition: CPyCppyy.h:44
unsigned long ULong_t
Definition: CPyCppyy.h:51
long Long_t
Definition: CPyCppyy.h:50
@ kHorizontalFrame
Definition: GuiTypes.h:382
#define f(i)
Definition: RSha256.hxx:104
bool Bool_t
Definition: RtypesCore.h:63
const Bool_t kTRUE
Definition: RtypesCore.h:100
const char Option_t
Definition: RtypesCore.h:66
#define ClassDef(name, id)
Definition: Rtypes.h:325
A button abstract base class.
Definition: TGButton.h:68
The base class for composite widgets (menu bars, list boxes, etc.).
Definition: TGFrame.h:287
ULong_t fNormBg
normal background color
virtual Bool_t HandleCrossing(Event_t *event)
Handle dock button crossing events.
virtual void DrawBorder()
Draw borders of dock button.
ULong_t fHiBg
highlighted background color
Bool_t fMouseOn
true when mouse on button
virtual ~TGDockButton()
Delete dock button.
virtual void DoRedraw()
Draw the dock button, i.e. two vertical lines.
TGDockButton(const TGCompositeFrame *p=nullptr, Int_t id=1)
Create a dock button (i.e. button with two vertical bars).
virtual void DoRedraw()
Draw dock hide button.
TGDockHideButton(const TGCompositeFrame *p=nullptr)
Create a dock hide button (i.e. button with small triangle).
void SetAspectRatio(Int_t a)
Int_t fAspectRatio
triangle orientation
A frame with handles that allow it to be undocked (i.e.
void DockContainer(Int_t del=kTRUE)
Dock container back to TGDockableFrame.
Bool_t fEnableUndock
if frame can be undocked
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
container containing dock and hide buttons
TGDockableFrame & operator=(const TGDockableFrame &)=delete
virtual ~TGDockableFrame()
Cleanup dockable frame.
TGUndockedFrame * fFrame
undocked frame
TGUndockedFrame * GetUndocked() const
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
container containing dockable frame
Bool_t fHidden
if frame is hidden
TGDockableFrame(const TGDockableFrame &)=delete
void UndockContainer()
Undock container.
Bool_t fDeleted
kTRUE if it is being deleted
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
Bool_t fFixedSize
kTRUE if fixed size when undocked
TGLayoutHints * fHints
layout hints
void SetWindowName(const char *name)
Set window name so it appear as title of the undock window.
Bool_t fEnableHide
if frame can be hidden
Bool_t EnableHide() const
TGDockButton * fDockButton
dock button
void ShowContainer()
Show dock container.
TGDockHideButton * fHideButton
hide button
virtual void Docked()
TString fDockName
name of frame
TGLayoutHints * fLc
layout hints
Bool_t IsUndocked() const
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition: TGFrame.h:80
This class describes layout hints used by the layout classes.
Definition: TGLayout.h:50
Defines transient windows that typically are used for dialogs windows.
Definition: TGFrame.h:498
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
orignal dockable frame
TGUndockedFrame(const TGUndockedFrame &)=delete
TGUndockedFrame & operator=(const TGUndockedFrame &)=delete
void CloseWindow()
Close undocked frame (called via WM close button).
The widget base class.
Definition: TGWidget.h:43
ROOT GUI Window base class.
Definition: TGWindow.h:23
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:164
Basic string class.
Definition: TString.h:136
static const std::string name("name")
Event structure.
Definition: GuiTypes.h:174
auto * a
Definition: textangle.C:12