summaryrefslogtreecommitdiffstats
path: root/kcontrol/fonts/fonts.h
blob: b75a82fa440be644105c22c26b1ae4ea18affc63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
//-----------------------------------------------------------------------------
//
// kdisplay, fonts tab
//
// Copyright (c)  Mark Donohoe 1997
//                Lars Knoll 1999

#ifndef FONTS_H
#define FONTS_H

#include <tqobject.h>

#include <kcmodule.h>
#include <kdialogbase.h>
#include <kfontdialog.h>
#include <kfontrequester.h>

#include "kxftconfig.h"

class TQCheckBox;
class TQComboBox;
class KDoubleNumInput;
class FontAASettings;

class FontUseItem : public KFontRequester
{
  Q_OBJECT

public:
    FontUseItem(TQWidget * parent, const TQString &name, const TQString &grp, 
        const TQString &key, const TQString &rc, const TQFont &default_fnt, 
        bool fixed = false);

    void readFont( bool useDefaults );
    void writeFont();
    void setDefault();
    void applyFontDiff(const TQFont &fnt, int fontDiffFlags);

    const TQString& rcFile() { return _rcfile; }
    const TQString& rcGroup() { return _rcgroup; }
    const TQString& rcKey() { return _rckey; }

private:
    TQString _rcfile;
    TQString _rcgroup;
    TQString _rckey;
    TQFont _default;
};

class FontAASettings : public KDialogBase
{
  Q_OBJECT

public:

    FontAASettings(TQWidget *parent);

    bool save( bool useAA );
    bool load();
    bool load( bool useDefaults );
    void defaults();
    int getIndex(KXftConfig::SubPixel::Type spType);
    KXftConfig::SubPixel::Type getSubPixelType();
#ifdef HAVE_FONTCONFIG
    int getIndex(KXftConfig::Hint::Style hStyle);
    KXftConfig::Hint::Style getHintStyle();
#endif
    void enableWidgets();
    int exec();

protected slots:

    void changed();

private:

    TQCheckBox *excludeRange;
    TQCheckBox *useSubPixel;
    KDoubleNumInput *excludeFrom;
    KDoubleNumInput *excludeTo;
    TQComboBox *subPixelType;
#ifdef HAVE_FONTCONFIG
    TQComboBox *hintingStyle;
#endif
    TQLabel    *excludeToLabel;
    bool      changesMade;
};

/**
 * The Desktop/fonts tab in kcontrol.
 */
class KFonts : public KCModule
{
    Q_OBJECT

public:
    KFonts(TQWidget *parent, const char *name, const TQStringList &);
    ~KFonts();

    virtual void load();
    virtual void load( bool useDefaults );
    virtual void save();
    virtual void defaults();

protected slots:
    void fontSelected();
    void slotApplyFontDiff(); 
    void slotUseAntiAliasing();
    void slotCfgAa();

private:
    enum AASetting { AAEnabled, AASystem, AADisabled };
    enum DPISetting { DPINone, DPI96, DPI120 };
    AASetting useAA, useAA_original;
    DPISetting dpi_original;
    TQComboBox *cbAA;
    TQComboBox* comboForceDpi;
    TQPushButton *aaSettingsButton;
    TQPtrList <FontUseItem> fontUseList;
    FontAASettings *aaSettings;
};

#endif