src/gui/widgets/qrubberband.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
00004 **
00005 ** This file is part of the QtGui module of the Qt Toolkit.
00006 **
00007 ** This file may be used under the terms of the GNU General Public
00008 ** License version 2.0 as published by the Free Software Foundation
00009 ** and appearing in the file LICENSE.GPL included in the packaging of
00010 ** this file.  Please review the following information to ensure GNU
00011 ** General Public Licensing requirements will be met:
00012 ** http://www.trolltech.com/products/qt/opensource.html
00013 **
00014 ** If you are unsure which license is appropriate for your use, please
00015 ** review the following information:
00016 ** http://www.trolltech.com/products/qt/licensing.html or contact the
00017 ** sales department at sales@trolltech.com.
00018 **
00019 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00020 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00021 **
00022 ****************************************************************************/
00023 
00024 #ifndef QRUBBERBAND_H
00025 #define QRUBBERBAND_H
00026 
00027 #include <QtGui/qwidget.h>
00028 
00029 QT_BEGIN_HEADER
00030 
00031 QT_MODULE(Gui)
00032 
00033 #ifndef QT_NO_RUBBERBAND
00034 
00035 class QRubberBandPrivate;
00036 
00037 class Q_GUI_EXPORT QRubberBand : public QWidget
00038 {
00039     Q_OBJECT
00040 
00041 public:
00042     enum Shape { Line, Rectangle };
00043     explicit QRubberBand(Shape, QWidget * =0);
00044     ~QRubberBand();
00045 
00046     Shape shape() const;
00047 
00048     void setGeometry(const QRect &r);
00049 
00050     inline void setGeometry(int x, int y, int w, int h);
00051     inline void move(int x, int y);
00052     inline void move(const QPoint &p)
00053     { move(p.x(), p.y()); }
00054     inline void resize(int w, int h)
00055     { setGeometry(geometry().x(), geometry().y(), w, h); }
00056     inline void resize(const QSize &s)
00057     { resize(s.width(), s.height()); }
00058 
00059 protected:
00060     bool event(QEvent *e);
00061     void paintEvent(QPaintEvent *);
00062     void changeEvent(QEvent *);
00063     void showEvent(QShowEvent *);
00064     void resizeEvent(QResizeEvent *);
00065     void moveEvent(QMoveEvent *);
00066 
00067 private:
00068     Q_DECLARE_PRIVATE(QRubberBand)
00069 };
00070 
00071 inline void QRubberBand::setGeometry(int ax, int ay, int aw, int ah)
00072 { setGeometry(QRect(ax, ay, aw, ah)); }
00073 inline void QRubberBand::move(int ax, int ay)
00074 { setGeometry(ax, ay, width(), height()); }
00075 
00076 #endif // QT_NO_RUBBERBAND
00077 
00078 QT_END_HEADER
00079 
00080 #endif // QRUBBERBAND_H

Generated on Thu Mar 15 11:57:04 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1