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 void DrawBorder() override;
35 void DoRedraw() override;
36
37public:
38 TGDockButton(const TGCompositeFrame *p = nullptr, Int_t id = 1);
39 virtual ~TGDockButton();
40
42
44};
45
46
48protected:
49 Int_t fAspectRatio; ///< triangle orientation
50
51 void DoRedraw() override;
52
53public:
54 TGDockHideButton(const TGCompositeFrame *p = nullptr);
55
57
58 ClassDefOverride(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 = nullptr, TGDockableFrame *dockable = nullptr);
73 virtual ~TGUndockedFrame();
74
75 void FixSize();
76 void CloseWindow() override;
77
78 ClassDefOverride(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 void AddFrame(TGFrame *f, TGLayoutHints *hints) override;
110
112 virtual void Docked() { Emit("Docked()"); } //*SIGNAL*
113 virtual void Undocked() { Emit("Undocked()"); } //*SIGNAL*
114
115 void UndockContainer();
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) override;
127
128 Bool_t IsUndocked() const { return fFrame != nullptr; }
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 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
138
139 ClassDefOverride(TGDockableFrame,0) // Dockable widget
140};
141
142#endif
@ kHorizontalFrame
Definition: GuiTypes.h:382
#define f(i)
Definition: RSha256.hxx:104
bool Bool_t
Definition: RtypesCore.h:63
int Int_t
Definition: RtypesCore.h:45
long Longptr_t
Definition: RtypesCore.h:82
const Bool_t kTRUE
Definition: RtypesCore.h:100
unsigned long ULong_t
Definition: RtypesCore.h:55
const char Option_t
Definition: RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t del
char name[80]
Definition: TGX11.cxx:110
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
Bool_t HandleCrossing(Event_t *event) override
Handle dock button crossing events.
ULong_t fHiBg
highlighted background color
Bool_t fMouseOn
true when mouse on button
void DoRedraw() override
Draw the dock button, i.e. two vertical lines.
void DrawBorder() override
Draw borders of dock button.
virtual ~TGDockButton()
Delete dock button.
TGDockButton(const TGCompositeFrame *p=nullptr, Int_t id=1)
Create a dock button (i.e. button with two vertical bars).
void DoRedraw() override
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
TGCompositeFrame * fButtons
container containing dock and hide buttons
virtual ~TGDockableFrame()
Cleanup dockable frame.
TGUndockedFrame * fFrame
undocked frame
Bool_t ProcessMessage(Longptr_t, Longptr_t, Longptr_t) override
Process dockable frame messages.
TGLayoutHints * fLb
Bool_t IsHidden() const
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a dockable frame widget as a C++ statement(s) on output stream out.
TGCompositeFrame * GetContainer() const
void AddFrame(TGFrame *f, TGLayoutHints *hints) override
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.
void SetWindowName(const char *name) override
Set window name so it appear as title of the undock window.
void SetFixedSize(Bool_t fixed)
Bool_t EnableUndock() const
Bool_t IsFixedSize() const
TGDockableFrame & operator=(const TGDockableFrame &)=delete
Bool_t fFixedSize
kTRUE if fixed size when undocked
TGLayoutHints * fHints
layout hints
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
TGUndockedFrame * GetUndocked() const
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
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
orignal dockable frame
TGUndockedFrame(const TGUndockedFrame &)=delete
void CloseWindow() override
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
Event structure.
Definition: GuiTypes.h:174
auto * a
Definition: textangle.C:12