12 #ifndef ROOT_TGProgressBar
13 #define ROOT_TGProgressBar
31 class TGProgressBar :
public TGFrame {
34 enum EBarType { kStandard, kFancy };
35 enum EFillType { kSolidFill, kBlockFill };
36 enum { kProgressBarStandardWidth = 16, kProgressBarTextWidth = 24,
37 kBlockSize = 8, kBlockSpace = 2 };
53 FontStruct_t fFontStruct;
55 virtual void DoRedraw() = 0;
57 static const TGFont *fgDefaultFont;
58 static TGGC *fgDefaultGC;
61 static FontStruct_t GetDefaultFontStruct();
62 static const TGGC &GetDefaultGC();
64 TGProgressBar(
const TGWindow *p, UInt_t w, UInt_t h,
65 Pixel_t back = GetWhitePixel(),
66 Pixel_t barcolor = GetDefaultSelectedBackground(),
67 GContext_t norm = GetDefaultGC()(),
68 FontStruct_t font = GetDefaultFontStruct(),
69 UInt_t options = kDoubleBorder | kSunkenFrame);
70 virtual ~TGProgressBar() { }
72 Float_t GetMin()
const {
return fMin; }
73 Float_t GetMax()
const {
return fMax; }
74 Float_t GetPosition()
const {
return fPos; }
75 EFillType GetFillType()
const {
return fFillType; }
76 EBarType GetBarType()
const {
return fBarType; }
77 Bool_t GetShowPos()
const {
return fShowPos; }
78 TString GetFormat()
const {
return fFormat; }
79 const char* GetValueFormat()
const {
return fFormat.Data(); }
80 Bool_t UsePercent()
const {
return fPercent; }
81 Pixel_t GetBarColor()
const {
return fBarColorGC.GetForeground(); }
82 GContext_t GetNormGC()
const {
return fNormGC; }
83 FontStruct_t GetFontStruct()
const {
return fFontStruct; }
85 void SetPosition(Float_t pos);
86 void SetRange(Float_t min, Float_t max);
87 void Increment(Float_t inc);
88 void SetBarType(EBarType type);
89 void SetFillType(EFillType type);
90 virtual void Percent(Bool_t on) { fPercent = on; fClient->NeedRedraw(
this); }
91 virtual void ShowPos(Bool_t on) { fShowPos = on; fClient->NeedRedraw(
this); }
92 virtual void Format(
const char *format =
"%.2f");
93 void SetMin(Float_t min) { fMin = min; }
94 void SetMax(Float_t max) { fMax = max; }
95 virtual void SetBarColor(Pixel_t color);
96 void SetBarColor(
const char *color=
"blue");
98 virtual void SetForegroundColor(Pixel_t pixel);
100 virtual void SavePrimitive(std::ostream &out, Option_t *option =
"");
102 ClassDef(TGProgressBar,0)
106 class TGHProgressBar :
public TGProgressBar {
109 virtual void DoRedraw();
112 TGHProgressBar(
const TGWindow *p = 0,
113 UInt_t w = 4, UInt_t h = kProgressBarTextWidth,
114 Pixel_t back = GetWhitePixel(),
115 Pixel_t barcolor = GetDefaultSelectedBackground(),
116 GContext_t norm = GetDefaultGC()(),
117 FontStruct_t font = GetDefaultFontStruct(),
118 UInt_t options = kDoubleBorder | kSunkenFrame);
119 TGHProgressBar(
const TGWindow *p, EBarType type, UInt_t w);
120 virtual ~TGHProgressBar() { }
122 virtual TGDimension GetDefaultSize()
const
123 {
return TGDimension(fWidth, fBarWidth); }
125 void ShowPosition(Bool_t set = kTRUE, Bool_t percent = kTRUE,
126 const char *format =
"%.2f");
128 virtual void SavePrimitive(std::ostream &out, Option_t *option =
"");
130 ClassDef(TGHProgressBar,0)
134 class TGVProgressBar :
public TGProgressBar {
137 virtual void DoRedraw();
140 TGVProgressBar(
const TGWindow *p = 0,
141 UInt_t w = kProgressBarTextWidth, UInt_t h = 4,
142 Pixel_t back = GetWhitePixel(),
143 Pixel_t barcolor = GetDefaultSelectedBackground(),
144 GContext_t norm = GetDefaultGC()(),
145 FontStruct_t font = GetDefaultFontStruct(),
146 UInt_t options = kDoubleBorder | kSunkenFrame);
147 TGVProgressBar(
const TGWindow *p, EBarType type, UInt_t h);
148 virtual ~TGVProgressBar() { }
150 virtual TGDimension GetDefaultSize()
const
151 {
return TGDimension(fBarWidth, fHeight); }
152 virtual void SavePrimitive(std::ostream &out, Option_t *option =
"");
153 void ShowPos(Bool_t) { }
154 void Percent(Bool_t) { }
156 ClassDef(TGVProgressBar,0)