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-2000, 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 
29 class TGSplitter : public TGFrame {
30 
31 protected:
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 
37 private:
38  TGSplitter(const TGSplitter&); // not implemented
39  TGSplitter& operator=(const TGSplitter&); // not implemented
40 
41 public:
42  TGSplitter(const TGWindow *p = 0, 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 
56  Bool_t GetExternalHandler() const { return fExternalHandler; }
58 
59  ClassDef(TGSplitter,0) //A frame splitter abstract base class
60 };
61 
62 
63 class TGVSplitter : public TGSplitter {
64 
65 private:
66  TGVSplitter(const TGVSplitter&); // not implemented
67  TGVSplitter& operator=(const TGVSplitter&); // not implemented
68 
69 protected:
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 
78 public:
79  TGVSplitter(const TGWindow *p = 0, 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 
100 class TGHSplitter : public TGSplitter {
101 
102 private:
103  TGHSplitter(const TGHSplitter&); // not implemented
104  TGHSplitter& operator=(const TGHSplitter&); // not implemented
105 
106 protected:
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 
115 public:
116  TGHSplitter(const TGWindow *p = 0, 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 
136 class TGVFileSplitter : public TGVSplitter {
137 
138 public:
139  TGVFileSplitter(const TGWindow *p = 0, UInt_t w = 4, UInt_t h = 4,
140  UInt_t options = kChildFrame,
142  virtual ~TGVFileSplitter();
143 
144  virtual Bool_t HandleDoubleClick(Event_t *);
145  virtual Bool_t HandleButton(Event_t *event);
146  virtual Bool_t HandleMotion(Event_t *event);
147  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
148 
149  void LayoutHeader(TGFrame *f); //*SIGNAL*
150  void LayoutListView(); //*SIGNAL*
151  void ButtonPressed(); //*SIGNAL*
152  void ButtonReleased(); //*SIGNAL*
153  void DoubleClicked(TGVFileSplitter* frame); //*SIGNAL*
154 
155  ClassDef(TGVFileSplitter,0) //A vertical file frame splitter
156 };
157 
158 
159 #endif
TGHSplitter::fMin
Int_t fMin
Definition: TGSplitter.h:110
TGWindow
Definition: TGWindow.h:31
TGVSplitter::fMax
Int_t fMax
Definition: TGSplitter.h:74
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:582
TGHSplitter::fFrameWidth
UInt_t fFrameWidth
Definition: TGSplitter.h:108
TGVFileSplitter::ButtonPressed
void ButtonPressed()
Emit ButtonPressed() signal.
Definition: TGSplitter.cxx:549
TGSplitter::fSplitCursor
Cursor_t fSplitCursor
Definition: TGSplitter.h:38
TGPicture
Definition: TGPicture.h:36
f
#define f(i)
Definition: RSha256.hxx:122
TGVSplitter::DrawBorder
virtual void DrawBorder()
Draw vertical splitter.
Definition: TGSplitter.cxx:250
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:648
TGSplitter::HandleMotion
virtual Bool_t HandleMotion(Event_t *event)=0
Pixel_t
ULong_t Pixel_t
Definition: GuiTypes.h:39
TGVFileSplitter::LayoutListView
void LayoutListView()
Emit LayoutListView() signal.
Definition: TGSplitter.cxx:541
TGSplitter::DragStarted
void DragStarted()
Emit DragStarted signal.
Definition: TGSplitter.cxx:52
TGVSplitter::operator=
TGVSplitter & operator=(const TGVSplitter &)
TGVSplitter::fStartX
Int_t fStartX
Definition: TGSplitter.h:70
TGHSplitter::GetAbove
Bool_t GetAbove() const
Definition: TGSplitter.h:125
TGVFileSplitter::HandleButton
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in vertical splitter.
Definition: TGSplitter.cxx:516
TGHSplitter::DrawBorder
virtual void DrawBorder()
Draw horizontal splitter.
Definition: TGSplitter.cxx:449
TGVSplitter::TGVSplitter
TGVSplitter(const TGVSplitter &)
TGVSplitter::SetFrame
virtual void SetFrame(TGFrame *frame, Bool_t left)
Set frame to be resized.
Definition: TGSplitter.cxx:142
TGVFileSplitter
Definition: TGSplitter.h:136
x
Double_t x[n]
Definition: legend1.C:17
TGHSplitter::fMax
Int_t fMax
Definition: TGSplitter.h:111
TGSplitter::~TGSplitter
virtual ~TGSplitter()
Definition: TGSplitter.h:51
TGFrame::GetDefaultFrameBackground
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:668
TGHSplitter::fFrame
TGFrame * fFrame
Definition: TGSplitter.h:112
TGSplitter::GetExternalHandler
Bool_t GetExternalHandler() const
Definition: TGSplitter.h:62
TGHSplitter::IsAbove
Bool_t IsAbove() const
Definition: TGSplitter.h:126
TGFrame
Definition: TGFrame.h:105
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TGVFileSplitter::TGVFileSplitter
TGVFileSplitter(const TGWindow *p=0, UInt_t w=4, UInt_t h=4, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
fSplitterPic = fClient->GetPicture("filesplitterv.xpm");
Definition: TGSplitter.cxx:461
bool
TGHSplitter::~TGHSplitter
virtual ~TGHSplitter()
Delete horizontal splitter widget.
Definition: TGSplitter.cxx:332
Cursor_t
Handle_t Cursor_t
Definition: GuiTypes.h:33
TGSplitter::SetExternalHandler
void SetExternalHandler(Bool_t x)
Definition: TGSplitter.h:63
TGVSplitter::GetFrame
const TGFrame * GetFrame() const
Definition: TGSplitter.h:87
TGSplitter::fExternalHandler
Bool_t fExternalHandler
Definition: TGSplitter.h:40
TGSplitter::SetFrame
virtual void SetFrame(TGFrame *frame, Bool_t prev)=0
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
TGHSplitter::operator=
TGHSplitter & operator=(const TGHSplitter &)
TGVFileSplitter::DoubleClicked
void DoubleClicked(TGVFileSplitter *frame)
Emit DoubleClicked() signal.
Definition: TGSplitter.cxx:565
TGVFileSplitter::~TGVFileSplitter
virtual ~TGVFileSplitter()
if (fSplitterPic) fClient->FreePicture(fSplitterPic);
Definition: TGSplitter.cxx:472
TGSplitter::fSplitterPic
const TGPicture * fSplitterPic
Definition: TGSplitter.h:41
TGVSplitter::~TGVSplitter
virtual ~TGVSplitter()
Delete vertical splitter widget.
Definition: TGSplitter.cxx:133
h
#define h(i)
Definition: RSha256.hxx:124
TGFrame.h
TGVFileSplitter::ButtonReleased
void ButtonReleased()
Emit ButtonReleased() signal.
Definition: TGSplitter.cxx:557
TGVSplitter::fFrameWidth
UInt_t fFrameWidth
Definition: TGSplitter.h:71
TGHSplitter::fAbove
Bool_t fAbove
Definition: TGSplitter.h:113
TGSplitter::operator=
TGSplitter & operator=(const TGSplitter &)
TGSplitter::HandleCrossing
virtual Bool_t HandleCrossing(Event_t *event)=0
TGVSplitter::fFrame
TGFrame * fFrame
Definition: TGSplitter.h:75
TGVFileSplitter::HandleMotion
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion event in vertical splitter.
Definition: TGSplitter.cxx:479
TGVSplitter::fMin
Int_t fMin
Definition: TGSplitter.h:73
TGVSplitter::IsLeft
Bool_t IsLeft() const
Definition: TGSplitter.h:89
TGSplitter
Definition: TGSplitter.h:29
unsigned int
TGVSplitter::fFrameHeight
UInt_t fFrameHeight
Definition: TGSplitter.h:72
TGHSplitter
Definition: TGSplitter.h:100
TGHSplitter::fFrameHeight
UInt_t fFrameHeight
Definition: TGSplitter.h:109
TGHSplitter::SetFrame
virtual void SetFrame(TGFrame *frame, Bool_t above)
Set frame to be resized.
Definition: TGSplitter.cxx:341
TGSplitter::fDragging
Bool_t fDragging
Definition: TGSplitter.h:39
TGVSplitter::fLeft
Bool_t fLeft
Definition: TGSplitter.h:76
TGVSplitter::HandleCrossing
virtual Bool_t HandleCrossing(Event_t *event)
Handle mouse motion event in vertical splitter.
Definition: TGSplitter.cxx:237
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:573
TGVSplitter::HandleButton
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in vertical splitter.
Definition: TGSplitter.cxx:154
Event_t
Definition: GuiTypes.h:173
TGHSplitter::fStartY
Int_t fStartY
Definition: TGSplitter.h:107
TGHSplitter::HandleCrossing
virtual Bool_t HandleCrossing(Event_t *event)
Handle mouse motion event in horizontal splitter.
Definition: TGSplitter.cxx:436
TGVSplitter
Definition: TGSplitter.h:63
TGVFileSplitter::LayoutHeader
void LayoutHeader(TGFrame *f)
Emit LayoutFeader() signal.
Definition: TGSplitter.cxx:533
TGVSplitter::GetLeft
Bool_t GetLeft() const
Definition: TGSplitter.h:88
TGHSplitter::HandleButton
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in horizontal splitter.
Definition: TGSplitter.cxx:353
TGHSplitter::HandleMotion
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion event in horizontal splitter.
Definition: TGSplitter.cxx:400
TGSplitter::TGSplitter
TGSplitter(const TGSplitter &)
TGSplitter::Moved
void Moved(Int_t delta)
Emit Moved signal.
Definition: TGSplitter.cxx:60
TGHSplitter::TGHSplitter
TGHSplitter(const TGHSplitter &)
TGVSplitter::HandleMotion
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion event in vertical splitter.
Definition: TGSplitter.cxx:201
TGHSplitter::GetFrame
const TGFrame * GetFrame() const
Definition: TGSplitter.h:124
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:615
kChildFrame
@ kChildFrame
Definition: GuiTypes.h:379
int
TGSplitter::HandleButton
virtual Bool_t HandleButton(Event_t *event)=0