ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TGSplitFrame.h
Go to the documentation of this file.
1 // @(#)root/gui:$Id$
2 // Author: Bertrand Bellenot 23/01/2008
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2008, 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_TGSplitFrame
13 #define ROOT_TGSplitFrame
14 
15 #ifndef ROOT_TGFrame
16 #include "TGFrame.h"
17 #endif
18 
19 #ifndef ROOT_TMap
20 #include "TMap.h"
21 #endif
22 
23 class TGSplitter;
24 class TContextMenu;
25 
26 class TGRectMap : public TObject {
27 
28 private:
29  TGRectMap(const TGRectMap&); // not implemented
30  TGRectMap& operator=(const TGRectMap&); // not implemented
31 
32 public:
33  Int_t fX; // x position
34  Int_t fY; // y position
35  UInt_t fW; // width
36  UInt_t fH; // height
37 
38  // constructors
39  TGRectMap(Int_t rx, Int_t ry, UInt_t rw, UInt_t rh):
40  fX(rx), fY(ry), fW(rw), fH(rh) { }
41  virtual ~TGRectMap() { }
42 
43  // methods
45  { return ((px >= fX) && (px < fX + (Int_t) fW) &&
46  (py >= fY) && (py < fY + (Int_t) fH)); }
47 
48  ClassDef(TGRectMap, 0) // Rectangle used in TMap
49 };
50 
51 class TGSplitTool : public TGCompositeFrame {
52 
53 private:
54  const TGFrame *fWindow; // frame to which tool tip is associated
55  TGGC fRectGC; // rectangles drawing context
56  TMap fMap; // map of rectangles/subframes
57  TContextMenu *fContextMenu; // Context menu for the splitter
58  Int_t fX; // X position in fWindow where to popup
59  Int_t fY; // Y position in fWindow where to popup
60 
61  TGSplitTool(const TGSplitTool&); // not implemented
62  TGSplitTool& operator=(const TGSplitTool&); // not implemented
63 
64 public:
65  TGSplitTool(const TGWindow *p = 0, const TGFrame *f = 0);
66  virtual ~TGSplitTool();
67 
68  void AddRectangle(TGFrame *frm, Int_t x, Int_t y, Int_t w, Int_t h);
69  void DoRedraw();
70  void DrawBorder();
71  Bool_t HandleButton(Event_t *event);
72  Bool_t HandleMotion(Event_t *event);
73  void Show(Int_t x, Int_t y);
74  void Hide();
75  void Reset();
76  void SetPosition(Int_t x, Int_t y);
77 
78  ClassDef(TGSplitTool, 0) // Split frame tool utility
79 };
80 
82 
83 private:
84  TGSplitFrame(const TGSplitFrame&); // Not implemented
85  TGSplitFrame& operator=(const TGSplitFrame&); // Not implemented
86 
87 protected:
88  TGFrame *fFrame; // Pointer to the embedded frame (if any)
89  TGTransientFrame *fUndocked; // Main frame used when "undocking" frame
90  TGSplitter *fSplitter; // Pointer to the (H/V) Splitter (if any)
91  TGSplitFrame *fFirst; // Pointer to the first child (if any)
92  TGSplitFrame *fSecond; // Pointer to the second child (if any)
93  TGSplitTool *fSplitTool; // SplitFrame Tool
94  Float_t fWRatio; // Width ratio between the first child and this
95  Float_t fHRatio; // Height ratio between the first child and this
96 
97 public:
98  TGSplitFrame(const TGWindow *p = 0, UInt_t w = 1, UInt_t h = 1,
99  UInt_t options = 0);
100  virtual ~TGSplitFrame();
101 
102  virtual void AddFrame(TGFrame *f, TGLayoutHints *l = 0);
103  virtual void Cleanup();
105  virtual void HSplit(UInt_t h = 0);
106  virtual void VSplit(UInt_t w = 0);
107  virtual void RemoveFrame(TGFrame *f);
108 
109  TGSplitFrame *GetFirst() const { return fFirst; }
110  TGFrame *GetFrame() const { return fFrame; }
111  TGSplitFrame *GetSecond() const { return fSecond; }
112  TGSplitter *GetSplitter() const { return fSplitter; }
113  TGSplitTool *GetSplitTool() const { return fSplitTool; }
115  TGFrame *GetUndocked() const { return fUndocked; }
116  Float_t GetHRatio() const { return fHRatio; }
117  Float_t GetWRatio() const { return fWRatio; }
118  void MapToSPlitTool(TGSplitFrame *top);
119  void OnSplitterClicked(Event_t *event);
120  void SetHRatio(Float_t r) { fHRatio = r; }
121  void SetWRatio(Float_t r) { fWRatio = r; }
122  void SplitHorizontal(const char *side = "top");
123  void SplitVertical(const char *side = "left");
124  void UnSplit(const char *which);
125 
126  // methods accessible via context menu
127 
128  void Close(); // *MENU*
129  void CloseAndCollapse(); // *MENU*
130  void ExtractFrame(); // *MENU*
131  void SwallowBack(); // *MENU*
132  void SwitchToMain(); // *MENU*
133  void SplitHor(); // *MENU*
134  void SplitVer(); // *MENU*
135 
136  void Docked(TGFrame* frame); //*SIGNAL*
137  void Undocked(TGFrame* frame); //*SIGNAL*
138 
139  static void SwitchFrames(TGFrame *frame, TGCompositeFrame *dest,
140  TGFrame *prev);
141  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
142 
143  ClassDef(TGSplitFrame, 0) // Splittable composite frame
144 };
145 
146 #endif
Int_t fX
Definition: TGSplitFrame.h:33
TGFrame * fFrame
Definition: TGSplitFrame.h:88
void SplitVertical(const char *side="left")
Vertically split the frame, and if it contains a child frame, ask the user where to keep it (left or ...
Float_t GetWRatio() const
Definition: TGSplitFrame.h:117
TGTransientFrame * fUndocked
Definition: TGSplitFrame.h:89
void SwallowBack()
Swallow back the child frame previously extracted, and close its parent (transient frame)...
TGSplitter * GetSplitter() const
Definition: TGSplitFrame.h:112
virtual void HSplit(UInt_t h=0)
Horizontally split the frame.
float Float_t
Definition: RtypesCore.h:53
const char Option_t
Definition: RtypesCore.h:62
void CloseAndCollapse()
Close (unmap, remove from the list of frames and destroy) the frame contained in this split frame...
TH1 * h
Definition: legend2.C:5
TGFrame * GetUndocked() const
Definition: TGSplitFrame.h:115
Float_t GetHRatio() const
Definition: TGSplitFrame.h:116
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TGSplitFrame * GetSecond() const
Definition: TGSplitFrame.h:111
void DrawBorder()
Draw border of tool window.
TGRectMap(const TGRectMap &)
Float_t py
Definition: hprod.C:33
TGSplitFrame * GetFirst() const
Definition: TGSplitFrame.h:109
void Close()
Close (unmap and remove from the list of frames) the frame contained in this split frame...
void SetWRatio(Float_t r)
Definition: TGSplitFrame.h:121
void OnSplitterClicked(Event_t *event)
Handle mouse click events on the splitter.
TFile * f
TGSplitTool * GetSplitTool() const
Definition: TGSplitFrame.h:113
void SplitHor()
Horizontally split the frame, and if it contains a child frame, ask the user where to keep it (top or...
Double_t x[n]
Definition: legend1.C:17
virtual ~TGSplitTool()
TGSplitTool destructor.
TContextMenu * fContextMenu
Definition: TGSplitFrame.h:57
#define ClassDef(name, id)
Definition: Rtypes.h:254
UInt_t fH
Definition: TGSplitFrame.h:36
void MapToSPlitTool(TGSplitFrame *top)
Map this split frame in the small overview tooltip.
void SplitHorizontal(const char *side="top")
Horizontally split the frame, and if it contains a child frame, ask the user where to keep it (top or...
virtual ~TGRectMap()
Definition: TGSplitFrame.h:41
void SwitchToMain()
Switch the actual embedded frame to the main (first) split frame.
virtual void RemoveFrame(TGFrame *f)
Add a frame in the split frame using layout hints l.
Float_t fHRatio
Definition: TGSplitFrame.h:95
UInt_t fW
Definition: TGSplitFrame.h:35
char * out
Definition: TBase64.cxx:29
TGSplitTool & operator=(const TGSplitTool &)
virtual Bool_t HandleConfigureNotify(Event_t *)
Handles resize events for this frame.
void Show(Int_t x, Int_t y)
Show tool window.
void DoRedraw()
Redraw split frame tool.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a splittable frame as a C++ statement(s) on output stream out.
TGSplitFrame(const TGSplitFrame &)
Int_t fY
Definition: TGSplitFrame.h:34
ROOT::R::TRInterface & r
Definition: Object.C:4
const TGFrame * fWindow
Definition: TGSplitFrame.h:54
void SetHRatio(Float_t r)
Definition: TGSplitFrame.h:120
Bool_t Contains(Int_t px, Int_t py) const
Definition: TGSplitFrame.h:44
This class provides an interface to context sensitive popup menus.
Definition: TContextMenu.h:44
void SetPosition(Int_t x, Int_t y)
Set popup position within specified frame (as specified in the ctor).
unsigned int UInt_t
Definition: RtypesCore.h:42
void AddRectangle(TGFrame *frm, Int_t x, Int_t y, Int_t w, Int_t h)
Add a rectangle representation of a split frame in the map, together with the frame itself...
TGSplitFrame & operator=(const TGSplitFrame &)
tuple w
Definition: qtexample.py:51
TLine * l
Definition: textangle.C:4
Bool_t HandleMotion(Event_t *event)
handle mouse motion events
TGFrame * GetFrame() const
Definition: TGSplitFrame.h:110
TGSplitter * fSplitter
Definition: TGSplitFrame.h:90
Bool_t HandleButton(Event_t *event)
Handle mouse click events in the tool.
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Definition: TMap.h:44
void Hide()
Hide tool window. Use this method to hide the tool in a client class.
TGSplitFrame * fSecond
Definition: TGSplitFrame.h:92
Double_t y[n]
Definition: legend1.C:17
virtual void VSplit(UInt_t w=0)
Vertically split the frame.
void Undocked(TGFrame *frame)
Emit Undocked() signal.
void ExtractFrame()
Extract the frame contained in this split frame an reparent it in a transient frame.
Mother of all ROOT objects.
Definition: TObject.h:58
Float_t px
Definition: hprod.C:33
void Reset()
Reset tool tip popup delay timer.
virtual void Cleanup()
Recursively cleanup child frames.
#define dest(otri, vertexptr)
Definition: triangle.c:1040
static void SwitchFrames(TGFrame *frame, TGCompositeFrame *dest, TGFrame *prev)
Switch (exchange) two frames.
virtual ~TGSplitFrame()
Destructor. Make cleanup.
void Docked(TGFrame *frame)
Emit Undocked() signal.
void SplitVer()
Vertically split the frame, and if it contains a child frame, ask the user where to keep it (left or ...
TGRectMap(Int_t rx, Int_t ry, UInt_t rw, UInt_t rh)
Definition: TGSplitFrame.h:39
TGSplitTool * fSplitTool
Definition: TGSplitFrame.h:93
TGSplitFrame * fFirst
Definition: TGSplitFrame.h:91
TGSplitTool(const TGSplitTool &)
TGSplitFrame * GetTopFrame()
Return the top level split frame.
void UnSplit(const char *which)
Close (unmap and remove from the list of frames) the frame contained in this split frame...
Definition: TGGC.h:35
Float_t fWRatio
Definition: TGSplitFrame.h:94
TGRectMap & operator=(const TGRectMap &)
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add a frame in the split frame using layout hints l.