Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef OCCVIEWER_VIEWPORT_H
00024 #define OCCVIEWER_VIEWPORT_H
00025
00026 #include "OCCViewer.h"
00027
00028 #include "QtxAction.h"
00029
00030 #include <QList>
00031 #include <QWidget>
00032
00033 #include <Aspect_Window.hxx>
00034
00035 class QColor;
00036 class QRect;
00037 class QPainter;
00038 class OCCViewer_ViewSketcher;
00039
00040 #ifdef WIN32
00041 #pragma warning ( disable:4251 )
00042 #endif
00043
00048 class OCCVIEWER_EXPORT OCCViewer_ViewPort : public QWidget
00049 {
00050 Q_OBJECT
00051
00052 friend class OCCViewer_ViewSketcher;
00053
00054 public:
00055 OCCViewer_ViewPort( QWidget* parent );
00056 virtual ~OCCViewer_ViewPort();
00057
00058 public:
00059 void setSketchingEnabled( bool );
00060 bool isSketchingEnabled() const;
00061 void setTransformEnabled( bool );
00062 bool isTransformEnabled() const;
00063
00064 virtual QColor backgroundColor() const;
00065 virtual void setBackgroundColor( const QColor& );
00066
00067 void redrawPainters();
00068
00069 virtual void onUpdate();
00070
00071 virtual QPaintEngine* paintEngine() const;
00072
00073 protected:
00074
00075 void selectVisualId();
00076
00077
00078 virtual void paintEvent( QPaintEvent *);
00079 virtual void mouseMoveEvent( QMouseEvent *);
00080 virtual void mouseReleaseEvent( QMouseEvent *);
00081 virtual void mousePressEvent( QMouseEvent *);
00082 virtual void mouseDoubleClickEvent( QMouseEvent *);
00083 virtual void keyPressEvent( QKeyEvent *);
00084 virtual void keyReleaseEvent( QKeyEvent *);
00085
00086
00087 virtual void reset() = 0;
00088 virtual void pan( int, int ) = 0;
00089 virtual void setCenter( int, int ) = 0;
00090 virtual void fitRect( const QRect& ) = 0;
00091 virtual void zoom( int, int, int, int ) = 0;
00092 virtual void fitAll( bool keepScale = false, bool withZ = true, bool upd = true ) = 0;
00093
00094
00095
00096
00097
00098 protected slots:
00099 virtual void onChangeBgColor();
00100
00101 signals:
00102 void vpKeyEvent( QKeyEvent* );
00103 void vpMouseEvent( QMouseEvent* );
00104 void vpDrawExternal( QPainter* );
00105 void vpChangeBGColor( QColor );
00106
00107 private:
00108 void initialize();
00109 void cleanup();
00110
00111 protected:
00112 Handle(Aspect_Window) myWindow;
00113 bool myEnableSketching;
00114 bool myEnableTransform;
00115 bool myPaintersRedrawing;
00116 QList<QtxAction*> myPopupActions;
00117
00118 private:
00119 static int nCounter;
00120 };
00121
00122 #ifdef WIN32
00123 #pragma warning ( default:4251 )
00124 #endif
00125
00126 #endif