debian/tmp/usr/include/KWWidgets/vtkKWColorPickerWidget.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Module:    $RCSfile: vtkKWColorPickerWidget.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 vtkKWColorPickerWidget - a color picker widget
00015 // .SECTION Description
00016 // A widget that can be used to pick a color. It provides interactive
00017 // RGB and HSV sliders, a color spectrum area, and various other means to
00018 // select or enter color coordinates. It features a set of colors swatches, a 
00019 // color preset editor that can be used store a list of persistent/favorite 
00020 // colors, and a history of "recently picked" colors.
00021 // This widget can be embedded in any other UI. For a standalone 
00022 // toplevel/dialog color picker, check the vtkKWColorPickerDialog class.
00023 // .SECTION Thanks
00024 // This work is part of the National Alliance for Medical Image
00025 // Computing (NAMIC), funded by the National Institutes of Health
00026 // through the NIH Roadmap for Medical Research, Grant U54 EB005149.
00027 // Information on the National Centers for Biomedical Computing
00028 // can be obtained from http://nihroadmap.nih.gov/bioinformatics.
00029 // .SECTION See Also
00030 // vtkKWColorPickerDialog vtkKWColorSpectrumWidget vtkKWColorPresetSelector
00031 
00032 #ifndef __vtkKWColorPickerWidget_h
00033 #define __vtkKWColorPickerWidget_h
00034 
00035 #include "vtkKWCompositeWidget.h"
00036 
00037 class vtkKWColorSpectrumWidget;
00038 class vtkKWColorPresetSelector;
00039 class vtkKWColorTransferFunctionEditor;
00040 class vtkKWEntryWithLabel;
00041 class vtkKWFrame;
00042 class vtkKWColorSwatchesWidget;
00043 class vtkKWLabel;
00044 class vtkKWLabelSet;
00045 class vtkKWNotebook;
00046 class vtkKWRadioButton;
00047 class vtkKWLabelWithLabel;
00048 class vtkKWColorPickerWidgetInternals;
00049 class vtkKWPushButton;
00050 
00051 class KWWidgets_EXPORT vtkKWColorPickerWidget : public vtkKWCompositeWidget
00052 {
00053 public:
00054   static vtkKWColorPickerWidget* New();
00055   vtkTypeRevisionMacro(vtkKWColorPickerWidget,vtkKWCompositeWidget);
00056   void PrintSelf(ostream& os, vtkIndent indent);
00057 
00058   // Description:
00059   // Set/Get the current color as RGB, or HSV.
00060   virtual double *GetNewColorAsRGB();
00061   virtual void GetNewColorAsRGB(double &, double &, double &);
00062   virtual void GetNewColorAsRGB(double _arg[3]);
00063   virtual void SetNewColorAsRGB(double r, double g, double b);
00064   virtual void SetNewColorAsRGB(double rgb[3]);
00065   virtual double *GetNewColorAsHSV();
00066   virtual void GetNewColorAsHSV(double &, double &, double &);
00067   virtual void GetNewColorAsHSV(double _arg[3]);
00068   virtual void SetNewColorAsHSV(double r, double g, double b);
00069   virtual void SetNewColorAsHSV(double rgb[3]);
00070 
00071   // Description:
00072   // Set/Get the current color as RGB, or HSV.
00073   // WARNING: the "current" color is not the one that is modified 
00074   // interactively; the "new" color is (see Set/GetNewColorAs...). Think
00075   // of the "current" color as a reference against which the user can 
00076   // compare his new choice at all time.
00077   virtual double *GetCurrentColorAsRGB();
00078   virtual void GetCurrentColorAsRGB(double &, double &, double &);
00079   virtual void GetCurrentColorAsRGB(double _arg[3]);
00080   virtual void SetCurrentColorAsRGB(double r, double g, double b);
00081   virtual void SetCurrentColorAsRGB(double rgb[3]);
00082   virtual double *GetCurrentColorAsHSV();
00083   virtual void GetCurrentColorAsHSV(double &, double &, double &);
00084   virtual void GetCurrentColorAsHSV(double _arg[3]);
00085   virtual void SetCurrentColorAsHSV(double r, double g, double b);
00086   virtual void SetCurrentColorAsHSV(double rgb[3]);
00087 
00088   // Description:
00089   // Access the color preset selector. Note that you can set their
00090   // RegistryKey ivar to save/restore the favorites and history presets
00091   // automatically (as done by the vtkKWColorPickerDialog class). 
00092   // Make sure RegistryKey is set *before* calling the Create() method.
00093   // Check the vtkKWColorPresetSelector for more details.
00094   virtual vtkKWColorPresetSelector* GetFavoritesColorPresetSelector();
00095   virtual vtkKWColorPresetSelector* GetHistoryColorPresetSelector();
00096 
00097   // Description:
00098   // Set/Get the color spectrum visibility.
00099   vtkBooleanMacro(ColorSpectrumVisibility, int);
00100   virtual void SetColorSpectrumVisibility(int);
00101   vtkGetMacro(ColorSpectrumVisibility, int);
00102 
00103   // Description:
00104   // Set/Get the color swatches visibility.
00105   vtkBooleanMacro(ColorSwatchesVisibility, int);
00106   virtual void SetColorSwatchesVisibility(int);
00107   vtkGetMacro(ColorSwatchesVisibility, int);
00108 
00109   // Description:
00110   // Get the internal color swatches
00111   vtkGetObjectMacro(ColorSwatchesWidget, vtkKWColorSwatchesWidget);   
00112    
00113   // Description:
00114   // Set/Get the favorites preset selector visibility.
00115   vtkBooleanMacro(FavoritesVisibility, int);
00116   virtual void SetFavoritesVisibility(int);
00117   vtkGetMacro(FavoritesVisibility, int);
00118 
00119   // Description:
00120   // Set/Get the history preset selector visibility.
00121   vtkBooleanMacro(HistoryVisibility, int);
00122   virtual void SetHistoryVisibility(int);
00123   vtkGetMacro(HistoryVisibility, int);
00124 
00125   // Description:
00126   // Set/Get if the layout should be compact (off by default).
00127   // Less precision can be achieved in compact mode, as the sliders and
00128   // the spectrum widgets are twice as small.
00129   vtkBooleanMacro(CompactMode, int);
00130   virtual void SetCompactMode(int);
00131   vtkGetMacro(CompactMode, int);
00132   virtual void ToggleCompactMode();
00133 
00134   // Description:
00135   // Events.
00136   // Not that no color values are passed as parameters (calldata), only
00137   // the value of EventCallData (defaults to NULL)
00138   //BTX
00139   enum
00140   {
00141     NewColorChangedEvent = 10000,
00142     NewColorChangingEvent,
00143     CompactModeChangedEvent
00144   };
00145   vtkGetMacro(EventCallData, void*);
00146   vtkSetMacro(EventCallData, void*);
00147   //ETX
00148 
00149   // Description:
00150   // Callbacks
00151   virtual void FavoritesColorPresetApplyCallback(int id);
00152   virtual int  FavoritesColorPresetAddCallback();
00153   virtual void FavoritesColorPresetUpdateCallback(int id);
00154   virtual void HistoryColorPresetApplyCallback(int id);
00155   virtual void CurrentColorCallback();
00156   virtual void HexadecimalColorEntryCallback(const char*);
00157   virtual void SwatchSelectedCallback(double r, double g, double b);
00158   virtual void UpdateInfoLabelCallback();
00159 
00160   // Description:
00161   // Update the "enable" state of the object and its internal parts.
00162   // Depending on different Ivars (this->Enabled, the application's 
00163   // Limited Edition Mode, etc.), the "enable" state of the object is updated
00164   // and propagated to its internal parts/subwidgets. This will, for example,
00165   // enable/disable parts of the widget UI, enable/disable the visibility
00166   // of 3D widgets, etc.
00167   virtual void UpdateEnableState();
00168 
00169 protected:
00170   vtkKWColorPickerWidget();
00171   ~vtkKWColorPickerWidget();
00172 
00173   // Description:
00174   // Create the widget.
00175   virtual void CreateWidget();
00176 
00177   // Description:
00178   // Pack.
00179   virtual void Pack();
00180 
00181   // Description:
00182   // Set/Get internal new color. 
00183   double InternalNewColorAsRGB[3];
00184   vtkGetVector3Macro(InternalNewColorAsRGB, double);
00185   virtual void SetInternalNewColorAsRGB(double r, double g, double b);
00186   virtual void SetInternalNewColorAsRGB(double rgb[3]);
00187   double InternalNewColorAsHSV[3];
00188   vtkGetVector3Macro(InternalNewColorAsHSV, double);
00189   virtual void SetInternalNewColorAsHSV(double h, double s, double v);
00190   virtual void SetInternalNewColorAsHSV(double hsv[3]);
00191 
00192   // Description:
00193   // Set/Get internal current color. 
00194   double InternalCurrentColorAsRGB[3];
00195   vtkGetVector3Macro(InternalCurrentColorAsRGB, double);
00196   virtual void SetInternalCurrentColorAsRGB(double r, double g, double b);
00197   virtual void SetInternalCurrentColorAsRGB(double rgb[3]);
00198   double InternalCurrentColorAsHSV[3];
00199   vtkGetVector3Macro(InternalCurrentColorAsHSV, double);
00200   virtual void SetInternalCurrentColorAsHSV(double h, double s, double v);
00201   virtual void SetInternalCurrentColorAsHSV(double hsv[3]);
00202 
00203   vtkKWFrame                       *SlidersFrame;
00204 
00205   vtkKWFrame                       *RGBSlidersFrame;
00206   vtkKWColorTransferFunctionEditor *RGBSliders[3];
00207 
00208   vtkKWFrame                       *HSVSlidersFrame;
00209   vtkKWColorTransferFunctionEditor *HSVSliders[3];
00210 
00211   vtkKWRadioButton                  *FixedAxisRadioButton[6];
00212   vtkKWLabel                        *SliderUnitLabel[6];
00213 
00214   vtkKWNotebook *Notebook;
00215 
00216   vtkKWEntryWithLabel              *HexadecimalColorEntry;
00217   vtkKWColorSpectrumWidget         *ColorSpectrumWidget;
00218   vtkKWColorPresetSelector         *FavoritesColorPresetSelector;
00219   vtkKWColorPresetSelector         *HistoryColorPresetSelector;
00220   vtkKWColorSwatchesWidget         *ColorSwatchesWidget;
00221 
00222   vtkKWFrame                       *ColorsFrame;
00223   vtkKWLabelSet                    *ColorsLabelSet;
00224   vtkKWLabelSet                    *ColorsNameLabelSet;
00225 
00226   vtkKWLabelWithLabel              *InfoLabel;
00227   vtkKWPushButton                  *CompactModeButton;
00228 
00229   virtual void UpdateSlidersRGB(double rgb[3]);
00230   virtual void UpdateSlidersHSV(double hsv[3]);
00231   virtual void UpdateColorLabel(vtkKWLabel *label, double rgb[3]);
00232   virtual void UpdateHexadecimalColorEntry(double rgb[3]);
00233 
00234   virtual void UpdateInfoLabel();
00235   virtual void ScheduleUpdateInfoLabel();
00236 
00237   int ColorSpectrumVisibility;
00238   int ColorSwatchesVisibility;
00239   int FavoritesVisibility;
00240   int HistoryVisibility;
00241   int CompactMode;
00242 
00243   void *EventCallData;
00244 
00245   virtual void CreateFavoritesColorPresetSelector();
00246   virtual void CreateHistoryColorPresetSelector();
00247   virtual void CreateColorSwatchesWidget();
00248 
00249   virtual void ColorSpectrumChangingCallback();
00250   virtual void RGBSlidersChangingCallback();
00251   virtual void HSVSlidersChangingCallback();
00252 
00253   virtual void NewColorChanged();
00254   virtual void NewColorChanging();
00255 
00256   virtual void AdjustToCompactMode();
00257 
00258   // Description:
00259   // Processes the events that are passed through CallbackCommand (or others).
00260   // Subclasses can oberride this method to process their own events, but
00261   // should call the superclass too.
00262   virtual void ProcessCallbackCommandEvents(
00263     vtkObject *caller, unsigned long event, void *calldata);
00264   
00265   // PIMPL Encapsulation for STL containers
00266   //BTX
00267   vtkKWColorPickerWidgetInternals *Internals;
00268   //ETX
00269 
00270 private:
00271   vtkKWColorPickerWidget(const vtkKWColorPickerWidget&); // Not implemented
00272   void operator=(const vtkKWColorPickerWidget&); // Not implemented
00273 };
00274 
00275 
00276 #endif

Generated on Sat Dec 12 16:04:53 2009 for KWWidgets by  doxygen 1.6.1