• Main Page
  • Classes
  • Files
  • Directories
  • File List
  • File Members

vtkKWStartupPageWidget.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Module:    vtkKWStartupPageWidget.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 vtkKWStartupPageWidget - an HSV color selector
00015 // Open file
00016 // Double click
00017 // Drag and drop
00018 // Recent files
00019 // .SECTION Description
00020 // A widget that allows the user choose a HSV color interactively
00021 
00022 #ifndef __vtkKWStartupPageWidget_h
00023 #define __vtkKWStartupPageWidget_h
00024 
00025 #include "vtkKWCompositeWidget.h"
00026 
00027 class vtkKWCanvas;
00028 class vtkKWLabel;
00029 class vtkKWIcon;
00030 class vtkKWStartupPageWidgetInternals;
00031 class vtkKWMostRecentFilesManager;
00032 
00033 class KWWidgets_EXPORT vtkKWStartupPageWidget : public vtkKWCompositeWidget
00034 {
00035 public:
00036   static vtkKWStartupPageWidget* New();
00037   vtkTypeRevisionMacro(vtkKWStartupPageWidget,vtkKWCompositeWidget);
00038   void PrintSelf(ostream& os, vtkIndent indent);
00039 
00040   // Description:
00041   // Set/Get the gradient colors (in RGB space)
00042   vtkGetVector3Macro(GradientColor1, double);
00043   virtual void SetGradientColor1(double r, double g, double b);
00044   virtual void SetGradientColor1(double rgb[3])
00045     { this->SetGradientColor1(rgb[0], rgb[1], rgb[2]); };
00046   vtkGetVector3Macro(GradientColor2, double);
00047   virtual void SetGradientColor2(double r, double g, double b);
00048   virtual void SetGradientColor2(double rgb[3])
00049     { this->SetGradientColor2(rgb[0], rgb[1], rgb[2]); };
00050 
00051   // Description:
00052   // Set/Get the text color (in RGB space)
00053   vtkGetVector3Macro(TextColor, double);
00054   virtual void SetTextColor(double r, double g, double b);
00055   virtual void SetTextColor(double rgb[3])
00056     { this->SetTextColor(rgb[0], rgb[1], rgb[2]); };
00057 
00058   // Description:
00059   // Set/Get the text size
00060   vtkGetMacro(TextSize, int);
00061   virtual void SetTextSize(int);
00062 
00063   // Description:
00064   // Set/Get the text color (in RGB space) when it is selected (hovered on)
00065   vtkGetVector3Macro(SelectedTextColor, double);
00066   virtual void SetSelectedTextColor(double r, double g, double b);
00067   virtual void SetSelectedTextColor(double rgb[3])
00068     { this->SetSelectedTextColor(rgb[0], rgb[1], rgb[2]); };
00069 
00070   // Description:
00071   // Set/Get the hint color (in RGB space)
00072   vtkGetVector3Macro(HintColor, double);
00073   virtual void SetHintColor(double r, double g, double b);
00074   virtual void SetHintColor(double rgb[3])
00075     { this->SetHintColor(rgb[0], rgb[1], rgb[2]); };
00076 
00077   // Description:
00078   // Set/Get the hint size
00079   vtkGetMacro(HintSize, int);
00080   virtual void SetHintSize(int);
00081 
00082   // Description:
00083   // Set/Get if the hints should have a shadow.
00084   virtual void SetAddShadowToHint(int);
00085   vtkGetMacro(AddShadowToHint, int);
00086   vtkBooleanMacro(AddShadowToHint, int);
00087   
00088   // Description:
00089   // Set/Get if the Open section is supported/shown.
00090   virtual void SetSupportOpen(int);
00091   vtkGetMacro(SupportOpen, int);
00092   vtkBooleanMacro(SupportOpen, int);
00093 
00094   // Description:
00095   // Set/Get the Open section icon using an icon, or the index to a 
00096   // predefined icon found in vtkKWIcon.
00097   // Note that the Set method does *not* keep a reference to the icon
00098   // passed as parameter: it copies the whole icon contents internally.
00099   vtkGetObjectMacro(OpenIcon, vtkKWIcon);
00100   virtual void SetOpenIcon(vtkKWIcon*);
00101   virtual void SetOpenIconToPredefinedIcon(int icon_index);
00102 
00103   // Description:
00104   // Set/Get if the Double Click section is supported/shown.
00105   virtual void SetSupportDoubleClick(int);
00106   vtkGetMacro(SupportDoubleClick, int);
00107   vtkBooleanMacro(SupportDoubleClick, int);
00108   
00109   // Description:
00110   // Set/Get the Double Click section icon using an icon, or the index to a 
00111   // predefined icon found in vtkKWIcon.
00112   // Note that the Set method does *not* keep a reference to the icon
00113   // passed as parameter: it copies the whole icon contents internally.
00114   vtkGetObjectMacro(DoubleClickIcon, vtkKWIcon);
00115   virtual void SetDoubleClickIcon(vtkKWIcon*);
00116   virtual void SetDoubleClickIconToPredefinedIcon(int icon_index);
00117 
00118   // Description:
00119   // Set/Get if the Drag & Drop section is supported/shown.
00120   virtual void SetSupportDrop(int);
00121   vtkGetMacro(SupportDrop, int);
00122   vtkBooleanMacro(SupportDrop, int);
00123   
00124   // Description:
00125   // Set/Get the Drag & Drop section icon using an icon, or the index to a 
00126   // predefined icon found in vtkKWIcon.
00127   // Note that the Set method does *not* keep a reference to the icon
00128   // passed as parameter: it copies the whole icon contents internally.
00129   vtkGetObjectMacro(DropIcon, vtkKWIcon);
00130   virtual void SetDropIcon(vtkKWIcon*);
00131   virtual void SetDropIconToPredefinedIcon(int icon_index);
00132 
00133   // Description:
00134   // Set/Get if the Most Recent Files section is supported/shown.
00135   virtual void SetSupportMostRecentFiles(int);
00136   vtkGetMacro(SupportMostRecentFiles, int);
00137   vtkBooleanMacro(SupportMostRecentFiles, int);
00138   
00139   // Description:
00140   // Set/Get the Most Recent Files section icon using an icon, or the index to 
00141   // a predefined icon found in vtkKWIcon.
00142   // Note that the Set method does *not* keep a reference to the icon
00143   // passed as parameter: it copies the whole icon contents internally.
00144   vtkGetObjectMacro(MostRecentFilesIcon, vtkKWIcon);
00145   virtual void SetMostRecentFilesIcon(vtkKWIcon*);
00146   virtual void SetMostRecentFilesIconToPredefinedIcon(int icon_index);
00147 
00148   // Description:
00149   // Set/Get the Most Recent File icon (i.e. the icon used for a single
00150   // most recent file, not the section itself) using an icon, or the index to 
00151   // a predefined icon found in vtkKWIcon.
00152   // Note that the Set method does *not* keep a reference to the icon
00153   // passed as parameter: it copies the whole icon contents internally.
00154   vtkGetObjectMacro(MostRecentFileIcon, vtkKWIcon);
00155   virtual void SetMostRecentFileIcon(vtkKWIcon*);
00156   virtual void SetMostRecentFileIconToPredefinedIcon(int icon_index);
00157 
00158   // Description:
00159   // Set/Get the text size of recent file items
00160   vtkGetMacro(MostRecentFileSize, int);
00161   virtual void SetMostRecentFileSize(int);
00162 
00163   // Description:
00164   // Set/Get the most recent files manager this page should listen to.
00165   vtkGetObjectMacro(MostRecentFilesManager, vtkKWMostRecentFilesManager);
00166   virtual void SetMostRecentFilesManager(vtkKWMostRecentFilesManager *mgr);
00167 
00168   // Description:
00169   // Set/Get the maximum number of most recent files to display.
00170   vtkGetMacro(MaximumNumberOfMostRecentFiles, int);
00171   virtual void SetMaximumNumberOfMostRecentFiles(int);
00172 
00173   // Description:
00174   // Specifies commands to associate with the widget. 
00175   // 'OpenCommand' is invoked when the user click on the Open section.
00176   // The 'object' argument is the object that will have the method called on
00177   // it. The 'method' argument is the name of the method to be called and any
00178   // arguments in string form. If the object is NULL, the method is still
00179   // evaluated as a simple command. 
00180   virtual void SetOpenCommand(
00181     vtkObject *object, const char *method);
00182 
00183   // Description:
00184   // Specifies commands to associate with the widget. 
00185   // 'DropCommand' is invoked when the user drop a file on the widget.
00186   // The 'object' argument is the object that will have the method called on
00187   // it. The 'method' argument is the name of the method to be called and any
00188   // arguments in string form. If the object is NULL, the method is still
00189   // evaluated as a simple command. 
00190   // The following parameters are also passed to the command:
00191   // - filename(s): list of filenames
00192   virtual void SetDropCommand(
00193     vtkObject *object, const char *method);
00194 
00195   // Description:
00196   // Specifies commands to associate with the widget. 
00197   // 'DoubleClickCommand' is invoked when the user double-click anywhere
00198   // in the page widget.
00199   // The 'object' argument is the object that will have the method called on
00200   // it. The 'method' argument is the name of the method to be called and any
00201   // arguments in string form. If the object is NULL, the method is still
00202   // evaluated as a simple command. 
00203   virtual void SetDoubleClickCommand(
00204     vtkObject *object, const char *method);
00205 
00206   // Description:
00207   // Access to the canvas and internal elements
00208   vtkGetObjectMacro(StartupPageCanvas, vtkKWCanvas);
00209 
00210   // Description:
00211   // Update the whole UI depending on the value of the Ivars
00212   virtual void Update();
00213 
00214   // Description:
00215   // Update the "enable" state of the object and its internal parts.
00216   // Depending on different Ivars (this->Enabled, the application's 
00217   // Limited Edition Mode, etc.), the "enable" state of the object is updated
00218   // and propagated to its internal parts/subwidgets. This will, for example,
00219   // enable/disable parts of the widget UI, enable/disable the visibility
00220   // of 3D widgets, etc.
00221   virtual void UpdateEnableState();
00222 
00223   // Description:
00224   // Callbacks. Internal, do not use.
00225   virtual void ConfigureCallback();
00226   virtual void RedrawCallback();
00227   virtual void HighlightSectionCallback(const char *tag, int flag);
00228   virtual void OpenCallback();
00229   virtual void DoubleClickCallback();
00230 
00231   // Description:
00232   // Add all the default observers needed by that object, or remove
00233   // all the observers that were added through AddCallbackCommandObserver.
00234   // Subclasses can override these methods to add/remove their own default
00235   // observers, but should call the superclass too.
00236   virtual void AddCallbackCommandObservers();
00237   virtual void RemoveCallbackCommandObservers();
00238 
00239 protected:
00240   vtkKWStartupPageWidget();
00241   ~vtkKWStartupPageWidget();
00242 
00243   // Description:
00244   // Create the widget.
00245   virtual void CreateWidget();
00246 
00247   double GradientColor1[3];
00248   double GradientColor2[3];
00249   double TextColor[3];
00250   double SelectedTextColor[3];
00251   double HintColor[3];
00252 
00253   int TextSize;
00254   int HintSize;
00255   int MostRecentFileSize;
00256 
00257   int    SupportOpen;
00258   int    SupportDoubleClick;
00259   int    SupportDrop;
00260   int    SupportMostRecentFiles;
00261 
00262   int    MaximumNumberOfMostRecentFiles;
00263   int    AddShadowToHint;
00264 
00265   vtkKWIcon *OpenIcon;
00266   vtkKWIcon *DoubleClickIcon;
00267   vtkKWIcon *DropIcon;
00268   vtkKWIcon *MostRecentFilesIcon;
00269   vtkKWIcon *MostRecentFileIcon;
00270 
00271   // Recent files manager
00272 
00273   vtkKWMostRecentFilesManager *MostRecentFilesManager;
00274 
00275   // Commands
00276 
00277   char *OpenCommand;
00278   char *DropCommand;
00279   char *DoubleClickCommand;
00280 
00281   // GUI
00282 
00283   vtkKWCanvas *StartupPageCanvas;
00284 
00285   // Description:
00286   // Bind/Unbind all components.
00287   virtual void Bind();
00288   virtual void UnBind();
00289 
00290   // Description:
00291   // Redraw or update canvas elements
00292   virtual void Redraw();
00293   virtual void ScheduleRedraw();
00294 
00295   // Description:
00296   // Update bindings, fonts, colors, icons
00297   virtual void UpdateInternalCanvasBindings();
00298   virtual void UpdateInternalCanvasColors();
00299   virtual void UpdateInternalCanvasFonts();
00300   virtual void UpdateInternalCanvasIcons();
00301 
00302   // Description:
00303   // Draw section
00304   virtual void AddSectionToCanvas(
00305     ostream &tk_cmd, 
00306     int x, int y, 
00307     vtkKWIcon *icon,
00308     const char *text, const char *text_font, 
00309     const char *hint, const char *hint_font, 
00310     vtkObject *object, const char *method,
00311     const char *tag, const char *extra_tag = NULL);
00312 
00313   virtual void AddMostRecentFilesSectionToCanvas(
00314     ostream &tk_cmd, 
00315     int x, int y);
00316 
00317   // Description:
00318   // Invoke the commands
00319   virtual void InvokeOpenCommand();
00320   virtual void InvokeDoubleClickCommand();
00321 
00322   // PIMPL Encapsulation for STL containers
00323   //BTX
00324   vtkKWStartupPageWidgetInternals *Internals;
00325   //ETX
00326 
00327   // Description:
00328   // Processes the events that are passed through CallbackCommand (or others).
00329   // Subclasses can oberride this method to process their own events, but
00330   // should call the superclass too.
00331   virtual void ProcessCallbackCommandEvents(
00332     vtkObject *caller, unsigned long event, void *calldata);
00333 
00334   // Description:
00335   // Helpers
00336   virtual int GetHorizontalIncrementFromIcon(vtkKWIcon *icon);
00337   
00338 private:
00339   vtkKWStartupPageWidget(const vtkKWStartupPageWidget&); // Not implemented
00340   void operator=(const vtkKWStartupPageWidget&); // Not implemented
00341 };
00342 
00343 #endif
00344 

Generated on Mon Aug 16 2010 18:58:47 for KWWidgets by  doxygen 1.7.1