ctkVTKMagnifyView_p.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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 __ctkVTKMagnifyView_p_h
  15. #define __ctkVTKMagnifyView_p_h
  16. // Qt includes
  17. #include <QPointer>
  18. class QPointF;
  19. class QTimerEvent;
  20. // CTK includes
  21. #include "ctkVTKMagnifyView.h"
  22. #include <ctkVTKObject.h>
  23. /// \ingroup Visualization_VTK_Widgets
  24. class ctkVTKMagnifyViewPrivate : public QObject
  25. {
  26. Q_OBJECT
  27. QVTK_OBJECT
  28. Q_DECLARE_PUBLIC(ctkVTKMagnifyView);
  29. protected:
  30. ctkVTKMagnifyView* const q_ptr;
  31. public:
  32. ctkVTKMagnifyViewPrivate(ctkVTKMagnifyView& object);
  33. virtual ~ctkVTKMagnifyViewPrivate();
  34. void init();
  35. #if CTK_USE_QVTKOPENGLWIDGET
  36. void observe(QVTKOpenGLWidget * widget);
  37. void remove(QVTKOpenGLWidget * widget);
  38. void connectRenderWindow(QVTKOpenGLWidget * widget);
  39. void disconnectRenderWindow(QVTKOpenGLWidget * widget);
  40. #else
  41. void observe(QVTKWidget * widget);
  42. void remove(QVTKWidget * widget);
  43. void connectRenderWindow(QVTKWidget * widget);
  44. void disconnectRenderWindow(QVTKWidget * widget);
  45. #endif
  46. protected:
  47. void updatePixmap();
  48. void removePixmap();
  49. void timerEvent(QTimerEvent * event);
  50. void restartTimer();
  51. void resetEventHandler();
  52. enum PendingEventType {
  53. NoEvent = 0,
  54. UpdatePixmapEvent,
  55. RemovePixmapEvent
  56. };
  57. struct EventHandlerStruct
  58. {
  59. PendingEventType EventType;
  60. #if CTK_USE_QVTKOPENGLWIDGET
  61. QPointer<QVTKOpenGLWidget> Widget;
  62. #else
  63. QPointer<QVTKWidget> Widget;
  64. #endif
  65. QPointF Position;
  66. int UpdateInterval;
  67. int TimerId;
  68. };
  69. public Q_SLOTS:
  70. void pushUpdatePixmapEvent();
  71. void pushUpdatePixmapEvent(QPointF pos);
  72. void pushRemovePixmapEvent();
  73. public:
  74. #if CTK_USE_QVTKOPENGLWIDGET
  75. QList<QVTKOpenGLWidget *> ObservedQVTKWidgets;
  76. #else
  77. QList<QVTKWidget *> ObservedQVTKWidgets;
  78. #endif
  79. double Magnification;
  80. bool ObserveRenderWindowEvents;
  81. EventHandlerStruct EventHandler;
  82. };
  83. #endif