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 Q_PROPERTY( QFont font READ font WRITE setFont )
00055
00056 public:
00062 enum FontColumn { FamilyList=0x01, StyleList=0x02, SizeList=0x04};
00063
00069 enum FontDiff { FontDiffFamily=0x01, FontDiffStyle=0x02, FontDiffSize=0x04 };
00070
00105 KFontChooser(QWidget *parent = 0L, const char *name = 0L,
00106 bool onlyFixed = false,
00107 const QStringList &fontList = QStringList(),
00108 bool makeFrame = true, int visibleListSize=8,
00109 bool diff = false, QButton::ToggleState *sizeIsRelativeState = 0L );
00110
00114 virtual ~KFontChooser();
00115
00127 void enableColumn( int column, bool state );
00128
00136 void setFont( const QFont &font, bool onlyFixed = false );
00137
00142 int fontDiffFlags();
00143
00147 QFont font() const { return selFont; }
00148
00152 void setColor( const QColor & col );
00153
00158 QColor color() const;
00159
00163 void setBackgroundColor( const QColor & col );
00164
00169 QColor backgroundColor() const;
00170
00177 void setSizeIsRelative( QButton::ToggleState relative );
00178
00183 QButton::ToggleState sizeIsRelative() const;
00184
00185
00189 QString sampleText() const { return sampleEdit->text(); }
00190
00201 void setSampleText( const QString &text )
00202 {
00203 sampleEdit->setText( text );
00204 }
00205
00213 static QString getXLFD( const QFont &theFont )
00214 { return theFont.rawName(); }
00215
00227 enum FontListCriteria { FixedWidthFonts=0x01, ScalableFonts=0x02, SmoothScalableFonts=0x04 };
00228
00236 static void getFontList( QStringList &list, uint fontListCriteria);
00237
00241 virtual QSize sizeHint( void ) const;
00242
00243 signals:
00247 void fontSelected( const QFont &font );
00248
00249 private slots:
00250 void toggled_checkbox();
00251 void family_chosen_slot(const QString&);
00252 void size_chosen_slot(const QString&);
00253 void style_chosen_slot(const QString&);
00254 void displaySample(const QFont &font);
00255 void showXLFDArea(bool);
00256 void size_value_slot(int);
00257 private:
00258 void fillFamilyListBox(bool onlyFixedFonts = false);
00259 void fillSizeList();
00260
00261 static void addFont( QStringList &list, const char *xfont );
00262
00263 void setupDisplay();
00264
00265
00266
00267 QStringList fontList;
00268
00269 KIntNumInput *sizeOfFont;
00270
00271 QLineEdit *sampleEdit;
00272 QLineEdit *xlfdEdit;
00273
00274 QLabel *familyLabel;
00275 QLabel *styleLabel;
00276 QCheckBox *familyCheckbox;
00277 QCheckBox *styleCheckbox;
00278 QCheckBox *sizeCheckbox;
00279 QLabel *sizeLabel;
00280 KListBox *familyListBox;
00281 KListBox *styleListBox;
00282 KListBox *sizeListBox;
00283 QComboBox *charsetsCombo;
00284 QCheckBox *sizeIsRelativeCheckBox;
00285
00286 QFont selFont;
00287
00288 QString selectedStyle;
00289 int selectedSize;
00290 QMap<QString, QString> currentStyles;
00291
00292 bool usingFixed;
00293
00294 protected:
00295 virtual void virtual_hook( int id, void* data );
00296 private:
00297 class KFontChooserPrivate;
00298 KFontChooserPrivate *d;
00299 };
00300
00324 class KFontDialog : public KDialogBase {
00325 Q_OBJECT
00326
00327 public:
00350 KFontDialog( QWidget *parent = 0L, const char *name = 0,
00351 bool onlyFixed = false, bool modal = false,
00352 const QStringList &fontlist = QStringList(),
00353 bool makeFrame = true, bool diff = false,
00354 QButton::ToggleState *sizeIsRelativeState = 0L );
00355
00363 void setFont( const QFont &font, bool onlyFixed = false )
00364 { chooser->setFont(font, onlyFixed); }
00365
00369 QFont font() const { return chooser->font(); }
00370
00377 void setSizeIsRelative( QButton::ToggleState relative )
00378 { chooser->setSizeIsRelative( relative ); }
00379
00384 QButton::ToggleState sizeIsRelative() const
00385 { return chooser->sizeIsRelative(); }
00386
00406 static int getFont( QFont &theFont, bool onlyFixed = false,
00407 QWidget *parent = 0L, bool makeFrame = true,
00408 QButton::ToggleState *sizeIsRelativeState = 0L );
00409
00442 static int getFontDiff( QFont &theFont, int &diffFlags, bool onlyFixed = false,
00443 QWidget *parent = 0L, bool makeFrame = true,
00444 QButton::ToggleState *sizeIsRelativeState = 0L );
00445
00465 static int getFontAndText( QFont &theFont, QString &theString,
00466 bool onlyFixed = false, QWidget *parent = 0L,
00467 bool makeFrame = true,
00468 QButton::ToggleState *sizeIsRelativeState = 0L );
00469
00470 signals:
00476 void fontSelected( const QFont &font );
00477
00478 protected:
00479 KFontChooser *chooser;
00480
00481 protected:
00482 virtual void virtual_hook( int id, void* data );
00483 private:
00484 class KFontDialogPrivate;
00485 KFontDialogPrivate *d;
00486
00487 };
00488
00489 #endif
This file is part of the documentation for kdeui Library Version 3.3.0.