1 #ifndef OCCVIEWER_VIEWPORT_H
2 #define OCCVIEWER_VIEWPORT_H
12 #include <Aspect_Window.hxx>
17 class OCCViewer_ViewSketcher;
18 class OCCViewer_ViewTransformer;
20 class OCCVIEWER_EXPORT OCCViewer_ViewPort : public QWidget
24 friend class OCCViewer_ViewSketcher;
27 OCCViewer_ViewPort( QWidget* parent );
28 virtual ~OCCViewer_ViewPort();
31 void setSketchingEnabled( bool );
32 bool isSketchingEnabled() const;
33 void setTransformEnabled( bool );
34 bool isTransformEnabled() const;
36 virtual QColor backgroundColor() const;
37 virtual void setBackgroundColor( const QColor& );
39 void redrawPainters();
41 virtual void onUpdate();
44 // enum ViewType { Type2D, Type3D };
45 void selectVisualId();
48 virtual void paintEvent( QPaintEvent *);
49 virtual void mouseMoveEvent( QMouseEvent *);
50 virtual void mouseReleaseEvent( QMouseEvent *);
51 virtual void mousePressEvent( QMouseEvent *);
52 virtual void mouseDoubleClickEvent( QMouseEvent *);
53 virtual void keyPressEvent( QKeyEvent *);
54 virtual void keyReleaseEvent( QKeyEvent *);
57 virtual void reset() = 0;
58 virtual void pan( int, int ) = 0;
59 virtual void setCenter( int, int ) = 0;
60 virtual void fitRect( const QRect& ) = 0;
61 virtual void zoom( int, int, int, int ) = 0;
62 virtual void fitAll( bool keepScale = false, bool withZ = true ) = 0;
65 // void onCreatePopup( QPopupMenu* );
66 // void onDestroyPopup( QPopupMenu* );
69 virtual void onChangeBgColor();
72 void vpKeyEvent( QKeyEvent* );
73 void vpMouseEvent( QMouseEvent* );
74 void vpDrawExternal( QPainter* );
75 void vpChangeBGColor( QColor );
82 Handle(Aspect_Window) myWindow;
83 bool myEnableSketching;
84 bool myEnableTransform;
85 bool myPaintersRedrawing; /* set to draw externally */
86 QPtrList<QtxAction> myPopupActions;
89 static int nCounter; /* objects counter */