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-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_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 
36 class TGDockableFrame;
37 
38 
39 class TGDockButton : public TGButton {
40 protected:
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 
48 public:
49  TGDockButton(const TGCompositeFrame *p = 0, 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 
59 protected:
60  Int_t fAspectRatio; // triangle orientation
61 
62  virtual void DoRedraw();
63 
64 public:
65  TGDockHideButton(const TGCompositeFrame *p = 0);
66 
68 
69  ClassDef(TGDockHideButton,0) // Hide dock button
70 };
71 
72 
74 
75 private:
76  TGUndockedFrame(const TGUndockedFrame&); // Not implemented
77  TGUndockedFrame& operator=(const TGUndockedFrame&); // Not implemented
78 
79 protected:
80  TGDockableFrame *fDockable; // orignal dockable frame
81 
82 public:
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 
93 class TGDockableFrame : public TGCompositeFrame, public TGWidget {
94 friend class TGUndockedFrame;
95 
96 private:
97  TGDockableFrame(const TGDockableFrame&); // Not implemented
98  TGDockableFrame& operator=(const TGDockableFrame&); // Not implemented
99 
100 protected:
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
110  TGDockHideButton *fHideButton; // hide button
111  TGUndockedFrame *fFrame; // undocked frame
112  TGLayoutHints *fHints; // layout hints
113  TGLayoutHints *fLb, *fLc; // layout hints
114 
115 public:
116  TGDockableFrame(const TGWindow *p = 0, 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);
133  Bool_t EnableUndock() const { return fEnableUndock; }
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
TGTransientFrame
Definition: TGFrame.h:553
TGDockableFrame::~TGDockableFrame
virtual ~TGDockableFrame()
Cleanup dockable frame.
Definition: TGDockableFrame.cxx:260
TGWindow
Definition: TGWindow.h:31
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TGDockButton::~TGDockButton
virtual ~TGDockButton()
Delete dock button.
Definition: TGDockableFrame.cxx:77
TGDockableFrame::UndockContainer
void UndockContainer()
Undock container.
Definition: TGDockableFrame.cxx:283
TGDockableFrame::fLb
TGLayoutHints * fLb
Definition: TGDockableFrame.h:113
TGDockableFrame::IsFixedSize
Bool_t IsFixedSize() const
Definition: TGDockableFrame.h:142
f
#define f(i)
Definition: RSha256.hxx:122
TGDockableFrame::fDeleted
Bool_t fDeleted
Definition: TGDockableFrame.h:104
TGDockHideButton::SetAspectRatio
void SetAspectRatio(Int_t a)
Definition: TGDockableFrame.h:67
TGDockButton::DrawBorder
virtual void DrawBorder()
Draw borders of dock button.
Definition: TGDockableFrame.cxx:101
TGDockableFrame::SetWindowName
void SetWindowName(const char *name)
Set window name so it appear as title of the undock window.
Definition: TGDockableFrame.cxx:442
TGUndockedFrame::~TGUndockedFrame
virtual ~TGUndockedFrame()
Delete undocked frame. Puts back dockable frame in its original container.
Definition: TGDockableFrame.cxx:190
TGDockButton::fHiBg
ULong_t fHiBg
Definition: TGDockableFrame.h:43
TGDockableFrame::fFrame
TGUndockedFrame * fFrame
Definition: TGDockableFrame.h:111
TGDockHideButton
Definition: TGDockableFrame.h:58
TGDockableFrame::fDockName
TString fDockName
Definition: TGDockableFrame.h:106
TGDockableFrame::Docked
virtual void Docked()
Definition: TGDockableFrame.h:123
Int_t
int Int_t
Definition: RtypesCore.h:45
TGUndockedFrame::operator=
TGUndockedFrame & operator=(const TGUndockedFrame &)
TGWidget
Definition: TGWidget.h:55
TGDockableFrame::fButtons
TGCompositeFrame * fButtons
Definition: TGDockableFrame.h:108
TGDockableFrame::fHints
TGLayoutHints * fHints
Definition: TGDockableFrame.h:112
TGDockableFrame::fEnableHide
Bool_t fEnableHide
Definition: TGDockableFrame.h:102
TGDockButton::HandleCrossing
virtual Bool_t HandleCrossing(Event_t *event)
Handle dock button crossing events.
Definition: TGDockableFrame.cxx:84
TGDockableFrame::IsHidden
Bool_t IsHidden() const
Definition: TGDockableFrame.h:140
TGDockHideButton::DoRedraw
virtual void DoRedraw()
Draw dock hide button.
Definition: TGDockableFrame.cxx:151
TGDockableFrame::fFixedSize
Bool_t fFixedSize
Definition: TGDockableFrame.h:105
TString
Definition: TString.h:136
TGFrame
Definition: TGFrame.h:105
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TGDockableFrame::operator=
TGDockableFrame & operator=(const TGDockableFrame &)
TGDockableFrame::Undocked
virtual void Undocked()
Definition: TGDockableFrame.h:124
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:273
TGDockableFrame::fLc
TGLayoutHints * fLc
Definition: TGDockableFrame.h:113
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
TGUndockedFrame::TGUndockedFrame
TGUndockedFrame(const TGUndockedFrame &)
TGUndockedFrame::CloseWindow
void CloseWindow()
Close undocked frame (called via WM close button).
Definition: TGDockableFrame.cxx:210
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:454
TGDockableFrame::fEnableUndock
Bool_t fEnableUndock
Definition: TGDockableFrame.h:103
a
auto * a
Definition: textangle.C:12
TGDockableFrame::EnableHide
Bool_t EnableHide() const
Definition: TGDockableFrame.h:135
TGFrame.h
Long_t
long Long_t
Definition: RtypesCore.h:54
TGLayoutHints
Definition: TGLayout.h:57
TGDockButton::fNormBg
ULong_t fNormBg
Definition: TGDockableFrame.h:42
TGDockableFrame
Definition: TGDockableFrame.h:93
ULong_t
unsigned long ULong_t
Definition: RtypesCore.h:55
TGDockableFrame::GetContainer
TGCompositeFrame * GetContainer() const
Definition: TGDockableFrame.h:145
TGUndockedFrame
Definition: TGDockableFrame.h:73
TGWidget.h
unsigned int
TGDockableFrame::EnableUndock
Bool_t EnableUndock() const
Definition: TGDockableFrame.h:133
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:388
TGDockableFrame::TGDockableFrame
TGDockableFrame(const TGDockableFrame &)
TGDockableFrame::fDockButton
TGDockButton * fDockButton
Definition: TGDockableFrame.h:109
TGDockHideButton::fAspectRatio
Int_t fAspectRatio
Definition: TGDockableFrame.h:60
TGDockableFrame::DockContainer
void DockContainer(Int_t del=kTRUE)
Dock container back to TGDockableFrame.
Definition: TGDockableFrame.cxx:322
TGDockableFrame::SetFixedSize
void SetFixedSize(Bool_t fixed)
Definition: TGDockableFrame.h:143
TGDockableFrame::ShowContainer
void ShowContainer()
Show dock container.
Definition: TGDockableFrame.cxx:354
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TGButton.h
Event_t
Definition: GuiTypes.h:173
TGDockableFrame::HideContainer
void HideContainer()
Hide dock container.
Definition: TGDockableFrame.cxx:371
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:200
TGDockableFrame::fContainer
TGCompositeFrame * fContainer
Definition: TGDockableFrame.h:107
TGDockHideButton::TGDockHideButton
TGDockHideButton(const TGCompositeFrame *p=0)
Create a dock hide button (i.e. button with small triangle).
Definition: TGDockableFrame.cxx:140
TGButton
Definition: TGButton.h:68
TGUndockedFrame::fDockable
TGDockableFrame * fDockable
Definition: TGDockableFrame.h:80
TGDockButton::DoRedraw
virtual void DoRedraw()
Draw the dock button, i.e. two vertical lines.
Definition: TGDockableFrame.cxx:123
TGDockButton::TGDockButton
TGDockButton(const TGCompositeFrame *p=0, Int_t id=1)
Create a dock button (i.e. button with two vertical bars).
Definition: TGDockableFrame.cxx:54
TGDockButton
Definition: TGDockableFrame.h:39
TGCompositeFrame
Definition: TGFrame.h:324
TGDockableFrame::fHidden
Bool_t fHidden
Definition: TGDockableFrame.h:101
TGDockableFrame::fHideButton
TGDockHideButton * fHideButton
Definition: TGDockableFrame.h:110
TGDockButton::fMouseOn
Bool_t fMouseOn
Definition: TGDockableFrame.h:41
TGDockableFrame::GetUndocked
TGUndockedFrame * GetUndocked() const
Definition: TGDockableFrame.h:146
TGDockableFrame::IsUndocked
Bool_t IsUndocked() const
Definition: TGDockableFrame.h:139
TQObject::Emit
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:164
int