tdeui
tdefontdialog.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
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
00275 static void addFont( TQStringList &list, const char *xfont );
00276
00277 void setupDisplay();
00278
00279
00280
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;
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