00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TGPack
00013 #define ROOT_TGPack
00014
00015 #include "TGFrame.h"
00016 #include "TGLayout.h"
00017
00018 class TGSplitter;
00019
00020
00021 class TGFrameElementPack : public TGFrameElement
00022 {
00023 private:
00024 TGFrameElementPack(const TGFrameElementPack&);
00025 TGFrameElementPack& operator=(const TGFrameElementPack&);
00026
00027 public:
00028 Float_t fWeight;
00029 TGFrameElementPack* fSplitFE;
00030
00031 TGFrameElementPack(TGFrame *frame, TGLayoutHints* lh = 0, Float_t weight = 1):
00032 TGFrameElement(frame, lh), fWeight(weight), fSplitFE(0) { }
00033
00034 ClassDef(TGFrameElementPack, 0);
00035 };
00036
00037
00038
00039 class TGPack : public TGCompositeFrame
00040 {
00041 private:
00042 TGPack(const TGPack&);
00043 TGPack& operator=(const TGPack&);
00044
00045 protected:
00046 Bool_t fVertical;
00047 Bool_t fUseSplitters;
00048 Int_t fSplitterLen;
00049
00050 Int_t fDragOverflow;
00051
00052 Float_t fWeightSum;
00053 Int_t fNVisible;
00054
00055 Int_t GetFrameLength(const TGFrame* f) const { return fVertical ? f->GetHeight() : f->GetWidth(); }
00056 Int_t GetLength() const { return GetFrameLength(this); }
00057 Int_t GetAvailableLength() const;
00058
00059 void SetFrameLength (TGFrame* f, Int_t len);
00060 void SetFramePosition(TGFrame* f, Int_t pos);
00061
00062 void FindFrames(TGFrame* splitter, TGFrameElementPack*& f0, TGFrameElementPack*& f1) const;
00063
00064 void CheckSplitterVisibility();
00065 void ResizeExistingFrames();
00066 void RefitFramesToPack();
00067
00068 void AddFrameInternal(TGFrame *f, TGLayoutHints* l = 0, Float_t weight = 1);
00069 void RemoveFrameInternal(TGFrame *f);
00070
00071
00072 public:
00073 TGPack(const TGWindow *p = 0, UInt_t w = 1, UInt_t h = 1, UInt_t options = 0,
00074 Pixel_t back = GetDefaultFrameBackground());
00075 TGPack(TGClient *c, Window_t id, const TGWindow *parent = 0);
00076 virtual ~TGPack();
00077
00078 virtual void AddFrameWithWeight(TGFrame *f, TGLayoutHints* l, Float_t w);
00079 virtual void AddFrame(TGFrame *f, TGLayoutHints* l=0);
00080
00081 virtual void DeleteFrame(TGFrame *f);
00082 virtual void RemoveFrame(TGFrame *f);
00083 virtual void ShowFrame(TGFrame *f);
00084 virtual void HideFrame(TGFrame *f);
00085
00086 using TGCompositeFrame::Resize;
00087 virtual void Resize(UInt_t w = 0, UInt_t h = 0);
00088
00089 using TGCompositeFrame::MapSubwindows;
00090 virtual void MapSubwindows();
00091
00092 virtual void MoveResize(Int_t x, Int_t y, UInt_t w = 0, UInt_t h = 0);
00093 virtual void Layout();
00094
00095 virtual void Dump() const;
00096
00097 void EqualizeFrames();
00098 void HandleSplitterStart();
00099 void HandleSplitterResize(Int_t delta);
00100
00101
00102
00103 Bool_t GetVertical() const { return fVertical; }
00104 void SetVertical(Bool_t x);
00105
00106
00107 Bool_t GetUseSplitters() const { return fUseSplitters; }
00108 void SetUseSplitters(Bool_t x) { fUseSplitters = x; }
00109
00110 ClassDef(TGPack, 0);
00111 };
00112
00113 #endif