diff options
Diffstat (limited to 'src/TextTheme.cc')
-rw-r--r-- | src/TextTheme.cc | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/TextTheme.cc b/src/TextTheme.cc new file mode 100644 index 0000000..bebf010 --- /dev/null +++ b/src/TextTheme.cc | |||
@@ -0,0 +1,56 @@ | |||
1 | // TextTheme.cc | ||
2 | // Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net) | ||
3 | // and Simon Bowden (rathnor at users.sourceforge.net) | ||
4 | // | ||
5 | // Permission is hereby granted, free of charge, to any person obtaining a | ||
6 | // copy of this software and associated documentation files (the "Software"), | ||
7 | // to deal in the Software without restriction, including without limitation | ||
8 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
9 | // and/or sell copies of the Software, and to permit persons to whom the | ||
10 | // Software is furnished to do so, subject to the following conditions: | ||
11 | // | ||
12 | // The above copyright notice and this permission notice shall be included in | ||
13 | // all copies or substantial portions of the Software. | ||
14 | // | ||
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
18 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
21 | // DEALINGS IN THE SOFTWARE. | ||
22 | |||
23 | // $Id: TextTheme.cc,v 1.6 2003/08/27 18:05:12 fluxgen Exp $ | ||
24 | |||
25 | #include "TextTheme.hh" | ||
26 | |||
27 | #include "FbTk/App.hh" | ||
28 | |||
29 | #include <X11/Xlib.h> | ||
30 | |||
31 | TextTheme::TextTheme(FbTk::Theme &theme, | ||
32 | const std::string &name, const std::string &altname): | ||
33 | m_font(theme, name + ".font", altname + ".Font"), | ||
34 | m_text_color(theme, name + ".textColor", altname + ".TextColor"), | ||
35 | m_justify(theme, name + ".justify", altname + ".Justify"), | ||
36 | m_text_gc(RootWindow(FbTk::App::instance()->display(), theme.screenNum())) { | ||
37 | *m_justify = FbTk::LEFT; | ||
38 | // set default values | ||
39 | m_font->load("fixed"); | ||
40 | m_text_color->setFromString("white", theme.screenNum()); | ||
41 | |||
42 | update(); | ||
43 | } | ||
44 | |||
45 | TextTheme::~TextTheme() { | ||
46 | |||
47 | } | ||
48 | |||
49 | void TextTheme::update() { | ||
50 | m_text_gc.setForeground(*m_text_color); | ||
51 | } | ||
52 | |||
53 | void TextTheme::setAntialias(bool value) { | ||
54 | font().setAntialias(value); | ||
55 | FbTk::ThemeManager::instance().loadItem(m_font); | ||
56 | } | ||