Eneboo - Documentación para desarrolladores
|
00001 /**************************************************************************** 00002 ** $Id: qt/qlcdnumber.h 3.3.8 edited Jan 11 14:38 $ 00003 ** 00004 ** Definition of QLCDNumber class 00005 ** 00006 ** Created : 940518 00007 ** 00008 ** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved. 00009 ** 00010 ** This file is part of the widgets module of the Qt GUI Toolkit. 00011 ** 00012 ** This file may be distributed under the terms of the Q Public License 00013 ** as defined by Trolltech ASA of Norway and appearing in the file 00014 ** LICENSE.QPL included in the packaging of this file. 00015 ** 00016 ** This file may be distributed and/or modified under the terms of the 00017 ** GNU General Public License version 2 as published by the Free Software 00018 ** Foundation and appearing in the file LICENSE.GPL included in the 00019 ** packaging of this file. 00020 ** 00021 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition 00022 ** licenses may use this file in accordance with the Qt Commercial License 00023 ** Agreement provided with the Software. 00024 ** 00025 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00026 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00027 ** 00028 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for 00029 ** information about Qt Commercial License Agreements. 00030 ** See http://www.trolltech.com/qpl/ for QPL licensing information. 00031 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 00032 ** 00033 ** Contact info@trolltech.com if any conditions of this licensing are 00034 ** not clear to you. 00035 ** 00036 **********************************************************************/ 00037 00038 #ifndef QLCDNUMBER_H 00039 #define QLCDNUMBER_H 00040 00041 #ifndef QT_H 00042 #include "qframe.h" 00043 #include "qbitarray.h" 00044 #endif // QT_H 00045 00046 #ifndef QT_NO_LCDNUMBER 00047 00048 00049 class QLCDNumberPrivate; 00050 00051 class Q_EXPORT QLCDNumber : public QFrame // LCD number widget 00052 { 00053 Q_OBJECT 00054 Q_ENUMS( Mode SegmentStyle ) 00055 Q_PROPERTY( bool smallDecimalPoint READ smallDecimalPoint WRITE setSmallDecimalPoint ) 00056 Q_PROPERTY( int numDigits READ numDigits WRITE setNumDigits ) 00057 Q_PROPERTY( Mode mode READ mode WRITE setMode ) 00058 Q_PROPERTY( SegmentStyle segmentStyle READ segmentStyle WRITE setSegmentStyle ) 00059 Q_PROPERTY( double value READ value WRITE display ) 00060 Q_PROPERTY( int intValue READ intValue WRITE display ) 00061 00062 public: 00063 QLCDNumber( QWidget* parent=0, const char* name=0 ); 00064 QLCDNumber( uint numDigits, QWidget* parent=0, const char* name=0 ); 00065 ~QLCDNumber(); 00066 00067 enum Mode { Hex, Dec, Oct, Bin, HEX = Hex, DEC = Dec, OCT = Oct, 00068 BIN = Bin }; 00069 enum SegmentStyle { Outline, Filled, Flat }; 00070 00071 bool smallDecimalPoint() const; 00072 00073 int numDigits() const; 00074 virtual void setNumDigits( int nDigits ); 00075 00076 bool checkOverflow( double num ) const; 00077 bool checkOverflow( int num ) const; 00078 00079 Mode mode() const; 00080 virtual void setMode( Mode ); 00081 00082 SegmentStyle segmentStyle() const; 00083 virtual void setSegmentStyle( SegmentStyle ); 00084 00085 double value() const; 00086 int intValue() const; 00087 00088 QSize sizeHint() const; 00089 00090 public slots: 00091 void display( const QString &str ); 00092 void display( int num ); 00093 void display( double num ); 00094 virtual void setHexMode(); 00095 virtual void setDecMode(); 00096 virtual void setOctMode(); 00097 virtual void setBinMode(); 00098 virtual void setSmallDecimalPoint( bool ); 00099 00100 signals: 00101 void overflow(); 00102 00103 protected: 00104 void drawContents( QPainter * ); 00105 00106 private: 00107 void init(); 00108 void internalDisplay( const QString &); 00109 void internalSetString( const QString& s ); 00110 void drawString( const QString& s, QPainter &, QBitArray * = 0, 00111 bool = TRUE ); 00112 //void drawString( const QString &, QPainter &, QBitArray * = 0 ) const; 00113 void drawDigit( const QPoint &, QPainter &, int, char, 00114 char = ' ' ); 00115 void drawSegment( const QPoint &, char, QPainter &, int, bool = FALSE ); 00116 00117 int ndigits; 00118 double val; 00119 uint base : 2; 00120 uint smallPoint : 1; 00121 uint fill : 1; 00122 uint shadow : 1; 00123 QString digitStr; 00124 QBitArray points; 00125 QLCDNumberPrivate * d; 00126 00127 private: // Disabled copy constructor and operator= 00128 #if defined(Q_DISABLE_COPY) 00129 QLCDNumber( const QLCDNumber & ); 00130 QLCDNumber &operator=( const QLCDNumber & ); 00131 #endif 00132 }; 00133 00134 inline bool QLCDNumber::smallDecimalPoint() const 00135 { return (bool)smallPoint; } 00136 00137 inline int QLCDNumber::numDigits() const 00138 { return ndigits; } 00139 00140 00141 #endif // QT_NO_LCDNUMBER 00142 00143 #endif // QLCDNUMBER_H