Qwt User's Guide svn
qwt_magnifier.h
00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
00002  * Qwt Widget Library
00003  * Copyright (C) 1997   Josef Wilgen
00004  * Copyright (C) 2002   Uwe Rathmann
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the Qwt License, Version 1.0
00008  *****************************************************************************/
00009 
00010 #ifndef QWT_MAGNIFIER_H
00011 #define QWT_MAGNIFIER_H 1
00012 
00013 #include "qwt_global.h"
00014 #include <qobject.h>
00015 
00016 class QWidget;
00017 class QMouseEvent;
00018 class QWheelEvent;
00019 class QKeyEvent;
00020 
00027 class QWT_EXPORT QwtMagnifier: public QObject
00028 {
00029     Q_OBJECT
00030 
00031 public:
00032     explicit QwtMagnifier( QWidget * );
00033     virtual ~QwtMagnifier();
00034 
00035     QWidget *parentWidget();
00036     const QWidget *parentWidget() const;
00037 
00038     void setEnabled( bool );
00039     bool isEnabled() const;
00040 
00041     // mouse
00042     void setMouseFactor( double );
00043     double mouseFactor() const;
00044 
00045     void setMouseButton( int button, int buttonState = Qt::NoButton );
00046     void getMouseButton( int &button, int &buttonState ) const;
00047 
00048     // mouse wheel
00049     void setWheelFactor( double );
00050     double wheelFactor() const;
00051 
00052     void setWheelButtonState( int buttonState );
00053     int wheelButtonState() const;
00054 
00055     // keyboard
00056     void setKeyFactor( double );
00057     double keyFactor() const;
00058 
00059     void setZoomInKey( int key, int modifiers );
00060     void getZoomInKey( int &key, int &modifiers ) const;
00061 
00062     void setZoomOutKey( int key, int modifiers );
00063     void getZoomOutKey( int &key, int &modifiers ) const;
00064 
00065     virtual bool eventFilter( QObject *, QEvent * );
00066 
00067 protected:
00072     virtual void rescale( double factor ) = 0;
00073 
00074     virtual void widgetMousePressEvent( QMouseEvent * );
00075     virtual void widgetMouseReleaseEvent( QMouseEvent * );
00076     virtual void widgetMouseMoveEvent( QMouseEvent * );
00077     virtual void widgetWheelEvent( QWheelEvent * );
00078     virtual void widgetKeyPressEvent( QKeyEvent * );
00079     virtual void widgetKeyReleaseEvent( QKeyEvent * );
00080 
00081 private:
00082     class PrivateData;
00083     PrivateData *d_data;
00084 };
00085 
00086 #endif
qmi style