all repos — fluxbox @ 4f51fab7afc2b7fa48e28d182336df84ffe284d2

custom fork of the fluxbox windowmanager

first import
fluxgen fluxgen
commit

4f51fab7afc2b7fa48e28d182336df84ffe284d2

parent

48de057b486f33013917593a389027600b592de4

4 files changed, 198 insertions(+), 0 deletions(-)

jump to
A 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 <X11/Xlib.h> + +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); +}
A 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<FbTk::Font> m_font; + FbTk::ThemeItem<FbTk::Color> m_text_color; + FbTk::ThemeItem<FbTk::Justify> m_justify; + GC m_text_gc; +}; + +#endif // TEXTTHEME_HH
A 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(); +} +
A 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 <X11/Xlib.h> +#include <string> + +#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<FbTk::Texture> m_texture; +}; + +#endif // TOOLTHEME_HH