• 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 
33 class TQComboBox;
34 class TQCheckBox;
35 class TQFont;
36 class TQGroupBox;
37 class TQLabel;
38 class TQStringList;
39 class TDEListBox;
40 class KIntNumInput;
54 class TDEUI_EXPORT TDEFontChooser : public TQWidget
55 {
56  Q_OBJECT
57  TQ_PROPERTY( TQFont font READ font WRITE setFont )
58 
59 public:
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 
255  virtual TQSize sizeHint( void ) const;
256 
257 signals:
261  void fontSelected( const TQFont &font );
262 
263 private slots:
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);
271 private:
272  void fillFamilyListBox(bool onlyFixedFonts = false);
273  void fillSizeList();
274  // This one must be static since getFontList( TQStringList, char*) is so
275  static void addFont( TQStringList &list, const char *xfont );
276 
277  void setupDisplay();
278 
279  // pointer to an optinally supplied list of fonts to
280  // inserted into the fontdialog font-family combo-box
281  TQStringList fontList;
282 
283  KIntNumInput *sizeOfFont;
284 
285  TQLineEdit *sampleEdit;
286  TQLineEdit *xlfdEdit;
287 
288  TQLabel *familyLabel;
289  TQLabel *styleLabel;
290  TQCheckBox *familyCheckbox;
291  TQCheckBox *styleCheckbox;
292  TQCheckBox *sizeCheckbox;
293  TQLabel *sizeLabel;
294  TDEListBox *familyListBox;
295  TDEListBox *styleListBox;
296  TDEListBox *sizeListBox;
297  TQComboBox *charsetsCombo; // BIC: remove in KDE4
298  TQCheckBox *sizeIsRelativeCheckBox;
299 
300  TQFont selFont;
301 
302  TQString selectedStyle;
303  int selectedSize;
304  TQMap<TQString, TQString> currentStyles;
305 
306  bool usingFixed;
307 
308 protected:
309  virtual void virtual_hook( int id, void* data );
310 private:
311  class TDEFontChooserPrivate;
312  TDEFontChooserPrivate *d;
313 };
314 
339 class TDEUI_EXPORT TDEFontDialog : public KDialogBase {
340  Q_OBJECT
341 
342 public:
365  TDEFontDialog( 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 );
370 
378  void setFont( const TQFont &font, bool onlyFixed = false )
379  { chooser->setFont(font, onlyFixed); }
380 
384  TQFont font() const { return chooser->font(); }
385 
392  void setSizeIsRelative( TQButton::ToggleState relative )
393  { chooser->setSizeIsRelative( relative ); }
394 
399  TQButton::ToggleState sizeIsRelative() const
400  { return chooser->sizeIsRelative(); }
401 
421  static int getFont( TQFont &theFont, bool onlyFixed = false,
422  TQWidget *parent = 0L, bool makeFrame = true,
423  TQButton::ToggleState *sizeIsRelativeState = 0L );
424 
457  static int getFontDiff( TQFont &theFont, int &diffFlags, bool onlyFixed = false,
458  TQWidget *parent = 0L, bool makeFrame = true,
459  TQButton::ToggleState *sizeIsRelativeState = 0L );
460 
480  static int getFontAndText( TQFont &theFont, TQString &theString,
481  bool onlyFixed = false, TQWidget *parent = 0L,
482  bool makeFrame = true,
483  TQButton::ToggleState *sizeIsRelativeState = 0L );
484 
485 signals:
491  void fontSelected( const TQFont &font );
492 
493 protected:
494  TDEFontChooser *chooser;
495 
496 protected:
497  virtual void virtual_hook( int id, void* data );
498 private:
499  class TDEFontDialogPrivate;
500  TDEFontDialogPrivate *d;
501 
502 };
503 
504 #endif
TDEFontChooser::FontListCriteria
FontListCriteria
The selection criteria for the font families shown in the dialog.
Definition: tdefontdialog.h:241
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:392
TDEFontChooser
A font selection widget.
Definition: tdefontdialog.h:54
TDEFontChooser::setSampleBoxVisible
void setSampleBoxVisible(bool visible)
Shows or hides the sample text box.
Definition: tdefontdialog.h:215
TDEFontChooser::FontDiff
FontDiff
Definition: tdefontdialog.h:72
KDialogBase
A dialog base class with standard buttons and predefined layouts.
Definition: kdialogbase.h:191
TDEFontDialog::font
TQFont font() const
Definition: tdefontdialog.h:384
TDEFontChooser::font
TQFont font() const
Definition: tdefontdialog.h:150
TDEFontChooser::FontColumn
FontColumn
Definition: tdefontdialog.h:65
TDEFontChooser::getXLFD
static TQString getXLFD(const TQFont &theFont)
Converts a TQFont into the corresponding X Logical Font Description (XLFD).
Definition: tdefontdialog.h:227
TDEFontDialog::sizeIsRelative
TQButton::ToggleState sizeIsRelative() const
Definition: tdefontdialog.h:399
TDEFontChooser::sampleText
TQString sampleText() const
Definition: tdefontdialog.h:192
TDEListBox
A variant of TQListBox that honors KDE's system-wide settings.
Definition: tdelistbox.h:40
TDEFontDialog
A font selection dialog.
Definition: tdefontdialog.h:339
TDEFontChooser::setSampleText
void setSampleText(const TQString &text)
Sets the sample text.
Definition: tdefontdialog.h:204
TDEFontDialog::setFont
void setFont(const TQFont &font, bool onlyFixed=false)
Sets the currently selected font in the dialog.
Definition: tdefontdialog.h:378
KIntNumInput
An input widget for integer numbers, consisting of a spinbox and a slider.
Definition: knuminput.h:188

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
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.8.8
This website is maintained by Timothy Pearson.