ctkWorkflowTabWidget.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. /// \brief ctkWorkflowStackedWidget is the basis for a workflow with a user
  25. /// interface containing a QTabWidget.
  26. ///
  27. /// The client area is a QTabWidget, onto which step-specific
  28. /// widgets can be placed.
  29. ///
  30. /// Multiple workflow steps can correspond to the same page of the
  31. /// QStackedWidget. The main widget can be inserted directly inside
  32. /// another user interface.
  33. class CTK_WIDGETS_EXPORT ctkWorkflowTabWidget : public ctkWorkflowAbstractPagedWidget
  34. {
  35. Q_OBJECT
  36. public:
  37. typedef ctkWorkflowAbstractPagedWidget Superclass;
  38. explicit ctkWorkflowTabWidget(QWidget* newParent = 0);
  39. virtual ~ctkWorkflowTabWidget(){}
  40. /// Provided for advanced customization: get the client area.
  41. /// A workflow containing a user interface is made up of steps
  42. /// (ctkWorkflowWidgetStep). Each step should either:
  43. /// 1) reimplement ctkWorkflowWidgetStep::populateStepWidgetsList or
  44. /// set its populateStepWidgetsListCommand to point to a method that
  45. /// will add the custom-step's widgets to the list; or
  46. /// 2) reimplement ctkWorkflowWidgetStep::showUserInterface or set
  47. /// its showUserInterfaceCommand to point to a method that will
  48. /// display the step's user interface. Within that method, each of
  49. /// the custom step's widgets should be added to the workflow
  50. /// widget's clientArea using the addWidget() function.
  51. /// If you do not associate a layout manager with the clientArea,
  52. /// the default layout manager is a QBoxLayout with direction
  53. /// QBoxLayout::TopToBottom. Use the function
  54. /// setClientAreaDirection() to change the direction.
  55. /// For additional customization of layouts, note that
  56. /// ctkWorkflowTabWidget()->clientArea()->setLayout() will likely
  57. /// not allow you to customize the client area layout. Customize
  58. /// specific pages instead using
  59. /// ctkWorkflowTabWidget::getWidgetFromIndex(index)->setLayout()
  60. virtual QTabWidget* clientArea();
  61. /// Provided for advanced customization: get the widget
  62. /// corresponding to the page of the given index
  63. virtual QWidget* getWidgetFromIndex(int index);
  64. protected:
  65. /// Add a widget to a new page of the client area.
  66. /// The label will be the name of the tab.
  67. virtual void addWidgetToClientArea(QWidget* widget, const QString& label);
  68. /// Set the current widget to that of the page containing the given widget
  69. virtual void setCurrentWidget(QWidget* widget) ;
  70. private:
  71. CTK_DECLARE_PRIVATE(ctkWorkflowTabWidget);
  72. };
  73. #endif