aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-08-11 14:28:38 (GMT)
committerfluxgen <fluxgen>2003-08-11 14:28:38 (GMT)
commit4f51fab7afc2b7fa48e28d182336df84ffe284d2 (patch)
tree218386f669671bedc1293c7eca06038618494c96 /src
parent48de057b486f33013917593a389027600b592de4 (diff)
downloadfluxbox_paul-4f51fab7afc2b7fa48e28d182336df84ffe284d2.zip
fluxbox_paul-4f51fab7afc2b7fa48e28d182336df84ffe284d2.tar.bz2
first import
Diffstat (limited to 'src')
-rw-r--r--src/TextTheme.cc53
-rw-r--r--src/TextTheme.hh52
-rw-r--r--src/ToolTheme.cc41
-rw-r--r--src/ToolTheme.hh52
4 files changed, 198 insertions, 0 deletions
diff --git a/src/TextTheme.cc b/src/TextTheme.cc
new file mode 100644
index 0000000..b90da0d
--- /dev/null
+++ b/src/TextTheme.cc
@@ -0,0 +1,53 @@
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.1 2003/08/11 14:28:38 fluxgen Exp $
24
25#include "TextTheme.hh"
26
27#include "FbTk/App.hh"
28
29#include <X11/Xlib.h>
30
31TextTheme::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(XCreateGC(FbTk::App::instance()->display(),
37 RootWindow(FbTk::App::instance()->display(),
38 theme.screenNum()), 0, 0)) {
39 // load default font
40 m_font->load("fixed");
41}
42
43TextTheme::~TextTheme() {
44 if (m_text_gc)
45 XFreeGC(FbTk::App::instance()->display(), m_text_gc);
46}
47
48void TextTheme::update() {
49 XGCValues gcv;
50 gcv.foreground = m_text_color->pixel();
51 XChangeGC(FbTk::App::instance()->display(), m_text_gc,
52 GCForeground, &gcv);
53}
diff --git a/src/TextTheme.hh b/src/TextTheme.hh
new file mode 100644
index 0000000..21d4f1b
--- /dev/null
+++ b/src/TextTheme.hh
@@ -0,0 +1,52 @@
1// TextTheme.hh
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.hh,v 1.1 2003/08/11 14:28:38 fluxgen Exp $
24
25#ifndef TEXTTHEME_HH
26#define TEXTTHEME_HH
27
28#include "FbTk/Theme.hh"
29#include "FbTk/Font.hh"
30#include "FbTk/Color.hh"
31#include "FbTk/Text.hh"
32
33class TextTheme {
34public:
35 TextTheme(FbTk::Theme &theme, const std::string &name, const std::string &altname);
36 virtual ~TextTheme();
37
38 void update();
39
40 FbTk::Font &font() { return *m_font; }
41 const FbTk::Font &font() const { return *m_font; }
42 const FbTk::Color &textColor() const { return *m_text_color; }
43 FbTk::Justify justify() const { return *m_justify; }
44 GC textGC() const { return m_text_gc; }
45private:
46 FbTk::ThemeItem<FbTk::Font> m_font;
47 FbTk::ThemeItem<FbTk::Color> m_text_color;
48 FbTk::ThemeItem<FbTk::Justify> m_justify;
49 GC m_text_gc;
50};
51
52#endif // TEXTTHEME_HH
diff --git a/src/ToolTheme.cc b/src/ToolTheme.cc
new file mode 100644
index 0000000..c52efed
--- /dev/null
+++ b/src/ToolTheme.cc
@@ -0,0 +1,41 @@
1// ToolTheme.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: ToolTheme.cc,v 1.1 2003/08/11 14:28:38 fluxgen Exp $
24
25#include "ToolTheme.hh"
26
27ToolTheme::ToolTheme(int screen_num, const std::string &name, const std::string &altname):
28 FbTk::Theme(screen_num),
29 TextTheme(*this, name, altname),
30 m_texture(*this, name, altname) {
31
32}
33
34ToolTheme::~ToolTheme() {
35
36}
37
38void ToolTheme::reconfigTheme() {
39 update();
40}
41
diff --git a/src/ToolTheme.hh b/src/ToolTheme.hh
new file mode 100644
index 0000000..d25c873
--- /dev/null
+++ b/src/ToolTheme.hh
@@ -0,0 +1,52 @@
1// ToolTheme.hh
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: ToolTheme.hh,v 1.1 2003/08/11 14:28:38 fluxgen Exp $
24
25#ifndef TOOLTHEME_HH
26#define TOOLTHEME_HH
27
28
29#include <X11/Xlib.h>
30#include <string>
31
32#include "TextTheme.hh"
33
34#include "FbTk/Texture.hh"
35
36
37
38/// Handles toolbar item theme for text and texture
39class ToolTheme: public FbTk::Theme, public TextTheme {
40public:
41 ToolTheme(int screen_num, const std::string &name, const std::string &altname);
42 virtual ~ToolTheme();
43
44 void reconfigTheme();
45 // textures
46 const FbTk::Texture &texture() const { return *m_texture; }
47
48private:
49 FbTk::ThemeItem<FbTk::Texture> m_texture;
50};
51
52#endif // TOOLTHEME_HH