Logo ROOT   6.12/07
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 
57  void SetExternalHandler(Bool_t x) { fExternalHandler = x; }
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
virtual void SetFrame(TGFrame *frame, Bool_t prev)=0
const char Option_t
Definition: RtypesCore.h:62
Int_t fStartX
Definition: TGSplitter.h:70
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:33
Int_t fMin
Definition: TGSplitter.h:110
Bool_t fDragging
Definition: TGSplitter.h:33
virtual void DrawBorder()
Draw frame border.
Definition: TGFrame.cxx:403
Int_t fMax
Definition: TGSplitter.h:74
int Int_t
Definition: RtypesCore.h:41
Int_t fMax
Definition: TGSplitter.h:111
bool Bool_t
Definition: RtypesCore.h:59
TGFrame * fFrame
Definition: TGSplitter.h:112
Bool_t IsAbove() const
Definition: TGSplitter.h:126
Bool_t GetAbove() const
Definition: TGSplitter.h:125
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:320
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:665
void Moved(Int_t delta)
Emit Moved signal.
Definition: TGSplitter.cxx:58
TGSplitter(const TGSplitter &)
Bool_t fAbove
Definition: TGSplitter.h:113
Cursor_t fSplitCursor
Definition: TGSplitter.h:32
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a frame widget as a C++ statement(s) on output stream out.
Definition: TGFrame.cxx:3187
UInt_t fFrameHeight
Definition: TGSplitter.h:72
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:42
void DragStarted()
Emit DragStarted signal.
Definition: TGSplitter.cxx:50
virtual ~TGSplitter()
Definition: TGSplitter.h:45
UInt_t fFrameWidth
Definition: TGSplitter.h:71
virtual Bool_t HandleDoubleClick(Event_t *)
Definition: TGFrame.h:209
Bool_t IsLeft() const
Definition: TGSplitter.h:89
Bool_t fLeft
Definition: TGSplitter.h:76
const TGFrame * GetFrame() const
Definition: TGSplitter.h:124
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
UInt_t fFrameWidth
Definition: TGSplitter.h:108
Bool_t GetLeft() const
Definition: TGSplitter.h:88
const TGPicture * fSplitterPic
Definition: TGSplitter.h:35