ctkWorkflowTabWidget.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) 2010 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 __ctkWorkflowTabWidget_h
  15. #define __ctkWorkflowTabWidget_h
  16. // Qt includes
  17. #include <QTabWidget>
  18. // CTK includes
  19. #include "ctkWorkflowAbstractPagedWidget.h"
  20. #include "ctkPimpl.h"
  21. #include "CTKWidgetsExport.h"
  22. class ctkWorkflowTabWidgetPrivate;
  23. ///
  24. /// ctkWorkflowStackedWidget is the basis for a workflow with a user
  25. /// interface containing a QTabWidget.
  26. /// It is a child of ctkWorkflowAbstractPagedWidget and therefore is a
  27. /// ctkWorkflow (i.e. a state machine). Its client area is a
  28. /// QTabWidget, onto which step-specific widgets can be placed.
  29. /// Multiple workflow steps can correspond to the same page of the
  30. /// QStackedWidget. The main widget can be inserted directly inside
  31. /// another user interface.
  32. class CTK_WIDGETS_EXPORT ctkWorkflowTabWidget : public ctkWorkflowAbstractPagedWidget
  33. {
  34. Q_OBJECT
  35. // TODO DESIGNER: properties here
  36. public:
  37. ///
  38. /// Superclass typedef
  39. typedef ctkWorkflowAbstractPagedWidget Superclass;
  40. ///
  41. /// Constructors
  42. explicit ctkWorkflowTabWidget(QWidget* parent = 0);
  43. virtual ~ctkWorkflowTabWidget();
  44. ///
  45. /// Provided for advanced customization: get the client area.
  46. /// A workflow containing a user interface is made up of steps
  47. /// (ctkWorkflowWidgetStep). Each step should either:
  48. /// 1) reimplement ctkWorkflowWidgetStep::populateStepWidgetsList or
  49. /// set its populateStepWidgetsListCommand to point to a method that
  50. /// will add the custom-step's widgets to the list; or
  51. /// 2) reimplement ctkWorkflowWidgetStep::showUserInterface or set
  52. /// its showUserInterfaceCommand to point to a method that will
  53. /// display the step's user interface. Within that method, each of
  54. /// the custom step's widgets should be added to the workflow
  55. /// widget's clientArea using the addWidget() function.
  56. /// If you do not associate a layout manager with the clientArea,
  57. /// the default layout manager is a QBoxLayout with direction
  58. /// QBoxLayout::TopToBottom. Use the function
  59. /// setClientAreaDirection() to change the direction.
  60. /// For additional customization of layouts, note that
  61. /// ctkWorkflowTabWidget()->clientArea()->setLayout() will likely
  62. /// not allow you to customize the client area layout. Customize
  63. /// specific pages instead using
  64. /// ctkWorkflowTabWidget::getWidgetFromIndex(index)->setLayout()
  65. virtual QTabWidget* clientArea();
  66. ///
  67. /// Provided for advanced customization: get the widget
  68. /// corresponding to the page of the given index
  69. virtual QWidget* getWidgetFromIndex(int index);
  70. protected:
  71. ///
  72. /// Add a widget to a new page of the client area.
  73. /// The label will be the name of the tab.
  74. virtual void addWidgetToClientArea(QWidget* widget, const QString& label);
  75. ///
  76. /// Set the current widget to that of the page containing the given
  77. /// widget
  78. virtual void setCurrentWidget(QWidget* widget) ;
  79. private:
  80. CTK_DECLARE_PRIVATE(ctkWorkflowTabWidget);
  81. };
  82. #endif