| # kdeui Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | 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 #include <kdelibs_export.h>
    00033
    00034 class QFont;
    00035 class QFontDatabase;
    00036 class QMouseEvent;
    00037 class QSpinBox;
    00038 class KCharSelectTablePrivate;
    00039 class KCharSelectPrivate;
    00040
    00051 class KDEUI_EXPORT KCharSelectTable : public QGridView
    00052 {
    00053     Q_OBJECT
    00054
    00055 public:
    00056     KCharSelectTable( QWidget *parent, const char *name, const QString &_font,
    00057               const QChar &_chr, int _tableNum );
    00058
    00059     virtual QSize sizeHint() const;
    00060     virtual void resizeEvent( QResizeEvent * );
    00061
    00062     virtual void setFont( const QString &_font );
    00063     virtual void setChar( const QChar &_chr );
    00064     virtual void setTableNum( int _tableNum );
    00065
    00066     virtual QChar chr() { return vChr; }
    00067
    00068 protected:
    00069     virtual void paintCell( class QPainter *p, int row, int col );
    00070
    00071     virtual void mousePressEvent( QMouseEvent *e ) {  mouseMoveEvent( e ); }
    00072     virtual void mouseDoubleClickEvent ( QMouseEvent *e ){  mouseMoveEvent( e ); emit doubleClicked();}
    00073     virtual void mouseReleaseEvent( QMouseEvent *e ) { mouseMoveEvent( e ); emit activated( chr() ); emit activated(); }
    00074     virtual void mouseMoveEvent( QMouseEvent *e );
    00075
    00076     virtual void keyPressEvent( QKeyEvent *e );
    00077
    00078     void gotoLeft();
    00079     void gotoRight();
    00080     void gotoUp();
    00081     void gotoDown();
    00082
    00083     QString vFont;
    00084     QChar vChr;
    00085     int vTableNum;
    00086     QPoint vPos;
    00087     QChar focusItem;
    00088     QPoint focusPos;
    00089     int temp;
    00090
    00091 signals:
    00092     void highlighted( const QChar &c );
    00093     void highlighted();
    00094     void activated( const QChar &c );
    00095     void activated();
    00096     void focusItemChanged();
    00097     void focusItemChanged( const QChar &c );
    00098     void tableUp();
    00099     void tableDown();
    00100     void doubleClicked();
    00101
    00102 private:
    00103     virtual void setFont(const QFont &f) { QGridView::setFont(f); }
    00104     void setToolTips();
    00105 protected:
    00106     virtual void virtual_hook( int id, void* data );
    00107 private:
    00108     KCharSelectTablePrivate* const d;
    00109 };
    00110
    00140 class KDEUI_EXPORT KCharSelect : public QVBox
    00141 {
    00142     Q_OBJECT
    00143     Q_PROPERTY( QString fontFamily READ font WRITE setFont )
    00144     Q_PROPERTY( int tableNum READ tableNum WRITE setTableNum )
    00145     Q_PROPERTY( bool fontComboEnabled READ isFontComboEnabled WRITE enableFontCombo )
    00146     Q_PROPERTY( bool tableSpinBoxEnabled READ isTableSpinBoxEnabled WRITE enableTableSpinBox )
    00147
    00148 public:
    00154     KCharSelect( QWidget *parent, const char *name,
    00155          const QString &font = QString::null, const QChar &chr = ' ', int tableNum = 0 );
    00156     ~KCharSelect();
    00160     virtual QSize sizeHint() const;
    00161
    00165     virtual void setFont( const QString &font );
    00166
    00170     virtual void setChar( const QChar &chr );
    00171
    00175     virtual void setTableNum( int tableNum );
    00176
    00180     virtual QChar chr() const { return charTable->chr(); }
    00181
    00185     virtual QString font() const { return fontCombo->currentText(); }
    00186
    00190     virtual int tableNum() const { return tableSpinBox->value(); }
    00191
    00197     virtual void enableFontCombo( bool e ) { fontCombo->setEnabled( e ); }
    00198
    00205     virtual void enableTableSpinBox( bool e ) { tableSpinBox->setEnabled( e ); }
    00206
    00213     virtual bool isFontComboEnabled() const { return fontCombo->isEnabled(); }
    00214
    00221     virtual bool isTableSpinBoxEnabled() const { return tableSpinBox->isEnabled(); }
    00222
    00223 protected:
    00224     virtual void fillFontCombo();
    00225     static void cleanupFontDatabase();
    00226
    00227     QComboBox *fontCombo;
    00228     QSpinBox *tableSpinBox;
    00229     KCharSelectTable *charTable;
    00230     QStringList fontList;
    00231     static QFontDatabase * fontDataBase;
    00232
    00233 protected slots:
    00234     void fontSelected( const QString &_font );
    00235     void tableChanged( int _value );
    00236     void charHighlighted( const QChar &c ) { emit highlighted( c ); }
    00237     void charHighlighted() { emit highlighted(); }
    00238     void charActivated( const QChar &c ) { emit activated( c ); }
    00239     void charActivated() { emit activated(); }
    00240     void charFocusItemChanged() { emit focusItemChanged(); }
    00241     void charFocusItemChanged( const QChar &c ) { emit focusItemChanged( c ); }
    00242     void charTableUp() { if ( tableNum() < 255 ) setTableNum( tableNum() + 1 ); }
    00243     void charTableDown() { if ( tableNum() > 0 ) setTableNum( tableNum() - 1 ); }
    00244     void slotDoubleClicked() { emit doubleClicked(); }
    00245     void slotUnicodeEntered();
    00246     void slotUpdateUnicode( const QChar &c );
    00247 signals:
    00248     void highlighted( const QChar &c );
    00249     void highlighted();
    00250     void activated( const QChar &c );
    00251     void activated();
    00252     void fontChanged( const QString &_font );
    00253     void focusItemChanged();
    00254     void focusItemChanged( const QChar &c );
    00255     void doubleClicked();
    00256
    00257 private:
    00258     virtual void setFont(const QFont &f) { QVBox::setFont(f); }
    00259 protected:
    00260     virtual void virtual_hook( int id, void* data );
    00261 private:
    00262     class KCharSelectPrivate;
    00263     KCharSelectPrivate* const d;
    00264 };
    00265
    00266 #endif

This file is part of the documentation for kdeui Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:20:13 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003