ctkMenuButton.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) Kitware Inc.
  4. All rights reserved.
  5. Distributed under a BSD License. See LICENSE.txt file.
  6. This software is distributed "AS IS" WITHOUT ANY WARRANTY; without even
  7. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the above copyright notice for more information.
  9. =========================================================================*/
  10. #ifndef __ctkMenuButton_h
  11. #define __ctkMenuButton_h
  12. // Qt includes
  13. #include <QPushButton>
  14. // CTK includes
  15. #include <ctkPimpl.h>
  16. #include "CTKWidgetsExport.h"
  17. class ctkMenuButtonPrivate;
  18. /// Description
  19. /// A Menu widget that show/hide its children depending on its checked/collapsed properties
  20. class CTK_WIDGETS_EXPORT ctkMenuButton : public QPushButton
  21. {
  22. Q_OBJECT
  23. public:
  24. ctkMenuButton(QWidget *parent = 0);
  25. ctkMenuButton(const QString& text, QWidget *parent = 0);
  26. virtual ~ctkMenuButton();
  27. virtual QSize minimumSizeHint()const;
  28. virtual QSize sizeHint()const;
  29. protected:
  30. virtual void paintEvent(QPaintEvent*);
  31. virtual void mousePressEvent(QMouseEvent* event);
  32. virtual bool hitButton(const QPoint & pos) const;
  33. virtual void initStyleOption ( QStyleOptionButton * option ) const;
  34. private:
  35. CTK_DECLARE_PRIVATE(ctkMenuButton);
  36. };
  37. #endif