ctkWorkflowWidgetStep.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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.commontk.org/LICENSE
  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 __ctkWorkflowWidgetStep_h
  15. #define __ctkWorkflowWidgetStep_h
  16. // QT includes
  17. #include <QWidget>
  18. #include <QIcon>
  19. #include <QBoxLayout>
  20. #include <QFlags>
  21. // CTK includes
  22. #include "ctkPimpl.h"
  23. #include "ctkWorkflowStep.h"
  24. #include "ctkWorkflowTransitions.h"
  25. #include "ctkWorkflowAbstractWidgetStep.h"
  26. #include "ctkWidgetsExport.h"
  27. class ctkWorkflowWidgetStepPrivate;
  28. class ctkWorkflowButtonBoxWidget;
  29. class ctkWorkflowGroupBox;
  30. class ctkWorkflow;
  31. ///
  32. /// \brief A concrete implementation of ctkWorkflowAbstractWidgetStep that derives from QWidget.
  33. class ctkWorkflowWidgetStepPlugin;
  34. class CTK_WIDGETS_EXPORT ctkWorkflowWidgetStep : public QWidget,
  35. public ctkWorkflowAbstractWidgetStep
  36. {
  37. Q_OBJECT
  38. Q_PROPERTY(QString id READ id WRITE setId)
  39. Q_PROPERTY(QIcon icon READ icon WRITE setIcon)
  40. Q_PROPERTY(QString backButtonText READ backButtonText WRITE setBackButtonText)
  41. Q_PROPERTY(QString nextButtonText READ nextButtonText WRITE setNextButtonText)
  42. Q_FLAGS(ButtonBoxHintForPlugin)
  43. Q_PROPERTY(ButtonBoxHintForPlugin buttonBoxHints READ buttonBoxHintsForPlugin WRITE setButtonBoxHintsForPlugin)
  44. public:
  45. typedef ctkWorkflowAbstractWidgetStep Superclass;
  46. explicit ctkWorkflowWidgetStep(ctkWorkflow* newWorkflow, const QString& newId, QWidget* newParent = 0);
  47. explicit ctkWorkflowWidgetStep(QWidget* newParent = 0);
  48. virtual ~ctkWorkflowWidgetStep();
  49. virtual QWidget* stepArea();
  50. //-----------------------------------------------------------------------------
  51. // To have ButtonBoxHints displayed as a propery in QtDesigner ...
  52. // Since ctkWorkflowAbstractWidgetStep is not a QObject, there is no way to
  53. // add ctkWorkflowAbstractWidgetStep::ButtonBoxHints to the meta object system using
  54. // the QFLAGS(ctkWorkflowAbstractWidgetStep::ButtonBoxHints)
  55. // The following enums, setter and getter serve as proxy for qtdesigner plugin
  56. // TODO Ideally, the following code should be private ..
  57. enum ButtonBoxHintForPlugin {
  58. qNoHints = 0x0,
  59. qBackButtonHidden = 0x1,
  60. qBackButtonDisabled = 0x2,
  61. qNextButtonHidden = 0x4,
  62. qNextButtonDisabled = 0x8,
  63. qButtonBoxHidden = 0x10
  64. };
  65. Q_DECLARE_FLAGS(ButtonBoxHintsForPlugin, ButtonBoxHintForPlugin)
  66. void setButtonBoxHintsForPlugin(ButtonBoxHintsForPlugin buttonBoxHints);
  67. ButtonBoxHintsForPlugin buttonBoxHintsForPlugin()const;
  68. //-----------------------------------------------------------------------------
  69. protected:
  70. virtual void createUserInterface(){}
  71. protected:
  72. QScopedPointer<ctkWorkflowWidgetStepPrivate> d_ptr;
  73. private:
  74. Q_DECLARE_PRIVATE(ctkWorkflowWidgetStep);
  75. Q_DISABLE_COPY(ctkWorkflowWidgetStep);
  76. };
  77. Q_DECLARE_OPERATORS_FOR_FLAGS(ctkWorkflowWidgetStep::ButtonBoxHintsForPlugin)
  78. #endif