KDEUI
kfontchooser.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
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
00045 class KDEUI_EXPORT KFontChooser : public QWidget
00046 {
00047 Q_OBJECT
00048 Q_PROPERTY( QFont font READ font WRITE setFont USER true )
00049
00050 public:
00056 enum FontColumn { FamilyList=0x01, StyleList=0x02, SizeList=0x04};
00057
00063 enum FontDiff { NoFontDiffFlags = 0,
00064 FontDiffFamily = 1,
00065 FontDiffStyle = 2,
00066 FontDiffSize = 4,
00067 AllFontDiffs = FontDiffFamily | FontDiffStyle | FontDiffSize };
00068 Q_DECLARE_FLAGS( FontDiffFlags, FontDiff )
00069
00070
00075 enum DisplayFlag { NoDisplayFlags = 0,
00076 FixedFontsOnly = 1,
00077 DisplayFrame = 2,
00078 ShowDifferences = 4 };
00079 Q_DECLARE_FLAGS( DisplayFlags, DisplayFlag )
00080
00081
00110 explicit KFontChooser( QWidget *parent = 0L,
00111 const DisplayFlags& flags = DisplayFrame,
00112 const QStringList &fontList = QStringList(),
00113 int visibleListSize = 8,
00114 Qt::CheckState *sizeIsRelativeState = 0L );
00115
00119 virtual ~KFontChooser();
00120
00132 void enableColumn( int column, bool state );
00133
00141 void setFont( const QFont &font, bool onlyFixed = false );
00142
00147 FontDiffFlags fontDiffFlags() const;
00148
00152 QFont font() const;
00153
00157 void setColor( const QColor & col );
00158
00163 QColor color() const;
00164
00168 void setBackgroundColor( const QColor & col );
00169
00174 QColor backgroundColor() const;
00175
00182 void setSizeIsRelative( Qt::CheckState relative );
00183
00188 Qt::CheckState sizeIsRelative() const;
00189
00190
00194 QString sampleText() const;
00195
00206 void setSampleText( const QString &text );
00207
00213 void setSampleBoxVisible( bool visible );
00214
00226 enum FontListCriteria { FixedWidthFonts=0x01, ScalableFonts=0x02, SmoothScalableFonts=0x04 };
00227
00235 static void getFontList( QStringList &list, uint fontListCriteria);
00236
00240 virtual QSize sizeHint( void ) const;
00241
00242 Q_SIGNALS:
00246 void fontSelected( const QFont &font );
00247
00248 private:
00249 class Private;
00250 Private * const d;
00251
00252 Q_DISABLE_COPY(KFontChooser)
00253
00254 Q_PRIVATE_SLOT(d, void _k_toggled_checkbox())
00255 Q_PRIVATE_SLOT(d, void _k_family_chosen_slot(const QString&))
00256 Q_PRIVATE_SLOT(d, void _k_size_chosen_slot(const QString&))
00257 Q_PRIVATE_SLOT(d, void _k_style_chosen_slot(const QString&))
00258 Q_PRIVATE_SLOT(d, void _k_displaySample(const QFont &font))
00259 Q_PRIVATE_SLOT(d, void _k_showXLFDArea(bool))
00260 Q_PRIVATE_SLOT(d, void _k_size_value_slot(int))
00261 };
00262
00263 Q_DECLARE_OPERATORS_FOR_FLAGS( KFontChooser::DisplayFlags )
00264
00265 #endif