.TH "KFontChooser" 3 "28 Jan 2004" "kdeui Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KFontChooser \- While KFontChooser as an ordinary widget can be embedded in custom dialogs and therefore is very flexible, in most cases it is preferable to use the convenience functions in \fBKFontDialog\fP. A font selection widget.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <kfontdialog.h>\fP
.PP
Inherits \fBQWidget\fP.
.PP
.SS "Public Types"

.in +1c
.ti -1c
.RI "enum \fBFontColumn\fP { \fBFamilyList\fP = 0x01, \fBStyleList\fP = 0x02, \fBSizeList\fP = 0x04 }"
.br
.RI "\fI.IP "\(bu" 2
\fCFamilyList\fP - Identifies the family (leftmost) list. 
.PP
\fP"
.ti -1c
.RI "enum \fBFontDiff\fP { \fBFontDiffFamily\fP = 0x01, \fBFontDiffStyle\fP = 0x02, \fBFontDiffSize\fP = 0x04 }"
.br
.RI "\fI.IP "\(bu" 2
\fCFontDiffFamily\fP - Identifies a requested change in the font family. 
.PP
\fP"
.ti -1c
.RI "enum \fBFontListCriteria\fP { \fBFixedWidthFonts\fP = 0x01, \fBScalableFonts\fP = 0x02, \fBSmoothScalableFonts\fP = 0x04 }"
.br
.RI "\fIThe selection criteria for the font families shown in the dialog. \fP"
.in -1c
.SS "Signals"

.in +1c
.ti -1c
.RI "void \fBfontSelected\fP (const  \fBQFont\fP &font)"
.br
.RI "\fIEmitted whenever the selected font changes. \fP"
.in -1c
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKFontChooser\fP (\fBQWidget\fP *parent=0L, const  char *name=0L, bool onlyFixed=false, const  \fBQStringList\fP &fontList=\fBQStringList\fP(), bool makeFrame=true, int visibleListSize=8, bool diff=false, QButton::ToggleState *sizeIsRelativeState=0L)"
.br
.RI "\fIConstructs a font picker widget. \fP"
.ti -1c
.RI "virtual \fB~KFontChooser\fP ()"
.br
.RI "\fIDestructs the font chooser. \fP"
.ti -1c
.RI "void \fBenableColumn\fP (int column, bool state)"
.br
.RI "\fIEnables or disable a font column in the chooser. \fP"
.ti -1c
.RI "void \fBsetFont\fP (const  \fBQFont\fP &font, bool onlyFixed=false)"
.br
.RI "\fISets the currently selected font in the chooser. \fP"
.ti -1c
.RI "int \fBfontDiffFlags\fP ()"
.br
.ti -1c
.RI "\fBQFont\fP \fBfont\fP () const "
.br
.ti -1c
.RI "void \fBsetColor\fP (const  \fBQColor\fP &col)"
.br
.RI "\fISets the color to use in the preview. \fP"
.ti -1c
.RI "\fBQColor\fP \fBcolor\fP () const "
.br
.ti -1c
.RI "void \fBsetBackgroundColor\fP (const  \fBQColor\fP &col)"
.br
.RI "\fISets the background color to use in the preview. \fP"
.ti -1c
.RI "\fBQColor\fP \fBbackgroundColor\fP () const "
.br
.ti -1c
.RI "void \fBsetSizeIsRelative\fP (QButton::ToggleState relative)"
.br
.RI "\fISets the state of the checkbox indicating whether the font size is to be interpreted as relative size. \fP"
.ti -1c
.RI "QButton::ToggleState \fBsizeIsRelative\fP () const "
.br
.ti -1c
.RI "\fBQString\fP \fBsampleText\fP () const "
.br
.ti -1c
.RI "void \fBsetSampleText\fP (const  \fBQString\fP &text)"
.br
.RI "\fISets the sample text. \fP"
.ti -1c
.RI "virtual \fBQSize\fP \fBsizeHint\fP (void) const "
.br
.RI "\fIReimplemented for internal reasons. \fP"
.in -1c
.SS "Static Public Member Functions"

.in +1c
.ti -1c
.RI "\fBQString\fP \fBgetXLFD\fP (const  \fBQFont\fP &theFont)"
.br
.RI "\fIConverts a \fBQFont\fP into the corresponding X Logical Font Description (XLFD). \fP"
.ti -1c
.RI "void \fBgetFontList\fP (\fBQStringList\fP &list, uint fontListCriteria)"
.br
.RI "\fICreates a list of font strings. \fP"
.in -1c
.SS "Protected Member Functions"

.in +1c
.ti -1c
.RI "virtual void \fBvirtual_hook\fP (int id, void *data)"
.br
.in -1c
.SH "Detailed Description"
.PP 
While KFontChooser as an ordinary widget can be embedded in custom dialogs and therefore is very flexible, in most cases it is preferable to use the convenience functions in \fBKFontDialog\fP. A font selection widget. 

\fBAuthor:\fP
.RS 4
Preston Brown <pbrown@kde.org>, Bernd Wuebben <wuebben@kde.org> 
.RE
.PP
\fBVersion:\fP
.RS 4
\fBId\fP.RS 4
\fBkfontdialog.h\fP,v 1.61 2002/09/11 02:18:25 orlovich Exp 
.RE
.PP
.RE
.PP

.PP
Definition at line 51 of file kfontdialog.h.
.SH "Member Enumeration Documentation"
.PP 
.SS "\fBenum\fP \fBKFontChooser::FontColumn\fP"
.PP
.IP "\(bu" 2
\fCFamilyList\fP - Identifies the family (leftmost) list. 
.PP
.IP "\(bu" 2
\fCStyleList\fP - Identifies the style (center) list. 
.IP "\(bu" 2
\fCSizeList\fP - Identifies the size (rightmost) list. 
.PP
Definition at line 61 of file kfontdialog.h.
.SS "\fBenum\fP \fBKFontChooser::FontDiff\fP"
.PP
.IP "\(bu" 2
\fCFontDiffFamily\fP - Identifies a requested change in the font family. 
.PP
.IP "\(bu" 2
\fCFontDiffStyle\fP - Identifies a requested change in the font style. 
.IP "\(bu" 2
\fCFontDiffSize\fP - Identifies a requested change in the font size. 
.PP
Definition at line 68 of file kfontdialog.h.
.SS "\fBenum\fP \fBKFontChooser::FontListCriteria\fP"
.PP
The selection criteria for the font families shown in the dialog. .IP "\(bu" 2
\fCFixedWidthFont\fP when included only fixed-width fonts are returned. The fonts where the width of every character is equal. 
.IP "\(bu" 2
\fCScalableFont\fP when included only scalable fonts are returned; certain configurations allow bitmap fonts to remain unscaled and thus these fonts have limited number of sizes. 
.IP "\(bu" 2
\fCSmoothScalableFont\fP when included only return smooth scalable fonts. this will return only non-bitmap fonts which are scalable to any size requested. Setting this option to true will mean the 'scalable' flag is irrelavant. 
.PP
Definition at line 222 of file kfontdialog.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KFontChooser::KFontChooser (\fBQWidget\fP * parent = 0L, const char * name = 0L, bool onlyFixed = false, const \fBQStringList\fP & fontList = \fBQStringList\fP(), bool makeFrame = true, int visibleListSize = 8, bool diff = false, QButton::ToggleState * sizeIsRelativeState = 0L)"
.PP
Constructs a font picker widget. It normally comes up with all font families present on the system; the getFont method below does allow some more fine-tuning of the selection of fonts that will be displayed in the dialog. 
.PP
Consider the following code snippet;
.PP
.nf

.PP
.PP
.PP
.nf
    \fBQStringList\fP list;
    KFontChooser::getFontList(list,SmoothScalableFonts);
    KFontChooser chooseFont = new KFontChooser(0, 'FontList', false, list);
 
.PP
 
.PP
The above creates a font chooser dialog with only SmoothScaleble fonts.
.PP
\fBParameters:\fP
.RS 4
\fIparent\fP The parent widget. 
.br
\fIname\fP The widget name. 
.br
\fIonlyFixedFonts\fP Only display fonts which have fixed-width character sizes. 
.br
\fIfontList\fP A list of fonts to display, in XLFD format. If no list is formatted, the internal \fBKDE\fP font list is used. If that has not been created, X is queried, and all fonts available on the system are displayed. 
.br
\fIdiff\fP Display the difference version dialog. See \fBKFontDialog::getFontDiff()\fP. 
.br
\fIvisibleListSize\fP The minimum number of visible entries in the fontlists. 
.br
\fIsizeIsRelativeState\fP If not zero the widget will show a checkbox where the user may choose whether the font size is to be interpreted as relative size. Initial state of this checkbox will be set according to *sizeIsRelativeState, user choice may be retrieved by calling \fBsizeIsRelative()\fP. 
.RE
.PP
Definition at line 96 of file kfontdialog.cpp.
.PP
References QToolTip::add(), QWhatsThis::add(), QGridLayout::addLayout(), QGridLayout::addMultiCellWidget(), QGridLayout::addWidget(), KGlobal::config(), QListBox::findItem(), QWidget::fontMetrics(), fontSelected(), QString::fromLatin1(), KGlobalSettings::generalFont(), QListBox::insertItem(), QListBox::insertStringList(), KStdAccel::label(), KDialog::marginHint(), KStdAccel::name(), QString::number(), QWidget::QWidget(), KConfigBase::readBoolEntry(), QLineEdit::setAlignment(), QGridLayout::setColStretch(), QWidget::setEnabled(), setFont(), KIntNumInput::setMinValue(), QListBox::setSelected(), setSizeIsRelative(), QLineEdit::setText(), QCheckBox::setTristate(), and KDialog::spacingHint().
.SS "KFontChooser::~\fBKFontChooser\fP ()\fC [virtual]\fP"
.PP
Destructs the font chooser. Definition at line 341 of file kfontdialog.cpp.
.SH "Member Function Documentation"
.PP 
.SS "void KFontChooser::enableColumn (int column, bool state)"
.PP
Enables or disable a font column in the chooser. Use this function if your application does not need or supports all font properties.
.PP
\fBParameters:\fP
.RS 4
\fIfont\fP Specifie the columns. An or'ed combination of \fCFamilyList\fP, \fCStyleList\fP and \fCSizeList\fP is possible. 
.br
\fIstate\fP If \fCfalse\fP the columns are disabled. 
.RE
.PP
Definition at line 415 of file kfontdialog.cpp.
.SS "void KFontChooser::setFont (const \fBQFont\fP & font, bool onlyFixed = false)"
.PP
Sets the currently selected font in the chooser. \fBParameters:\fP
.RS 4
\fIfont\fP The font to select. 
.br
\fIonlyFixed\fP Readjust the font list to display only fixed width fonts if \fCtrue\fP, or vice-versa. 
.RE
.PP
Definition at line 432 of file kfontdialog.cpp.
.PP
Referenced by KFontChooser(), and KFontDialog::setFont().
.SS "int KFontChooser::fontDiffFlags ()"
.PP
\fBReturns:\fP
.RS 4
The bitmask corresponding to the attributes the user wishes to change. 
.RE
.PP
Definition at line 449 of file kfontdialog.cpp.
.PP
References QCheckBox::isChecked().
.PP
Referenced by KFontDialog::getFontDiff().
.SS "\fBQFont\fP KFontChooser::font () const\fC [inline]\fP"
.PP
\fBReturns:\fP
.RS 4
The currently selected font in the chooser. 
.RE
.PP
Reimplemented from \fBQWidget\fP.
.PP
Definition at line 144 of file kfontdialog.h.
.PP
Referenced by KFontDialog::font(), KFontDialog::getFont(), KFontDialog::getFontAndText(), and KFontDialog::getFontDiff().
.SS "void KFontChooser::setColor (const \fBQColor\fP & col)"
.PP
Sets the color to use in the preview. Definition at line 365 of file kfontdialog.cpp.
.PP
References QPalette::setColor().
.SS "\fBQColor\fP KFontChooser::color () const"
.PP
\fBReturns:\fP
.RS 4
The color currently used in the preview (default: black) 
.RE
.PP
Definition at line 373 of file kfontdialog.cpp.
.SS "void KFontChooser::setBackgroundColor (const \fBQColor\fP & col)"
.PP
Sets the background color to use in the preview. Definition at line 378 of file kfontdialog.cpp.
.PP
References QPalette::setColor().
.SS "\fBQColor\fP KFontChooser::backgroundColor () const"
.PP
\fBReturns:\fP
.RS 4
The background color currently used in the preview (default: white) 
.RE
.PP
Definition at line 386 of file kfontdialog.cpp.
.SS "void KFontChooser::setSizeIsRelative (QButton::ToggleState relative)"
.PP
Sets the state of the checkbox indicating whether the font size is to be interpreted as relative size. NOTE: If parameter sizeIsRelative was not set in the constructor of the widget this setting will be ignored. Definition at line 391 of file kfontdialog.cpp.
.PP
References QCheckBox::setChecked(), and QCheckBox::setNoChange().
.PP
Referenced by KFontChooser(), and KFontDialog::setSizeIsRelative().
.SS "QButton::ToggleState KFontChooser::sizeIsRelative () const"
.PP
\fBReturns:\fP
.RS 4
Whether the font size is to be interpreted as relative size (default: \fBQButton\fP:Off) 
.RE
.PP
Definition at line 402 of file kfontdialog.cpp.
.PP
References QCheckBox::state().
.PP
Referenced by KFontDialog::getFont(), KFontDialog::getFontAndText(), KFontDialog::getFontDiff(), and KFontDialog::sizeIsRelative().
.SS "\fBQString\fP KFontChooser::sampleText () const\fC [inline]\fP"
.PP
\fBReturns:\fP
.RS 4
The current text in the sample text input area. 
.RE
.PP
Definition at line 184 of file kfontdialog.h.
.PP
References QLineEdit::text().
.PP
Referenced by KFontDialog::getFontAndText().
.SS "void KFontChooser::setSampleText (const \fBQString\fP & text)\fC [inline]\fP"
.PP
Sets the sample text. Normally you should not change this text, but it can be better to do this if the default text is too large for the edit area when using the default font of your application.
.PP
\fBParameters:\fP
.RS 4
\fItext\fP The new sample text. The current will be removed. 
.RE
.PP
Definition at line 196 of file kfontdialog.h.
.PP
References QLineEdit::setText().
.SS "\fBQString\fP KFontChooser::getXLFD (const \fBQFont\fP & theFont)\fC [inline, static]\fP"
.PP
Converts a \fBQFont\fP into the corresponding X Logical Font Description (XLFD). \fBParameters:\fP
.RS 4
\fItheFont\fP The font to convert. 
.RE
.PP
\fBReturns:\fP
.RS 4
A string representing the given font in XLFD format. 
.RE
.PP
Definition at line 208 of file kfontdialog.h.
.PP
References QFont::rawName().
.SS "void KFontChooser::getFontList (\fBQStringList\fP & list, uint fontListCriteria)\fC [static]\fP"
.PP
Creates a list of font strings. \fBParameters:\fP
.RS 4
\fIlist\fP The list is returned here. 
.br
\fIfontListCriteria\fP should contain all the restrictions for font selection as OR-ed values 
.RE
.PP
\fBSee also:\fP
.RS 4
\fBKFontChooser::FontListCriteria\fP for the individual values 
.RE
.PP
Definition at line 640 of file kfontdialog.cpp.
.PP
References QFontDatabase::families(), QFontDatabase::isBitmapScalable(), QFontDatabase::isFixedPitch(), QFontDatabase::isSmoothlyScalable(), and QStringList::sort().
.PP
Referenced by KFontCombo::KFontCombo().
.SS "\fBQSize\fP KFontChooser::sizeHint (void) const\fC [virtual]\fP"
.PP
Reimplemented for internal reasons. Reimplemented from \fBQWidget\fP.
.PP
Definition at line 409 of file kfontdialog.cpp.
.PP
References QWidget::minimumSizeHint().
.SS "void KFontChooser::fontSelected (const \fBQFont\fP & font)\fC [signal]\fP"
.PP
Emitted whenever the selected font changes. Referenced by KFontChooser().

.SH "Author"
.PP 
Generated automatically by Doxygen for kdeui Library from the source code.
