Logo ROOT  
Reference Guide
No Matches
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Bertrand Bellenot 23/01/2008
5 * Copyright (C) 1995-2021, 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 *************************************************************************/
12#ifndef ROOT_TGSplitFrame
13#define ROOT_TGSplitFrame
15#include "TGFrame.h"
17#include "TMap.h"
19class TGSplitter;
20class TContextMenu;
22class TGRectMap : public TObject {
25 TGRectMap(const TGRectMap&) = delete;
26 TGRectMap& operator=(const TGRectMap&) = delete;
29 Int_t fX; // x position
30 Int_t fY; // y position
31 UInt_t fW; // width
32 UInt_t fH; // height
34 // constructors
36 fX(rx), fY(ry), fW(rw), fH(rh) { }
37 virtual ~TGRectMap() { }
39 // methods
40 Bool_t Contains(Int_t px, Int_t py) const
41 { return ((px >= fX) && (px < fX + (Int_t) fW) &&
42 (py >= fY) && (py < fY + (Int_t) fH)); }
44 ClassDef(TGRectMap, 0) // Rectangle used in TMap
50 const TGFrame *fWindow; // frame to which tool tip is associated
51 TGGC fRectGC; // rectangles drawing context
52 TMap fMap; // map of rectangles/subframes
53 TContextMenu *fContextMenu; // Context menu for the splitter
54 Int_t fX; // X position in fWindow where to popup
55 Int_t fY; // Y position in fWindow where to popup
57 TGSplitTool(const TGSplitTool&) = delete;
61 TGSplitTool(const TGWindow *p = nullptr, const TGFrame *f = nullptr);
62 virtual ~TGSplitTool();
64 void AddRectangle(TGFrame *frm, Int_t x, Int_t y, Int_t w, Int_t h);
65 void DoRedraw();
66 void DrawBorder();
69 void Show(Int_t x, Int_t y);
70 void Hide();
71 void Reset();
72 void SetPosition(Int_t x, Int_t y);
74 ClassDef(TGSplitTool, 0) // Split frame tool utility
80 TGSplitFrame(const TGSplitFrame&) = delete;
84 TGFrame *fFrame; // Pointer to the embedded frame (if any)
85 TGTransientFrame *fUndocked; // Main frame used when "undocking" frame
86 TGSplitter *fSplitter; // Pointer to the (H/V) Splitter (if any)
87 TGSplitFrame *fFirst; // Pointer to the first child (if any)
88 TGSplitFrame *fSecond; // Pointer to the second child (if any)
89 TGSplitTool *fSplitTool; // SplitFrame Tool
90 Float_t fWRatio; // Width ratio between the first child and this
91 Float_t fHRatio; // Height ratio between the first child and this
94 TGSplitFrame(const TGWindow *p = nullptr, UInt_t w = 1, UInt_t h = 1,
95 UInt_t options = 0);
96 virtual ~TGSplitFrame();
98 virtual void AddFrame(TGFrame *f, TGLayoutHints *l = nullptr);
99 virtual void Cleanup();
101 virtual void HSplit(UInt_t h = 0);
102 virtual void VSplit(UInt_t w = 0);
103 virtual void RemoveFrame(TGFrame *f);
105 TGSplitFrame *GetFirst() const { return fFirst; }
106 TGFrame *GetFrame() const { return fFrame; }
107 TGSplitFrame *GetSecond() const { return fSecond; }
108 TGSplitter *GetSplitter() const { return fSplitter; }
111 TGFrame *GetUndocked() const { return fUndocked; }
112 Float_t GetHRatio() const { return fHRatio; }
113 Float_t GetWRatio() const { return fWRatio; }
114 void MapToSPlitTool(TGSplitFrame *top);
115 void OnSplitterClicked(Event_t *event);
118 void SplitHorizontal(const char *side = "top");
119 void SplitVertical(const char *side = "left");
120 void UnSplit(const char *which);
122 // methods accessible via context menu
124 void Close(); // *MENU*
125 void CloseAndCollapse(); // *MENU*
126 void ExtractFrame(); // *MENU*
127 void SwallowBack(); // *MENU*
128 void SwitchToMain(); // *MENU*
129 void SplitHor(); // *MENU*
130 void SplitVer(); // *MENU*
132 void Docked(TGFrame* frame); //*SIGNAL*
133 void Undocked(TGFrame* frame); //*SIGNAL*
135 static void SwitchFrames(TGFrame *frame, TGCompositeFrame *dest,
136 TGFrame *prev);
137 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
139 ClassDef(TGSplitFrame, 0) // Splittable composite frame
ROOT::R::TRInterface & r
Definition Object.C:4
#define f(i)
Definition RSha256.hxx:104
#define h(i)
Definition RSha256.hxx:106
float Float_t
Definition RtypesCore.h:57
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:325
This class provides an interface to context sensitive popup menus.
Definition TGGC.h:31
TGRectMap(const TGRectMap &)=delete
TGRectMap & operator=(const TGRectMap &)=delete
UInt_t fH
virtual ~TGRectMap()
Bool_t Contains(Int_t px, Int_t py) const
UInt_t fW
TGRectMap(Int_t rx, Int_t ry, UInt_t rw, UInt_t rh)
void MapToSPlitTool(TGSplitFrame *top)
Map this split frame in the small overview tooltip.
virtual void Cleanup()
Recursively cleanup child frames.
virtual void VSplit(UInt_t w=0)
Vertically split the frame.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a splittable frame as a C++ statement(s) on output stream out.
TGSplitFrame * GetFirst() const
void OnSplitterClicked(Event_t *event)
Handle mouse click events on the splitter.
virtual ~TGSplitFrame()
Destructor. Make cleanup.
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 ...
void SwitchToMain()
Switch the actual embedded frame to the main (first) split frame.
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add a frame in the split frame using layout hints l.
void SetHRatio(Float_t r)
TGSplitFrame * fSecond
TGSplitTool * GetSplitTool() const
virtual void RemoveFrame(TGFrame *f)
Add a frame in the split frame using layout hints l.
virtual void HSplit(UInt_t h=0)
Horizontally split the frame.
TGSplitFrame * GetTopFrame()
Return the top level split frame.
void SetWRatio(Float_t r)
TGSplitFrame(const TGSplitFrame &)=delete
void SwallowBack()
Swallow back the child frame previously extracted, and close its parent (transient frame).
TGFrame * GetFrame() const
TGSplitTool * fSplitTool
TGTransientFrame * fUndocked
TGSplitter * fSplitter
void Docked(TGFrame *frame)
Emit Undocked() signal.
TGSplitFrame & operator=(const TGSplitFrame &)=delete
TGSplitter * GetSplitter() const
Float_t GetWRatio() const
void Undocked(TGFrame *frame)
Emit Undocked() signal.
TGFrame * fFrame
static void SwitchFrames(TGFrame *frame, TGCompositeFrame *dest, TGFrame *prev)
Switch (exchange) two frames.
void Close()
Close (unmap and remove from the list of frames) the frame contained in this split frame.
TGSplitFrame * fFirst
virtual Bool_t HandleConfigureNotify(Event_t *)
Handles resize events for this frame.
Float_t GetHRatio() const
Float_t fHRatio
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...
Float_t fWRatio
TGSplitFrame * GetSecond() const
TGFrame * GetUndocked() const
void ExtractFrame()
Extract the frame contained in this split frame an reparent it in a transient frame.
void SplitVer()
Vertically split the frame, and if it contains a child frame, ask the user where to keep it (left or ...
void UnSplit(const char *which)
Close (unmap and remove from the list of frames) the frame contained in this split frame.
void CloseAndCollapse()
Close (unmap, remove from the list of frames and destroy) the frame contained in this split frame.
void SplitHor()
Horizontally split the frame, and if it contains a child frame, ask the user where to keep it (top or...
Bool_t HandleMotion(Event_t *event)
handle mouse motion events
void Show(Int_t x, Int_t y)
Show tool window.
virtual ~TGSplitTool()
TGSplitTool destructor.
TGSplitTool(const TGSplitTool &)=delete
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.
void DrawBorder()
Draw border of tool window.
void SetPosition(Int_t x, Int_t y)
Set popup position within specified frame (as specified in the ctor).
void DoRedraw()
Redraw split frame tool.
void Reset()
Reset tool tip popup delay timer.
const TGFrame * fWindow
Bool_t HandleButton(Event_t *event)
Handle mouse click events in the tool.
void Hide()
Hide tool window. Use this method to hide the tool in a client class.
TGSplitTool & operator=(const TGSplitTool &)=delete
TContextMenu * fContextMenu
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Definition TMap.h:40
Mother of all ROOT objects.
Definition TObject.h:37
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
Event structure.
Definition GuiTypes.h:174
auto * l
Definition textangle.C:4
#define dest(otri, vertexptr)
Definition triangle.c:1040