Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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//////////////////////////////////////////////////////////////////////////
17// //
18// TGSplitter, TGVSplitter and TGHSplitter //
19// //
20// A splitter allows the frames left and right or above and below of //
21// it to be resized. The frame to be resized must have the kFixedWidth //
22// or kFixedHeight property set. //
23// //
24//////////////////////////////////////////////////////////////////////////
25
26#include "TGFrame.h"
27
28
29class TGSplitter : public TGFrame {
30
31protected:
32 Cursor_t fSplitCursor; // split cursor
33 Bool_t fDragging; // true if in dragging mode
34 Bool_t fExternalHandler; // true when splitter movement is handled externally
35 const TGPicture *fSplitterPic; // picture to draw splitter
36
37private:
38 TGSplitter(const TGSplitter&) = delete;
39 TGSplitter& operator=(const TGSplitter&) = delete;
40
41public:
42 TGSplitter(const TGWindow *p = nullptr, UInt_t w = 2, UInt_t h = 4,
43 UInt_t options = kChildFrame,
45 virtual ~TGSplitter() { }
46
47 virtual void SetFrame(TGFrame *frame, Bool_t prev) = 0;
48
49 virtual Bool_t HandleButton(Event_t *event) = 0;
50 virtual Bool_t HandleMotion(Event_t *event) = 0;
51 virtual Bool_t HandleCrossing(Event_t *event) = 0;
52
53 void DragStarted(); // *SIGNAL*
54 void Moved(Int_t delta); // *SIGNAL*
55
58
59 ClassDef(TGSplitter,0) //A frame splitter abstract base class
60};
61
62
63class TGVSplitter : public TGSplitter {
64
65private:
66 TGVSplitter(const TGVSplitter&) = delete;
68
69protected:
70 Int_t fStartX; // x position when dragging starts
71 UInt_t fFrameWidth; // width of frame to be resized
72 UInt_t fFrameHeight; // height of frame to be resized
73 Int_t fMin; // min x position frame can be resized to
74 Int_t fMax; // max x position frame can be resized to
75 TGFrame *fFrame; // frame that should be resized
76 Bool_t fLeft; // true if frame is on the left of splitter
77
78public:
79 TGVSplitter(const TGWindow *p = nullptr, UInt_t w = 4, UInt_t h = 4,
80 UInt_t options = kChildFrame,
82 TGVSplitter(const TGWindow *p, UInt_t w, UInt_t h, Bool_t external);
83 virtual ~TGVSplitter();
84
85 virtual void DrawBorder();
86 virtual void SetFrame(TGFrame *frame, Bool_t left);
87 const TGFrame *GetFrame() const { return fFrame; }
88 Bool_t GetLeft() const { return fLeft; }
89 Bool_t IsLeft() const { return fLeft; }
90 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
91
92 virtual Bool_t HandleButton(Event_t *event);
93 virtual Bool_t HandleMotion(Event_t *event);
94 virtual Bool_t HandleCrossing(Event_t *event);
95
96 ClassDef(TGVSplitter,0) //A vertical frame splitter
97};
98
99
100class TGHSplitter : public TGSplitter {
101
102private:
103 TGHSplitter(const TGHSplitter&) = delete;
105
106protected:
107 Int_t fStartY; // y position when dragging starts
108 UInt_t fFrameWidth; // width of frame to be resized
109 UInt_t fFrameHeight; // height of frame to be resized
110 Int_t fMin; // min y position frame can be resized to
111 Int_t fMax; // max y position frame can be resized to
112 TGFrame *fFrame; // frame that should be resized
113 Bool_t fAbove; // true if frame is above the splitter
114
115public:
116 TGHSplitter(const TGWindow *p = nullptr, UInt_t w = 4, UInt_t h = 4,
117 UInt_t options = kChildFrame,
119 TGHSplitter(const TGWindow *p, UInt_t w, UInt_t h, Bool_t external);
120 virtual ~TGHSplitter();
121
122 virtual void DrawBorder();
123 virtual void SetFrame(TGFrame *frame, Bool_t above);
124 const TGFrame *GetFrame() const { return fFrame; }
125 Bool_t GetAbove() const { return fAbove; }
126 Bool_t IsAbove() const { return fAbove; }
127 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
128
129 virtual Bool_t HandleButton(Event_t *event);
130 virtual Bool_t HandleMotion(Event_t *event);
131 virtual Bool_t HandleCrossing(Event_t *event);
132
133 ClassDef(TGHSplitter,0) //A horizontal frame splitter
134};
135
137
138private:
141
142public:
143 TGVFileSplitter(const TGWindow *p = nullptr, UInt_t w = 4, UInt_t h = 4,
144 UInt_t options = kChildFrame,
146 virtual ~TGVFileSplitter();
147
149 virtual Bool_t HandleButton(Event_t *event);
150 virtual Bool_t HandleMotion(Event_t *event);
151 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
152
153 void LayoutHeader(TGFrame *f); //*SIGNAL*
154 void LayoutListView(); //*SIGNAL*
155 void ButtonPressed(); //*SIGNAL*
156 void ButtonReleased(); //*SIGNAL*
157 void DoubleClicked(TGVFileSplitter* frame); //*SIGNAL*
158
159 ClassDef(TGVFileSplitter,0) //A vertical file frame splitter
160};
161
162
163#endif
Handle_t Cursor_t
Cursor handle.
Definition GuiTypes.h:34
@ kChildFrame
Definition GuiTypes.h:379
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
#define f(i)
Definition RSha256.hxx:104
#define h(i)
Definition RSha256.hxx:106
bool Bool_t
Definition RtypesCore.h:63
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:325
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition TGFrame.cxx:668
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a splitter widget as a C++ statement(s) on output stream out.
TGHSplitter(const TGHSplitter &)=delete
const TGFrame * GetFrame() const
Definition TGSplitter.h:124
UInt_t fFrameHeight
Definition TGSplitter.h:109
TGHSplitter & operator=(const TGHSplitter &)=delete
virtual void SetFrame(TGFrame *frame, Bool_t above)
Set frame to be resized.
virtual void DrawBorder()
Draw horizontal splitter.
TGFrame * fFrame
Definition TGSplitter.h:112
Bool_t GetAbove() const
Definition TGSplitter.h:125
Bool_t fAbove
Definition TGSplitter.h:113
Int_t fStartY
Definition TGSplitter.h:107
virtual Bool_t HandleCrossing(Event_t *event)
Handle mouse motion event in horizontal splitter.
virtual ~TGHSplitter()
Delete horizontal splitter widget.
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in horizontal splitter.
UInt_t fFrameWidth
Definition TGSplitter.h:108
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion event in horizontal splitter.
Bool_t IsAbove() const
Definition TGSplitter.h:126
TGSplitter(const TGSplitter &)=delete
Cursor_t fSplitCursor
Definition TGSplitter.h:32
void DragStarted()
Emit DragStarted signal.
virtual Bool_t HandleCrossing(Event_t *event)=0
void Moved(Int_t delta)
Emit Moved signal.
void SetExternalHandler(Bool_t x)
Definition TGSplitter.h:57
const TGPicture * fSplitterPic
Definition TGSplitter.h:35
virtual void SetFrame(TGFrame *frame, Bool_t prev)=0
virtual Bool_t HandleMotion(Event_t *event)=0
Bool_t fDragging
Definition TGSplitter.h:33
TGSplitter & operator=(const TGSplitter &)=delete
Bool_t GetExternalHandler() const
Definition TGSplitter.h:56
virtual ~TGSplitter()
Definition TGSplitter.h:45
virtual Bool_t HandleButton(Event_t *event)=0
Bool_t fExternalHandler
Definition TGSplitter.h:34
void ButtonPressed()
Emit ButtonPressed() signal.
virtual ~TGVFileSplitter()
if (fSplitterPic) fClient->FreePicture(fSplitterPic);
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in vertical splitter.
void DoubleClicked(TGVFileSplitter *frame)
Emit DoubleClicked() signal.
void LayoutListView()
Emit LayoutListView() signal.
TGVFileSplitter(const TGVFileSplitter &)=delete
void ButtonReleased()
Emit ButtonReleased() signal.
virtual Bool_t HandleDoubleClick(Event_t *)
Handle double click mouse event in splitter.
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion event in vertical splitter.
TGVFileSplitter & operator=(const TGVFileSplitter &)=delete
void LayoutHeader(TGFrame *f)
Emit LayoutFeader() signal.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a splitter widget as a C++ statement(s) on output stream out.
UInt_t fFrameHeight
Definition TGSplitter.h:72
TGVSplitter(const TGVSplitter &)=delete
virtual ~TGVSplitter()
Delete vertical splitter widget.
const TGFrame * GetFrame() const
Definition TGSplitter.h:87
Bool_t IsLeft() const
Definition TGSplitter.h:89
virtual void SetFrame(TGFrame *frame, Bool_t left)
Set frame to be resized.
TGVSplitter & operator=(const TGVSplitter &)=delete
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in vertical splitter.
virtual Bool_t HandleCrossing(Event_t *event)
Handle mouse motion event in vertical splitter.
Bool_t GetLeft() const
Definition TGSplitter.h:88
TGFrame * fFrame
Definition TGSplitter.h:75
UInt_t fFrameWidth
Definition TGSplitter.h:71
Int_t fStartX
Definition TGSplitter.h:70
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a splitter widget as a C++ statement(s) on output stream out.
Bool_t fLeft
Definition TGSplitter.h:76
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion event in vertical splitter.
virtual void DrawBorder()
Draw vertical splitter.
Double_t x[n]
Definition legend1.C:17
Event structure.
Definition GuiTypes.h:174