]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiCharacter.h
do what the FIXME suggested
[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 "qt_helpers.h" // for LanguagePair
20 #include "Font.h"
21
22 #include <vector>
23
24
25 namespace lyx {
26
27 namespace frontend {
28
29 enum FontState {
30         ///
31         IGNORE,
32         ///
33         EMPH_TOGGLE,
34         ///
35         UNDERBAR_TOGGLE,
36         ///
37         NOUN_TOGGLE,
38         ///
39         INHERIT
40 };
41
42 typedef std::pair<QString, FontFamily> FamilyPair;
43 typedef std::pair<QString, FontSeries> SeriesPair;
44 typedef std::pair<QString, FontShape>  ShapePair;
45 typedef std::pair<QString, FontSize>   SizePair;
46 typedef std::pair<QString, FontState> BarPair;
47 typedef std::pair<QString, ColorCode> ColorPair;
48
49 class GuiCharacter : public GuiDialog, public Ui::CharacterUi
50 {
51         Q_OBJECT
52
53 public:
54         GuiCharacter(GuiView & lv);
55
56 protected Q_SLOTS:
57         void change_adaptor();
58
59 private:
60         /// Apply changes
61         void applyView();
62         /// update
63         void updateContents();
64
65         std::vector<FamilyPair> family;
66         std::vector<SeriesPair> series;
67         std::vector<ShapePair>  shape;
68         std::vector<SizePair>   size;
69         std::vector<BarPair>    bar;
70         std::vector<ColorPair>  color;
71         std::vector<LanguagePair> language;
72
73         ///
74         bool initialiseParams(std::string const & data);
75         ///
76         void clearParams() {}
77         ///
78         void dispatchParams();
79         ///
80         bool isBufferDependent() const { return true; }
81         ///
82         kb_action getLfun() const { return LFUN_FONT_FREE_UPDATE; }
83
84         ///
85         void setFamily(FontFamily);
86         ///
87         void setSeries(FontSeries);
88         ///
89         void setShape(FontShape);
90         ///
91         void setSize(FontSize);
92         ///
93         void setBar(FontState);
94         ///
95         void setColor(ColorCode);
96         ///
97         void setLanguage(std::string const &);
98
99         ///
100         FontFamily getFamily() const;
101         ///
102         FontSeries getSeries() const;
103         ///
104         FontShape getShape() const;
105         ///
106         FontSize getSize() const;
107         ///
108         FontState getBar() const;
109         ///
110         ColorCode getColor() const;
111         ///
112         std::string getLanguage() const;
113
114 private:
115         ///
116         Font font_;
117         ///
118         bool toggleall_;
119         /// If true the language should be reset.
120         /// If false the language of font_ is used.
121         bool reset_lang_;
122 };
123
124 } // namespace frontend
125 } // namespace lyx
126
127 #endif // GUICHARACTER_H