Logo ROOT  
Reference Guide
TGSplitter.h
Go to the documentation of this file.
1 // @(#)root/gui:$Id$
2 // Author: Fons Rademakers 6/09/2000
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_TGSplitter
13 #define ROOT_TGSplitter
14 
15 
16 #include "TGFrame.h"
17 
18 
19 class TGSplitter : public TGFrame {
20 
21 protected:
22  Cursor_t fSplitCursor; ///< split cursor
23  Bool_t fDragging; ///< true if in dragging mode
24  Bool_t fExternalHandler; ///< true when splitter movement is handled externally
25  const TGPicture *fSplitterPic; ///< picture to draw splitter
26 
27 private:
28  TGSplitter(const TGSplitter&) = delete;
29  TGSplitter& operator=(const TGSplitter&) = delete;
30 
31 public:
32  TGSplitter(const TGWindow *p = nullptr, UInt_t w = 2, UInt_t h = 4,
33  UInt_t options = kChildFrame,
35  virtual ~TGSplitter() { }
36 
37  virtual void SetFrame(TGFrame *frame, Bool_t prev) = 0;
38 
42 
43  void DragStarted(); // *SIGNAL*
44  void Moved(Int_t delta); // *SIGNAL*
45 
48 
49  ClassDef(TGSplitter,0) //A frame splitter abstract base class
50 };
51 
52 
53 class TGVSplitter : public TGSplitter {
54 
55 private:
56  TGVSplitter(const TGVSplitter&) = delete;
57  TGVSplitter& operator=(const TGVSplitter&) = delete;
58 
59 protected:
60  Int_t fStartX; ///< x position when dragging starts
61  UInt_t fFrameWidth; ///< width of frame to be resized
62  UInt_t fFrameHeight; ///< height of frame to be resized
63  Int_t fMin; ///< min x position frame can be resized to
64  Int_t fMax; ///< max x position frame can be resized to
65  TGFrame *fFrame; ///< frame that should be resized
66  Bool_t fLeft; ///< true if frame is on the left of splitter
67 
68 public:
69  TGVSplitter(const TGWindow *p = nullptr, UInt_t w = 4, UInt_t h = 4,
70  UInt_t options = kChildFrame,
72  TGVSplitter(const TGWindow *p, UInt_t w, UInt_t h, Bool_t external);
73  virtual ~TGVSplitter();
74 
75  virtual void DrawBorder();
76  virtual void SetFrame(TGFrame *frame, Bool_t left);
77  const TGFrame *GetFrame() const { return fFrame; }
78  Bool_t GetLeft() const { return fLeft; }
79  Bool_t IsLeft() const { return fLeft; }
80  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
81 
82  virtual Bool_t HandleButton(Event_t *event);
83  virtual Bool_t HandleMotion(Event_t *event);
85 
86  ClassDef(TGVSplitter,0) //A vertical frame splitter
87 };
88 
89 
90 class TGHSplitter : public TGSplitter {
91 
92 private:
93  TGHSplitter(const TGHSplitter&) = delete;
94  TGHSplitter& operator=(const TGHSplitter&) = delete;
95 
96 protected:
97  Int_t fStartY; ///< y position when dragging starts
98  UInt_t fFrameWidth; ///< width of frame to be resized
99  UInt_t fFrameHeight; ///< height of frame to be resized
100  Int_t fMin; ///< min y position frame can be resized to
101  Int_t fMax; ///< max y position frame can be resized to
102  TGFrame *fFrame; ///< frame that should be resized
103  Bool_t fAbove; ///< true if frame is above the splitter
104 
105 public:
106  TGHSplitter(const TGWindow *p = nullptr, UInt_t w = 4, UInt_t h = 4,
107  UInt_t options = kChildFrame,
109  TGHSplitter(const TGWindow *p, UInt_t w, UInt_t h, Bool_t external);
110  virtual ~TGHSplitter();
111 
112  virtual void DrawBorder();
113  virtual void SetFrame(TGFrame *frame, Bool_t above);
114  const TGFrame *GetFrame() const { return fFrame; }
115  Bool_t GetAbove() const { return fAbove; }
116  Bool_t IsAbove() const { return fAbove; }
117  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
118 
119  virtual Bool_t HandleButton(Event_t *event);
120  virtual Bool_t HandleMotion(Event_t *event);
122 
123  ClassDef(TGHSplitter,0) //A horizontal frame splitter
124 };
125 
126 class TGVFileSplitter : public TGVSplitter {
127 
128 private:
131 
132 public:
133  TGVFileSplitter(const TGWindow *p = nullptr, UInt_t w = 4, UInt_t h = 4,
134  UInt_t options = kChildFrame,
136  virtual ~TGVFileSplitter();
137 
138  virtual Bool_t HandleDoubleClick(Event_t *);
139  virtual Bool_t HandleButton(Event_t *event);
140  virtual Bool_t HandleMotion(Event_t *event);
141  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
142 
143  void LayoutHeader(TGFrame *f); //*SIGNAL*
144  void LayoutListView(); //*SIGNAL*
145  void ButtonPressed(); //*SIGNAL*
146  void ButtonReleased(); //*SIGNAL*
147  void DoubleClicked(TGVFileSplitter* frame); //*SIGNAL*
148 
149  ClassDef(TGVFileSplitter,0) //A vertical file frame splitter
150 };
151 
152 
153 #endif
TGHSplitter::fMin
Int_t fMin
min y position frame can be resized to
Definition: TGSplitter.h:100
TGWindow
ROOT GUI Window base class.
Definition: TGWindow.h:23
TGVSplitter::fMax
Int_t fMax
max x position frame can be resized to
Definition: TGSplitter.h:64
TGVSplitter::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a splitter widget as a C++ statement(s) on output stream out.
Definition: TGSplitter.cxx:583
TGHSplitter::fFrameWidth
UInt_t fFrameWidth
width of frame to be resized
Definition: TGSplitter.h:98
TGHSplitter::operator=
TGHSplitter & operator=(const TGHSplitter &)=delete
TGVFileSplitter::ButtonPressed
void ButtonPressed()
Emit ButtonPressed() signal.
Definition: TGSplitter.cxx:550
TGSplitter::fSplitCursor
Cursor_t fSplitCursor
split cursor
Definition: TGSplitter.h:22
TGPicture
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition: TGPicture.h:25
f
#define f(i)
Definition: RSha256.hxx:104
TGVSplitter::DrawBorder
virtual void DrawBorder()
Draw vertical splitter.
Definition: TGSplitter.cxx:251
Option_t
const char Option_t
Definition: RtypesCore.h:66
TGVFileSplitter::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a splitter widget as a C++ statement(s) on output stream out.
Definition: TGSplitter.cxx:649
TGSplitter::HandleMotion
virtual Bool_t HandleMotion(Event_t *event)=0
Pixel_t
ULong_t Pixel_t
Pixel value.
Definition: GuiTypes.h:40
TGVFileSplitter::LayoutListView
void LayoutListView()
Emit LayoutListView() signal.
Definition: TGSplitter.cxx:542
TGSplitter::DragStarted
void DragStarted()
Emit DragStarted signal.
Definition: TGSplitter.cxx:53
TGVSplitter::fStartX
Int_t fStartX
x position when dragging starts
Definition: TGSplitter.h:60
TGHSplitter::GetAbove
Bool_t GetAbove() const
Definition: TGSplitter.h:115
TGVFileSplitter::HandleButton
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in vertical splitter.
Definition: TGSplitter.cxx:517
TGHSplitter::DrawBorder
virtual void DrawBorder()
Draw horizontal splitter.
Definition: TGSplitter.cxx:450
TGVSplitter::SetFrame
virtual void SetFrame(TGFrame *frame, Bool_t left)
Set frame to be resized.
Definition: TGSplitter.cxx:143
TGVFileSplitter
Definition: TGSplitter.h:126
TGSplitter::TGSplitter
TGSplitter(const TGSplitter &)=delete
event
Definition: triangle.c:553
x
Double_t x[n]
Definition: legend1.C:17
TGHSplitter::fMax
Int_t fMax
max y position frame can be resized to
Definition: TGSplitter.h:101
TGSplitter::~TGSplitter
virtual ~TGSplitter()
Definition: TGSplitter.h:35
TGFrame::GetDefaultFrameBackground
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:683
TGHSplitter::fFrame
TGFrame * fFrame
frame that should be resized
Definition: TGSplitter.h:102
TGSplitter::GetExternalHandler
Bool_t GetExternalHandler() const
Definition: TGSplitter.h:46
TGHSplitter::IsAbove
Bool_t IsAbove() const
Definition: TGSplitter.h:116
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
bool
TGHSplitter::~TGHSplitter
virtual ~TGHSplitter()
Delete horizontal splitter widget.
Definition: TGSplitter.cxx:333
Cursor_t
Handle_t Cursor_t
Cursor handle.
Definition: GuiTypes.h:34
TGSplitter::SetExternalHandler
void SetExternalHandler(Bool_t x)
Definition: TGSplitter.h:47
TGVSplitter::GetFrame
const TGFrame * GetFrame() const
Definition: TGSplitter.h:77
TGSplitter::fExternalHandler
Bool_t fExternalHandler
true when splitter movement is handled externally
Definition: TGSplitter.h:24
TGSplitter::SetFrame
virtual void SetFrame(TGFrame *frame, Bool_t prev)=0
TGVFileSplitter::DoubleClicked
void DoubleClicked(TGVFileSplitter *frame)
Emit DoubleClicked() signal.
Definition: TGSplitter.cxx:566
TGVFileSplitter::~TGVFileSplitter
virtual ~TGVFileSplitter()
if (fSplitterPic) fClient->FreePicture(fSplitterPic);
Definition: TGSplitter.cxx:473
TGSplitter::fSplitterPic
const TGPicture * fSplitterPic
picture to draw splitter
Definition: TGSplitter.h:25
TGVSplitter::~TGVSplitter
virtual ~TGVSplitter()
Delete vertical splitter widget.
Definition: TGSplitter.cxx:134
h
#define h(i)
Definition: RSha256.hxx:106
TGVSplitter::TGVSplitter
TGVSplitter(const TGVSplitter &)=delete
TGFrame.h
TGVFileSplitter::ButtonReleased
void ButtonReleased()
Emit ButtonReleased() signal.
Definition: TGSplitter.cxx:558
TGVSplitter::fFrameWidth
UInt_t fFrameWidth
width of frame to be resized
Definition: TGSplitter.h:61
TGHSplitter::TGHSplitter
TGHSplitter(const TGHSplitter &)=delete
TGHSplitter::fAbove
Bool_t fAbove
true if frame is above the splitter
Definition: TGSplitter.h:103
TGSplitter::HandleCrossing
virtual Bool_t HandleCrossing(Event_t *event)=0
TGVSplitter::fFrame
TGFrame * fFrame
frame that should be resized
Definition: TGSplitter.h:65
TGVFileSplitter::HandleMotion
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion event in vertical splitter.
Definition: TGSplitter.cxx:480
TGVSplitter::fMin
Int_t fMin
min x position frame can be resized to
Definition: TGSplitter.h:63
TGVSplitter::IsLeft
Bool_t IsLeft() const
Definition: TGSplitter.h:79
TGSplitter
A splitter allows the frames left and right or above and below of it to be resized.
Definition: TGSplitter.h:19
unsigned int
TGVSplitter::fFrameHeight
UInt_t fFrameHeight
height of frame to be resized
Definition: TGSplitter.h:62
TGHSplitter
Definition: TGSplitter.h:90
TGHSplitter::fFrameHeight
UInt_t fFrameHeight
height of frame to be resized
Definition: TGSplitter.h:99
TGHSplitter::SetFrame
virtual void SetFrame(TGFrame *frame, Bool_t above)
Set frame to be resized.
Definition: TGSplitter.cxx:342
TGSplitter::fDragging
Bool_t fDragging
true if in dragging mode
Definition: TGSplitter.h:23
TGVSplitter::fLeft
Bool_t fLeft
true if frame is on the left of splitter
Definition: TGSplitter.h:66
TGVFileSplitter::operator=
TGVFileSplitter & operator=(const TGVFileSplitter &)=delete
TGVSplitter::HandleCrossing
virtual Bool_t HandleCrossing(Event_t *event)
Handle mouse motion event in vertical splitter.
Definition: TGSplitter.cxx:238
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TGVFileSplitter::HandleDoubleClick
virtual Bool_t HandleDoubleClick(Event_t *)
Handle double click mouse event in splitter.
Definition: TGSplitter.cxx:574
TGVSplitter::HandleButton
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in vertical splitter.
Definition: TGSplitter.cxx:155
Event_t
Event structure.
Definition: GuiTypes.h:174
TGHSplitter::fStartY
Int_t fStartY
y position when dragging starts
Definition: TGSplitter.h:97
TGHSplitter::HandleCrossing
virtual Bool_t HandleCrossing(Event_t *event)
Handle mouse motion event in horizontal splitter.
Definition: TGSplitter.cxx:437
TGSplitter::operator=
TGSplitter & operator=(const TGSplitter &)=delete
TGVSplitter::operator=
TGVSplitter & operator=(const TGVSplitter &)=delete
TGVSplitter
Definition: TGSplitter.h:53
TGVFileSplitter::LayoutHeader
void LayoutHeader(TGFrame *f)
Emit LayoutFeader() signal.
Definition: TGSplitter.cxx:534
TGVSplitter::GetLeft
Bool_t GetLeft() const
Definition: TGSplitter.h:78
TGHSplitter::HandleButton
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in horizontal splitter.
Definition: TGSplitter.cxx:354
TGHSplitter::HandleMotion
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion event in horizontal splitter.
Definition: TGSplitter.cxx:401
TGSplitter::Moved
void Moved(Int_t delta)
Emit Moved signal.
Definition: TGSplitter.cxx:61
TGVSplitter::HandleMotion
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion event in vertical splitter.
Definition: TGSplitter.cxx:202
TGVFileSplitter::TGVFileSplitter
TGVFileSplitter(const TGVFileSplitter &)=delete
TGHSplitter::GetFrame
const TGFrame * GetFrame() const
Definition: TGSplitter.h:114
TGHSplitter::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a splitter widget as a C++ statement(s) on output stream out.
Definition: TGSplitter.cxx:616
kChildFrame
@ kChildFrame
Definition: GuiTypes.h:379
int
TGSplitter::HandleButton
virtual Bool_t HandleButton(Event_t *event)=0