Warning, file /include/root/TGSplitFrame.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TGSplitFrame
0013 #define ROOT_TGSplitFrame
0014
0015 #include "TGFrame.h"
0016
0017 #include "TMap.h"
0018
0019 class TGSplitter;
0020 class TContextMenu;
0021
0022 class TGRectMap : public TObject {
0023
0024 private:
0025 TGRectMap(const TGRectMap&) = delete;
0026 TGRectMap& operator=(const TGRectMap&) = delete;
0027
0028 public:
0029 Int_t fX;
0030 Int_t fY;
0031 UInt_t fW;
0032 UInt_t fH;
0033
0034
0035 TGRectMap(Int_t rx, Int_t ry, UInt_t rw, UInt_t rh):
0036 fX(rx), fY(ry), fW(rw), fH(rh) {}
0037 ~TGRectMap() override {}
0038
0039
0040 Bool_t Contains(Int_t px, Int_t py) const
0041 { return ((px >= fX) && (px < fX + (Int_t) fW) &&
0042 (py >= fY) && (py < fY + (Int_t) fH)); }
0043
0044 ClassDefOverride(TGRectMap, 0)
0045 };
0046
0047 class TGSplitTool : public TGCompositeFrame {
0048
0049 private:
0050 const TGFrame *fWindow;
0051 TGGC fRectGC;
0052 TMap fMap;
0053 TContextMenu *fContextMenu;
0054 Int_t fX;
0055 Int_t fY;
0056
0057 TGSplitTool(const TGSplitTool&) = delete;
0058 TGSplitTool& operator=(const TGSplitTool&) = delete;
0059
0060 public:
0061 TGSplitTool(const TGWindow *p = nullptr, const TGFrame *f = nullptr);
0062 ~TGSplitTool() override;
0063
0064 void AddRectangle(TGFrame *frm, Int_t x, Int_t y, Int_t w, Int_t h);
0065 void DoRedraw() override;
0066 void DrawBorder() override;
0067 Bool_t HandleButton(Event_t *event) override;
0068 Bool_t HandleMotion(Event_t *event) override;
0069 void Show(Int_t x, Int_t y);
0070 void Hide();
0071 void Reset();
0072 void SetPosition(Int_t x, Int_t y);
0073
0074 ClassDefOverride(TGSplitTool, 0)
0075 };
0076
0077 class TGSplitFrame : public TGCompositeFrame {
0078
0079 private:
0080 TGSplitFrame(const TGSplitFrame&) = delete;
0081 TGSplitFrame& operator=(const TGSplitFrame&) = delete;
0082
0083 protected:
0084 TGFrame *fFrame;
0085 TGTransientFrame *fUndocked;
0086 TGSplitter *fSplitter;
0087 TGSplitFrame *fFirst;
0088 TGSplitFrame *fSecond;
0089 TGSplitTool *fSplitTool;
0090 Float_t fWRatio;
0091 Float_t fHRatio;
0092
0093 public:
0094 TGSplitFrame(const TGWindow *p = nullptr, UInt_t w = 1, UInt_t h = 1,
0095 UInt_t options = 0);
0096 ~TGSplitFrame() override;
0097
0098 void AddFrame(TGFrame *f, TGLayoutHints *l = nullptr) override;
0099 void Cleanup() override;
0100 Bool_t HandleConfigureNotify(Event_t *) override;
0101 virtual void HSplit(UInt_t h = 0);
0102 virtual void VSplit(UInt_t w = 0);
0103 void RemoveFrame(TGFrame *f) override;
0104
0105 TGSplitFrame *GetFirst() const { return fFirst; }
0106 TGFrame *GetFrame() const { return fFrame; }
0107 TGSplitFrame *GetSecond() const { return fSecond; }
0108 TGSplitter *GetSplitter() const { return fSplitter; }
0109 TGSplitTool *GetSplitTool() const { return fSplitTool; }
0110 TGSplitFrame *GetTopFrame();
0111 TGFrame *GetUndocked() const { return fUndocked; }
0112 Float_t GetHRatio() const { return fHRatio; }
0113 Float_t GetWRatio() const { return fWRatio; }
0114 void MapToSPlitTool(TGSplitFrame *top);
0115 void OnSplitterClicked(Event_t *event);
0116 void SetHRatio(Float_t r) { fHRatio = r; }
0117 void SetWRatio(Float_t r) { fWRatio = r; }
0118 void SplitHorizontal(const char *side = "top");
0119 void SplitVertical(const char *side = "left");
0120 void UnSplit(const char *which);
0121
0122
0123
0124 void Close();
0125 void CloseAndCollapse();
0126 void ExtractFrame();
0127 void SwallowBack();
0128 void SwitchToMain();
0129 void SplitHor();
0130 void SplitVer();
0131
0132 void Docked(TGFrame* frame);
0133 void Undocked(TGFrame* frame);
0134
0135 static void SwitchFrames(TGFrame *frame, TGCompositeFrame *dest,
0136 TGFrame *prev);
0137 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
0138
0139 ClassDefOverride(TGSplitFrame, 0)
0140 };
0141
0142 #endif