Logo ROOT  
Reference Guide
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Fons Rademakers 10/10/2000
5 * Copyright (C) 1995-2000, 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 *************************************************************************/
12#ifndef ROOT_TGProgressBar
13#define ROOT_TGProgressBar
16#include "TGFrame.h"
19class TGProgressBar : public TGFrame {
28 Float_t fMin; ///< logical minimum value (default 0)
29 Float_t fMax; ///< logical maximum value (default 100)
30 Float_t fPos; ///< logical position [fMin,fMax]
31 Int_t fPosPix; ///< position of progress bar in pixel coordinates
32 Int_t fBarWidth; ///< progress bar width
33 EFillType fFillType; ///< *OPTION={GetMethod="GetFillType";SetMethod="SetFillType";Items=(kSolidFill=Solid",kBlockFill="Block")}*
34 EBarType fBarType; ///< *OPTION={GetMethod="GetBarType";SetMethod="SetBarType";Items=(kStandard="Standard",kFancy="Fancy")}*
35 TString fFormat; ///< format used to show position not in percent
36 Bool_t fShowPos; ///< show position value (default false)
37 Bool_t fPercent; ///< show position in percent (default true)
38 Bool_t fDrawBar; ///< if true draw only bar in DoRedraw()
39 TGGC fBarColorGC; ///< progress bar drawing context
40 GContext_t fNormGC; ///< text drawing graphics context
41 FontStruct_t fFontStruct; ///< font used to draw position text
43 virtual void DoRedraw() = 0;
45 static const TGFont *fgDefaultFont;
50 static const TGGC &GetDefaultGC();
53 Pixel_t back = GetWhitePixel(),
55 GContext_t norm = GetDefaultGC()(),
58 virtual ~TGProgressBar() { }
60 Float_t GetMin() const { return fMin; }
61 Float_t GetMax() const { return fMax; }
62 Float_t GetPosition() const { return fPos; }
63 EFillType GetFillType() const { return fFillType; }
64 EBarType GetBarType() const { return fBarType; }
65 Bool_t GetShowPos() const { return fShowPos; }
66 TString GetFormat() const { return fFormat; }
67 const char* GetValueFormat() const { return fFormat.Data(); }
68 Bool_t UsePercent() const { return fPercent; }
70 GContext_t GetNormGC() const { return fNormGC; }
73 void SetPosition(Float_t pos); //*MENU* *GETTER=GetPosition
74 void SetRange(Float_t min, Float_t max); //*MENU*
75 void Increment(Float_t inc);
76 void SetBarType(EBarType type); //*SUBMENU*
77 void SetFillType(EFillType type); //*SUBMENU*
78 virtual void Percent(Bool_t on) { fPercent = on; fClient->NeedRedraw(this); } //*TOGGLE* *GETTER=UsePercent
79 virtual void ShowPos(Bool_t on) { fShowPos = on; fClient->NeedRedraw(this); } //*TOGGLE* *GETTER=GetShowPos
80 virtual void Format(const char *format = "%.2f"); //*MENU* *GETTER=GetValueFormat
81 void SetMin(Float_t min) { fMin = min; }
82 void SetMax(Float_t max) { fMax = max; }
83 virtual void SetBarColor(Pixel_t color);
84 void SetBarColor(const char *color="blue");
85 virtual void Reset(); //*MENU*
86 virtual void SetForegroundColor(Pixel_t pixel);
88 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
90 ClassDef(TGProgressBar,0) // Progress bar abstract base class
97 virtual void DoRedraw();
100 TGHProgressBar(const TGWindow *p = 0,
102 Pixel_t back = GetWhitePixel(),
104 GContext_t norm = GetDefaultGC()(),
106 UInt_t options = kDoubleBorder | kSunkenFrame);
108 virtual ~TGHProgressBar() { }
111 { return TGDimension(fWidth, fBarWidth); }
113 void ShowPosition(Bool_t set = kTRUE, Bool_t percent = kTRUE,
114 const char *format = "%.2f");
116 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
118 ClassDef(TGHProgressBar,0) // Horizontal progress bar widget
125 virtual void DoRedraw();
128 TGVProgressBar(const TGWindow *p = 0,
130 Pixel_t back = GetWhitePixel(),
132 GContext_t norm = GetDefaultGC()(),
134 UInt_t options = kDoubleBorder | kSunkenFrame);
136 virtual ~TGVProgressBar() { }
139 { return TGDimension(fBarWidth, fHeight); }
140 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
141 void ShowPos(Bool_t) { }
142 void Percent(Bool_t) { }
144 ClassDef(TGVProgressBar,0) // Vertical progress bar widget
int Int_t
Definition: CPyCppyy.h:43
unsigned int UInt_t
Definition: CPyCppyy.h:44
@ kSunkenFrame
Definition: GuiTypes.h:383
@ kDoubleBorder
Definition: GuiTypes.h:385
Handle_t GContext_t
Graphics context handle.
Definition: GuiTypes.h:38
Handle_t FontStruct_t
Pointer to font structure.
Definition: GuiTypes.h:39
ULong_t Pixel_t
Pixel value.
Definition: GuiTypes.h:40
#define h(i)
Definition: RSha256.hxx:106
bool Bool_t
Definition: RtypesCore.h:63
float Float_t
Definition: RtypesCore.h:57
const Bool_t kTRUE
Definition: RtypesCore.h:100
const char Option_t
Definition: RtypesCore.h:66
#define ClassDef(name, id)
Definition: Rtypes.h:325
int type
Definition: TGX11.cxx:121
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition: TGClient.cxx:374
Encapsulate fonts used in the GUI system.
Definition: TGFont.h:140
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition: TGFrame.h:80
static Pixel_t GetDefaultSelectedBackground()
Get default selected frame background.
Definition: TGFrame.cxx:696
static Pixel_t GetWhitePixel()
Get white pixel value.
Definition: TGFrame.cxx:709
UInt_t fHeight
frame height
Definition: TGFrame.h:88
UInt_t fWidth
frame width
Definition: TGFrame.h:87
Encapsulate a graphics context used in the low level graphics.
Definition: TGGC.h:22
Pixel_t GetForeground() const
Definition: TGGC.h:73
TGHProgressBar(const TGWindow *p=0, UInt_t w=4, UInt_t h=kProgressBarTextWidth, Pixel_t back=GetWhitePixel(), Pixel_t barcolor=GetDefaultSelectedBackground(), GContext_t norm=GetDefaultGC()(), FontStruct_t font=GetDefaultFontStruct(), UInt_t options=kDoubleBorder|kSunkenFrame)
Horizontal progress bar constructor.
virtual void DoRedraw()
Draw horizontal progress bar.
virtual ~TGHProgressBar()
void ShowPosition(Bool_t set=kTRUE, Bool_t percent=kTRUE, const char *format="%.2f")
Show postion text, either in percent or formatted according format.
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a horizontal progress bar as a C++ statement(s) on output stream out.
TGClient * fClient
Connection to display server.
Definition: TGObject.h:27
The classes in this file implement progress bars.
Definition: TGProgressBar.h:19
static const TGFont * fgDefaultFont
Definition: TGProgressBar.h:45
Bool_t fPercent
show position in percent (default true)
Definition: TGProgressBar.h:37
void Increment(Float_t inc)
Increment progress position.
Float_t GetMin() const
Definition: TGProgressBar.h:60
TString fFormat
format used to show position not in percent
Definition: TGProgressBar.h:35
Pixel_t GetBarColor() const
Definition: TGProgressBar.h:69
static TGGC * fgDefaultGC
Definition: TGProgressBar.h:46
virtual void DoRedraw()=0
Redraw the frame.
EBarType fBarType
Definition: TGProgressBar.h:34
static const TGGC & GetDefaultGC()
Return default graphics context in use.
Float_t fPos
logical position [fMin,fMax]
Definition: TGProgressBar.h:30
Bool_t UsePercent() const
Definition: TGProgressBar.h:68
const char * GetValueFormat() const
Definition: TGProgressBar.h:67
Float_t fMax
logical maximum value (default 100)
Definition: TGProgressBar.h:29
TGProgressBar(const TGWindow *p, UInt_t w, UInt_t h, Pixel_t back=GetWhitePixel(), Pixel_t barcolor=GetDefaultSelectedBackground(), GContext_t norm=GetDefaultGC()(), FontStruct_t font=GetDefaultFontStruct(), UInt_t options=kDoubleBorder|kSunkenFrame)
Create progress bar.
virtual void SetForegroundColor(Pixel_t pixel)
Change text color drawing.
GContext_t fNormGC
text drawing graphics context
Definition: TGProgressBar.h:40
Int_t fBarWidth
progress bar width
Definition: TGProgressBar.h:32
FontStruct_t fFontStruct
font used to draw position text
Definition: TGProgressBar.h:41
FontStruct_t GetFontStruct() const
Definition: TGProgressBar.h:71
void SetPosition(Float_t pos)
Set progress position between [min,max].
Bool_t fDrawBar
if true draw only bar in DoRedraw()
Definition: TGProgressBar.h:38
Bool_t GetShowPos() const
Definition: TGProgressBar.h:65
TString GetFormat() const
Definition: TGProgressBar.h:66
static FontStruct_t GetDefaultFontStruct()
Return default font structure in use.
Float_t fMin
logical minimum value (default 0)
Definition: TGProgressBar.h:28
TGGC fBarColorGC
progress bar drawing context
Definition: TGProgressBar.h:39
virtual void Format(const char *format="%.2f")
Set format for displaying a value.
void SetFillType(EFillType type)
Set fill type.
void SetMin(Float_t min)
Definition: TGProgressBar.h:81
virtual ~TGProgressBar()
Definition: TGProgressBar.h:58
Float_t GetPosition() const
Definition: TGProgressBar.h:62
virtual void SetBarColor(Pixel_t color)
Set progress bar color.
void SetMax(Float_t max)
Definition: TGProgressBar.h:82
void SetBarType(EBarType type)
Set bar type.
EBarType GetBarType() const
Definition: TGProgressBar.h:64
GContext_t GetNormGC() const
Definition: TGProgressBar.h:70
@ kProgressBarStandardWidth
Definition: TGProgressBar.h:24
virtual void Percent(Bool_t on)
Definition: TGProgressBar.h:78
Float_t GetMax() const
Definition: TGProgressBar.h:61
void SetRange(Float_t min, Float_t max)
Set min and max of progress bar.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save progress bar parameters as a C++ statement(s) on output stream out.
EFillType GetFillType() const
Definition: TGProgressBar.h:63
Int_t fPosPix
position of progress bar in pixel coordinates
Definition: TGProgressBar.h:31
EFillType fFillType
Definition: TGProgressBar.h:33
virtual void ShowPos(Bool_t on)
Definition: TGProgressBar.h:79
Bool_t fShowPos
show position value (default false)
Definition: TGProgressBar.h:36
virtual void Reset()
Reset progress bar (i.e. set pos to 0).
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
TGVProgressBar(const TGWindow *p=0, UInt_t w=kProgressBarTextWidth, UInt_t h=4, Pixel_t back=GetWhitePixel(), Pixel_t barcolor=GetDefaultSelectedBackground(), GContext_t norm=GetDefaultGC()(), FontStruct_t font=GetDefaultFontStruct(), UInt_t options=kDoubleBorder|kSunkenFrame)
virtual void DoRedraw()
Draw vertical progress bar.
virtual ~TGVProgressBar()
void ShowPos(Bool_t)
void Percent(Bool_t)
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a vertical progress bar as a C++ statement(s) on output stream out.
ROOT GUI Window base class.
Definition: TGWindow.h:23
Basic string class.
Definition: TString.h:136
const char * Data() const
Definition: TString.h:369