From 4f51fab7afc2b7fa48e28d182336df84ffe284d2 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Mon, 11 Aug 2003 14:28:38 +0000 Subject: first import --- src/TextTheme.cc | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/TextTheme.hh | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/ToolTheme.cc | 41 +++++++++++++++++++++++++++++++++++++++++ src/ToolTheme.hh | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 198 insertions(+) create mode 100644 src/TextTheme.cc create mode 100644 src/TextTheme.hh create mode 100644 src/ToolTheme.cc create mode 100644 src/ToolTheme.hh 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 @@ +// TextTheme.cc +// Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net) +// and Simon Bowden (rathnor at users.sourceforge.net) +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + +// $Id: TextTheme.cc,v 1.1 2003/08/11 14:28:38 fluxgen Exp $ + +#include "TextTheme.hh" + +#include "FbTk/App.hh" + +#include + +TextTheme::TextTheme(FbTk::Theme &theme, + const std::string &name, const std::string &altname): + m_font(theme, name + ".font", altname + ".Font"), + m_text_color(theme, name + ".textColor", altname + ".TextColor"), + m_justify(theme, name + ".justify", altname + ".Justify"), + m_text_gc(XCreateGC(FbTk::App::instance()->display(), + RootWindow(FbTk::App::instance()->display(), + theme.screenNum()), 0, 0)) { + // load default font + m_font->load("fixed"); +} + +TextTheme::~TextTheme() { + if (m_text_gc) + XFreeGC(FbTk::App::instance()->display(), m_text_gc); +} + +void TextTheme::update() { + XGCValues gcv; + gcv.foreground = m_text_color->pixel(); + XChangeGC(FbTk::App::instance()->display(), m_text_gc, + GCForeground, &gcv); +} 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 @@ +// TextTheme.hh +// Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net) +// and Simon Bowden (rathnor at users.sourceforge.net) +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + +// $Id: TextTheme.hh,v 1.1 2003/08/11 14:28:38 fluxgen Exp $ + +#ifndef TEXTTHEME_HH +#define TEXTTHEME_HH + +#include "FbTk/Theme.hh" +#include "FbTk/Font.hh" +#include "FbTk/Color.hh" +#include "FbTk/Text.hh" + +class TextTheme { +public: + TextTheme(FbTk::Theme &theme, const std::string &name, const std::string &altname); + virtual ~TextTheme(); + + void update(); + + FbTk::Font &font() { return *m_font; } + const FbTk::Font &font() const { return *m_font; } + const FbTk::Color &textColor() const { return *m_text_color; } + FbTk::Justify justify() const { return *m_justify; } + GC textGC() const { return m_text_gc; } +private: + FbTk::ThemeItem m_font; + FbTk::ThemeItem m_text_color; + FbTk::ThemeItem m_justify; + GC m_text_gc; +}; + +#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 @@ +// ToolTheme.cc +// Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net) +// and Simon Bowden (rathnor at users.sourceforge.net) +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + +// $Id: ToolTheme.cc,v 1.1 2003/08/11 14:28:38 fluxgen Exp $ + +#include "ToolTheme.hh" + +ToolTheme::ToolTheme(int screen_num, const std::string &name, const std::string &altname): + FbTk::Theme(screen_num), + TextTheme(*this, name, altname), + m_texture(*this, name, altname) { + +} + +ToolTheme::~ToolTheme() { + +} + +void ToolTheme::reconfigTheme() { + update(); +} + 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 @@ +// ToolTheme.hh +// Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net) +// and Simon Bowden (rathnor at users.sourceforge.net) +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + +// $Id: ToolTheme.hh,v 1.1 2003/08/11 14:28:38 fluxgen Exp $ + +#ifndef TOOLTHEME_HH +#define TOOLTHEME_HH + + +#include +#include + +#include "TextTheme.hh" + +#include "FbTk/Texture.hh" + + + +/// Handles toolbar item theme for text and texture +class ToolTheme: public FbTk::Theme, public TextTheme { +public: + ToolTheme(int screen_num, const std::string &name, const std::string &altname); + virtual ~ToolTheme(); + + void reconfigTheme(); + // textures + const FbTk::Texture &texture() const { return *m_texture; } + +private: + FbTk::ThemeItem m_texture; +}; + +#endif // TOOLTHEME_HH -- cgit v0.11.2