00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TGSplitFrame
00013 #define ROOT_TGSplitFrame
00014
00015 #ifndef ROOT_TGFrame
00016 #include "TGFrame.h"
00017 #endif
00018
00019 #ifndef ROOT_TMap
00020 #include "TMap.h"
00021 #endif
00022
00023 class TGSplitter;
00024 class TContextMenu;
00025
00026 class TGRectMap : public TObject {
00027
00028 private:
00029 TGRectMap(const TGRectMap&);
00030 TGRectMap& operator=(const TGRectMap&);
00031
00032 public:
00033 Int_t fX;
00034 Int_t fY;
00035 UInt_t fW;
00036 UInt_t fH;
00037
00038
00039 TGRectMap(Int_t rx, Int_t ry, UInt_t rw, UInt_t rh):
00040 fX(rx), fY(ry), fW(rw), fH(rh) { }
00041 virtual ~TGRectMap() { }
00042
00043
00044 Bool_t Contains(Int_t px, Int_t py) const
00045 { return ((px >= fX) && (px < fX + (Int_t) fW) &&
00046 (py >= fY) && (py < fY + (Int_t) fH)); }
00047
00048 ClassDef(TGRectMap, 0)
00049 };
00050
00051 class TGSplitTool : public TGCompositeFrame {
00052
00053 private:
00054 const TGFrame *fWindow;
00055 TGGC fRectGC;
00056 TMap fMap;
00057 TContextMenu *fContextMenu;
00058 Int_t fX;
00059 Int_t fY;
00060
00061 TGSplitTool(const TGSplitTool&);
00062 TGSplitTool& operator=(const TGSplitTool&);
00063
00064 public:
00065 TGSplitTool(const TGWindow *p = 0, const TGFrame *f = 0);
00066 virtual ~TGSplitTool();
00067
00068 void AddRectangle(TGFrame *frm, Int_t x, Int_t y, Int_t w, Int_t h);
00069 void DoRedraw();
00070 void DrawBorder();
00071 Bool_t HandleButton(Event_t *event);
00072 Bool_t HandleMotion(Event_t *event);
00073 void Show(Int_t x, Int_t y);
00074 void Hide();
00075 void Reset();
00076 void SetPosition(Int_t x, Int_t y);
00077
00078 ClassDef(TGSplitTool, 0)
00079 };
00080
00081 class TGSplitFrame : public TGCompositeFrame {
00082
00083 private:
00084 TGSplitFrame(const TGSplitFrame&);
00085 TGSplitFrame& operator=(const TGSplitFrame&);
00086
00087 protected:
00088 TGFrame *fFrame;
00089 TGTransientFrame *fUndocked;
00090 TGSplitter *fSplitter;
00091 TGSplitFrame *fFirst;
00092 TGSplitFrame *fSecond;
00093 TGSplitTool *fSplitTool;
00094 Float_t fWRatio;
00095 Float_t fHRatio;
00096
00097 public:
00098 TGSplitFrame(const TGWindow *p = 0, UInt_t w = 1, UInt_t h = 1,
00099 UInt_t options = 0);
00100 virtual ~TGSplitFrame();
00101
00102 virtual void AddFrame(TGFrame *f, TGLayoutHints *l = 0);
00103 virtual void Cleanup();
00104 virtual Bool_t HandleConfigureNotify(Event_t *);
00105 virtual void HSplit(UInt_t h = 0);
00106 virtual void VSplit(UInt_t w = 0);
00107 virtual void RemoveFrame(TGFrame *f);
00108
00109 TGSplitFrame *GetFirst() const { return fFirst; }
00110 TGFrame *GetFrame() const { return fFrame; }
00111 TGSplitFrame *GetSecond() const { return fSecond; }
00112 TGSplitter *GetSplitter() const { return fSplitter; }
00113 TGSplitTool *GetSplitTool() const { return fSplitTool; }
00114 TGSplitFrame *GetTopFrame();
00115 TGFrame *GetUndocked() const { return fUndocked; }
00116 Float_t GetHRatio() const { return fHRatio; }
00117 Float_t GetWRatio() const { return fWRatio; }
00118 void MapToSPlitTool(TGSplitFrame *top);
00119 void OnSplitterClicked(Event_t *event);
00120 void SetHRatio(Float_t r) { fHRatio = r; }
00121 void SetWRatio(Float_t r) { fWRatio = r; }
00122 void SplitHorizontal(const char *side = "top");
00123 void SplitVertical(const char *side = "left");
00124 void UnSplit(const char *which);
00125
00126
00127
00128 void Close();
00129 void CloseAndCollapse();
00130 void ExtractFrame();
00131 void SwallowBack();
00132 void SwitchToMain();
00133 void SplitHor();
00134 void SplitVer();
00135
00136 void Docked(TGFrame* frame);
00137 void Undocked(TGFrame* frame);
00138
00139 static void SwitchFrames(TGFrame *frame, TGCompositeFrame *dest,
00140 TGFrame *prev);
00141 virtual void SavePrimitive(ostream &out, Option_t *option = "");
00142
00143 ClassDef(TGSplitFrame, 0)
00144 };
00145
00146 #endif