Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGProgressBar.h
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Fons Rademakers 10/10/2000
3
4/*************************************************************************
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 *************************************************************************/
11
12#ifndef ROOT_TGProgressBar
13#define ROOT_TGProgressBar
14
15
16#include "TGFrame.h"
17
18
19class TGProgressBar : public TGFrame {
20
21public:
26
27protected:
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
42
43 virtual void DoRedraw() = 0;
44
45 static const TGFont *fgDefaultFont;
47
48public:
50 static const TGGC &GetDefaultGC();
51
53 Pixel_t back = GetWhitePixel(),
55 GContext_t norm = GetDefaultGC()(),
58 virtual ~TGProgressBar() { }
59
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; }
72
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);
87
88 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
89
90 ClassDef(TGProgressBar,0) // Progress bar abstract base class
91};
92
93
95
96protected:
97 virtual void DoRedraw();
98
99public:
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() { }
109
111 { return TGDimension(fWidth, fBarWidth); }
112
113 void ShowPosition(Bool_t set = kTRUE, Bool_t percent = kTRUE,
114 const char *format = "%.2f");
115
116 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
117
118 ClassDef(TGHProgressBar,0) // Horizontal progress bar widget
119};
120
121
123
124protected:
125 virtual void DoRedraw();
126
127public:
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() { }
137
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) { }
143
144 ClassDef(TGVProgressBar,0) // Vertical progress bar widget
145};
146
147#endif
148
@ 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:372
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
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.
static const TGFont * fgDefaultFont
Bool_t fPercent
show position in percent (default true)
void Increment(Float_t inc)
Increment progress position.
Float_t GetMin() const
TString fFormat
format used to show position not in percent
Pixel_t GetBarColor() const
static TGGC * fgDefaultGC
virtual void DoRedraw()=0
Redraw the frame.
EBarType fBarType
OPTION={GetMethod="GetBarType";SetMethod="SetBarType";Items=(kStandard="Standard",...
static const TGGC & GetDefaultGC()
Return default graphics context in use.
Float_t fPos
logical position [fMin,fMax]
Bool_t UsePercent() const
Float_t fMax
logical maximum value (default 100)
virtual void SetForegroundColor(Pixel_t pixel)
Change text color drawing.
GContext_t fNormGC
text drawing graphics context
Int_t fBarWidth
progress bar width
FontStruct_t fFontStruct
font used to draw position text
FontStruct_t GetFontStruct() const
void SetPosition(Float_t pos)
Set progress position between [min,max].
Bool_t fDrawBar
if true draw only bar in DoRedraw()
Bool_t GetShowPos() const
TString GetFormat() const
static FontStruct_t GetDefaultFontStruct()
Return default font structure in use.
Float_t fMin
logical minimum value (default 0)
TGGC fBarColorGC
progress bar drawing context
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)
virtual ~TGProgressBar()
Float_t GetPosition() const
virtual void SetBarColor(Pixel_t color)
Set progress bar color.
void SetMax(Float_t max)
void SetBarType(EBarType type)
Set bar type.
EBarType GetBarType() const
GContext_t GetNormGC() const
const char * GetValueFormat() const
virtual void Percent(Bool_t on)
Float_t GetMax() const
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
Int_t fPosPix
position of progress bar in pixel coordinates
EFillType fFillType
OPTION={GetMethod="GetFillType";SetMethod="SetFillType";Items=(kSolidFill=Solid",kBlockFill="Block")}
virtual void ShowPos(Bool_t on)
Bool_t fShowPos
show position value (default false)
virtual void Reset()
Reset progress bar (i.e. set pos to 0).
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
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