ctkBasePopupWidget_p.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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 __ctkBasePopupWidget_p_h
  15. #define __ctkBasePopupWidget_p_h
  16. // Qt includes
  17. class QPropertyAnimation;
  18. class QLabel;
  19. // CTK includes
  20. #include "ctkBasePopupWidget.h"
  21. // -------------------------------------------------------------------------
  22. /// \ingroup Widgets
  23. class CTK_WIDGETS_EXPORT ctkBasePopupWidgetPrivate
  24. : public QObject
  25. {
  26. Q_OBJECT
  27. Q_DECLARE_PUBLIC(ctkBasePopupWidget);
  28. protected:
  29. ctkBasePopupWidget* const q_ptr;
  30. public:
  31. ctkBasePopupWidgetPrivate(ctkBasePopupWidget& object);
  32. ~ctkBasePopupWidgetPrivate();
  33. virtual void init();
  34. bool isOpening()const;
  35. bool isClosing()const;
  36. /// Return true if the animation was closing (direction == backward).
  37. /// It doesn't indicate if the action is still running or finished.
  38. /// Can only be called in a slot as it uses sender().
  39. bool wasClosing()const;
  40. bool fitBaseWidgetSize()const;
  41. Qt::Alignment pixmapAlignment()const;
  42. void setupPopupPixmapWidget();
  43. QWidgetList focusWidgets(bool onlyVisible = false)const;
  44. // Return the widget if the mouse cursor is above any of the focus widgets or their
  45. // children.
  46. virtual QWidget* mouseOver();
  47. // Same as QWidget::isAncestorOf() but don't restrain to the same window
  48. // and apply it to all the focusWidgets
  49. bool isAncestorOf(const QWidget* ancestor, const QWidget* child)const;
  50. /// Return the closed geometry for the popup based on the current geometry
  51. QRect closedGeometry()const;
  52. /// Return the closed geometry for a given open geometry
  53. QRect closedGeometry(QRect openGeom)const;
  54. /// Return the desired geometry, maybe it won't happen if the size is too
  55. /// small for the popup.
  56. QRect desiredOpenGeometry()const;
  57. QRect desiredOpenGeometry(QRect baseGeometry)const;
  58. QRect baseGeometry()const;
  59. QPoint mapToGlobal(const QPoint& baseWidgetPoint)const;
  60. QPropertyAnimation* currentAnimation()const;
  61. //void temporarilyHiddenOn();
  62. //void temporarilyHiddenOff();
  63. void hideAll();
  64. protected:
  65. QWidget* BaseWidget;
  66. double EffectAlpha;
  67. ctkBasePopupWidget::AnimationEffect Effect;
  68. int EffectDuration;
  69. QPropertyAnimation* AlphaAnimation;
  70. bool ForcedTranslucent;
  71. QPropertyAnimation* ScrollAnimation;
  72. QLabel* PopupPixmapWidget;
  73. // Geometry attributes
  74. Qt::Alignment Alignment;
  75. Qt::Orientations Orientations;
  76. ctkBasePopupWidget::VerticalDirection VerticalDirection;
  77. Qt::LayoutDirection HorizontalDirection;
  78. };
  79. #endif