kfontdialog.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef _K_FONT_DIALOG_H_
00027 #define _K_FONT_DIALOG_H_
00028
00029 #include <qlineedit.h>
00030 #include <qbutton.h>
00031 #include <kdialogbase.h>
00032
00033 class QComboBox;
00034 class QCheckBox;
00035 class QFont;
00036 class QGroupBox;
00037 class QLabel;
00038 class QStringList;
00039 class KListBox;
00040 class KIntNumInput;
00051 class KFontChooser : public QWidget
00052 {
00053 Q_OBJECT
00054
00055 public:
00061 enum FontColumn { FamilyList=0x01, StyleList=0x02, SizeList=0x04};
00062
00068 enum FontDiff { FontDiffFamily=0x01, FontDiffStyle=0x02, FontDiffSize=0x04 };
00069
00102 KFontChooser(QWidget *parent = 0L, const char *name = 0L,
00103 bool onlyFixed = false,
00104 const QStringList &fontList = QStringList(),
00105 bool makeFrame = true, int visibleListSize=8,
00106 bool diff = false, QButton::ToggleState *sizeIsRelativeState = 0L );
00107
00111 virtual ~KFontChooser();
00112
00124 void enableColumn( int column, bool state );
00125
00133 void setFont( const QFont &font, bool onlyFixed = false );
00134
00139 int fontDiffFlags();
00140
00144 QFont font() const { return selFont; }
00145
00149 void setColor( const QColor & col );
00150
00154 QColor color() const;
00155
00159 void setBackgroundColor( const QColor & col );
00160
00164 QColor backgroundColor() const;
00165
00172 void setSizeIsRelative( QButton::ToggleState relative );
00173
00178 QButton::ToggleState sizeIsRelative() const;
00179
00180
00184 QString sampleText() const { return sampleEdit->text(); }
00185
00196 void setSampleText( const QString &text )
00197 {
00198 sampleEdit->setText( text );
00199 }
00200
00208 static QString getXLFD( const QFont &theFont )
00209 { return theFont.rawName(); }
00210
00222 enum FontListCriteria { FixedWidthFonts=0x01, ScalableFonts=0x02, SmoothScalableFonts=0x04 };
00223
00231 static void getFontList( QStringList &list, uint fontListCriteria);
00232
00236 virtual QSize sizeHint( void ) const;
00237
00238 signals:
00242 void fontSelected( const QFont &font );
00243
00244 private slots:
00245 void toggled_checkbox();
00246 void family_chosen_slot(const QString&);
00247 void size_chosen_slot(const QString&);
00248 void style_chosen_slot(const QString&);
00249 void displaySample(const QFont &font);
00250 void showXLFDArea(bool);
00251 void size_value_slot(int);
00252 private:
00253 void fillFamilyListBox(bool onlyFixedFonts = false);
00254 void fillSizeList();
00255
00256 static void addFont( QStringList &list, const char *xfont );
00257
00258 void setupDisplay();
00259
00260
00261
00262 QStringList fontList;
00263
00264 KIntNumInput *sizeOfFont;
00265
00266 QLineEdit *sampleEdit;
00267 QLineEdit *xlfdEdit;
00268
00269 QLabel *familyLabel;
00270 QLabel *styleLabel;
00271 QCheckBox *familyCheckbox;
00272 QCheckBox *styleCheckbox;
00273 QCheckBox *sizeCheckbox;
00274 QLabel *sizeLabel;
00275 KListBox *familyListBox;
00276 KListBox *styleListBox;
00277 KListBox *sizeListBox;
00278 QComboBox *charsetsCombo;
00279 QCheckBox *sizeIsRelativeCheckBox;
00280
00281 QFont selFont;
00282
00283 QString selectedStyle;
00284 int selectedSize;
00285 QMap<QString, QString> currentStyles;
00286
00287 bool usingFixed;
00288
00289 protected:
00290 virtual void virtual_hook( int id, void* data );
00291 private:
00292 class KFontChooserPrivate;
00293 KFontChooserPrivate *d;
00294 };
00295
00319 class KFontDialog : public KDialogBase {
00320 Q_OBJECT
00321
00322 public:
00345 KFontDialog( QWidget *parent = 0L, const char *name = 0,
00346 bool onlyFixed = false, bool modal = false,
00347 const QStringList &fontlist = QStringList(),
00348 bool makeFrame = true, bool diff = false,
00349 QButton::ToggleState *sizeIsRelativeState = 0L );
00350
00358 void setFont( const QFont &font, bool onlyFixed = false )
00359 { chooser->setFont(font, onlyFixed); }
00360
00364 QFont font() const { return chooser->font(); }
00365
00372 void setSizeIsRelative( QButton::ToggleState relative )
00373 { chooser->setSizeIsRelative( relative ); }
00374
00379 QButton::ToggleState sizeIsRelative() const
00380 { return chooser->sizeIsRelative(); }
00381
00401 static int getFont( QFont &theFont, bool onlyFixed = false,
00402 QWidget *parent = 0L, bool makeFrame = true,
00403 QButton::ToggleState *sizeIsRelativeState = 0L );
00404
00437 static int getFontDiff( QFont &theFont, int &diffFlags, bool onlyFixed = false,
00438 QWidget *parent = 0L, bool makeFrame = true,
00439 QButton::ToggleState *sizeIsRelativeState = 0L );
00440
00460 static int getFontAndText( QFont &theFont, QString &theString,
00461 bool onlyFixed = false, QWidget *parent = 0L,
00462 bool makeFrame = true,
00463 QButton::ToggleState *sizeIsRelativeState = 0L );
00464
00465 signals:
00471 void fontSelected( const QFont &font );
00472
00473 protected:
00474 KFontChooser *chooser;
00475
00476 protected:
00477 virtual void virtual_hook( int id, void* data );
00478 private:
00479 class KFontDialogPrivate;
00480 KFontDialogPrivate *d;
00481
00482 };
00483
00484 #endif
This file is part of the documentation for kdelibs Version 3.1.5.