ctkVTKMagnifyView_p.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. #include "ctkVTKOpenGLNativeWidget.h"
  24. /// \ingroup Visualization_VTK_Widgets
  25. class ctkVTKMagnifyViewPrivate : public QObject
  26. {
  27. Q_OBJECT
  28. QVTK_OBJECT
  29. Q_DECLARE_PUBLIC(ctkVTKMagnifyView);
  30. protected:
  31. ctkVTKMagnifyView* const q_ptr;
  32. public:
  33. ctkVTKMagnifyViewPrivate(ctkVTKMagnifyView& object);
  34. virtual ~ctkVTKMagnifyViewPrivate();
  35. void init();
  36. void observe(ctkVTKOpenGLNativeWidget * widget);
  37. void remove(ctkVTKOpenGLNativeWidget * widget);
  38. void connectRenderWindow(ctkVTKOpenGLNativeWidget * widget);
  39. void disconnectRenderWindow(ctkVTKOpenGLNativeWidget * widget);
  40. protected:
  41. void updatePixmap();
  42. void removePixmap();
  43. void timerEvent(QTimerEvent * event);
  44. void restartTimer();
  45. void resetEventHandler();
  46. enum PendingEventType {
  47. NoEvent = 0,
  48. UpdatePixmapEvent,
  49. RemovePixmapEvent
  50. };
  51. struct EventHandlerStruct
  52. {
  53. PendingEventType EventType;
  54. QPointer<ctkVTKOpenGLNativeWidget> Widget;
  55. QPointF Position;
  56. int UpdateInterval;
  57. int TimerId;
  58. };
  59. public Q_SLOTS:
  60. void pushUpdatePixmapEvent();
  61. void pushUpdatePixmapEvent(QPointF pos);
  62. void pushRemovePixmapEvent();
  63. public:
  64. QList<ctkVTKOpenGLNativeWidget *> ObservedQVTKWidgets;
  65. double Magnification;
  66. bool ObserveRenderWindowEvents;
  67. EventHandlerStruct EventHandler;
  68. };
  69. #endif