kcharselect.h
/* This file is part of the KDE libraries
Copyright (C) 1999 Reginald Stadlbauer <reggie@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef kcharselect_h
#define kcharselect_h
#include <qgridview.h>
#include <qvbox.h>
#include <qcombobox.h>
#include <qspinbox.h>
#include <qstring.h>
#include <qpoint.h>
#include <qstringlist.h>
#include <kdelibs_export.h>
class QFont;
class QFontDatabase;
class QMouseEvent;
class QSpinBox;
class KCharSelectTablePrivate;
class KCharSelectPrivate;
class KDEUI_EXPORT KCharSelectTable : public QGridView
{
Q_OBJECT
public:
KCharSelectTable( QWidget *parent, const char *name, const QString &_font,
const QChar &_chr, int _tableNum );
virtual QSize sizeHint() const;
virtual void resizeEvent( QResizeEvent * );
virtual void setFont( const QString &_font );
virtual void setChar( const QChar &_chr );
virtual void setTableNum( int _tableNum );
virtual QChar chr() { return vChr; }
protected:
virtual void paintCell( class QPainter *p, int row, int col );
virtual void mousePressEvent( QMouseEvent *e ) { mouseMoveEvent( e ); }
virtual void mouseDoubleClickEvent ( QMouseEvent *e ){ mouseMoveEvent( e ); emit doubleClicked();}
virtual void mouseReleaseEvent( QMouseEvent *e ) { mouseMoveEvent( e ); emit activated( chr() ); emit activated(); }
virtual void mouseMoveEvent( QMouseEvent *e );
virtual void keyPressEvent( QKeyEvent *e );
void gotoLeft();
void gotoRight();
void gotoUp();
void gotoDown();
QString vFont;
QChar vChr;
int vTableNum;
QPoint vPos;
QChar focusItem;
QPoint focusPos;
int temp;
signals:
void highlighted( const QChar &c );
void highlighted();
void activated( const QChar &c );
void activated();
void focusItemChanged();
void focusItemChanged( const QChar &c );
void tableUp();
void tableDown();
void doubleClicked();
private:
virtual void setFont(const QFont &f) { QGridView::setFont(f); }
void setToolTips();
protected:
virtual void virtual_hook( int id, void* data );
private:
KCharSelectTablePrivate* const d;
};
class KDEUI_EXPORT KCharSelect : public QVBox
{
Q_OBJECT
Q_PROPERTY( QString fontFamily READ font WRITE setFont )
Q_PROPERTY( int tableNum READ tableNum WRITE setTableNum )
Q_PROPERTY( bool fontComboEnabled READ isFontComboEnabled WRITE enableFontCombo )
Q_PROPERTY( bool tableSpinBoxEnabled READ isTableSpinBoxEnabled WRITE enableTableSpinBox )
public:
KCharSelect( QWidget *parent, const char *name,
const QString &font = QString::null, const QChar &chr = ' ', int tableNum = 0 );
~KCharSelect();
virtual QSize sizeHint() const;
virtual void setFont( const QString &font );
virtual void setChar( const QChar &chr );
virtual void setTableNum( int tableNum );
virtual QChar chr() const { return charTable->chr(); }
virtual QString font() const { return fontCombo->currentText(); }
virtual int tableNum() const { return tableSpinBox->value(); }
virtual void enableFontCombo( bool e ) { fontCombo->setEnabled( e ); }
virtual void enableTableSpinBox( bool e ) { tableSpinBox->setEnabled( e ); }
virtual bool isFontComboEnabled() const { return fontCombo->isEnabled(); }
virtual bool isTableSpinBoxEnabled() const { return tableSpinBox->isEnabled(); }
protected:
virtual void fillFontCombo();
static void cleanupFontDatabase();
QComboBox *fontCombo;
QSpinBox *tableSpinBox;
KCharSelectTable *charTable;
QStringList fontList;
static QFontDatabase * fontDataBase;
protected slots:
void fontSelected( const QString &_font );
void tableChanged( int _value );
void charHighlighted( const QChar &c ) { emit highlighted( c ); }
void charHighlighted() { emit highlighted(); }
void charActivated( const QChar &c ) { emit activated( c ); }
void charActivated() { emit activated(); }
void charFocusItemChanged() { emit focusItemChanged(); }
void charFocusItemChanged( const QChar &c ) { emit focusItemChanged( c ); }
void charTableUp() { if ( tableNum() < 255 ) setTableNum( tableNum() + 1 ); }
void charTableDown() { if ( tableNum() > 0 ) setTableNum( tableNum() - 1 ); }
void slotDoubleClicked() { emit doubleClicked(); }
void slotUnicodeEntered();
void slotUpdateUnicode( const QChar &c );
signals:
void highlighted( const QChar &c );
void highlighted();
void activated( const QChar &c );
void activated();
void fontChanged( const QString &_font );
void focusItemChanged();
void focusItemChanged( const QChar &c );
void doubleClicked();
private:
virtual void setFont(const QFont &f) { QVBox::setFont(f); }
protected:
virtual void virtual_hook( int id, void* data );
private:
class KCharSelectPrivate;
KCharSelectPrivate* const d;
};
#endif
KCharSelect::enableFontCombo
virtual void enableFontCombo(bool e)
If e is set to true, the combobox which allows the user to select the font which should be displayed ...
Definition: kcharselect.h:197
KCharSelect::font
virtual QString font() const
Returns the currently displayed font.
Definition: kcharselect.h:185
KCharSelect::isFontComboEnabled
virtual bool isFontComboEnabled() const
Returns wether the font combobox on the top is enabled or disabled.
Definition: kcharselect.h:213
KCharSelect::enableTableSpinBox
virtual void enableTableSpinBox(bool e)
If e is set to true, the spinbox which allows the user to specify which characters of the font should...
Definition: kcharselect.h:205
KCharSelect
Character selection widget.
Definition: kcharselect.h:140
KCharSelect::chr
virtual QChar chr() const
Returns the currently selected character.
Definition: kcharselect.h:180
KCharSelect::isTableSpinBoxEnabled
virtual bool isTableSpinBoxEnabled() const
Returns wether the table spinbox on the top is enabled or disabled.
Definition: kcharselect.h:221
KCharSelect::tableNum
virtual int tableNum() const
Returns the currently displayed table.
Definition: kcharselect.h:190
KCharSelectTable
Character selection table.
Definition: kcharselect.h:51

KDE Home | KDE Accessibility Home | Description of Access Keys