summaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/BorderTheme.cc36
-rw-r--r--src/FbTk/BorderTheme.hh47
-rw-r--r--src/FbTk/Makefile.am1
-rw-r--r--src/FbTk/TextTheme.cc48
-rw-r--r--src/FbTk/TextTheme.hh55
5 files changed, 187 insertions, 0 deletions
diff --git a/src/FbTk/BorderTheme.cc b/src/FbTk/BorderTheme.cc
new file mode 100644
index 0000000..1223954
--- /dev/null
+++ b/src/FbTk/BorderTheme.cc
@@ -0,0 +1,36 @@
1// BorderTheme.cc
2// Copyright (c) 2003 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org)
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#include "BorderTheme.hh"
24
25namespace FbTk {
26
27BorderTheme::BorderTheme(Theme &theme, const std::string &name,
28 const std::string &altname):
29 m_width(theme, name + ".borderWidth", altname + ".BorderWidth"),
30 m_color(theme, name + ".borderColor", altname + ".BorderColor") {
31 // set default values
32 *m_width = 0;
33 m_color->setFromString("black", theme.screenNum());
34}
35
36}; // end namespace FbTk
diff --git a/src/FbTk/BorderTheme.hh b/src/FbTk/BorderTheme.hh
new file mode 100644
index 0000000..9b9ca55
--- /dev/null
+++ b/src/FbTk/BorderTheme.hh
@@ -0,0 +1,47 @@
1// BorderTheme.hh
2// Copyright (c) 2003 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org)
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#ifndef FBTK_BORDERTHEME_HH
24#define FBTK_BORDERTHEME_HH
25
26#include "Theme.hh"
27#include "Color.hh"
28
29namespace FbTk {
30
31/// helper class for border theme items
32class BorderTheme {
33public:
34 BorderTheme(Theme &theme, const std::string &name, const std::string &altname);
35 virtual ~BorderTheme() { }
36
37 int width() const { return *m_width; }
38 const Color &color() const { return *m_color; }
39
40private:
41 ThemeItem<int> m_width;
42 ThemeItem<Color> m_color;
43};
44
45}; // end namespace FbTk
46
47#endif // FBTK_BORDERTHEME_HH
diff --git a/src/FbTk/Makefile.am b/src/FbTk/Makefile.am
index e3e5d76..75733a7 100644
--- a/src/FbTk/Makefile.am
+++ b/src/FbTk/Makefile.am
@@ -28,6 +28,7 @@ libFbTk_a_SOURCES = App.hh App.cc Color.cc Color.hh Command.hh \
28 BoolMenuItem.hh IntMenuItem.hh \ 28 BoolMenuItem.hh IntMenuItem.hh \
29 MultiButtonMenuItem.hh MultiButtonMenuItem.cc \ 29 MultiButtonMenuItem.hh MultiButtonMenuItem.cc \
30 MenuTheme.hh MenuTheme.cc NotCopyable.hh \ 30 MenuTheme.hh MenuTheme.cc NotCopyable.hh \
31 BorderTheme.hh BorderTheme.cc TextTheme.hh TextTheme.cc \
31 RefCount.hh SimpleCommand.hh SignalHandler.cc SignalHandler.hh \ 32 RefCount.hh SimpleCommand.hh SignalHandler.cc SignalHandler.hh \
32 Text.hh Text.cc \ 33 Text.hh Text.cc \
33 Texture.cc Texture.hh TextureRender.hh TextureRender.cc \ 34 Texture.cc Texture.hh TextureRender.hh TextureRender.cc \
diff --git a/src/FbTk/TextTheme.cc b/src/FbTk/TextTheme.cc
new file mode 100644
index 0000000..848ee01
--- /dev/null
+++ b/src/FbTk/TextTheme.cc
@@ -0,0 +1,48 @@
1// TextTheme.cc
2// Copyright (c) 2003 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org)
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#include "TextTheme.hh"
24
25#include "App.hh"
26
27#include <X11/Xlib.h>
28
29namespace FbTk {
30
31TextTheme::TextTheme(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(App::instance()->display(), theme.screenNum())) {
37 *m_justify = LEFT;
38 // set default values
39 m_text_color->setFromString("white", theme.screenNum());
40
41 update();
42}
43
44void TextTheme::update() {
45 m_text_gc.setForeground(*m_text_color);
46}
47
48}; // end namespace FbTk
diff --git a/src/FbTk/TextTheme.hh b/src/FbTk/TextTheme.hh
new file mode 100644
index 0000000..ea22d4b
--- /dev/null
+++ b/src/FbTk/TextTheme.hh
@@ -0,0 +1,55 @@
1// TextTheme.hh
2// Copyright (c) 2003 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org)
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#ifndef FBTK_TEXTTHEME_HH
24#define FBTK_TEXTTHEME_HH
25
26#include "Theme.hh"
27#include "Font.hh"
28#include "Color.hh"
29#include "Text.hh"
30#include "GContext.hh"
31
32namespace FbTk {
33
34class TextTheme {
35public:
36 TextTheme(Theme &theme, const std::string &name, const std::string &altname);
37 virtual ~TextTheme() { }
38
39 void update();
40
41 Font &font() { return *m_font; }
42 const Font &font() const { return *m_font; }
43 const Color &textColor() const { return *m_text_color; }
44 Justify justify() const { return *m_justify; }
45 GC textGC() const { return m_text_gc.gc(); }
46private:
47 ThemeItem<Font> m_font;
48 ThemeItem<Color> m_text_color;
49 ThemeItem<Justify> m_justify;
50 GContext m_text_gc;
51};
52
53}; // end namespace FbTk
54
55#endif // FBTK_TEXTTHEME_HH