26 #ifndef _K_FONT_DIALOG_H_
27 #define _K_FONT_DIALOG_H_
29 #include <tqlineedit.h>
31 #include <kdialogbase.h>
57 Q_PROPERTY( TQFont font READ font WRITE setFont )
65 enum FontColumn { FamilyList=0x01, StyleList=0x02, SizeList=0x04};
72 enum FontDiff { FontDiffFamily=0x01, FontDiffStyle=0x02, FontDiffSize=0x04 };
108 KFontChooser(TQWidget *parent = 0L,
const char *name = 0L,
109 bool onlyFixed =
false,
110 const TQStringList &fontList = TQStringList(),
111 bool makeFrame =
true,
int visibleListSize=8,
112 bool diff =
false, TQButton::ToggleState *sizeIsRelativeState = 0L );
130 void enableColumn(
int column,
bool state );
139 void setFont(
const TQFont &font,
bool onlyFixed =
false );
150 TQFont
font()
const {
return selFont; }
155 void setColor(
const TQColor & col );
161 TQColor color()
const;
166 void setBackgroundColor(
const TQColor & col );
172 TQColor backgroundColor()
const;
180 void setSizeIsRelative( TQButton::ToggleState relative );
186 TQButton::ToggleState sizeIsRelative()
const;
206 sampleEdit->setText( text );
217 sampleEdit->setShown( visible );
227 static TQString
getXLFD(
const TQFont &theFont )
228 {
return theFont.rawName(); }
241 enum FontListCriteria { FixedWidthFonts=0x01, ScalableFonts=0x02, SmoothScalableFonts=0x04 };
250 static void getFontList( TQStringList &list, uint fontListCriteria);
255 virtual TQSize sizeHint(
void )
const;
264 void toggled_checkbox();
265 void family_chosen_slot(
const TQString&);
266 void size_chosen_slot(
const TQString&);
267 void style_chosen_slot(
const TQString&);
268 void displaySample(
const TQFont &font);
269 void showXLFDArea(
bool);
270 void size_value_slot(
int);
272 void fillFamilyListBox(
bool onlyFixedFonts =
false);
275 static void addFont( TQStringList &list,
const char *xfont );
281 TQStringList fontList;
285 TQLineEdit *sampleEdit;
286 TQLineEdit *xlfdEdit;
288 TQLabel *familyLabel;
290 TQCheckBox *familyCheckbox;
291 TQCheckBox *styleCheckbox;
292 TQCheckBox *sizeCheckbox;
297 TQComboBox *charsetsCombo;
298 TQCheckBox *sizeIsRelativeCheckBox;
302 TQString selectedStyle;
304 TQMap<TQString, TQString> currentStyles;
309 virtual void virtual_hook(
int id,
void* data );
311 class KFontChooserPrivate;
312 KFontChooserPrivate *d;
365 KFontDialog( TQWidget *parent = 0L,
const char *name = 0,
366 bool onlyFixed =
false,
bool modal =
false,
367 const TQStringList &fontlist = TQStringList(),
368 bool makeFrame =
true,
bool diff =
false,
369 TQButton::ToggleState *sizeIsRelativeState = 0L );
378 void setFont(
const TQFont &font,
bool onlyFixed =
false )
379 { chooser->setFont(font, onlyFixed); }
384 TQFont
font()
const {
return chooser->font(); }
393 { chooser->setSizeIsRelative( relative ); }
400 {
return chooser->sizeIsRelative(); }
421 static int getFont( TQFont &theFont,
bool onlyFixed =
false,
422 TQWidget *parent = 0L,
bool makeFrame =
true,
423 TQButton::ToggleState *sizeIsRelativeState = 0L );
457 static int getFontDiff( TQFont &theFont,
int &diffFlags,
bool onlyFixed =
false,
458 TQWidget *parent = 0L,
bool makeFrame =
true,
459 TQButton::ToggleState *sizeIsRelativeState = 0L );
480 static int getFontAndText( TQFont &theFont, TQString &theString,
481 bool onlyFixed =
false, TQWidget *parent = 0L,
482 bool makeFrame =
true,
483 TQButton::ToggleState *sizeIsRelativeState = 0L );
497 virtual void virtual_hook(
int id,
void* data );
499 class KFontDialogPrivate;
500 KFontDialogPrivate *d;
A dialog base class with standard buttons and predefined layouts.
void fontSelected(const TQFont &font)
Emitted whenever the selected font changes.
void setSampleBoxVisible(bool visible)
Shows or hides the sample text box.
TQString sampleText() const
FontListCriteria
The selection criteria for the font families shown in the dialog.
void setSampleText(const TQString &text)
Sets the sample text.
static TQString getXLFD(const TQFont &theFont)
Converts a TQFont into the corresponding X Logical Font Description (XLFD).
void setSizeIsRelative(TQButton::ToggleState relative)
Sets the state of the checkbox indicating whether the font size is to be interpreted as relative size...
TQButton::ToggleState sizeIsRelative() const
void setFont(const TQFont &font, bool onlyFixed=false)
Sets the currently selected font in the dialog.
void fontSelected(const TQFont &font)
Emitted whenever the currently selected font changes.
A variant of TQListBox that honors KDE's system-wide settings.