pDockToolBar.sip 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*!
  2. \file pDockToolBar.h
  3. \date 2008-01-14T00:27:40
  4. \author Filipe AZEVEDO aka Nox P\@sNox <pasnox@gmail.com>
  5. \brief A toolbar that can manage dock visibility by adding buttons in it
  6. */
  7. /*!
  8. \brief A toolbar that can manage dock visibility by adding buttons in it
  9. \details The dock toolbars are managed by a pDockToolBarManager for top, right, bottom, left
  10. */
  11. class pDockToolBar : QToolBar
  12. {
  13. %TypeHeaderCode
  14. #include <gui/dockmanager/pDockToolBar.h>
  15. %End
  16. public:
  17. /*! This enumeration represents the possible order to use. */
  18. enum DockWidgetsOrder {
  19. HashedOrder = 0, /*!< The list is ordered by the hash order. */
  20. InsertedOrder /*!< The list is ordered by the insertion order. */
  21. };
  22. /*!
  23. Create a pDockToolBar having \a manager as manager and orientation \a orientation.
  24. */
  25. pDockToolBar( pDockToolBarManager* manager, Qt::Orientation orientation = Qt::Horizontal );
  26. /*!
  27. Reimplemented.
  28. */
  29. virtual bool event( QEvent* event );
  30. /*!
  31. Reimplemented.
  32. */
  33. virtual bool eventFilter( QObject* object, QEvent* event );
  34. /*!
  35. Add \a dockWidget being handled by this toolbar.
  36. If \a title and \a icon are non null, they will overwrite the dock widget window title and window icon.
  37. */
  38. void addDockWidget( QDockWidget* dockWidget, const QString& title = QString(), const QIcon& icon = QIcon() );
  39. /*!
  40. Remove \a dockWidget from the list of handled dock widgets by this toolbar.
  41. The dock is not deleted nor hided.
  42. */
  43. void removeDockWidget( QDockWidget* dockWidget );
  44. /*!
  45. Return true if this toolbar buttons are exclusive, else false.
  46. */
  47. bool isExclusive() const;
  48. /*!
  49. Set the toolbar button to be exclusive according to \a exclusive.
  50. */
  51. void setExclusive( bool exclusive );
  52. /*!
  53. Change the \a dockWidget visibility according to \a visible.
  54. */
  55. void setDockVisible( QDockWidget* dockWidget, bool visible );
  56. /*!
  57. Return the list of managed dock widgets in this toolbar sorted by \a order method.
  58. */
  59. QList<QDockWidget*> dockWidgets( pDockToolBar::DockWidgetsOrder order = pDockToolBar::HashedOrder ) const;
  60. /*!
  61. Return the dock widget associated with \a button.
  62. */
  63. QDockWidget* dockWidget( pToolButton* button ) const;
  64. /*!
  65. Return true if \a dockWidget is managed by this toolbar.
  66. */
  67. bool hasDockWidget( QDockWidget* dockWidget ) const;
  68. /*!
  69. Return all the buttons associated with dock widgets managed by this toolbar.
  70. */
  71. QList<pToolButton*> buttons() const;
  72. /*!
  73. Return the button associated with \a dockWidget.
  74. */
  75. pToolButton* button( QDockWidget* dockWidget ) const;
  76. /*!
  77. Return the number of managed dock widgets.
  78. */
  79. int count() const;
  80. /*!
  81. Return the checkable action for changing the exclusive mode of this toolbar.
  82. */
  83. QAction* toggleExclusiveAction() const;
  84. private:
  85. /*!
  86. Update the button properties according to the current manager mode.
  87. */
  88. void setButtonMode( pToolButton* button );
  89. /*!
  90. Add a button for \a dockWidget and return it.
  91. */
  92. pToolButton* addButton( QDockWidget* dockWidget );
  93. private slots:
  94. void internal_checkToolBarVisibility();
  95. void internal_checkButtonExclusivity( QDockWidget* dockWidget = 0 );
  96. void internal_updateButtonsState();
  97. void internal_orientationChanged( Qt::Orientation orientation );
  98. void internal_buttonClicked( bool checked );
  99. };