ctkExampleDerivedWorkflowWidgetStep.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) Kitware Inc.
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0.txt
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. =========================================================================*/
  14. #ifndef __ctkExampleDerivedWorkflowWidgetStep_h
  15. #define __ctkExampleDerivedWorkflowWidgetStep_h
  16. // CTK includes
  17. #include "ctkPimpl.h"
  18. #include "ctkWorkflowWidgetStep.h"
  19. #include "ctkWorkflowTransitions.h"
  20. class ctkWorkflow;
  21. class ctkExampleDerivedWorkflowWidgetStepPrivate;
  22. class QLabel;
  23. class QLineEdit;
  24. ///
  25. /// ctkExampleDerivedWorkflowWidgetStep is an example custom step with
  26. /// a user interface, created by deriving ctkWorkflowWidgetStep and
  27. /// re-implementing validate(const QString&), onEntry(), onExit()
  28. /// and populateStepWidgetsList().
  29. class ctkExampleDerivedWorkflowWidgetStep : public ctkWorkflowWidgetStep
  30. {
  31. Q_OBJECT
  32. public:
  33. typedef ctkWorkflowWidgetStep Superclass;
  34. explicit ctkExampleDerivedWorkflowWidgetStep(const QString& newId);
  35. virtual ~ctkExampleDerivedWorkflowWidgetStep();
  36. ///
  37. /// Set/get the label on this step's user interface
  38. QLabel* label()const;
  39. void setLabel(QLabel* label);
  40. ///
  41. /// Set/get the line edit on this step's user interface
  42. QLineEdit* lineEdit()const;
  43. void setLineEdit(QLineEdit* lineEdit);
  44. ///
  45. /// Get the values for the counters of the number of times we have
  46. /// run the onEntry() and onExit() functions
  47. int numberOfTimesRanOnEntry()const;
  48. int numberOfTimesRanOnExit()const;
  49. ///
  50. /// Adds the label and line edit on this step's user interface to
  51. /// the given list, which will be used by the superclass's
  52. /// showUserInterface() function
  53. virtual void createUserInterface();
  54. protected:
  55. virtual void validate(const QString& desiredBranchId = QString());
  56. ///
  57. /// Increments the counter numberOfTimesRanOnEntry
  58. virtual void onEntry(const ctkWorkflowStep* comingFrom, const ctkWorkflowInterstepTransition::InterstepTransitionType transitionType);
  59. ///
  60. /// Increments the counter numberOfTimesRanOnExit
  61. virtual void onExit(const ctkWorkflowStep* goingTo, const ctkWorkflowInterstepTransition::InterstepTransitionType transitionType);
  62. protected:
  63. QScopedPointer<ctkExampleDerivedWorkflowWidgetStepPrivate> d_ptr;
  64. private:
  65. Q_DECLARE_PRIVATE(ctkExampleDerivedWorkflowWidgetStep);
  66. Q_DISABLE_COPY(ctkExampleDerivedWorkflowWidgetStep);
  67. };
  68. #endif