Logo ROOT   master
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 
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
void ButtonReleased()
Emit ButtonReleased() signal.
Definition: TGSplitter.cxx:556
virtual void SetFrame(TGFrame *frame, Bool_t prev)=0
TGVSplitter & operator=(const TGVSplitter &)
void DoubleClicked(TGVFileSplitter *frame)
Emit DoubleClicked() signal.
Definition: TGSplitter.cxx:564
virtual void DrawBorder()
Draw vertical splitter.
Definition: TGSplitter.cxx:249
virtual void DrawBorder()
Draw horizontal splitter.
Definition: TGSplitter.cxx:448
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in horizontal splitter.
Definition: TGSplitter.cxx:352
virtual Bool_t HandleDoubleClick(Event_t *)
Handle double click mouse event in splitter.
Definition: TGSplitter.cxx:572
const char Option_t
Definition: RtypesCore.h:64
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.
Definition: TGSplitter.cxx:614
virtual Bool_t HandleCrossing(Event_t *event)=0
TGSplitter & operator=(const TGSplitter &)
Handle_t Cursor_t
Definition: GuiTypes.h:33
virtual void SetFrame(TGFrame *frame, Bool_t left)
Set frame to be resized.
Definition: TGSplitter.cxx:141
Int_t fMin
Definition: TGSplitter.h:110
Bool_t fDragging
Definition: TGSplitter.h:33
void ButtonPressed()
Emit ButtonPressed() signal.
Definition: TGSplitter.cxx:548
Int_t fMax
Definition: TGSplitter.h:74
#define f(i)
Definition: RSha256.hxx:104
int Int_t
Definition: RtypesCore.h:43
Int_t fMax
Definition: TGSplitter.h:111
bool Bool_t
Definition: RtypesCore.h:61
TGFrame * fFrame
Definition: TGSplitter.h:112
TGVSplitter(const TGVSplitter &)
Bool_t IsAbove() const
Definition: TGSplitter.h:126
TGHSplitter & operator=(const TGHSplitter &)
Bool_t GetAbove() const
Definition: TGSplitter.h:125
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:322
ULong_t Pixel_t
Definition: GuiTypes.h:39
const TGFrame * GetFrame() const
Definition: TGSplitter.h:87
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:667
void Moved(Int_t delta)
Emit Moved signal.
Definition: TGSplitter.cxx:59
TGSplitter(const TGSplitter &)
virtual ~TGHSplitter()
Delete horizontal splitter widget.
Definition: TGSplitter.cxx:331
Bool_t fAbove
Definition: TGSplitter.h:113
Cursor_t fSplitCursor
Definition: TGSplitter.h:32
UInt_t fFrameHeight
Definition: TGSplitter.h:72
virtual ~TGVSplitter()
Delete vertical splitter widget.
Definition: TGSplitter.cxx:132
TGFrame * fFrame
Definition: TGSplitter.h:75
virtual Bool_t HandleButton(Event_t *event)=0
virtual Bool_t HandleMotion(Event_t *event)=0
UInt_t fFrameHeight
Definition: TGSplitter.h:109
Int_t fMin
Definition: TGSplitter.h:73
unsigned int UInt_t
Definition: RtypesCore.h:44
virtual void SetFrame(TGFrame *frame, Bool_t above)
Set frame to be resized.
Definition: TGSplitter.cxx:340
virtual ~TGVFileSplitter()
if (fSplitterPic) fClient->FreePicture(fSplitterPic);
Definition: TGSplitter.cxx:471
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in vertical splitter.
Definition: TGSplitter.cxx:515
#define h(i)
Definition: RSha256.hxx:106
virtual Bool_t HandleCrossing(Event_t *event)
Handle mouse motion event in horizontal splitter.
Definition: TGSplitter.cxx:435
void DragStarted()
Emit DragStarted signal.
Definition: TGSplitter.cxx:51
virtual ~TGSplitter()
Definition: TGSplitter.h:45
UInt_t fFrameWidth
Definition: TGSplitter.h:71
void LayoutHeader(TGFrame *f)
Emit LayoutFeader() signal.
Definition: TGSplitter.cxx:532
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:647
Bool_t IsLeft() const
Definition: TGSplitter.h:89
Bool_t fLeft
Definition: TGSplitter.h:76
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:460
virtual Bool_t HandleCrossing(Event_t *event)
Handle mouse motion event in vertical splitter.
Definition: TGSplitter.cxx:236
const TGFrame * GetFrame() const
Definition: TGSplitter.h:124
void LayoutListView()
Emit LayoutListView() signal.
Definition: TGSplitter.cxx:540
void SetExternalHandler(Bool_t x)
Definition: TGSplitter.h:57
Int_t fStartY
Definition: TGSplitter.h:107
Bool_t fExternalHandler
Definition: TGSplitter.h:34
Bool_t GetExternalHandler() const
Definition: TGSplitter.h:56
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion event in horizontal splitter.
Definition: TGSplitter.cxx:399
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion event in vertical splitter.
Definition: TGSplitter.cxx:478
TGHSplitter(const TGHSplitter &)
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion event in vertical splitter.
Definition: TGSplitter.cxx:200
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:581
UInt_t fFrameWidth
Definition: TGSplitter.h:108
Bool_t GetLeft() const
Definition: TGSplitter.h:88
const TGPicture * fSplitterPic
Definition: TGSplitter.h:35
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in vertical splitter.
Definition: TGSplitter.cxx:153