F:/KPlato/koffice/libs/kotext/KFontDialog_local.h

Aller à la documentation de ce fichier.
00001 /*
00002     $Id: kfontdialog.h,v 1.71 2004/10/10 10:27:49 bhards Exp $
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 
00027 /*This local copy has been added to be able to hide the preview pane of the font chooser. A patch has been made in kdelibs since 3.5. This local copy can be disposed of when we require kdelibs 3.5 and higher*/
00028 
00029 #ifndef _K_FONT_DIALOG_LOCAL_H_
00030 #define _K_FONT_DIALOG_LOCAL_H_
00031 
00032 #include <QLineEdit>
00033 #include <q3button.h>
00034 //Added by qt3to4:
00035 #include <QLabel>
00036 #include <kdialog.h>
00037 
00038 #include <koffice_export.h>
00039 
00040 class QComboBox;
00041 class QCheckBox;
00042 class QFont;
00043 class Q3GroupBox;
00044 class QLabel;
00045 class QStringList;
00046 class KListBox;
00047 class KIntNumInput;
00059 class KOTEXT_EXPORT KFontChooser_local : public QWidget
00060 {
00061   Q_OBJECT
00062   Q_PROPERTY( QFont font READ font WRITE setFont )
00063 
00064 public:
00070   enum FontColumn { FamilyList=0x01, StyleList=0x02, SizeList=0x04};
00071 
00077   enum FontDiff { FontDiffFamily=0x01, FontDiffStyle=0x02, FontDiffSize=0x04 };
00078 
00113   KFontChooser_local(QWidget *parent = 0L,
00114                bool onlyFixed = false,
00115                const QStringList &fontList = QStringList(),
00116                bool makeFrame = true, int visibleListSize=8,
00117                bool diff = false, Qt::CheckState *sizeIsRelativeState = 0L );
00118 
00122   virtual ~KFontChooser_local();
00123 
00135   void enableColumn( int column, bool state );
00136 
00144   void setFont( const QFont &font, bool onlyFixed = false );
00145 
00150   int fontDiffFlags();
00151 
00155   QFont font() const { return selFont; }
00156 
00160   void setColor( const QColor & col );
00161 
00166   QColor color() const;
00167 
00171   void setBackgroundColor( const QColor & col );
00172 
00177   QColor backgroundColor() const;
00178 
00185   void setSizeIsRelative( Qt::CheckState relative );
00186 
00191   Qt::CheckState sizeIsRelative() const;
00192 
00193 
00197   QString sampleText() const { return sampleEdit->text(); }
00198 
00209   void setSampleText( const QString &text )
00210   {
00211     sampleEdit->setText( text );
00212   }
00213 
00219   void setSampleBoxVisible( bool visible )
00220   {
00221     ( visible ) ? sampleEdit->show() : sampleEdit->hide();
00222   }
00223 
00231   static QString getXLFD( const QFont &theFont )
00232     { return theFont.rawName(); }
00233 
00245   enum FontListCriteria { FixedWidthFonts=0x01, ScalableFonts=0x02, SmoothScalableFonts=0x04 };
00246 
00254   static void getFontList( QStringList &list, uint fontListCriteria);
00255 
00262   void setFamilyList( const QStringList & list );
00263 
00267   virtual QSize sizeHint( void ) const;
00268 
00269 signals:
00273   void fontSelected( const QFont &font );
00274 
00275 private slots:
00276   void toggled_checkbox();
00277   void family_chosen_slot(const QString&);
00278   void size_chosen_slot(const QString&);
00279   void style_chosen_slot(const QString&);
00280   void displaySample(const QFont &font);
00281   void showXLFDArea(bool);
00282   void size_value_slot(int);
00283 private:
00284   void fillFamilyListBox(bool onlyFixedFonts = false);
00285   void fillSizeList();
00286   // This one must be static since getFontList( QStringList, char*) is so
00287   static void addFont( QStringList &list, const char *xfont );
00288 
00289   void setupDisplay();
00290 
00291   // pointer to an optinally supplied list of fonts to
00292   // inserted into the fontdialog font-family combo-box
00293   QStringList  fontList;
00294 
00295   KIntNumInput *sizeOfFont;
00296 
00297   QLineEdit    *sampleEdit;
00298   QLineEdit    *xlfdEdit;
00299 
00300   QLabel       *familyLabel;
00301   QLabel       *styleLabel;
00302   QCheckBox    *familyCheckbox;
00303   QCheckBox    *styleCheckbox;
00304   QCheckBox    *sizeCheckbox;
00305   QLabel       *sizeLabel;
00306   KListBox     *familyListBox;
00307   KListBox     *styleListBox;
00308   KListBox     *sizeListBox;
00309   QComboBox    *charsetsCombo; // BIC: remove in KDE4
00310   QCheckBox    *sizeIsRelativeCheckBox;
00311 
00312   QFont        selFont;
00313 
00314   QString      selectedFamily;
00315   QString      selectedStyle;
00316   int          selectedSize;
00317   QMap<QString, QString> currentStyles;
00318 
00319   bool usingFixed;
00320 
00321 protected:
00322   virtual void virtual_hook( int id, void* data );
00323 private:
00324   class KFontChooser_localPrivate;
00325   KFontChooser_localPrivate *d;
00326 };
00327 
00352 class KOTEXT_EXPORT KFontDialog_local : public KDialog  {
00353     Q_OBJECT
00354 
00355 public:
00378   KFontDialog_local( QWidget *parent = 0L, const char *name = 0,
00379                bool onlyFixed = false, bool modal = false,
00380                const QStringList &fontlist = QStringList(),
00381                bool makeFrame = true, bool diff = false,
00382                Qt::CheckState *sizeIsRelativeState = 0L );
00383 
00391   void setFont( const QFont &font, bool onlyFixed = false )
00392     { chooser->setFont(font, onlyFixed); }
00393 
00397   QFont font() const { return chooser->font(); }
00398 
00405   void setSizeIsRelative( Qt::CheckState relative )
00406     { chooser->setSizeIsRelative( relative ); }
00407 
00412   Qt::CheckState sizeIsRelative() const
00413     { return chooser->sizeIsRelative(); }
00414 
00434   static int getFont( QFont &theFont, bool onlyFixed = false,
00435                       QWidget *parent = 0L, bool makeFrame = true,
00436                       Qt::CheckState *sizeIsRelativeState = 0L );
00437 
00470   static int getFontDiff( QFont &theFont, int &diffFlags, bool onlyFixed = false,
00471                       QWidget *parent = 0L, bool makeFrame = true,
00472                       Qt::CheckState *sizeIsRelativeState = 0L );
00473 
00493   static int getFontAndText( QFont &theFont, QString &theString,
00494                              bool onlyFixed = false, QWidget *parent = 0L,
00495                              bool makeFrame = true,
00496                              Qt::CheckState *sizeIsRelativeState = 0L );
00497 
00498 signals:
00504   void fontSelected( const QFont &font );
00505 
00506 protected:
00507   KFontChooser_local *chooser;
00508 
00509 protected:
00510   virtual void virtual_hook( int id, void* data );
00511 private:
00512   class KFontDialog_localPrivate;
00513   KFontDialog_localPrivate *d;
00514 
00515 };
00516 
00517 #endif

Généré le Wed Nov 22 23:41:07 2006 pour KPlato par  doxygen 1.5.1-p1