kcharselect.h Source File (kdeui Library)

| # kdeui Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# 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 protected:
    00102     virtual void virtual_hook( int id, void* data );
    00103 private:
    00104     KCharSelectTablePrivate *d;
    00105 };
    00106
    00134 class KCharSelect : public QVBox
    00135 {
    00136     Q_OBJECT
    00137     Q_PROPERTY( QString fontFamily READ font WRITE setFont )
    00138     Q_PROPERTY( int tableNum READ tableNum WRITE setTableNum )
    00139     Q_PROPERTY( bool fontComboEnabled READ isFontComboEnabled WRITE enableFontCombo )
    00140     Q_PROPERTY( bool tableSpinBoxEnabled READ isTableSpinBoxEnabled WRITE enableTableSpinBox )
    00141
    00142 public:
    00148     KCharSelect( QWidget *parent, const char *name,
    00149                  const QString &font = QString::null, const QChar &chr = ' ', int tableNum = 0 );
    00153     virtual QSize sizeHint() const;
    00154
    00158     virtual void setFont( const QString &font );
    00159
    00163     virtual void setChar( const QChar &chr );
    00164
    00168     virtual void setTableNum( int tableNum );
    00169
    00173     virtual QChar chr() const { return charTable->chr(); }
    00174
    00178     virtual QString font() const { return fontCombo->currentText(); }
    00179
    00183     virtual int tableNum() const { return tableSpinBox->value(); }
    00184
    00190     virtual void enableFontCombo( bool e ) { fontCombo->setEnabled( e ); }
    00191
    00198     virtual void enableTableSpinBox( bool e ) { tableSpinBox->setEnabled( e ); }
    00199
    00206     virtual bool isFontComboEnabled() const { return fontCombo->isEnabled(); }
    00207
    00214     virtual bool isTableSpinBoxEnabled() const { return tableSpinBox->isEnabled(); }
    00215
    00216 protected:
    00217     virtual void fillFontCombo();
    00218     static void cleanupFontDatabase();
    00219
    00220     QComboBox *fontCombo;
    00221     QSpinBox *tableSpinBox;
    00222     KCharSelectTable *charTable;
    00223     QStringList fontList;
    00224     static QFontDatabase * fontDataBase;
    00225
    00226 protected slots:
    00227     void fontSelected( const QString &_font );
    00228     void tableChanged( int _value );
    00229     void charHighlighted( const QChar &c ) { emit highlighted( c ); }
    00230     void charHighlighted() { emit highlighted(); }
    00231     void charActivated( const QChar &c ) { emit activated( c ); }
    00232     void charActivated() { emit activated(); }
    00233     void charFocusItemChanged() { emit focusItemChanged(); }
    00234     void charFocusItemChanged( const QChar &c ) { emit focusItemChanged( c ); }
    00235     void charTableUp() { if ( tableNum() < 255 ) setTableNum( tableNum() + 1 ); }
    00236     void charTableDown() { if ( tableNum() > 0 ) setTableNum( tableNum() - 1 ); }
    00237     void slotDoubleClicked() { emit doubleClicked(); }
    00238 signals:
    00239     void highlighted( const QChar &c );
    00240     void highlighted();
    00241     void activated( const QChar &c );
    00242     void activated();
    00243     void fontChanged( const QString &_font );
    00244     void focusItemChanged();
    00245     void focusItemChanged( const QChar &c );
    00246     void doubleClicked();
    00247
    00248 private:
    00249     virtual void setFont(const QFont &f) { QVBox::setFont(f); }
    00250 protected:
    00251     virtual void virtual_hook( int id, void* data );
    00252 private:
    00253     KCharSelectPrivate *d;
    00254 };
    00255
    00256 #endif

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:56:15 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001