CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkWorkflowWidgetStep.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Library: CTK
4 
5  Copyright (c) Kitware Inc.
6 
7  Licensed under the Apache License, Version 2.0 (the "License");
8  you may not use this file except in compliance with the License.
9  You may obtain a copy of the License at
10 
11  http://www.apache.org/licenses/LICENSE-2.0.txt
12 
13  Unless required by applicable law or agreed to in writing, software
14  distributed under the License is distributed on an "AS IS" BASIS,
15  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  See the License for the specific language governing permissions and
17  limitations under the License.
18 
19 =========================================================================*/
20 
21 #ifndef __ctkWorkflowWidgetStep_h
22 #define __ctkWorkflowWidgetStep_h
23 
24 // Qt includes
25 #include <QWidget>
26 #include <QBoxLayout>
27 #include <QFlags>
28 #include <QIcon>
29 
30 // CTK includes
31 #include "ctkPimpl.h"
32 #include "ctkWidgetsExport.h"
33 #include "ctkWorkflowStep.h"
34 #include "ctkWorkflowTransitions.h"
35 
37 
38 class ctkWorkflowWidgetStepPrivate;
39 
58 
59 class CTK_WIDGETS_EXPORT ctkWorkflowWidgetStep : public QWidget, public ctkWorkflowStep
60 {
61  Q_OBJECT
62  Q_PROPERTY(QString stepid READ id WRITE setId)
63  Q_PROPERTY(QString name READ name WRITE setName)
64  Q_PROPERTY(QString description READ description WRITE setDescription)
65  Q_PROPERTY(QIcon icon READ icon WRITE setIcon)
66  Q_PROPERTY(QString statusText READ statusText)
67  Q_PROPERTY(QString backButtonText READ backButtonText WRITE setBackButtonText)
68  Q_PROPERTY(QString nextButtonText READ nextButtonText WRITE setNextButtonText)
69  Q_FLAGS(ButtonBoxHint ButtonBoxHints)
70  Q_ENUMS(ButtonBoxHint)
71  Q_PROPERTY(ButtonBoxHints buttonBoxHints READ buttonBoxHints WRITE setButtonBoxHints)
72 public:
73 
75  NoHints = 0x0,
76  BackButtonHidden = 0x1,
77  BackButtonDisabled = 0x2,
78  NextButtonHidden = 0x4,
79  NextButtonDisabled = 0x8,
80  ButtonBoxHidden = 0x10
81  };
82  Q_DECLARE_FLAGS(ButtonBoxHints, ButtonBoxHint)
83 
84  explicit ctkWorkflowWidgetStep(QWidget* newParent = 0);
85  explicit ctkWorkflowWidgetStep(const QString& newId, QWidget* newParent = 0);
87 
90  virtual QString backButtonText()const;
91  virtual void setBackButtonText(const QString& name);
92 
95  virtual QString nextButtonText()const;
96  virtual void setNextButtonText(const QString& name);
97 
100  void setButtonBoxHints(ButtonBoxHints buttonBoxHints);
101  ButtonBoxHints buttonBoxHints()const;
102 
105  QIcon icon()const;
106  void setIcon(const QIcon& newIcon);
107 
109  virtual QWidget* stepArea();
110 
114  virtual bool hasShowUserInterfaceCommand()const;
115  virtual void setHasShowUserInterfaceCommand(bool flag);
116 
120  virtual bool hasCreateUserInterfaceCommand()const;
121  virtual void setHasCreateUserInterfaceCommand(bool flag);
122 
123 protected:
124 
126  virtual void createUserInterface(){}
127 
129  virtual void showUserInterface();
130 
135 
140 
145 
150 
151 private:
152 
153  //Q_DECLARE_PRIVATE(ctkWorkflowWidgetStep);
154  // Since this class derives from both QWidget and ctkWorkflowStep,
155  // let's specify which 'd_ptr' to use to avoid ambiguous reference
156  inline ctkWorkflowWidgetStepPrivate* d_func() { return reinterpret_cast<ctkWorkflowWidgetStepPrivate *>(qGetPtrHelper(ctkWorkflowStep::d_ptr)); }
157  inline const ctkWorkflowWidgetStepPrivate* d_func() const { return reinterpret_cast<const ctkWorkflowWidgetStepPrivate *>(qGetPtrHelper(ctkWorkflowStep::d_ptr)); }
158  friend class ctkWorkflowWidgetStepPrivate;
159 
160  Q_DISABLE_COPY(ctkWorkflowWidgetStep);
161  friend class ctkWorkflowGroupBox; // For access to showUserInterface()
162 };
163 
164  Q_DECLARE_OPERATORS_FOR_FLAGS(ctkWorkflowWidgetStep::ButtonBoxHints)
165 
166 #endif
167 
ctkWorkflowGroupBox is a widget displaying the user interface elements, title, description and/or err...
ctkWorkflowStep is the basis for a workflow step.
QScopedPointer< ctkWorkflowStepPrivate > d_ptr
ctkWorkflowWidgetStep is a convienience class to quickly construct a ctkWorkflowStep with a user inte...
void createUserInterfaceComplete() const
Signal (emitted by the private implementation) indicating that the step's createUserInterface() metho...
void showUserInterfaceComplete() const
Signal (emitted by the private implementation) indicating that the step's showUserInterface() method ...
virtual void showUserInterface()
Prepares the step to be shown.
void invokeCreateUserInterfaceCommand() const
Signal (emitted by the private implementation) indicating that the step's createUserInterface() metho...
void invokeShowUserInterfaceCommand() const
Signal (emitted by the private implementation) indicating that the step's 'showUserInterface() method...
Q_DECLARE_OPERATORS_FOR_FLAGS(ctkVTKDataSetModel::AttributeTypes)