\section{KFont\-Chooser Class Reference}
\label{classKFontChooser}\index{KFontChooser@{KFontChooser}}
A font selection widget.  


{\tt \#include $<$kfontdialog.h$>$}

Inheritance diagram for KFont\-Chooser:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=58pt]{classKFontChooser__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KFont\-Chooser:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=197pt]{classKFontChooser__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{CompactItemize}
\item 
enum {\bf Font\-Column} \{ {\bf Family\-List} = 0x01, 
{\bf Style\-List} = 0x02, 
{\bf Size\-List} = 0x04
 \}
\item 
enum {\bf Font\-Diff} \{ {\bf Font\-Diff\-Family} = 0x01, 
{\bf Font\-Diff\-Style} = 0x02, 
{\bf Font\-Diff\-Size} = 0x04
 \}
\item 
enum {\bf Font\-List\-Criteria} \{ {\bf Fixed\-Width\-Fonts} = 0x01, 
{\bf Scalable\-Fonts} = 0x02, 
{\bf Smooth\-Scalable\-Fonts} = 0x04
 \}
\end{CompactItemize}
\subsection*{Signals}
\begin{CompactItemize}
\item 
void {\bf font\-Selected} (const {\bf QFont} \&font)
\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KFont\-Chooser} ({\bf QWidget} $\ast$parent=0L, const char $\ast$name=0L, bool only\-Fixed=false, const {\bf QString\-List} \&font\-List={\bf QString\-List}(), bool make\-Frame=true, int visible\-List\-Size=8, bool diff=false, QButton::Toggle\-State $\ast$size\-Is\-Relative\-State=0L)
\item 
virtual {\bf $\sim$KFont\-Chooser} ()
\item 
void {\bf enable\-Column} (int column, bool state)
\item 
void {\bf set\-Font} (const {\bf QFont} \&font, bool only\-Fixed=false)
\item 
int {\bf font\-Diff\-Flags} ()
\item 
{\bf QFont} {\bf font} () const 
\item 
void {\bf set\-Color} (const {\bf QColor} \&col)
\item 
{\bf QColor} {\bf color} () const 
\item 
void {\bf set\-Background\-Color} (const {\bf QColor} \&col)
\item 
{\bf QColor} {\bf background\-Color} () const 
\item 
void {\bf set\-Size\-Is\-Relative} (QButton::Toggle\-State relative)
\item 
QButton::Toggle\-State {\bf size\-Is\-Relative} () const 
\item 
{\bf QString} {\bf sample\-Text} () const 
\item 
void {\bf set\-Sample\-Text} (const {\bf QString} \&text)
\item 
virtual {\bf QSize} {\bf size\-Hint} (void) const 
\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
static {\bf QString} {\bf get\-XLFD} (const {\bf QFont} \&the\-Font)
\item 
static void {\bf get\-Font\-List} ({\bf QString\-List} \&list, uint font\-List\-Criteria)
\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
virtual void {\bf virtual\_\-hook} (int id, void $\ast$data)\label{classKFontChooser_b0}

\end{CompactItemize}
\subsection*{Properties}
\begin{CompactItemize}
\item 
{\bf QFont} {\bf font}\label{classKFontChooser_00}

\end{CompactItemize}


\subsection{Detailed Description}
A font selection widget. 

While KFont\-Chooser 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 {\bf KFont\-Dialog}{\rm (p.\,\pageref{classKFontDialog})}.

\begin{Desc}
\item[Author:]Preston Brown $<${\tt pbrown@kde.org}$>$, Bernd Wuebben $<${\tt wuebben@kde.org}$>$ \end{Desc}
\begin{Desc}
\item[Version:]\begin{Desc}
\item[Id]{\bf kfontdialog.h}{\rm (p.\,\pageref{kfontdialog_8h})} 353310 2004-10-10 10:27:49Z bhards \end{Desc}
\end{Desc}




Definition at line 52 of file kfontdialog.h.

\subsection{Member Enumeration Documentation}
\index{KFontChooser@{KFont\-Chooser}!FontColumn@{FontColumn}}
\index{FontColumn@{FontColumn}!KFontChooser@{KFont\-Chooser}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf enum} {\bf KFont\-Chooser::Font\-Column}}\label{classKFontChooser_w9}


\begin{itemize}
\item {\tt Family\-List} - Identifies the family (leftmost) list. \end{itemize}


\begin{itemize}
\item {\tt Style\-List} - Identifies the style (center) list. \item {\tt Size\-List} - Identifies the size (rightmost) list. \end{itemize}


Definition at line 63 of file kfontdialog.h.\index{KFontChooser@{KFont\-Chooser}!FontDiff@{FontDiff}}
\index{FontDiff@{FontDiff}!KFontChooser@{KFont\-Chooser}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf enum} {\bf KFont\-Chooser::Font\-Diff}}\label{classKFontChooser_w10}


\begin{itemize}
\item {\tt Font\-Diff\-Family} - Identifies a requested change in the font family. \end{itemize}


\begin{itemize}
\item {\tt Font\-Diff\-Style} - Identifies a requested change in the font style. \item {\tt Font\-Diff\-Size} - Identifies a requested change in the font size. \end{itemize}


Definition at line 70 of file kfontdialog.h.\index{KFontChooser@{KFont\-Chooser}!FontListCriteria@{FontListCriteria}}
\index{FontListCriteria@{FontListCriteria}!KFontChooser@{KFont\-Chooser}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf enum} {\bf KFont\-Chooser::Font\-List\-Criteria}}\label{classKFontChooser_w11}


The selection criteria for the font families shown in the dialog. 

\begin{itemize}
\item {\tt Fixed\-Width\-Font} when included only fixed-width fonts are returned. The fonts where the width of every character is equal. \item {\tt Scalable\-Font} when included only scalable fonts are returned; certain configurations allow bitmap fonts to remain unscaled and thus these fonts have limited number of sizes. \item {\tt Smooth\-Scalable\-Font} 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 \char`\"{}scalable\char`\"{} flag is irrelavant. \end{itemize}


Definition at line 228 of file kfontdialog.h.

\subsection{Constructor \& Destructor Documentation}
\index{KFontChooser@{KFont\-Chooser}!KFontChooser@{KFontChooser}}
\index{KFontChooser@{KFontChooser}!KFontChooser@{KFont\-Chooser}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KFont\-Chooser::KFont\-Chooser ({\bf QWidget} $\ast$ {\em parent} = {\tt 0L}, const char $\ast$ {\em name} = {\tt 0L}, bool {\em only\-Fixed} = {\tt false}, const {\bf QString\-List} \& {\em font\-List} = {\tt {\bf QString\-List}()}, bool {\em make\-Frame} = {\tt true}, int {\em visible\-List\-Size} = {\tt 8}, bool {\em diff} = {\tt false}, QButton::Toggle\-State $\ast$ {\em size\-Is\-Relative\-State} = {\tt 0L})}\label{classKFontChooser_a0}


Constructs a font picker widget. 

It normally comes up with all font families present on the system; the get\-Font method below does allow some more fine-tuning of the selection of fonts that will be displayed in the dialog. 

Consider the following code snippet; 

\footnotesize\begin{verbatim}    QStringList list;
    KFontChooser::getFontList(list,SmoothScalableFonts);
    KFontChooser chooseFont = new KFontChooser(0, "FontList", false, list);
\end{verbatim}
\normalsize
 

The above creates a font chooser dialog with only Smooth\-Scaleble fonts.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em parent}]The parent widget. \item[{\em name}]The widget name. \item[{\em only\-Fixed}]Only display fonts which have fixed-width character sizes. \item[{\em font\-List}]A list of fonts to display, in XLFD format. If no list is formatted, the internal {\bf KDE} font list is used. If that has not been created, X is queried, and all fonts available on the system are displayed. \item[{\em diff}]Display the difference version dialog. See {\bf KFont\-Dialog::get\-Font\-Diff()}{\rm (p.\,\pageref{classKFontDialog_e1})}. \item[{\em make\-Frame}]Draws a frame with titles around the contents. \item[{\em visible\-List\-Size}]The minimum number of visible entries in the fontlists. \item[{\em size\-Is\-Relative\-State}]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 $\ast$size\-Is\-Relative\-State, user choice may be retrieved by calling {\bf size\-Is\-Relative()}{\rm (p.\,\pageref{classKFontChooser_a11})}. \end{description}
\end{Desc}


Definition at line 96 of file kfontdialog.cpp.

References QTool\-Tip::add(), QWhats\-This::add(), QGrid\-Layout::add\-Layout(), QGrid\-Layout::add\-Multi\-Cell\-Widget(), QGrid\-Layout::add\-Widget(), KGlobal::config(), QList\-Box::find\-Item(), QWidget::font\-Metrics(), font\-Selected(), QList\-Box::insert\-Item(), QList\-Box::insert\-String\-List(), QWidget::QWidget(), KConfig\-Base::read\-Bool\-Entry(), QLine\-Edit::set\-Alignment(), QGrid\-Layout::set\-Col\-Stretch(), QWidget::set\-Enabled(), set\-Font(), KInt\-Num\-Input::set\-Min\-Value(), QList\-Box::set\-Selected(), set\-Size\-Is\-Relative(), QLine\-Edit::set\-Text(), QCheck\-Box::set\-Tristate(), and KDialog::spacing\-Hint().\index{KFontChooser@{KFont\-Chooser}!~KFontChooser@{$\sim$KFontChooser}}
\index{~KFontChooser@{$\sim$KFontChooser}!KFontChooser@{KFont\-Chooser}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KFont\-Chooser::$\sim${\bf KFont\-Chooser} ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKFontChooser_a1}


Destructs the font chooser. 



Definition at line 341 of file kfontdialog.cpp.

\subsection{Member Function Documentation}
\index{KFontChooser@{KFont\-Chooser}!enableColumn@{enableColumn}}
\index{enableColumn@{enableColumn}!KFontChooser@{KFont\-Chooser}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KFont\-Chooser::enable\-Column (int {\em column}, bool {\em state})}\label{classKFontChooser_a2}


Enables or disable a font column in the chooser. 

Use this function if your application does not need or supports all font properties.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em column}]Specify the columns. An or'ed combination of {\tt Family\-List}, {\tt Style\-List} and {\tt Size\-List} is possible. \item[{\em state}]If {\tt false} the columns are disabled. \end{description}
\end{Desc}


Definition at line 415 of file kfontdialog.cpp.\index{KFontChooser@{KFont\-Chooser}!setFont@{setFont}}
\index{setFont@{setFont}!KFontChooser@{KFont\-Chooser}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KFont\-Chooser::set\-Font (const {\bf QFont} \& {\em font}, bool {\em only\-Fixed} = {\tt false})}\label{classKFontChooser_a3}


Sets the currently selected font in the chooser. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em font}]The font to select. \item[{\em only\-Fixed}]Readjust the font list to display only fixed width fonts if {\tt true}, or vice-versa. \end{description}
\end{Desc}


Definition at line 432 of file kfontdialog.cpp.

References QFont::point\-Size().

Referenced by KFont\-Chooser().\index{KFontChooser@{KFont\-Chooser}!fontDiffFlags@{fontDiffFlags}}
\index{fontDiffFlags@{fontDiffFlags}!KFontChooser@{KFont\-Chooser}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KFont\-Chooser::font\-Diff\-Flags ()}\label{classKFontChooser_a4}


\begin{Desc}
\item[Returns:]The bitmask corresponding to the attributes the user wishes to change. \end{Desc}


Definition at line 449 of file kfontdialog.cpp.

References QCheck\-Box::is\-Checked().

Referenced by KFont\-Dialog::get\-Font\-Diff().\index{KFontChooser@{KFont\-Chooser}!font@{font}}
\index{font@{font}!KFontChooser@{KFont\-Chooser}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QFont} KFont\-Chooser::font () const\hspace{0.3cm}{\tt  [inline]}}\label{classKFontChooser_a5}


\begin{Desc}
\item[Returns:]The currently selected font in the chooser. \end{Desc}


Reimplemented from {\bf QWidget}.

Definition at line 148 of file kfontdialog.h.\index{KFontChooser@{KFont\-Chooser}!setColor@{setColor}}
\index{setColor@{setColor}!KFontChooser@{KFont\-Chooser}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KFont\-Chooser::set\-Color (const {\bf QColor} \& {\em col})}\label{classKFontChooser_a6}


Sets the color to use in the preview. 



Definition at line 365 of file kfontdialog.cpp.

References QPalette::set\-Color().\index{KFontChooser@{KFont\-Chooser}!color@{color}}
\index{color@{color}!KFontChooser@{KFont\-Chooser}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QColor} KFont\-Chooser::color () const}\label{classKFontChooser_a7}


\begin{Desc}
\item[Returns:]The color currently used in the preview (default: the text color of the active color group) \end{Desc}


Definition at line 373 of file kfontdialog.cpp.\index{KFontChooser@{KFont\-Chooser}!setBackgroundColor@{setBackgroundColor}}
\index{setBackgroundColor@{setBackgroundColor}!KFontChooser@{KFont\-Chooser}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KFont\-Chooser::set\-Background\-Color (const {\bf QColor} \& {\em col})}\label{classKFontChooser_a8}


Sets the background color to use in the preview. 



Definition at line 378 of file kfontdialog.cpp.

References QPalette::set\-Color().\index{KFontChooser@{KFont\-Chooser}!backgroundColor@{backgroundColor}}
\index{backgroundColor@{backgroundColor}!KFontChooser@{KFont\-Chooser}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QColor} KFont\-Chooser::background\-Color () const}\label{classKFontChooser_a9}


\begin{Desc}
\item[Returns:]The background color currently used in the preview (default: the base color of the active colorgroup) \end{Desc}


Definition at line 386 of file kfontdialog.cpp.\index{KFontChooser@{KFont\-Chooser}!setSizeIsRelative@{setSizeIsRelative}}
\index{setSizeIsRelative@{setSizeIsRelative}!KFontChooser@{KFont\-Chooser}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KFont\-Chooser::set\-Size\-Is\-Relative (QButton::Toggle\-State {\em relative})}\label{classKFontChooser_a10}


Sets the state of the checkbox indicating whether the font size is to be interpreted as relative size. 

NOTE: If parameter size\-Is\-Relative was not set in the constructor of the widget this setting will be ignored. 

Definition at line 391 of file kfontdialog.cpp.

References QCheck\-Box::set\-Checked(), and QCheck\-Box::set\-No\-Change().

Referenced by KFont\-Chooser().\index{KFontChooser@{KFont\-Chooser}!sizeIsRelative@{sizeIsRelative}}
\index{sizeIsRelative@{sizeIsRelative}!KFontChooser@{KFont\-Chooser}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}QButton::Toggle\-State KFont\-Chooser::size\-Is\-Relative () const}\label{classKFontChooser_a11}


\begin{Desc}
\item[Returns:]Whether the font size is to be interpreted as relative size (default: {\bf QButton}:Off) \end{Desc}


Definition at line 402 of file kfontdialog.cpp.

References QCheck\-Box::state().

Referenced by KFont\-Dialog::get\-Font(), KFont\-Dialog::get\-Font\-And\-Text(), and KFont\-Dialog::get\-Font\-Diff().\index{KFontChooser@{KFont\-Chooser}!sampleText@{sampleText}}
\index{sampleText@{sampleText}!KFontChooser@{KFont\-Chooser}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KFont\-Chooser::sample\-Text () const\hspace{0.3cm}{\tt  [inline]}}\label{classKFontChooser_a12}


\begin{Desc}
\item[Returns:]The current text in the sample text input area. \end{Desc}


Definition at line 190 of file kfontdialog.h.

Referenced by KFont\-Dialog::get\-Font\-And\-Text().\index{KFontChooser@{KFont\-Chooser}!setSampleText@{setSampleText}}
\index{setSampleText@{setSampleText}!KFontChooser@{KFont\-Chooser}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KFont\-Chooser::set\-Sample\-Text (const {\bf QString} \& {\em text})\hspace{0.3cm}{\tt  [inline]}}\label{classKFontChooser_a13}


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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em text}]The new sample text. The current will be removed. \end{description}
\end{Desc}


Definition at line 202 of file kfontdialog.h.\index{KFontChooser@{KFont\-Chooser}!getXLFD@{getXLFD}}
\index{getXLFD@{getXLFD}!KFontChooser@{KFont\-Chooser}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}static {\bf QString} KFont\-Chooser::get\-XLFD (const {\bf QFont} \& {\em the\-Font})\hspace{0.3cm}{\tt  [inline, static]}}\label{classKFontChooser_e0}


Converts a {\bf QFont} into the corresponding X Logical Font Description (XLFD). 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em the\-Font}]The font to convert. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A string representing the given font in XLFD format. \end{Desc}


Definition at line 214 of file kfontdialog.h.\index{KFontChooser@{KFont\-Chooser}!getFontList@{getFontList}}
\index{getFontList@{getFontList}!KFontChooser@{KFont\-Chooser}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KFont\-Chooser::get\-Font\-List ({\bf QString\-List} \& {\em list}, uint {\em font\-List\-Criteria})\hspace{0.3cm}{\tt  [static]}}\label{classKFontChooser_e1}


Creates a list of font strings. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em list}]The list is returned here. \item[{\em font\-List\-Criteria}]should contain all the restrictions for font selection as OR-ed values \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf KFont\-Chooser::Font\-List\-Criteria}{\rm (p.\,\pageref{classKFontChooser_w11})} for the individual values \end{Desc}


Definition at line 644 of file kfontdialog.cpp.

References QFont\-Database::families(), QFont\-Database::is\-Bitmap\-Scalable(), QFont\-Database::is\-Fixed\-Pitch(), QFont\-Database::is\-Smoothly\-Scalable(), and QString\-List::sort().

Referenced by KFont\-Combo::KFont\-Combo().\index{KFontChooser@{KFont\-Chooser}!sizeHint@{sizeHint}}
\index{sizeHint@{sizeHint}!KFontChooser@{KFont\-Chooser}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QSize} KFont\-Chooser::size\-Hint (void) const\hspace{0.3cm}{\tt  [virtual]}}\label{classKFontChooser_a14}


Reimplemented for internal reasons. 



Reimplemented from {\bf QWidget}.

Definition at line 409 of file kfontdialog.cpp.

References QWidget::minimum\-Size\-Hint().\index{KFontChooser@{KFont\-Chooser}!fontSelected@{fontSelected}}
\index{fontSelected@{fontSelected}!KFontChooser@{KFont\-Chooser}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KFont\-Chooser::font\-Selected (const {\bf QFont} \& {\em font})\hspace{0.3cm}{\tt  [signal]}}\label{classKFontChooser_l0}


Emitted whenever the selected font changes. 



Referenced by KFont\-Chooser().

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
kfontdialog.h\item 
kfontdialog.cpp\end{CompactItemize}
