ROOT  6.06/09
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 #ifndef ROOT_TGFrame
27 #include "TGFrame.h"
28 #endif
29 
30 
31 class TGSplitter : public TGFrame {
32 
33 protected:
34  Cursor_t fSplitCursor; // split cursor
35  Bool_t fDragging; // true if in dragging mode
36  Bool_t fExternalHandler; // true when splitter movement is handled externally
37  const TGPicture *fSplitterPic; // picture to draw splitter
38 
39 private:
40  TGSplitter(const TGSplitter&); // not implemented
41  TGSplitter& operator=(const TGSplitter&); // not implemented
42 
43 public:
44  TGSplitter(const TGWindow *p = 0, UInt_t w = 2, UInt_t h = 4,
45  UInt_t options = kChildFrame,
47  virtual ~TGSplitter() { }
48 
49  virtual void SetFrame(TGFrame *frame, Bool_t prev) = 0;
50 
51  virtual Bool_t HandleButton(Event_t *event) = 0;
52  virtual Bool_t HandleMotion(Event_t *event) = 0;
53  virtual Bool_t HandleCrossing(Event_t *event) = 0;
54 
55  void DragStarted(); // *SIGNAL*
56  void Moved(Int_t delta); // *SIGNAL*
57 
59  void SetExternalHandler(Bool_t x) { fExternalHandler = x; }
60 
61  ClassDef(TGSplitter,0) //A frame splitter abstract base class
62 };
63 
64 
65 class TGVSplitter : public TGSplitter {
66 
67 private:
68  TGVSplitter(const TGVSplitter&); // not implemented
69  TGVSplitter& operator=(const TGVSplitter&); // not implemented
70 
71 protected:
72  Int_t fStartX; // x position when dragging starts
73  UInt_t fFrameWidth; // width of frame to be resized
74  UInt_t fFrameHeight; // height of frame to be resized
75  Int_t fMin; // min x position frame can be resized to
76  Int_t fMax; // max x position frame can be resized to
77  TGFrame *fFrame; // frame that should be resized
78  Bool_t fLeft; // true if frame is on the left of splitter
79 
80 public:
81  TGVSplitter(const TGWindow *p = 0, UInt_t w = 4, UInt_t h = 4,
82  UInt_t options = kChildFrame,
84  TGVSplitter(const TGWindow *p, UInt_t w, UInt_t h, Bool_t external);
85  virtual ~TGVSplitter();
86 
87  virtual void DrawBorder();
88  virtual void SetFrame(TGFrame *frame, Bool_t left);
89  const TGFrame *GetFrame() const { return fFrame; }
90  Bool_t GetLeft() const { return fLeft; }
91  Bool_t IsLeft() const { return fLeft; }
92  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
93 
94  virtual Bool_t HandleButton(Event_t *event);
95  virtual Bool_t HandleMotion(Event_t *event);
96  virtual Bool_t HandleCrossing(Event_t *event);
97 
98  ClassDef(TGVSplitter,0) //A vertical frame splitter
99 };
100 
101 
102 class TGHSplitter : public TGSplitter {
103 
104 private:
105  TGHSplitter(const TGHSplitter&); // not implemented
106  TGHSplitter& operator=(const TGHSplitter&); // not implemented
107 
108 protected:
109  Int_t fStartY; // y position when dragging starts
110  UInt_t fFrameWidth; // width of frame to be resized
111  UInt_t fFrameHeight; // height of frame to be resized
112  Int_t fMin; // min y position frame can be resized to
113  Int_t fMax; // max y position frame can be resized to
114  TGFrame *fFrame; // frame that should be resized
115  Bool_t fAbove; // true if frame is above the splitter
116 
117 public:
118  TGHSplitter(const TGWindow *p = 0, UInt_t w = 4, UInt_t h = 4,
119  UInt_t options = kChildFrame,
121  TGHSplitter(const TGWindow *p, UInt_t w, UInt_t h, Bool_t external);
122  virtual ~TGHSplitter();
123 
124  virtual void DrawBorder();
125  virtual void SetFrame(TGFrame *frame, Bool_t above);
126  const TGFrame *GetFrame() const { return fFrame; }
127  Bool_t GetAbove() const { return fAbove; }
128  Bool_t IsAbove() const { return fAbove; }
129  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
130 
131  virtual Bool_t HandleButton(Event_t *event);
132  virtual Bool_t HandleMotion(Event_t *event);
133  virtual Bool_t HandleCrossing(Event_t *event);
134 
135  ClassDef(TGHSplitter,0) //A horizontal frame splitter
136 };
137 
138 class TGVFileSplitter : public TGVSplitter {
139 
140 public:
141  TGVFileSplitter(const TGWindow *p = 0, UInt_t w = 4, UInt_t h = 4,
142  UInt_t options = kChildFrame,
144  virtual ~TGVFileSplitter();
145 
146  virtual Bool_t HandleDoubleClick(Event_t *);
147  virtual Bool_t HandleButton(Event_t *event);
148  virtual Bool_t HandleMotion(Event_t *event);
149  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
150 
151  void LayoutHeader(TGFrame *f); //*SIGNAL*
152  void LayoutListView(); //*SIGNAL*
153  void ButtonPressed(); //*SIGNAL*
154  void ButtonReleased(); //*SIGNAL*
155  void DoubleClicked(TGVFileSplitter* frame); //*SIGNAL*
156 
157  ClassDef(TGVFileSplitter,0) //A vertical file frame splitter
158 };
159 
160 
161 #endif
void ButtonReleased()
Emit ButtonReleased() signal.
Definition: TGSplitter.cxx:555
virtual void SetFrame(TGFrame *frame, Bool_t prev)=0
TGVSplitter & operator=(const TGVSplitter &)
void DoubleClicked(TGVFileSplitter *frame)
Emit DoubleClicked() signal.
Definition: TGSplitter.cxx:563
virtual void DrawBorder()
Draw vertical splitter.
Definition: TGSplitter.cxx:248
virtual void DrawBorder()
Draw horizontal splitter.
Definition: TGSplitter.cxx:447
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in horizontal splitter.
Definition: TGSplitter.cxx:351
virtual Bool_t HandleDoubleClick(Event_t *)
Handle double click mouse event in splitter.
Definition: TGSplitter.cxx:571
const char Option_t
Definition: RtypesCore.h:62
Int_t fStartX
Definition: TGSplitter.h:72
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:613
virtual Bool_t HandleCrossing(Event_t *event)=0
TH1 * h
Definition: legend2.C:5
TGSplitter & operator=(const TGSplitter &)
Handle_t Cursor_t
Definition: GuiTypes.h:35
virtual void SetFrame(TGFrame *frame, Bool_t left)
Set frame to be resized.
Definition: TGSplitter.cxx:140
Int_t fMin
Definition: TGSplitter.h:112
Bool_t fDragging
Definition: TGSplitter.h:35
void ButtonPressed()
Emit ButtonPressed() signal.
Definition: TGSplitter.cxx:547
Int_t fMax
Definition: TGSplitter.h:76
int Int_t
Definition: RtypesCore.h:41
Int_t fMax
Definition: TGSplitter.h:113
bool Bool_t
Definition: RtypesCore.h:59
TGFrame * fFrame
Definition: TGSplitter.h:114
TGVSplitter(const TGVSplitter &)
TGHSplitter & operator=(const TGHSplitter &)
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:254
ULong_t Pixel_t
Definition: GuiTypes.h:41
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:665
void Moved(Int_t delta)
Emit Moved signal.
Definition: TGSplitter.cxx:58
TGSplitter(const TGSplitter &)
virtual ~TGHSplitter()
Delete horizontal splitter widget.
Definition: TGSplitter.cxx:330
Bool_t fAbove
Definition: TGSplitter.h:115
const TGFrame * GetFrame() const
Definition: TGSplitter.h:126
char * out
Definition: TBase64.cxx:29
Bool_t GetExternalHandler() const
Definition: TGSplitter.h:58
Cursor_t fSplitCursor
Definition: TGSplitter.h:34
UInt_t fFrameHeight
Definition: TGSplitter.h:74
Bool_t GetLeft() const
Definition: TGSplitter.h:90
virtual ~TGVSplitter()
Delete vertical splitter widget.
Definition: TGSplitter.cxx:131
TGFrame * fFrame
Definition: TGSplitter.h:77
virtual Bool_t HandleButton(Event_t *event)=0
virtual Bool_t HandleMotion(Event_t *event)=0
UInt_t fFrameHeight
Definition: TGSplitter.h:111
Int_t fMin
Definition: TGSplitter.h:75
unsigned int UInt_t
Definition: RtypesCore.h:42
Bool_t IsLeft() const
Definition: TGSplitter.h:91
virtual void SetFrame(TGFrame *frame, Bool_t above)
Set frame to be resized.
Definition: TGSplitter.cxx:339
virtual ~TGVFileSplitter()
if (fSplitterPic) fClient->FreePicture(fSplitterPic);
Definition: TGSplitter.cxx:470
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in vertical splitter.
Definition: TGSplitter.cxx:514
virtual Bool_t HandleCrossing(Event_t *event)
Handle mouse motion event in horizontal splitter.
Definition: TGSplitter.cxx:434
void DragStarted()
Emit DragStarted signal.
Definition: TGSplitter.cxx:50
double f(double x)
Bool_t IsAbove() const
Definition: TGSplitter.h:128
virtual ~TGSplitter()
Definition: TGSplitter.h:47
UInt_t fFrameWidth
Definition: TGSplitter.h:73
void LayoutHeader(TGFrame *f)
Emit LayoutFeader() signal.
Definition: TGSplitter.cxx:531
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:646
Bool_t fLeft
Definition: TGSplitter.h:78
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:459
virtual Bool_t HandleCrossing(Event_t *event)
Handle mouse motion event in vertical splitter.
Definition: TGSplitter.cxx:235
Bool_t GetAbove() const
Definition: TGSplitter.h:127
void LayoutListView()
Emit LayoutListView() signal.
Definition: TGSplitter.cxx:539
void SetExternalHandler(Bool_t x)
Definition: TGSplitter.h:59
Int_t fStartY
Definition: TGSplitter.h:109
Bool_t fExternalHandler
Definition: TGSplitter.h:36
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion event in horizontal splitter.
Definition: TGSplitter.cxx:398
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion event in vertical splitter.
Definition: TGSplitter.cxx:477
TGHSplitter(const TGHSplitter &)
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion event in vertical splitter.
Definition: TGSplitter.cxx:199
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:580
UInt_t fFrameWidth
Definition: TGSplitter.h:110
const TGFrame * GetFrame() const
Definition: TGSplitter.h:89
const TGPicture * fSplitterPic
Definition: TGSplitter.h:37
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in vertical splitter.
Definition: TGSplitter.cxx:152