00001 /*========================================================================= 00002 00003 Module: $RCSfile: vtkKWProgressGauge.h,v $ 00004 00005 Copyright (c) Kitware, Inc. 00006 All rights reserved. 00007 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00008 00009 This software is distributed WITHOUT ANY WARRANTY; without even 00010 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00011 PURPOSE. See the above copyright notice for more information. 00012 00013 =========================================================================*/ 00014 // .NAME vtkKWProgressGauge - a horizontal progress bar widget 00015 // .SECTION Description 00016 // A simple widget used for displaying a progress bar with a percent value 00017 // text in the center of the widget. 00018 00019 #ifndef __vtkKWProgressGauge_h 00020 #define __vtkKWProgressGauge_h 00021 00022 #include "vtkKWCompositeWidget.h" 00023 00024 class vtkKWCanvas; 00025 class vtkKWProgressGaugeInternals; 00026 00027 class KWWidgets_EXPORT vtkKWProgressGauge : public vtkKWCompositeWidget 00028 { 00029 public: 00030 static vtkKWProgressGauge* New(); 00031 vtkTypeRevisionMacro(vtkKWProgressGauge,vtkKWCompositeWidget); 00032 void PrintSelf(ostream& os, vtkIndent indent); 00033 00034 // Description: 00035 // Set/Get the percentage displayed for the primary progress gauge. 00036 // This number is clamped between 0.0 and 100.0. 00037 // Note: setting the progress to zero resets the gauge to its nominal 00038 // blank appearance. 00039 virtual void SetValue(double value); 00040 virtual double GetValue(); 00041 00042 // Description: 00043 // Set/Get the percentage displayed for the primary (ranked 0) and 00044 // the secondary progress gauges. If rank = 0, calling this method is 00045 // the same as calling the SetValue method. 00046 // This number is clamped between 0.0 and 100.0. 00047 // Note: setting the progress to zero resets the gauge to its nominal 00048 // blank appearance. 00049 // All progress gauges are stacked vertically on top of each other, with the 00050 // lower rank at the top by default (this can be changed with 00051 // the SetPrimaryGaugePosition method). Space for the primary gauge 00052 // (ranked 0) is always allocated. It is not for secondary gauges which 00053 // value is 0.0 unless a higher rank gauge is != 0.0. 00054 virtual void SetNthValue(int rank, double value); 00055 virtual double GetNthValue(int rank); 00056 00057 // Description: 00058 // Set/Get the width and height of the widget. 00059 // The height parameter is ignored if ExpandHeight is set to On. 00060 virtual void SetWidth(int width); 00061 vtkGetMacro(Width, int); 00062 virtual void SetHeight(int height); 00063 vtkGetMacro(Height, int); 00064 00065 // Description: 00066 // Set/Get if the height of the gauge should be automatically adjusted 00067 // to fill the available vertical space. The widget should be packed 00068 // accordingly to expand automatically. Check MinimumHeight too. 00069 vtkBooleanMacro(ExpandHeight, int); 00070 virtual void SetExpandHeight(int); 00071 vtkGetMacro(ExpandHeight, int); 00072 00073 // Description: 00074 // Set/Get the minimum height of the widget. 00075 // This value is ignored if ExpandHeight is set to Off. If set to On, 00076 // the height computed from the available vertical space will not be any 00077 // smaller than this minimum height. 00078 virtual void SetMinimumHeight(int height); 00079 vtkGetMacro(MinimumHeight, int); 00080 00081 // Description: 00082 // Set/Get the color of the progress bar, the default is blue. 00083 virtual void SetBarColor(double r, double g, double b); 00084 virtual void SetBarColor(double rgb[3]) 00085 { this->SetBarColor(rgb[0], rgb[1], rgb[2]); } 00086 vtkGetVectorMacro(BarColor,double,3); 00087 00088 // Description: 00089 // Set/Get the position of the primary gauge (rank 0). 00090 // If on top, higher rank are stacked below. If at the bottom, higher rank 00091 // are stacked on top. 00092 //BTX 00093 enum 00094 { 00095 GaugePositionTop = 0, 00096 GaugePositionBottom 00097 }; 00098 //ETX 00099 virtual void SetPrimaryGaugePosition(int); 00100 vtkGetMacro(PrimaryGaugePosition, int); 00101 virtual void SetPrimaryGaugePositionToTop(); 00102 virtual void SetPrimaryGaugePositionToBottom(); 00103 00104 // Description: 00105 // Callbacks. Internal, do not use. 00106 virtual void ConfigureCallback(); 00107 00108 protected: 00109 vtkKWProgressGauge(); 00110 ~vtkKWProgressGauge(); 00111 00112 // Description: 00113 // Create the widget. 00114 virtual void CreateWidget(); 00115 00116 virtual void Redraw(); 00117 00118 int Width; 00119 int Height; 00120 int MinimumHeight; 00121 double BarColor[3]; 00122 double Value; 00123 int ExpandHeight; 00124 int PrimaryGaugePosition; 00125 00126 vtkKWCanvas *Canvas; 00127 00128 // PIMPL Encapsulation for STL containers 00129 //BTX 00130 vtkKWProgressGaugeInternals *Internals; 00131 //ETX 00132 00133 private: 00134 vtkKWProgressGauge(const vtkKWProgressGauge&); // Not implemented 00135 void operator=(const vtkKWProgressGauge&); // Not implemented 00136 }; 00137 00138 00139 #endif 00140