Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

GUI/Widgets/vtkKWMaterialPropertyWidget.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Module:    $RCSfile: vtkKWMaterialPropertyWidget.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 =========================================================================*/
00019 #ifndef __vtkKWMaterialPropertyWidget_h
00020 #define __vtkKWMaterialPropertyWidget_h
00021 
00022 #include "vtkKWCompositeWidget.h"
00023 
00024 class vtkKWApplication;
00025 class vtkKWFrame;
00026 class vtkKWLabel;
00027 class vtkKWFrameWithLabel;
00028 class vtkKWLabelWithLabel;
00029 class vtkKWPushButtonSetWithLabel;
00030 class vtkKWPopupButtonWithLabel;
00031 class vtkKWPushButton;
00032 class vtkKWScaleWithEntry;
00033 class vtkKWMaterialPropertyWidgetInternals;
00034 
00035 class KWWIDGETS_EXPORT vtkKWMaterialPropertyWidget : public vtkKWCompositeWidget
00036 {
00037 public:
00038   vtkTypeRevisionMacro(vtkKWMaterialPropertyWidget, vtkKWCompositeWidget);
00039   void PrintSelf(ostream& os, vtkIndent indent);
00040   
00042 
00045   vtkSetMacro(PopupMode, int);
00046   vtkGetMacro(PopupMode, int);
00047   vtkBooleanMacro(PopupMode, int);
00048   vtkGetObjectMacro(PopupButton, vtkKWPopupButtonWithLabel);
00050   
00052   virtual void Create(vtkKWApplication *app);
00053   
00056   virtual void Update();
00057 
00059   virtual void UpdatePreview();
00060 
00062 
00063   virtual void SetPreviewSize(int);
00064   virtual void SetPresetSize(int);
00065   virtual void SetPopupPreviewSize(int);
00066   vtkGetMacro(PreviewSize, int);
00067   vtkGetMacro(PresetSize, int);
00068   vtkGetMacro(PopupPreviewSize, int);
00070 
00072 
00073   virtual void SetGridOpacity(double);
00074   vtkGetMacro(GridOpacity, double);
00076   
00078 
00079   vtkGetVector3Macro(MaterialColor, double);
00080   void SetMaterialColor(double r, double g, double b);
00081   void SetMaterialColor(double color[3])
00082     { this->SetMaterialColor(color[0], color[1], color[2]); }
00084 
00086 
00088   virtual void SetLightingParametersVisibility(int);
00089   vtkBooleanMacro(LightingParametersVisibility, int);
00090   vtkGetMacro(LightingParametersVisibility, int);
00092 
00094 
00099   vtkSetMacro(PropertyChangedEvent, int);
00100   vtkGetMacro(PropertyChangedEvent, int);
00101   vtkSetMacro(PropertyChangingEvent, int);
00102   vtkGetMacro(PropertyChangingEvent, int);
00104 
00106 
00108   virtual void SetPropertyChangedCommand(
00109     vtkObject *object, const char *method);
00110   virtual void SetPropertyChangingCommand(
00111     vtkObject *object, const char *method);
00112   virtual void InvokePropertyChangedCommand();
00113   virtual void InvokePropertyChangingCommand();
00115 
00117 
00118   virtual void PropertyChangingCallback();
00119   virtual void PropertyChangedCallback();
00120   virtual void PresetMaterialCallback(int preset_idx);
00122 
00129   virtual void UpdateEnableState();
00130 
00131 protected:
00132 
00133   vtkKWMaterialPropertyWidget();
00134   ~vtkKWMaterialPropertyWidget();
00135   
00136   int   PopupMode;
00137   int   PreviewSize;
00138   int   PresetSize;
00139   int   PopupPreviewSize;
00140   double GridOpacity;
00141   int LightingParametersVisibility;
00142 
00143   double MaterialColor[3];
00144 
00146 
00147   int   PropertyChangedEvent;
00148   int   PropertyChangingEvent;
00150 
00152 
00153   char  *PropertyChangedCommand;
00154   char  *PropertyChangingCommand;
00156 
00157   virtual void InvokeCommand(const char *command);
00158 
00159   // Presets
00160 
00161   //BTX
00162   class Preset
00163   {
00164   public:
00165     double Ambient;
00166     double Diffuse;
00167     double Specular;
00168     double SpecularPower;
00169     char *HelpString;
00170 
00171     Preset() { this->HelpString = 0; };
00172   };
00173 
00174   // PIMPL Encapsulation for STL containers
00175 
00176   vtkKWMaterialPropertyWidgetInternals *Internals;
00177   friend class vtkKWMaterialPropertyWidgetInternals;
00178   //ETX
00179 
00180   // UI
00181 
00182   vtkKWPopupButtonWithLabel   *PopupButton;
00183   vtkKWFrameWithLabel         *MaterialPropertiesFrame;
00184   vtkKWFrame                  *ControlFrame;
00185   vtkKWFrame                  *LightingFrame;
00186   vtkKWScaleWithEntry         *AmbientScale;
00187   vtkKWScaleWithEntry         *DiffuseScale;
00188   vtkKWScaleWithEntry         *SpecularScale;
00189   vtkKWScaleWithEntry         *SpecularPowerScale;
00190   vtkKWFrame                  *PresetsFrame;
00191   vtkKWLabelWithLabel         *PreviewLabel;
00192   vtkKWPushButtonSetWithLabel *PresetPushButtonSet;
00193 
00195   virtual void Pack();
00196 
00198 
00199   virtual void CreateImage(unsigned char *data, 
00200                            double ambient, 
00201                            double diffuse,
00202                            double specular, 
00203                            double specular_power, 
00204                            int size);
00206   
00208   virtual void SendStateEvent(int event);
00209 
00211   virtual void AddDefaultPresets();
00212 
00214   virtual void CreatePresets();
00215 
00217   virtual void UpdatePopupPreview();
00218 
00220 
00222   virtual int UpdatePropertyFromInterface() = 0;
00223   virtual int UpdatePropertyFromPreset(const Preset *preset) = 0;
00225 
00227 
00228   virtual int UpdateScalesFromPreset(const Preset *preset);
00229   virtual void UpdateScales(double ambient, 
00230                             double diffuse,
00231                             double specular, 
00232                             double specular_power);
00234 
00236   virtual int AreControlsEnabled() { return 1; };
00237 
00238 private:
00239   vtkKWMaterialPropertyWidget(const vtkKWMaterialPropertyWidget&);  //Not implemented
00240   void operator=(const vtkKWMaterialPropertyWidget&);  //Not implemented
00241 };
00242 
00243 #endif

Generated on Tue May 30 12:31:43 2006 for ParaView by doxygen 1.3.5