KWWidgets
debian/tmp/usr/include/KWWidgets/vtkKWWizardWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Module: $RCSfile: vtkKWWizardWidget.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 vtkKWWizardWidget - a superclass for creating wizards UI.
15 // .SECTION Description
16 // This class is the basis for a wizard widget/dialog. It embeds a
17 // wizard workflow (i.e. a state machine) and tie it to navigation buttons.
18 // This widget can be inserted directly inside another user interface;
19 // most of the time, however, people will use a vtkKWWizardDialog, which
20 // is just an independent toplevel embedding a vtkKWWizardWidget.
21 // .SECTION Thanks
22 // This work is part of the National Alliance for Medical Image
23 // Computing (NAMIC), funded by the National Institutes of Health
24 // through the NIH Roadmap for Medical Research, Grant U54 EB005149.
25 // Information on the National Centers for Biomedical Computing
26 // can be obtained from http://nihroadmap.nih.gov/bioinformatics.
27 // .SECTION See Also
28 // vtkKWWizardDialog vtkKWWizardStep vtkKWWizardWorkflow
29 
30 #ifndef __vtkKWWizardWidget_h
31 #define __vtkKWWizardWidget_h
32 
33 #include "vtkKWCompositeWidget.h"
34 
35 class vtkKWPushButton;
36 class vtkKWLabel;
38 class vtkKWFrame;
39 class vtkKWSeparator;
41 
43 {
44 public:
45  static vtkKWWizardWidget* New();
46  vtkTypeRevisionMacro(vtkKWWizardWidget,vtkKWCompositeWidget);
47  void PrintSelf(ostream& os, vtkIndent indent);
48 
49  // Description:
50  // Get the wizard workflow instance.
51  vtkGetObjectMacro(WizardWorkflow, vtkKWWizardWorkflow);
52 
53  // Description:
54  // Get the client area. This is where user content should be placed.
55  // A wizard workflow is made of steps (vtkKWWizardStep). Each step
56  // should set its vtkKWWizardStep::ShowUserInterfaceCommand callback to point
57  // to a method that will display this step's UI (or reimplement
58  // vtkKWWizardStep::ShowUserInterface). Within that method,
59  // all widgets should be children of this ClientArea.
60  vtkGetObjectMacro(ClientArea, vtkKWFrame);
61 
62  // Description:
63  // Set the minimum client area height. No effect if called before Create().
64  virtual void SetClientAreaMinimumHeight(int);
65 
66  // Description:
67  // Refresh the interface.
68  // This important method will refresh the state of the buttons, depending
69  // on the current workflow navigation stack. If the workflow's FinishStep
70  // step is defined, it will invoke its CanGoToSelf method/callback to check
71  // if it can be reached directly, and enable the Finish button accordingly.
72  // This method should be called each time modifying the UI of the current
73  // step may have an impact on navigating the workflow. For example, updating
74  // the value of a specific entry may forbid the user to move to the Finish
75  // step directly. Check the entry's API for callbacks that can
76  // be triggered with a small granularity (vtkKWEntry::Command,
77  // vtkKWEntry::SetCommandTriggerToAnyChange, vtkKWScale::Command, etc.).
78  virtual void Update();
79 
80  // Description:
81  // Set the title text (usually a few words), located in the top area.
82  // Note that this method is called automatically by Update() to display
83  // the name of the WizardWorkflow's CurrentStep() step (see the
84  // vtkKWWizardStep::GetName() method).
85  virtual void SetTitle(const char *);
86  virtual char* GetTitle();
87 
88  // Description:
89  // Set the subtitle text (usually a short sentence or two), located in the
90  // top area below the title.
91  // Note that this method is called automatically by Update() to display
92  // the description of the WizardWorkflow's CurrentStep() step (see the
93  // vtkKWWizardStep::GetDescription() method).
94  virtual void SetSubTitle(const char *);
95  virtual char* GetSubTitle();
96 
97  // Description:
98  // Set/Get the background color of the title area.
99  virtual void GetTitleAreaBackgroundColor(double *r, double *g, double *b);
100  virtual double* GetTitleAreaBackgroundColor();
101  virtual void SetTitleAreaBackgroundColor(double r, double g, double b);
102  virtual void SetTitleAreaBackgroundColor(double rgb[3])
103  { this->SetTitleAreaBackgroundColor(rgb[0], rgb[1], rgb[2]); };
104 
105  // Description:
106  // Get the wizard icon, located in the top area right of the title.
107  // This can be used to provide a better graphical identity to the wizard.
108  vtkGetObjectMacro(TitleIconLabel, vtkKWLabel);
109 
110  // Description:
111  // Set the pre-text, i.e. the contents of a convenience text section placed
112  // just above the client area.
113  virtual void SetPreText(const char *);
114  virtual char* GetPreText();
115 
116  // Description:
117  // Set the post-text, i.e. the contents of a convenience text section placed
118  // just below the client area.
119  virtual void SetPostText(const char *);
120  virtual char* GetPostText();
121 
122  // Description:
123  // Set the error text, i.e. the contents of a convenience text section
124  // placed just below the client area. It is prefixed with an error icon.
125  // This is typically used by a step's vtkKWWizardStep::Validate
126  // method/callback to report an error when validating the UI failed.
127  virtual void SetErrorText(const char *);
128  virtual char* GetErrorText();
129 
130  // Description:
131  // Unpack all children in the client-area and set all pre-/post-/title label
132  // to empty strings.
133  // This is typically used by a step's
134  // vtkKWWizardStep::HideUserInterfaceCommand callback (or the
135  // vtkKWWizardStep::HideUserInterface method) to hide the step's UI
136  // or release resources that were allocated specifically for a step's UI.
137  virtual void ClearPage();
138 
139  // Description:
140  // Set/Get the visibility of the buttons.
141  virtual void SetBackButtonVisibility(int);
142  vtkGetMacro(BackButtonVisibility,int);
143  vtkBooleanMacro(BackButtonVisibility,int);
144  virtual void SetNextButtonVisibility(int);
145  vtkGetMacro(NextButtonVisibility,int);
146  vtkBooleanMacro(NextButtonVisibility,int);
147  virtual void SetFinishButtonVisibility(int);
148  vtkGetMacro(FinishButtonVisibility,int);
149  vtkBooleanMacro(FinishButtonVisibility,int);
150  virtual void SetCancelButtonVisibility(int);
151  vtkGetMacro(CancelButtonVisibility,int);
152  vtkBooleanMacro(CancelButtonVisibility,int);
153  virtual void SetHelpButtonVisibility(int);
154  vtkGetMacro(HelpButtonVisibility,int);
155  vtkBooleanMacro(HelpButtonVisibility,int);
156  virtual void SetOKButtonVisibility(int);
157  vtkGetMacro(OKButtonVisibility,int);
158  vtkBooleanMacro(OKButtonVisibility,int);
159 
160  // Description:
161  // Get and customize some UI elements.
162  vtkGetObjectMacro(CancelButton, vtkKWPushButton);
163  vtkGetObjectMacro(OKButton, vtkKWPushButton);
164  vtkGetObjectMacro(FinishButton, vtkKWPushButton);
165  vtkGetObjectMacro(HelpButton, vtkKWPushButton);
166  vtkGetObjectMacro(SeparatorBeforeButtons, vtkKWSeparator);
167  vtkGetObjectMacro(SubTitleLabel, vtkKWLabel);
168  vtkGetObjectMacro(TitleLabel, vtkKWLabel);
169 
170  // Description:
171  // If supported, set the label position in regards to the rest of
172  // the composite widget. Check the subclass for more information about
173  // what the Default position is, and if specific positions are supported.
174  //BTX
175  enum
176  {
177  ButtonsPositionTop = 0,
178  ButtonsPositionBottom
179  };
180  //ETX
181  virtual void SetButtonsPosition(int);
182  vtkGetMacro(ButtonsPosition, int);
183  virtual void SetButtonsPositionToTop()
184  { this->SetButtonsPosition(vtkKWWizardWidget::ButtonsPositionTop); };
185  virtual void SetButtonsPositionToBottom()
186  { this->SetButtonsPosition(vtkKWWizardWidget::ButtonsPositionBottom); };
187 
188  // Description:
189  // Add all the default observers needed by that object, or remove
190  // all the observers that were added through AddCallbackCommandObserver.
191  // Subclasses can override these methods to add/remove their own default
192  // observers, but should call the superclass too.
193  virtual void AddCallbackCommandObservers();
194  virtual void RemoveCallbackCommandObservers();
195 
196  // Description:
197  // Update the "enable" state of the object and its internal parts.
198  // Depending on different Ivars (this->Enabled, the application's
199  // Limited Edition Mode, etc.), the "enable" state of the object is updated
200  // and propagated to its internal parts/subwidgets. This will, for example,
201  // enable/disable parts of the widget UI, enable/disable the visibility
202  // of 3D widgets, etc.
203  virtual void UpdateEnableState();
204 
205 protected:
208 
209  // Description:
210  // Create the widget
211  virtual void CreateWidget();
212 
213  // Description:
214  // Pack the buttons.
215  virtual void PackButtons();
216 
218 
225 
227 
232 
234 
240 
242 
250 
251  // Description:
252  // Processes the events that are passed through CallbackCommand (or others).
253  // Subclasses can oberride this method to process their own events, but
254  // should call the superclass too.
255  virtual void ProcessCallbackCommandEvents(
256  vtkObject *caller, unsigned long event, void *calldata);
257 
258 private:
259  vtkKWWizardWidget(const vtkKWWizardWidget&); // Not implemented
260  void operator=(const vtkKWWizardWidget&); // Not Implemented
261 };
262 
263 #endif