]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiCharacter.h
GuiCharacter: Add "Reset" and "Restore Defaults" buttons
[lyx.git] / src / frontends / qt4 / GuiCharacter.h
1 // -*- C++ -*-
2 /**
3  * \file GuiCharacter.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Angus Leeming
8  * \author Edwin Leuven
9  * \author John Levon
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #ifndef GUICHARACTER_H
15 #define GUICHARACTER_H
16
17 #include "GuiDialog.h"
18 #include "ui_CharacterUi.h"
19 #include "Font.h"
20
21 #include <utility>
22
23 #ifdef IGNORE
24 #undef IGNORE
25 #endif
26
27 namespace lyx {
28 namespace frontend {
29
30 enum FontState {
31         ///
32         IGNORE,
33         ///
34         UNDERBAR,
35         ///
36         STRIKEOUT,
37         ///
38         XOUT,
39         ///
40         UULINE,
41         ///
42         UWAVE,
43         ///
44         INHERIT,
45         ///
46         NONE
47 };
48
49 typedef std::pair<QString, FontFamily> FamilyPair;
50 typedef std::pair<QString, FontFamily> FamilyPair;
51 typedef std::pair<QString, FontSeries> SeriesPair;
52 typedef std::pair<QString, FontShape>  ShapePair;
53 typedef std::pair<QString, FontSize>   SizePair;
54 typedef std::pair<QString, FontState>  BarPair;
55 typedef std::pair<QString, QString>    LanguagePair;
56
57 class GuiCharacter : public GuiDialog, public Ui::CharacterUi
58 {
59         Q_OBJECT
60
61 public:
62         GuiCharacter(GuiView & lv);
63
64 protected Q_SLOTS:
65         void change_adaptor();
66         void on_emphCB_clicked();
67         void on_nounCB_clicked();
68         void on_nospellcheckCB_clicked();
69         void slotRestoreDefaults();
70         void checkRestoreDefaults();
71
72 private:
73         /// \name Dialog inherited methods
74         //@{
75         void applyView();
76         void updateContents();
77         bool initialiseParams(std::string const & data);
78         void clearParams() {}
79         void dispatchParams();
80         bool isBufferDependent() const { return true; }
81         FuncCode getLfun() const { return LFUN_TEXTSTYLE_UPDATE; }
82         void saveSession(QSettings & settings) const;
83         void restoreSession();
84         //@}
85
86         ///
87         void paramsToDialog(Font const & font);
88         ///
89         void setBar(FontInfo & fi, FontState val);
90         ///
91         void setStrike(FontInfo & fi, FontState val);
92
93         QList<FamilyPair> family;
94         QList<SeriesPair> series;
95         QList<ShapePair>  shape;
96         QList<SizePair>   size;
97         QList<BarPair>    bar;
98         QList<BarPair>    strike;
99         QList<ColorCode> color;
100         QList<LanguagePair> language;
101
102         ///
103         Font font_;
104         ///
105         bool emph_;
106         ///
107         bool noun_;
108         ///
109         bool nospellcheck_;
110 };
111
112 } // namespace frontend
113 } // namespace lyx
114
115 #endif // GUICHARACTER_H