KWWidgets
vtkKWProgressGauge.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Module: $RCSfile: vtkKWProgressGauge.h,v $
4 
5  Copyright (c) Kitware, Inc.
6  All rights reserved.
7  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
14 // .NAME vtkKWProgressGauge - a horizontal progress bar widget
15 // .SECTION Description
16 // A simple widget used for displaying a progress bar with a percent value
17 // text in the center of the widget.
18 
19 #ifndef __vtkKWProgressGauge_h
20 #define __vtkKWProgressGauge_h
21 
22 #include "vtkKWCompositeWidget.h"
23 
24 class vtkKWCanvas;
25 class vtkKWProgressGaugeInternals;
26 
28 {
29 public:
30  static vtkKWProgressGauge* New();
32  void PrintSelf(ostream& os, vtkIndent indent);
33 
34  // Description:
35  // Set/Get the percentage displayed for the primary progress gauge.
36  // This number is clamped between 0.0 and 100.0.
37  // Note: setting the progress to zero resets the gauge to its nominal
38  // blank appearance.
39  virtual void SetValue(double value);
40  virtual double GetValue();
41 
42  // Description:
43  // Set/Get the percentage displayed for the primary (ranked 0) and
44  // the secondary progress gauges. If rank = 0, calling this method is
45  // the same as calling the SetValue method.
46  // This number is clamped between 0.0 and 100.0.
47  // Note: setting the progress to zero resets the gauge to its nominal
48  // blank appearance.
49  // All progress gauges are stacked vertically on top of each other, with the
50  // lower rank at the top by default (this can be changed with
51  // the SetPrimaryGaugePosition method). Space for the primary gauge
52  // (ranked 0) is always allocated. It is not for secondary gauges which
53  // value is 0.0 unless a higher rank gauge is != 0.0.
54  virtual void SetNthValue(int rank, double value);
55  virtual double GetNthValue(int rank);
56 
57  // Description:
58  // Set/Get the width and height of the widget.
59  // The height parameter is ignored if ExpandHeight is set to On.
60  virtual void SetWidth(int width);
61  vtkGetMacro(Width, int);
62  virtual void SetHeight(int height);
63  vtkGetMacro(Height, int);
64 
65  // Description:
66  // Set/Get if the height of the gauge should be automatically adjusted
67  // to fill the available vertical space. The widget should be packed
68  // accordingly to expand automatically. Check MinimumHeight too.
69  vtkBooleanMacro(ExpandHeight, int);
70  virtual void SetExpandHeight(int);
71  vtkGetMacro(ExpandHeight, int);
72 
73  // Description:
74  // Set/Get the minimum height of the widget.
75  // This value is ignored if ExpandHeight is set to Off. If set to On,
76  // the height computed from the available vertical space will not be any
77  // smaller than this minimum height.
78  virtual void SetMinimumHeight(int height);
79  vtkGetMacro(MinimumHeight, int);
80 
81  // Description:
82  // Set/Get the color of the progress bar, the default is blue.
83  virtual void SetBarColor(double r, double g, double b);
84  virtual void SetBarColor(double rgb[3])
85  { this->SetBarColor(rgb[0], rgb[1], rgb[2]); }
86  vtkGetVectorMacro(BarColor,double,3);
87 
88  // Description:
89  // Set/Get the position of the primary gauge (rank 0).
90  // If on top, higher rank are stacked below. If at the bottom, higher rank
91  // are stacked on top.
92  //BTX
93  enum
94  {
95  GaugePositionTop = 0,
96  GaugePositionBottom
97  };
98  //ETX
99  virtual void SetPrimaryGaugePosition(int);
100  vtkGetMacro(PrimaryGaugePosition, int);
101  virtual void SetPrimaryGaugePositionToTop();
102  virtual void SetPrimaryGaugePositionToBottom();
103 
104  // Description:
105  // Callbacks. Internal, do not use.
106  virtual void ConfigureCallback();
107 
108 protected:
111 
112  // Description:
113  // Create the widget.
114  virtual void CreateWidget();
115 
116  virtual void Redraw();
117 
118  int Width;
119  int Height;
120  int MinimumHeight;
121  double BarColor[3];
122  double Value;
123  int ExpandHeight;
124  int PrimaryGaugePosition;
125 
126  vtkKWCanvas *Canvas;
127 
128  // PIMPL Encapsulation for STL containers
129  //BTX
130  vtkKWProgressGaugeInternals *Internals;
131  //ETX
132 
133 private:
134  vtkKWProgressGauge(const vtkKWProgressGauge&); // Not implemented
135  void operator=(const vtkKWProgressGauge&); // Not implemented
136 };
137 
138 
139 #endif
140