KDEUI
kfontchooser.h
Go to the documentation of this file.
00001 /* 00002 Requires the Qt widget libraries, available at no cost at 00003 http://www.troll.no 00004 00005 Copyright (C) 1997 Bernd Johannes Wuebben <wuebben@kde.org> 00006 Copyright (c) 1999 Preston Brown <pbrown@kde.org> 00007 Copyright (c) 1999 Mario Weilguni <mweilguni@kde.org> 00008 00009 This library is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU Library General Public 00011 License as published by the Free Software Foundation; either 00012 version 2 of the License, or (at your option) any later version. 00013 00014 This library is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 Library General Public License for more details. 00018 00019 You should have received a copy of the GNU Library General Public License 00020 along with this library; see the file COPYING.LIB. If not, write to 00021 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00022 Boston, MA 02110-1301, USA. 00023 */ 00024 #ifndef K_FONT_CHOOSER_H 00025 #define K_FONT_CHOOSER_H 00026 00027 #include <kdeui_export.h> 00028 #include <QtGui/QWidget> 00029 00030 class QFont; 00031 class QStringList; 00032 00047 class KDEUI_EXPORT KFontChooser : public QWidget 00048 { 00049 Q_OBJECT 00050 Q_PROPERTY( QFont font READ font WRITE setFont NOTIFY fontSelected USER true ) 00051 Q_PROPERTY( QColor color READ color WRITE setColor ) 00052 Q_PROPERTY( QColor backgroundColor READ backgroundColor WRITE setBackgroundColor ) 00053 Q_PROPERTY( Qt::CheckState sizeIsRelative READ sizeIsRelative WRITE setSizeIsRelative ) 00054 Q_PROPERTY( QString sampleText READ sampleText WRITE setSampleText ) 00055 00056 public: 00062 enum FontColumn { FamilyList=0x01, StyleList=0x02, SizeList=0x04}; 00063 00069 enum FontDiff { NoFontDiffFlags = 0, 00070 FontDiffFamily = 1, 00071 FontDiffStyle = 2, 00072 FontDiffSize = 4, 00073 AllFontDiffs = FontDiffFamily | FontDiffStyle | FontDiffSize }; 00074 Q_DECLARE_FLAGS( FontDiffFlags, FontDiff ) 00075 00076 00081 enum DisplayFlag { NoDisplayFlags = 0, 00082 FixedFontsOnly = 1, 00083 DisplayFrame = 2, 00084 ShowDifferences = 4 }; 00085 Q_DECLARE_FLAGS( DisplayFlags, DisplayFlag ) 00086 00087 00116 explicit KFontChooser( QWidget *parent = 0L, 00117 const DisplayFlags& flags = DisplayFrame, 00118 const QStringList &fontList = QStringList(), 00119 int visibleListSize = 8, 00120 Qt::CheckState *sizeIsRelativeState = 0L ); 00121 00125 virtual ~KFontChooser(); 00126 00138 void enableColumn( int column, bool state ); 00139 00147 void setFont( const QFont &font, bool onlyFixed = false ); 00148 00153 FontDiffFlags fontDiffFlags() const; 00154 00158 QFont font() const; 00159 00163 void setColor( const QColor & col ); 00164 00169 QColor color() const; 00170 00174 void setBackgroundColor( const QColor & col ); 00175 00180 QColor backgroundColor() const; 00181 00188 void setSizeIsRelative( Qt::CheckState relative ); 00189 00194 Qt::CheckState sizeIsRelative() const; 00195 00196 00200 QString sampleText() const; 00201 00212 void setSampleText( const QString &text ); 00213 00219 void setSampleBoxVisible( bool visible ); 00220 00232 enum FontListCriteria { FixedWidthFonts=0x01, ScalableFonts=0x02, SmoothScalableFonts=0x04 }; 00233 00241 static void getFontList( QStringList &list, uint fontListCriteria); 00242 00246 virtual QSize sizeHint( void ) const; 00247 00248 Q_SIGNALS: 00252 void fontSelected( const QFont &font ); 00253 00254 private: 00255 class Private; 00256 Private * const d; 00257 00258 Q_DISABLE_COPY(KFontChooser) 00259 00260 Q_PRIVATE_SLOT(d, void _k_toggled_checkbox()) 00261 Q_PRIVATE_SLOT(d, void _k_family_chosen_slot(const QString&)) 00262 Q_PRIVATE_SLOT(d, void _k_size_chosen_slot(const QString&)) 00263 Q_PRIVATE_SLOT(d, void _k_style_chosen_slot(const QString&)) 00264 Q_PRIVATE_SLOT(d, void _k_displaySample(const QFont &font)) 00265 Q_PRIVATE_SLOT(d, void _k_showXLFDArea(bool)) 00266 Q_PRIVATE_SLOT(d, void _k_size_value_slot(double)) 00267 }; 00268 00269 Q_DECLARE_OPERATORS_FOR_FLAGS( KFontChooser::DisplayFlags ) 00270 00271 #endif
KDE 4.6 API Reference