ctkAxesWidget.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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.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 __ctkAxesWidget_h
  15. #define __ctkAxesWidget_h
  16. // Qt includes
  17. #include <QWidget>
  18. #include <QStyle>
  19. #include <QSize>
  20. // CTK includes
  21. #include <ctkPimpl.h>
  22. #include "CTKWidgetsExport.h"
  23. class ctkAxesWidgetPrivate;
  24. class CTK_WIDGETS_EXPORT ctkAxesWidget : public QWidget
  25. {
  26. Q_OBJECT
  27. Q_PROPERTY(Axis currentAxis READ currentAxis WRITE setCurrentAxis NOTIFY currentAxisChanged)
  28. public :
  29. enum Axis
  30. {
  31. None=0,
  32. Right,
  33. Left,
  34. Superior,
  35. Inferior,
  36. Anterior,
  37. Posterior,
  38. };
  39. Q_ENUMS(Axis)
  40. ctkAxesWidget(QWidget *parent = 0);
  41. virtual ~ctkAxesWidget();
  42. ///
  43. /// Current selected axis. None by default.
  44. Axis currentAxis() const;
  45. signals:
  46. void currentAxisChanged(Axis axis);
  47. public slots :
  48. void setCurrentAxis(Axis axis);
  49. protected slots:
  50. void paintEvent(QPaintEvent *);
  51. void mousePressEvent(QMouseEvent *mouseEvent);
  52. protected:
  53. QScopedPointer<ctkAxesWidgetPrivate> d_ptr;
  54. private :
  55. Q_DECLARE_PRIVATE(ctkAxesWidget);
  56. Q_DISABLE_COPY(ctkAxesWidget);
  57. };
  58. #endif