kdeui Library API Documentation

kcharselect.h

00001 /* This file is part of the KDE libraries 00002 00003 Copyright (C) 1999 Reginald Stadlbauer <reggie@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00018 Boston, MA 02111-1307, USA. 00019 */ 00020 00021 #ifndef kcharselect_h 00022 #define kcharselect_h 00023 00024 #include <qgridview.h> 00025 #include <qvbox.h> 00026 #include <qcombobox.h> 00027 #include <qspinbox.h> 00028 #include <qstring.h> 00029 #include <qpoint.h> 00030 #include <qstringlist.h> 00031 00032 class QFont; 00033 class QFontDatabase; 00034 class QMouseEvent; 00035 class QSpinBox; 00036 class KCharSelectTablePrivate; 00037 class KCharSelectPrivate; 00038 00048 class KCharSelectTable : public QGridView 00049 { 00050 Q_OBJECT 00051 00052 public: 00053 KCharSelectTable( QWidget *parent, const char *name, const QString &_font, 00054 const QChar &_chr, int _tableNum ); 00055 00056 virtual QSize sizeHint() const; 00057 virtual void resizeEvent( QResizeEvent * ); 00058 00059 virtual void setFont( const QString &_font ); 00060 virtual void setChar( const QChar &_chr ); 00061 virtual void setTableNum( int _tableNum ); 00062 00063 virtual QChar chr() { return vChr; } 00064 00065 protected: 00066 virtual void paintCell( class QPainter *p, int row, int col ); 00067 00068 virtual void mousePressEvent( QMouseEvent *e ) { mouseMoveEvent( e ); } 00069 virtual void mouseDoubleClickEvent ( QMouseEvent *e ){ mouseMoveEvent( e ); emit doubleClicked();} 00070 virtual void mouseReleaseEvent( QMouseEvent *e ) { mouseMoveEvent( e ); emit activated( chr() ); emit activated(); } 00071 virtual void mouseMoveEvent( QMouseEvent *e ); 00072 00073 virtual void keyPressEvent( QKeyEvent *e ); 00074 00075 void gotoLeft(); 00076 void gotoRight(); 00077 void gotoUp(); 00078 void gotoDown(); 00079 00080 QString vFont; 00081 QChar vChr; 00082 int vTableNum; 00083 QPoint vPos; 00084 QChar focusItem; 00085 QPoint focusPos; 00086 int temp; 00087 00088 signals: 00089 void highlighted( const QChar &c ); 00090 void highlighted(); 00091 void activated( const QChar &c ); 00092 void activated(); 00093 void focusItemChanged(); 00094 void focusItemChanged( const QChar &c ); 00095 void tableUp(); 00096 void tableDown(); 00097 void doubleClicked(); 00098 00099 private: 00100 virtual void setFont(const QFont &f) { QGridView::setFont(f); } 00101 void setToolTips(); 00102 protected: 00103 virtual void virtual_hook( int id, void* data ); 00104 private: 00105 KCharSelectTablePrivate *d; 00106 }; 00107 00135 class KCharSelect : public QVBox 00136 { 00137 Q_OBJECT 00138 Q_PROPERTY( QString fontFamily READ font WRITE setFont ) 00139 Q_PROPERTY( int tableNum READ tableNum WRITE setTableNum ) 00140 Q_PROPERTY( bool fontComboEnabled READ isFontComboEnabled WRITE enableFontCombo ) 00141 Q_PROPERTY( bool tableSpinBoxEnabled READ isTableSpinBoxEnabled WRITE enableTableSpinBox ) 00142 00143 public: 00149 KCharSelect( QWidget *parent, const char *name, 00150 const QString &font = QString::null, const QChar &chr = ' ', int tableNum = 0 ); 00154 virtual QSize sizeHint() const; 00155 00159 virtual void setFont( const QString &font ); 00160 00164 virtual void setChar( const QChar &chr ); 00165 00169 virtual void setTableNum( int tableNum ); 00170 00174 virtual QChar chr() const { return charTable->chr(); } 00175 00179 virtual QString font() const { return fontCombo->currentText(); } 00180 00184 virtual int tableNum() const { return tableSpinBox->value(); } 00185 00191 virtual void enableFontCombo( bool e ) { fontCombo->setEnabled( e ); } 00192 00199 virtual void enableTableSpinBox( bool e ) { tableSpinBox->setEnabled( e ); } 00200 00207 virtual bool isFontComboEnabled() const { return fontCombo->isEnabled(); } 00208 00215 virtual bool isTableSpinBoxEnabled() const { return tableSpinBox->isEnabled(); } 00216 00217 protected: 00218 virtual void fillFontCombo(); 00219 static void cleanupFontDatabase(); 00220 00221 QComboBox *fontCombo; 00222 QSpinBox *tableSpinBox; 00223 KCharSelectTable *charTable; 00224 QStringList fontList; 00225 static QFontDatabase * fontDataBase; 00226 00227 protected slots: 00228 void fontSelected( const QString &_font ); 00229 void tableChanged( int _value ); 00230 void charHighlighted( const QChar &c ) { emit highlighted( c ); } 00231 void charHighlighted() { emit highlighted(); } 00232 void charActivated( const QChar &c ) { emit activated( c ); } 00233 void charActivated() { emit activated(); } 00234 void charFocusItemChanged() { emit focusItemChanged(); } 00235 void charFocusItemChanged( const QChar &c ) { emit focusItemChanged( c ); } 00236 void charTableUp() { if ( tableNum() < 255 ) setTableNum( tableNum() + 1 ); } 00237 void charTableDown() { if ( tableNum() > 0 ) setTableNum( tableNum() - 1 ); } 00238 void slotDoubleClicked() { emit doubleClicked(); } 00239 signals: 00240 void highlighted( const QChar &c ); 00241 void highlighted(); 00242 void activated( const QChar &c ); 00243 void activated(); 00244 void fontChanged( const QString &_font ); 00245 void focusItemChanged(); 00246 void focusItemChanged( const QChar &c ); 00247 void doubleClicked(); 00248 00249 private: 00250 virtual void setFont(const QFont &f) { QVBox::setFont(f); } 00251 protected: 00252 virtual void virtual_hook( int id, void* data ); 00253 private: 00254 KCharSelectPrivate *d; 00255 }; 00256 00257 #endif
KDE Logo
This file is part of the documentation for kdeui Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Aug 20 09:48:43 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003