KDEUI
kxyselector.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 1997 Martin Jones (mjones@kde.org) 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef KXYSELECTOR_H 00021 #define KXYSELECTOR_H 00022 00023 #include <kdeui_export.h> 00024 00025 #include <QtGui/QWidget> 00026 #include <QtGui/QPixmap> 00027 00039 class KDEUI_EXPORT KXYSelector : public QWidget 00040 { 00041 Q_OBJECT 00042 Q_PROPERTY( int xValue READ xValue WRITE setXValue ) 00043 Q_PROPERTY( int yValue READ yValue WRITE setYValue ) 00044 00045 public: 00050 explicit KXYSelector( QWidget *parent=0 ); 00054 ~KXYSelector(); 00055 00062 void setValues( int xPos, int yPos ); 00063 00068 void setXValue( int xPos ); 00069 00074 void setYValue( int yPos ); 00075 00079 void setRange( int minX, int minY, int maxX, int maxY ); 00080 00085 void setMarkerColor( const QColor &col ); 00086 00090 int xValue() const; 00094 int yValue() const; 00095 00099 QRect contentsRect() const; 00100 00104 virtual QSize minimumSizeHint() const; 00105 00106 Q_SIGNALS: 00111 void valueChanged( int x, int y ); 00112 00113 protected: 00120 virtual void drawContents( QPainter * ); 00121 00126 virtual void drawMarker( QPainter *p, int xp, int yp ); 00127 00128 virtual void paintEvent( QPaintEvent *e ); 00129 virtual void mousePressEvent( QMouseEvent *e ); 00130 virtual void mouseMoveEvent( QMouseEvent *e ); 00131 virtual void wheelEvent( QWheelEvent * ); 00132 00136 void valuesFromPosition( int x, int y, int& xVal, int& yVal ) const; 00137 00138 private: 00139 void setPosition( int xp, int yp ); 00140 00141 private: 00142 class Private; 00143 friend class Private; 00144 Private * const d; 00145 00146 Q_DISABLE_COPY(KXYSelector) 00147 }; 00148 00149 #endif /* KXYSELECTOR_H */
KDE 4.6 API Reference