not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / kcontrol / fonts / fonts.h
blob2c722d408b140547edcca3e25bb2442c10d41eaa
1 //-----------------------------------------------------------------------------
2 //
3 // kdisplay, fonts tab
4 //
5 // Copyright (c) Mark Donohoe 1997
6 // Lars Knoll 1999
8 #ifndef FONTS_H
9 #define FONTS_H
11 #include <QLabel>
12 #include <QList>
14 #include <kcmodule.h>
15 #include <kdialog.h>
16 #include <kfontdialog.h>
17 #include <kfontrequester.h>
19 #include "kxftconfig.h"
21 class QCheckBox;
22 class QComboBox;
23 class KDoubleNumInput;
24 class FontAASettings;
26 class FontUseItem : public KFontRequester
28 Q_OBJECT
30 public:
31 FontUseItem(QWidget * parent, const QString &name, const QString &grp,
32 const QString &key, const QString &rc, const QFont &default_fnt,
33 bool fixed = false);
35 void readFont();
36 void writeFont();
37 void setDefault();
38 void applyFontDiff(const QFont &fnt, int fontDiffFlags);
40 const QString& rcFile() { return _rcfile; }
41 const QString& rcGroup() { return _rcgroup; }
42 const QString& rcKey() { return _rckey; }
44 private:
45 QString _rcfile;
46 QString _rcgroup;
47 QString _rckey;
48 QFont _default;
51 class FontAASettings : public KDialog
53 Q_OBJECT
55 public:
57 #ifdef HAVE_FONTCONFIG
58 FontAASettings(QWidget *parent);
60 bool save( bool useAA );
61 bool load();
62 void defaults();
63 int getIndex(KXftConfig::SubPixel::Type spType);
64 KXftConfig::SubPixel::Type getSubPixelType();
65 int getIndex(KXftConfig::Hint::Style hStyle);
66 KXftConfig::Hint::Style getHintStyle();
67 void enableWidgets();
68 int exec();
69 #endif
71 protected Q_SLOTS:
73 void changed();
75 #ifdef HAVE_FONTCONFIG
76 private:
78 QCheckBox *excludeRange;
79 QCheckBox *useSubPixel;
80 KDoubleNumInput *excludeFrom;
81 KDoubleNumInput *excludeTo;
82 QComboBox *subPixelType;
83 QComboBox *hintingStyle;
84 QLabel *excludeToLabel;
85 bool changesMade;
86 #endif
89 /**
90 * The Desktop/fonts tab in kcontrol.
92 class KFonts : public KCModule
94 Q_OBJECT
96 public:
97 KFonts(QWidget *parent, const QVariantList &);
98 ~KFonts();
100 virtual void load();
101 virtual void save();
102 virtual void defaults();
104 protected Q_SLOTS:
105 void fontSelected();
106 void slotApplyFontDiff();
107 void slotUseAntiAliasing();
108 void slotCfgAa();
110 private:
111 #ifdef HAVE_FONTCONFIG
112 enum AASetting { AAEnabled, AASystem, AADisabled };
113 AASetting useAA, useAA_original;
114 QComboBox *cbAA;
115 QPushButton *aaSettingsButton;
116 FontAASettings *aaSettings;
117 #endif
119 enum DPISetting { DPINone, DPI96, DPI120 };
120 DPISetting dpi_original;
121 QComboBox* comboForceDpi;
122 QList<FontUseItem *> fontUseList;
125 #endif