Logo ROOT   6.08/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 #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
virtual void SetFrame(TGFrame *frame, Bool_t prev)=0
const char Option_t
Definition: RtypesCore.h:62
Int_t fStartX
Definition: TGSplitter.h:72
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
Int_t fMin
Definition: TGSplitter.h:112
Bool_t fDragging
Definition: TGSplitter.h:35
virtual void DrawBorder()
Draw frame border.
Definition: TGFrame.cxx:403
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
Bool_t IsAbove() const
Definition: TGSplitter.h:128
Bool_t GetAbove() const
Definition: TGSplitter.h:127
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:254
ULong_t Pixel_t
Definition: GuiTypes.h:41
const TGFrame * GetFrame() const
Definition: TGSplitter.h:89
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:115
Cursor_t fSplitCursor
Definition: TGSplitter.h:34
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:3188
UInt_t fFrameHeight
Definition: TGSplitter.h:74
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
void DragStarted()
Emit DragStarted signal.
Definition: TGSplitter.cxx:50
double f(double x)
virtual ~TGSplitter()
Definition: TGSplitter.h:47
UInt_t fFrameWidth
Definition: TGSplitter.h:73
virtual Bool_t HandleDoubleClick(Event_t *)
Definition: TGFrame.h:225
Bool_t IsLeft() const
Definition: TGSplitter.h:91
Bool_t fLeft
Definition: TGSplitter.h:78
const TGFrame * GetFrame() const
Definition: TGSplitter.h:126
void SetExternalHandler(Bool_t x)
Definition: TGSplitter.h:59
Int_t fStartY
Definition: TGSplitter.h:109
Bool_t fExternalHandler
Definition: TGSplitter.h:36
Bool_t GetExternalHandler() const
Definition: TGSplitter.h:58
UInt_t fFrameWidth
Definition: TGSplitter.h:110
Bool_t GetLeft() const
Definition: TGSplitter.h:90
const TGPicture * fSplitterPic
Definition: TGSplitter.h:37