• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeui
 

tdeui

  • tdeui
tdefontdialog.h
1/*
2 $Id$
3
4 Requires the Qt widget libraries, available at no cost at
5 http://www.troll.no
6
7 Copyright (C) 1997 Bernd Johannes Wuebben <wuebben@kde.org>
8 Copyright (c) 1999 Preston Brown <pbrown@kde.org>
9 Copyright (c) 1999 Mario Weilguni <mweilguni@kde.org>
10
11 This library is free software; you can redistribute it and/or
12 modify it under the terms of the GNU Library General Public
13 License as published by the Free Software Foundation; either
14 version 2 of the License, or (at your option) any later version.
15
16 This library is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 Library General Public License for more details.
20
21 You should have received a copy of the GNU Library General Public License
22 along with this library; see the file COPYING.LIB. If not, write to
23 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 Boston, MA 02110-1301, USA.
25*/
26#ifndef _TDE_FONT_DIALOG_H_
27#define _TDE_FONT_DIALOG_H_
28
29#include <tqlineedit.h>
30#include <tqbutton.h>
31#include <kdialogbase.h>
32
33class TQComboBox;
34class TQCheckBox;
35class TQFont;
36class TQGroupBox;
37class TQLabel;
38class TQStringList;
39class TDEListBox;
40class KIntNumInput;
54class TDEUI_EXPORT TDEFontChooser : public TQWidget
55{
56 TQ_OBJECT
57 TQ_PROPERTY( TQFont font READ font WRITE setFont )
58
59public:
65 enum FontColumn { FamilyList=0x01, StyleList=0x02, SizeList=0x04};
66
72 enum FontDiff { FontDiffFamily=0x01, FontDiffStyle=0x02, FontDiffSize=0x04 };
73
108 TDEFontChooser(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 );
113
117 virtual ~TDEFontChooser();
118
130 void enableColumn( int column, bool state );
131
139 void setFont( const TQFont &font, bool onlyFixed = false );
140
145 int fontDiffFlags();
146
150 TQFont font() const { return selFont; }
151
155 void setColor( const TQColor & col );
156
161 TQColor color() const;
162
166 void setBackgroundColor( const TQColor & col );
167
172 TQColor backgroundColor() const;
173
180 void setSizeIsRelative( TQButton::ToggleState relative );
181
186 TQButton::ToggleState sizeIsRelative() const;
187
188
192 TQString sampleText() const { return sampleEdit->text(); }
193
204 void setSampleText( const TQString &text )
205 {
206 sampleEdit->setText( text );
207 }
208
215 void setSampleBoxVisible( bool visible )
216 {
217 sampleEdit->setShown( visible );
218 }
219
227 static TQString getXLFD( const TQFont &theFont )
228 { return theFont.rawName(); }
229
241 enum FontListCriteria { FixedWidthFonts=0x01, ScalableFonts=0x02, SmoothScalableFonts=0x04 };
242
250 static void getFontList( TQStringList &list, uint fontListCriteria);
251
258 void setFamilyList( TQStringList list );
259
263 virtual TQSize sizeHint( void ) const;
264
265signals:
269 void fontSelected( const TQFont &font );
270
271private slots:
272 void toggled_checkbox();
273 void family_chosen_slot(const TQString&);
274 void size_chosen_slot(const TQString&);
275 void style_chosen_slot(const TQString&);
276 void displaySample(const TQFont &font);
277 void showXLFDArea(bool);
278 void size_value_slot(int);
279private:
280 void fillFamilyListBox(bool onlyFixedFonts = false);
281 void fillSizeList();
282 TQString style_name(const TQString &name);
283 // This one must be static since getFontList( TQStringList, char*) is so
284 static void addFont( TQStringList &list, const char *xfont );
285
286 void setupDisplay();
287
288 // pointer to an optinally supplied list of fonts to
289 // inserted into the fontdialog font-family combo-box
290 TQStringList fontList;
291
292 KIntNumInput *sizeOfFont;
293
294 TQLineEdit *sampleEdit;
295 TQLineEdit *xlfdEdit;
296
297 TQLabel *familyLabel;
298 TQLabel *styleLabel;
299 TQCheckBox *familyCheckbox;
300 TQCheckBox *styleCheckbox;
301 TQCheckBox *sizeCheckbox;
302 TQLabel *sizeLabel;
303 TDEListBox *familyListBox;
304 TDEListBox *styleListBox;
305 TDEListBox *sizeListBox;
306 TQComboBox *charsetsCombo; // BIC: remove in KDE4
307 TQCheckBox *sizeIsRelativeCheckBox;
308
309 TQFont selFont;
310
311 TQString selectedFamily;
312 TQString selectedStyle;
313 int selectedSize;
314 TQMap<TQString, TQString> currentStyles;
315
316 bool usingFixed;
317
318protected:
319 virtual void virtual_hook( int id, void* data );
320private:
321 class TDEFontChooserPrivate;
322 TDEFontChooserPrivate *d;
323};
324
349class TDEUI_EXPORT TDEFontDialog : public KDialogBase {
350 TQ_OBJECT
351
352public:
375 TDEFontDialog( TQWidget *parent = 0L, const char *name = 0,
376 bool onlyFixed = false, bool modal = false,
377 const TQStringList &fontlist = TQStringList(),
378 bool makeFrame = true, bool diff = false,
379 TQButton::ToggleState *sizeIsRelativeState = 0L );
380
388 void setFont( const TQFont &font, bool onlyFixed = false )
389 { chooser->setFont(font, onlyFixed); }
390
394 TQFont font() const { return chooser->font(); }
395
402 void setSizeIsRelative( TQButton::ToggleState relative )
403 { chooser->setSizeIsRelative( relative ); }
404
409 TQButton::ToggleState sizeIsRelative() const
410 { return chooser->sizeIsRelative(); }
411
431 static int getFont( TQFont &theFont, bool onlyFixed = false,
432 TQWidget *parent = 0L, bool makeFrame = true,
433 TQButton::ToggleState *sizeIsRelativeState = 0L );
434
467 static int getFontDiff( TQFont &theFont, int &diffFlags, bool onlyFixed = false,
468 TQWidget *parent = 0L, bool makeFrame = true,
469 TQButton::ToggleState *sizeIsRelativeState = 0L );
470
490 static int getFontAndText( TQFont &theFont, TQString &theString,
491 bool onlyFixed = false, TQWidget *parent = 0L,
492 bool makeFrame = true,
493 TQButton::ToggleState *sizeIsRelativeState = 0L );
494
495signals:
501 void fontSelected( const TQFont &font );
502
503protected:
504 TDEFontChooser *chooser;
505
506protected:
507 virtual void virtual_hook( int id, void* data );
508private:
509 class TDEFontDialogPrivate;
510 TDEFontDialogPrivate *d;
511
512};
513
514#endif
KDialogBase
A dialog base class with standard buttons and predefined layouts.
Definition: kdialogbase.h:192
KIntNumInput
An input widget for integer numbers, consisting of a spinbox and a slider.
Definition: knuminput.h:189
TDEFontChooser
A font selection widget.
Definition: tdefontdialog.h:55
TDEFontChooser::setSampleText
void setSampleText(const TQString &text)
Sets the sample text.
Definition: tdefontdialog.h:204
TDEFontChooser::getXLFD
static TQString getXLFD(const TQFont &theFont)
Converts a TQFont into the corresponding X Logical Font Description (XLFD).
Definition: tdefontdialog.h:227
TDEFontChooser::fontSelected
void fontSelected(const TQFont &font)
Emitted whenever the selected font changes.
TDEFontChooser::sampleText
TQString sampleText() const
Definition: tdefontdialog.h:192
TDEFontChooser::FontDiff
FontDiff
Definition: tdefontdialog.h:72
TDEFontChooser::FontColumn
FontColumn
Definition: tdefontdialog.h:65
TDEFontChooser::setSampleBoxVisible
void setSampleBoxVisible(bool visible)
Shows or hides the sample text box.
Definition: tdefontdialog.h:215
TDEFontChooser::font
TQFont font() const
Definition: tdefontdialog.h:150
TDEFontChooser::FontListCriteria
FontListCriteria
The selection criteria for the font families shown in the dialog.
Definition: tdefontdialog.h:241
TDEFontDialog
A font selection dialog.
Definition: tdefontdialog.h:349
TDEFontDialog::setFont
void setFont(const TQFont &font, bool onlyFixed=false)
Sets the currently selected font in the dialog.
Definition: tdefontdialog.h:388
TDEFontDialog::fontSelected
void fontSelected(const TQFont &font)
Emitted whenever the currently selected font changes.
TDEFontDialog::sizeIsRelative
TQButton::ToggleState sizeIsRelative() const
Definition: tdefontdialog.h:409
TDEFontDialog::setSizeIsRelative
void setSizeIsRelative(TQButton::ToggleState relative)
Sets the state of the checkbox indicating whether the font size is to be interpreted as relative size...
Definition: tdefontdialog.h:402
TDEFontDialog::font
TQFont font() const
Definition: tdefontdialog.h:394
TDEListBox
A variant of TQListBox that honors KDE's system-wide settings.
Definition: tdelistbox.h:41

tdeui

Skip menu "tdeui"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeui

Skip menu "tdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.9.4
This website is maintained by Timothy Pearson.