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

tdeui

tdefontdialog.h
00001 /*
00002     $Id$
00003 
00004     Requires the Qt widget libraries, available at no cost at
00005     http://www.troll.no
00006 
00007     Copyright (C) 1997 Bernd Johannes Wuebben <wuebben@kde.org>
00008     Copyright (c) 1999 Preston Brown <pbrown@kde.org>
00009     Copyright (c) 1999 Mario Weilguni <mweilguni@kde.org>
00010 
00011     This library is free software; you can redistribute it and/or
00012     modify it under the terms of the GNU Library General Public
00013     License as published by the Free Software Foundation; either
00014     version 2 of the License, or (at your option) any later version.
00015 
00016     This library is distributed in the hope that it will be useful,
00017     but WITHOUT ANY WARRANTY; without even the implied warranty of
00018     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019     Library General Public License for more details.
00020 
00021     You should have received a copy of the GNU Library General Public License
00022     along with this library; see the file COPYING.LIB.  If not, write to
00023     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00024     Boston, MA 02110-1301, USA.
00025 */
00026 #ifndef _TDE_FONT_DIALOG_H_
00027 #define _TDE_FONT_DIALOG_H_
00028 
00029 #include <tqlineedit.h>
00030 #include <tqbutton.h>
00031 #include <kdialogbase.h>
00032 
00033 class TQComboBox;
00034 class TQCheckBox;
00035 class TQFont;
00036 class TQGroupBox;
00037 class TQLabel;
00038 class TQStringList;
00039 class TDEListBox;
00040 class KIntNumInput;
00054 class TDEUI_EXPORT TDEFontChooser : public TQWidget
00055 {
00056   Q_OBJECT
00057   TQ_PROPERTY( TQFont font READ font WRITE setFont )
00058 
00059 public:
00065   enum FontColumn { FamilyList=0x01, StyleList=0x02, SizeList=0x04};
00066 
00072   enum FontDiff { FontDiffFamily=0x01, FontDiffStyle=0x02, FontDiffSize=0x04 };
00073 
00108   TDEFontChooser(TQWidget *parent = 0L, const char *name = 0L,
00109            bool onlyFixed = false,
00110            const TQStringList &fontList = TQStringList(),
00111            bool makeFrame = true, int visibleListSize=8,
00112                bool diff = false, TQButton::ToggleState *sizeIsRelativeState = 0L );
00113 
00117   virtual ~TDEFontChooser();
00118 
00130   void enableColumn( int column, bool state );
00131 
00139   void setFont( const TQFont &font, bool onlyFixed = false );
00140 
00145   int fontDiffFlags();
00146 
00150   TQFont font() const { return selFont; }
00151 
00155   void setColor( const TQColor & col );
00156 
00161   TQColor color() const;
00162 
00166   void setBackgroundColor( const TQColor & col );
00167 
00172   TQColor backgroundColor() const;
00173 
00180   void setSizeIsRelative( TQButton::ToggleState relative );
00181 
00186   TQButton::ToggleState sizeIsRelative() const;
00187 
00188 
00192   TQString sampleText() const { return sampleEdit->text(); }
00193 
00204   void setSampleText( const TQString &text )
00205   {
00206     sampleEdit->setText( text );
00207   }
00208 
00215   void setSampleBoxVisible( bool visible )
00216   {
00217     sampleEdit->setShown( visible );
00218   }
00219 
00227   static TQString getXLFD( const TQFont &theFont )
00228     { return theFont.rawName(); }
00229 
00241   enum FontListCriteria { FixedWidthFonts=0x01, ScalableFonts=0x02, SmoothScalableFonts=0x04 };
00242 
00250   static void getFontList( TQStringList &list, uint fontListCriteria);
00251 
00255   virtual TQSize sizeHint( void ) const;
00256 
00257 signals:
00261   void fontSelected( const TQFont &font );
00262 
00263 private slots:
00264   void toggled_checkbox();
00265   void family_chosen_slot(const TQString&);
00266   void size_chosen_slot(const TQString&);
00267   void style_chosen_slot(const TQString&);
00268   void displaySample(const TQFont &font);
00269   void showXLFDArea(bool);
00270   void size_value_slot(int);
00271 private:
00272   void fillFamilyListBox(bool onlyFixedFonts = false);
00273   void fillSizeList();
00274   // This one must be static since getFontList( TQStringList, char*) is so
00275   static void addFont( TQStringList &list, const char *xfont );
00276 
00277   void setupDisplay();
00278 
00279   // pointer to an optinally supplied list of fonts to
00280   // inserted into the fontdialog font-family combo-box
00281   TQStringList  fontList;
00282 
00283   KIntNumInput *sizeOfFont;
00284 
00285   TQLineEdit    *sampleEdit;
00286   TQLineEdit    *xlfdEdit;
00287 
00288   TQLabel       *familyLabel;
00289   TQLabel       *styleLabel;
00290   TQCheckBox    *familyCheckbox;
00291   TQCheckBox    *styleCheckbox;
00292   TQCheckBox    *sizeCheckbox;
00293   TQLabel       *sizeLabel;
00294   TDEListBox     *familyListBox;
00295   TDEListBox     *styleListBox;
00296   TDEListBox     *sizeListBox;
00297   TQComboBox    *charsetsCombo; // BIC: remove in KDE4
00298   TQCheckBox    *sizeIsRelativeCheckBox;
00299 
00300   TQFont        selFont;
00301 
00302   TQString      selectedStyle;
00303   int          selectedSize;
00304   TQMap<TQString, TQString> currentStyles;
00305 
00306   bool usingFixed;
00307 
00308 protected:
00309   virtual void virtual_hook( int id, void* data );
00310 private:
00311   class TDEFontChooserPrivate;
00312   TDEFontChooserPrivate *d;
00313 };
00314 
00339 class TDEUI_EXPORT TDEFontDialog : public KDialogBase  {
00340     Q_OBJECT
00341 
00342 public:
00365   TDEFontDialog( TQWidget *parent = 0L, const char *name = 0,
00366            bool onlyFixed = false, bool modal = false,
00367            const TQStringList &fontlist = TQStringList(),
00368            bool makeFrame = true, bool diff = false,
00369                TQButton::ToggleState *sizeIsRelativeState = 0L );
00370 
00378   void setFont( const TQFont &font, bool onlyFixed = false )
00379     { chooser->setFont(font, onlyFixed); }
00380 
00384   TQFont font() const { return chooser->font(); }
00385 
00392   void setSizeIsRelative( TQButton::ToggleState relative )
00393     { chooser->setSizeIsRelative( relative ); }
00394 
00399   TQButton::ToggleState sizeIsRelative() const
00400     { return chooser->sizeIsRelative(); }
00401 
00421   static int getFont( TQFont &theFont, bool onlyFixed = false,
00422               TQWidget *parent = 0L, bool makeFrame = true,
00423                       TQButton::ToggleState *sizeIsRelativeState = 0L );
00424 
00457   static int getFontDiff( TQFont &theFont, int &diffFlags, bool onlyFixed = false,
00458               TQWidget *parent = 0L, bool makeFrame = true,
00459                       TQButton::ToggleState *sizeIsRelativeState = 0L );
00460 
00480   static int getFontAndText( TQFont &theFont, TQString &theString,
00481                  bool onlyFixed = false, TQWidget *parent = 0L,
00482                  bool makeFrame = true,
00483                              TQButton::ToggleState *sizeIsRelativeState = 0L );
00484 
00485 signals:
00491   void fontSelected( const TQFont &font );
00492 
00493 protected:
00494   TDEFontChooser *chooser;
00495 
00496 protected:
00497   virtual void virtual_hook( int id, void* data );
00498 private:
00499   class TDEFontDialogPrivate;
00500   TDEFontDialogPrivate *d;
00501 
00502 };
00503 
00504 #endif

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.7.6.1
This website is maintained by Timothy Pearson.