Logo ROOT   6.16/01
Reference Guide
TGPack.h
Go to the documentation of this file.
1// @(#)root/eve:$Id$
2// Author: Matevz Tadel 2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2007, 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_TGPack
13#define ROOT_TGPack
14
15#include "TGFrame.h"
16#include "TGLayout.h"
17
18class TGSplitter;
19
20
22{
23private:
24 TGFrameElementPack(const TGFrameElementPack&); // Not implemented
25 TGFrameElementPack& operator=(const TGFrameElementPack&); // Not implemented
26
27public:
28 Float_t fWeight; // relative weight
29 TGFrameElementPack* fSplitFE; //! cached varaible for optimisation
30
31 TGFrameElementPack(TGFrame *frame, TGLayoutHints* lh = 0, Float_t weight = 1):
32 TGFrameElement(frame, lh), fWeight(weight), fSplitFE(0) { }
33
34 ClassDef(TGFrameElementPack, 0); // Class used in TGPack.
35};
36
37//==============================================================================
38
40{
41private:
42 TGPack(const TGPack&); // Not implemented
43 TGPack& operator=(const TGPack&); // Not implemented
44
45protected:
49
51
52 Float_t fWeightSum; // total sum of sub frame weights
53 Int_t fNVisible; // number of visible frames
54
55 Int_t GetFrameLength(const TGFrame* f) const { return fVertical ? f->GetHeight() : f->GetWidth(); }
56 Int_t GetLength() const { return GetFrameLength(this); }
58
59 void SetFrameLength (TGFrame* f, Int_t len);
60 void SetFramePosition(TGFrame* f, Int_t pos);
61
63
66 void RefitFramesToPack();
67
68 void AddFrameInternal(TGFrame *f, TGLayoutHints* l = 0, Float_t weight = 1);
70
71
72public:
73 TGPack(const TGWindow *p = 0, UInt_t w = 1, UInt_t h = 1, UInt_t options = 0,
75 TGPack(TGClient *c, Window_t id, const TGWindow *parent = 0);
76 virtual ~TGPack();
77
79 virtual void AddFrame(TGFrame *f, TGLayoutHints* l=0);
80
81 virtual void DeleteFrame(TGFrame *f);
82 virtual void RemoveFrame(TGFrame *f);
83 virtual void ShowFrame(TGFrame *f);
84 virtual void HideFrame(TGFrame *f);
85
87 virtual void Resize(UInt_t w = 0, UInt_t h = 0);
88
90 virtual void MapSubwindows();
91
92 virtual void MoveResize(Int_t x, Int_t y, UInt_t w = 0, UInt_t h = 0);
93 virtual void Layout();
94
95 virtual void Dump() const;
96
97 void EqualizeFrames();
99 void HandleSplitterResize(Int_t delta);
100
101 // ----------------------------------------------------------------
102
103 Bool_t GetVertical() const { return fVertical; }
104 void SetVertical(Bool_t x);
105
106 // For now assume this is always true. Length of splitter = 4 pixels.
109
110 ClassDef(TGPack, 0); // Horizontal or vertical stack of frames.
111};
112
113#endif
ULong_t Pixel_t
Definition: GuiTypes.h:39
Handle_t Window_t
Definition: GuiTypes.h:28
#define f(i)
Definition: RSha256.hxx:104
#define c(i)
Definition: RSha256.hxx:101
#define h(i)
Definition: RSha256.hxx:106
int Int_t
Definition: RtypesCore.h:41
unsigned int UInt_t
Definition: RtypesCore.h:42
bool Bool_t
Definition: RtypesCore.h:59
float Float_t
Definition: RtypesCore.h:53
#define ClassDef(name, id)
Definition: Rtypes.h:324
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition: TGFrame.cxx:1146
TGFrameElementPack(const TGFrameElementPack &)
TGFrameElementPack(TGFrame *frame, TGLayoutHints *lh=0, Float_t weight=1)
cached varaible for optimisation
Definition: TGPack.h:31
Float_t fWeight
Definition: TGPack.h:28
TGFrameElementPack * fSplitFE
Definition: TGPack.h:29
TGFrameElementPack & operator=(const TGFrameElementPack &)
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:665
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:587
Definition: TGPack.h:40
Bool_t fVertical
Definition: TGPack.h:46
virtual void RemoveFrame(TGFrame *f)
Remove frame f and refit existing frames to pack size.
Definition: TGPack.cxx:336
TGPack & operator=(const TGPack &)
void SetUseSplitters(Bool_t x)
Definition: TGPack.h:108
void RemoveFrameInternal(TGFrame *f)
Remove frame f.
Definition: TGPack.cxx:294
virtual ~TGPack()
Destructor.
Definition: TGPack.cxx:62
void ResizeExistingFrames()
Resize (shrink or expand) existing frames by amount in total.
Definition: TGPack.cxx:138
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the pack.
Definition: TGPack.cxx:450
Int_t GetAvailableLength() const
Return length of entire frame without splitters.
Definition: TGPack.cxx:71
TGPack(const TGPack &)
Int_t fSplitterLen
Definition: TGPack.h:48
virtual void DeleteFrame(TGFrame *f)
Remove frame f and refit existing frames to pack size.
Definition: TGPack.cxx:325
Int_t GetFrameLength(const TGFrame *f) const
Definition: TGPack.h:55
virtual void AddFrameWithWeight(TGFrame *f, TGLayoutHints *l, Float_t w)
Add frame f at the end with given weight.
Definition: TGPack.cxx:275
virtual void ShowFrame(TGFrame *f)
Show sub frame.
Definition: TGPack.cxx:363
virtual void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0)
Move and resize the pack.
Definition: TGPack.cxx:466
void RefitFramesToPack()
Refit existing frames to pack size.
Definition: TGPack.cxx:190
void AddFrameInternal(TGFrame *f, TGLayoutHints *l=0, Float_t weight=1)
Add frame f at the end.
Definition: TGPack.cxx:231
virtual void HideFrame(TGFrame *f)
Hide sub frame.
Definition: TGPack.cxx:393
Bool_t GetUseSplitters() const
Definition: TGPack.h:107
Int_t GetLength() const
Definition: TGPack.h:56
virtual void Layout()
Reposition the frames so that they fit correctly.
Definition: TGPack.cxx:476
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame f at the end with default weight.
Definition: TGPack.cxx:285
void EqualizeFrames()
Refit existing frames so that their lengths are equal.
Definition: TGPack.cxx:497
void HandleSplitterStart()
Called when splitter drag starts.
Definition: TGPack.cxx:519
Float_t fWeightSum
Definition: TGPack.h:52
virtual void MapSubwindows()
Virtual method of TGcompositeFrame.
Definition: TGPack.cxx:425
Bool_t fUseSplitters
Definition: TGPack.h:47
void SetVertical(Bool_t x)
Sets the vertical flag and reformats the back to new stacking direction.
Definition: TGPack.cxx:597
void HandleSplitterResize(Int_t delta)
Handle resize events from splitters.
Definition: TGPack.cxx:527
void SetFrameLength(TGFrame *f, Int_t len)
Set pack-wise length of frame f.
Definition: TGPack.cxx:82
void SetFramePosition(TGFrame *f, Int_t pos)
Set pack-wise position of frame f.
Definition: TGPack.cxx:93
void CheckSplitterVisibility()
Check if splitter of first visible frame is hidden.
Definition: TGPack.cxx:105
Int_t fNVisible
Definition: TGPack.h:53
Int_t fDragOverflow
Definition: TGPack.h:50
virtual void Dump() const
Print sub frame info.
Definition: TGPack.cxx:345
void FindFrames(TGFrame *splitter, TGFrameElementPack *&f0, TGFrameElementPack *&f1) const
Find frames around splitter and return them f0 (previous) and f1 (next).
Definition: TGPack.cxx:207
Bool_t GetVertical() const
Definition: TGPack.h:103
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
TF1 * f1
Definition: legend1.C:11
auto * l
Definition: textangle.C:4
REAL splitter
Definition: triangle.c:616