ctkVTKMagnifyView_p.h 2.1 KB

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