ctkWorkflowAbstractPagedWidget.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 __ctkWorkflowAbstractPagedWidget_h
  15. #define __ctkWorkflowAbstractPagedWidget_h
  16. // Qt includes
  17. class QString;
  18. // CTK includes
  19. #include "ctkWorkflowWidget.h"
  20. #include "ctkPimpl.h"
  21. #include "ctkWidgetsExport.h"
  22. class ctkWorkflowStep;
  23. class ctkWorkflowAbstractPagedWidgetPrivate;
  24. /// \ingroup Widgets
  25. /// ctkWorkflowAbstractPagedWidget is the basis for a workflow with a
  26. /// user interface containing multiple pages.
  27. /// By default, each step is placed onto its own page. Multiple workflow steps can be placed on the
  28. /// same page using associateStepWithPage().
  29. class CTK_WIDGETS_EXPORT ctkWorkflowAbstractPagedWidget : public ctkWorkflowWidget
  30. {
  31. Q_OBJECT
  32. public:
  33. typedef ctkWorkflowWidget Superclass;
  34. explicit ctkWorkflowAbstractPagedWidget(QWidget* newParent = 0);
  35. virtual ~ctkWorkflowAbstractPagedWidget();
  36. /// Optionally specify the label to be displayed on the page shown for the given step.
  37. virtual void associateStepWithLabel(ctkWorkflowStep* step, QString label);
  38. /// Dictate that a step be displayed on a particular page index, to override the default setting
  39. /// to display each encountered step on a new page. A label can also be provided for the step's
  40. /// page.
  41. virtual void associateStepWithPage(ctkWorkflowStep* step, int index);
  42. virtual void associateStepWithPage(ctkWorkflowStep* step, int index, QString label);
  43. /// Get the workflow group box associated with a particular step
  44. using ctkWorkflowWidget::workflowGroupBox;
  45. virtual ctkWorkflowGroupBox* workflowGroupBox(ctkWorkflowStep* step)const;
  46. protected:
  47. // Triggers updates of the workflowGroupBox on the current page, when the workflow step hyas
  48. // changed.
  49. virtual void updateStepUI(ctkWorkflowStep* currentStep);
  50. virtual void initClientArea() = 0;
  51. virtual QWidget* clientArea() = 0;
  52. virtual void createNewPage(QWidget* widget) = 0;
  53. virtual void showPage(QWidget* widget, const QString& label) = 0;
  54. protected:
  55. QScopedPointer<ctkWorkflowAbstractPagedWidgetPrivate> d_ptr;
  56. private:
  57. Q_DECLARE_PRIVATE(ctkWorkflowAbstractPagedWidget);
  58. Q_DISABLE_COPY(ctkWorkflowAbstractPagedWidget);
  59. };
  60. #endif