moved BorderTheme and TextTheme to FbTk
This commit is contained in:
parent
b5c354b994
commit
00ceefd884
11 changed files with 69 additions and 71 deletions
|
@ -20,11 +20,11 @@
|
|||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// $Id$
|
||||
|
||||
#include "BorderTheme.hh"
|
||||
|
||||
BorderTheme::BorderTheme(FbTk::Theme &theme, const std::string &name,
|
||||
namespace FbTk {
|
||||
|
||||
BorderTheme::BorderTheme(Theme &theme, const std::string &name,
|
||||
const std::string &altname):
|
||||
m_width(theme, name + ".borderWidth", altname + ".BorderWidth"),
|
||||
m_color(theme, name + ".borderColor", altname + ".BorderColor") {
|
||||
|
@ -32,3 +32,5 @@ BorderTheme::BorderTheme(FbTk::Theme &theme, const std::string &name,
|
|||
*m_width = 0;
|
||||
m_color->setFromString("black", theme.screenNum());
|
||||
}
|
||||
|
||||
}; // end namespace FbTk
|
|
@ -20,26 +20,28 @@
|
|||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// $Id$
|
||||
#ifndef FBTK_BORDERTHEME_HH
|
||||
#define FBTK_BORDERTHEME_HH
|
||||
|
||||
#ifndef BORDERTHEME_HH
|
||||
#define BORDERTHEME_HH
|
||||
#include "Theme.hh"
|
||||
#include "Color.hh"
|
||||
|
||||
#include "FbTk/Theme.hh"
|
||||
#include "FbTk/Color.hh"
|
||||
namespace FbTk {
|
||||
|
||||
/// helper class for border theme items
|
||||
class BorderTheme {
|
||||
public:
|
||||
BorderTheme(FbTk::Theme &theme, const std::string &name, const std::string &altname);
|
||||
BorderTheme(Theme &theme, const std::string &name, const std::string &altname);
|
||||
virtual ~BorderTheme() { }
|
||||
|
||||
int width() const { return *m_width; }
|
||||
const FbTk::Color &color() const { return *m_color; }
|
||||
const Color &color() const { return *m_color; }
|
||||
|
||||
private:
|
||||
FbTk::ThemeItem<int> m_width;
|
||||
FbTk::ThemeItem<FbTk::Color> m_color;
|
||||
ThemeItem<int> m_width;
|
||||
ThemeItem<Color> m_color;
|
||||
};
|
||||
|
||||
#endif // BORDERTHEME_HH
|
||||
}; // end namespace FbTk
|
||||
|
||||
#endif // FBTK_BORDERTHEME_HH
|
|
@ -28,6 +28,7 @@ libFbTk_a_SOURCES = App.hh App.cc Color.cc Color.hh Command.hh \
|
|||
BoolMenuItem.hh IntMenuItem.hh \
|
||||
MultiButtonMenuItem.hh MultiButtonMenuItem.cc \
|
||||
MenuTheme.hh MenuTheme.cc NotCopyable.hh \
|
||||
BorderTheme.hh BorderTheme.cc TextTheme.hh TextTheme.cc \
|
||||
RefCount.hh SimpleCommand.hh SignalHandler.cc SignalHandler.hh \
|
||||
Text.hh Text.cc \
|
||||
Texture.cc Texture.hh TextureRender.hh TextureRender.cc \
|
||||
|
|
|
@ -20,31 +20,29 @@
|
|||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// $Id$
|
||||
|
||||
#include "TextTheme.hh"
|
||||
|
||||
#include "FbTk/App.hh"
|
||||
#include "App.hh"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
TextTheme::TextTheme(FbTk::Theme &theme,
|
||||
namespace FbTk {
|
||||
|
||||
TextTheme::TextTheme(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(RootWindow(FbTk::App::instance()->display(), theme.screenNum())) {
|
||||
*m_justify = FbTk::LEFT;
|
||||
m_text_gc(RootWindow(App::instance()->display(), theme.screenNum())) {
|
||||
*m_justify = LEFT;
|
||||
// set default values
|
||||
m_text_color->setFromString("white", theme.screenNum());
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
TextTheme::~TextTheme() {
|
||||
|
||||
}
|
||||
|
||||
void TextTheme::update() {
|
||||
m_text_gc.setForeground(*m_text_color);
|
||||
}
|
||||
|
||||
}; // end namespace FbTk
|
|
@ -20,34 +20,36 @@
|
|||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// $Id$
|
||||
#ifndef FBTK_TEXTTHEME_HH
|
||||
#define FBTK_TEXTTHEME_HH
|
||||
|
||||
#ifndef TEXTTHEME_HH
|
||||
#define TEXTTHEME_HH
|
||||
#include "Theme.hh"
|
||||
#include "Font.hh"
|
||||
#include "Color.hh"
|
||||
#include "Text.hh"
|
||||
#include "GContext.hh"
|
||||
|
||||
#include "FbTk/Theme.hh"
|
||||
#include "FbTk/Font.hh"
|
||||
#include "FbTk/Color.hh"
|
||||
#include "FbTk/Text.hh"
|
||||
#include "FbTk/GContext.hh"
|
||||
namespace FbTk {
|
||||
|
||||
class TextTheme {
|
||||
public:
|
||||
TextTheme(FbTk::Theme &theme, const std::string &name, const std::string &altname);
|
||||
virtual ~TextTheme();
|
||||
TextTheme(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; }
|
||||
Font &font() { return *m_font; }
|
||||
const Font &font() const { return *m_font; }
|
||||
const Color &textColor() const { return *m_text_color; }
|
||||
Justify justify() const { return *m_justify; }
|
||||
GC textGC() const { return m_text_gc.gc(); }
|
||||
private:
|
||||
FbTk::ThemeItem<FbTk::Font> m_font;
|
||||
FbTk::ThemeItem<FbTk::Color> m_text_color;
|
||||
FbTk::ThemeItem<FbTk::Justify> m_justify;
|
||||
FbTk::GContext m_text_gc;
|
||||
ThemeItem<Font> m_font;
|
||||
ThemeItem<Color> m_text_color;
|
||||
ThemeItem<Justify> m_justify;
|
||||
GContext m_text_gc;
|
||||
};
|
||||
|
||||
#endif // TEXTTHEME_HH
|
||||
}; // end namespace FbTk
|
||||
|
||||
#endif // FBTK_TEXTTHEME_HH
|
|
@ -29,10 +29,10 @@
|
|||
#include "FbTk/Text.hh"
|
||||
#include "FbTk/Color.hh"
|
||||
#include "FbTk/Theme.hh"
|
||||
#include "FbTk/BorderTheme.hh"
|
||||
#include "FbTk/Subject.hh"
|
||||
#include "FbTk/GContext.hh"
|
||||
|
||||
#include "BorderTheme.hh"
|
||||
#include "IconbarTheme.hh"
|
||||
#include "Shape.hh"
|
||||
|
||||
|
@ -84,7 +84,7 @@ public:
|
|||
inline Cursor bottomSideCursor() const { return m_cursor_bottom_side; }
|
||||
|
||||
inline Shape::ShapePlace shapePlace() const { return *m_shape_place; }
|
||||
inline const BorderTheme &border(bool focus) const { return (focus ? m_border_focus : m_border_unfocus); }
|
||||
inline const FbTk::BorderTheme &border(bool focus) const { return (focus ? m_border_focus : m_border_unfocus); }
|
||||
|
||||
unsigned int titleHeight() const { return *m_title_height; }
|
||||
unsigned int bevelWidth() const { return *m_bevel_width; }
|
||||
|
@ -109,7 +109,7 @@ private:
|
|||
FbTk::ThemeItem<Shape::ShapePlace> m_shape_place;
|
||||
|
||||
FbTk::ThemeItem<int> m_title_height, m_bevel_width, m_handle_width;
|
||||
BorderTheme m_border_focus, m_border_unfocus;
|
||||
FbTk::BorderTheme m_border_focus, m_border_unfocus;
|
||||
|
||||
FbTk::GContext m_button_pic_focus_gc, m_button_pic_unfocus_gc;
|
||||
|
||||
|
|
|
@ -26,10 +26,9 @@
|
|||
#define ICONBARTHEME_HH
|
||||
|
||||
#include "FbTk/Theme.hh"
|
||||
#include "FbTk/BorderTheme.hh"
|
||||
#include "FbTk/Texture.hh"
|
||||
|
||||
#include "TextTheme.hh"
|
||||
#include "BorderTheme.hh"
|
||||
#include "FbTk/TextTheme.hh"
|
||||
|
||||
class IconbarTheme:public FbTk::Theme {
|
||||
public:
|
||||
|
@ -39,21 +38,21 @@ public:
|
|||
void reconfigTheme();
|
||||
bool fallback(FbTk::ThemeItem_base &item);
|
||||
|
||||
TextTheme &focusedText() { return m_focused_text; }
|
||||
TextTheme &unfocusedText() { return m_unfocused_text; }
|
||||
FbTk::TextTheme &focusedText() { return m_focused_text; }
|
||||
FbTk::TextTheme &unfocusedText() { return m_unfocused_text; }
|
||||
|
||||
const FbTk::BorderTheme &focusedBorder() const { return m_focused_border; }
|
||||
const FbTk::BorderTheme &unfocusedBorder() const { return m_unfocused_border; }
|
||||
const FbTk::BorderTheme &border() const { return m_border; }
|
||||
|
||||
const BorderTheme &focusedBorder() const { return m_focused_border; }
|
||||
const BorderTheme &unfocusedBorder() const { return m_unfocused_border; }
|
||||
const BorderTheme &border() const { return m_border; }
|
||||
|
||||
const FbTk::Texture &focusedTexture() const { return *m_focused_texture; }
|
||||
const FbTk::Texture &unfocusedTexture() const { return *m_unfocused_texture; }
|
||||
const FbTk::Texture &emptyTexture() const { return *m_empty_texture; }
|
||||
|
||||
private:
|
||||
FbTk::ThemeItem<FbTk::Texture> m_focused_texture, m_unfocused_texture, m_empty_texture;
|
||||
BorderTheme m_focused_border, m_unfocused_border, m_border;
|
||||
TextTheme m_focused_text, m_unfocused_text;
|
||||
FbTk::BorderTheme m_focused_border, m_unfocused_border, m_border;
|
||||
FbTk::TextTheme m_focused_text, m_unfocused_text;
|
||||
std::string m_name, m_altname;
|
||||
};
|
||||
|
||||
|
|
|
@ -120,8 +120,6 @@ fluxbox_SOURCES = AtomHandler.hh ArrowButton.hh ArrowButton.cc \
|
|||
Shape.hh Shape.cc \
|
||||
MenuTheme.hh MenuTheme.cc \
|
||||
Container.hh Container.cc \
|
||||
TextTheme.hh TextTheme.cc \
|
||||
BorderTheme.hh BorderTheme.cc \
|
||||
CommandDialog.hh CommandDialog.cc SendToMenu.hh SendToMenu.cc \
|
||||
AlphaMenu.hh AlphaMenu.cc ObjectResource.hh \
|
||||
CompareWindow.hh \
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
ToolTheme::ToolTheme(int screen_num, const std::string &name, const std::string &altname):
|
||||
FbTk::Theme(screen_num),
|
||||
TextTheme(*this, name, altname),
|
||||
FbTk::TextTheme(*this, name, altname),
|
||||
m_texture(*this, name, altname),
|
||||
m_border(*this, name, altname),
|
||||
m_alpha(255) {
|
||||
|
|
|
@ -26,18 +26,15 @@
|
|||
#define TOOLTHEME_HH
|
||||
|
||||
|
||||
#include "TextTheme.hh"
|
||||
#include "BorderTheme.hh"
|
||||
|
||||
#include "FbTk/TextTheme.hh"
|
||||
#include "FbTk/BorderTheme.hh"
|
||||
#include "FbTk/Texture.hh"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <string>
|
||||
|
||||
class ToolbarTheme;
|
||||
|
||||
/// Handles toolbar item theme for text and texture
|
||||
class ToolTheme: public FbTk::Theme, public TextTheme {
|
||||
class ToolTheme: public FbTk::Theme, public FbTk::TextTheme {
|
||||
public:
|
||||
ToolTheme(int screen_num, const std::string &name, const std::string &altname);
|
||||
virtual ~ToolTheme();
|
||||
|
@ -47,7 +44,7 @@ public:
|
|||
void reconfigTheme();
|
||||
// textures
|
||||
const FbTk::Texture &texture() const { return *m_texture; }
|
||||
const BorderTheme &border() const { return m_border; }
|
||||
const FbTk::BorderTheme &border() const { return m_border; }
|
||||
inline unsigned char alpha() const { return m_alpha; }
|
||||
inline void setAlpha(unsigned char alpha) { m_alpha = alpha; }
|
||||
|
||||
|
@ -56,7 +53,7 @@ protected:
|
|||
|
||||
private:
|
||||
FbTk::ThemeItem<FbTk::Texture> m_texture;
|
||||
BorderTheme m_border;
|
||||
FbTk::BorderTheme m_border;
|
||||
unsigned char m_alpha;
|
||||
};
|
||||
|
||||
|
|
|
@ -27,8 +27,7 @@
|
|||
#include "FbTk/Theme.hh"
|
||||
#include "FbTk/Texture.hh"
|
||||
#include "FbTk/Color.hh"
|
||||
|
||||
#include "BorderTheme.hh"
|
||||
#include "FbTk/BorderTheme.hh"
|
||||
|
||||
/// toolbar theme class container
|
||||
class ToolbarTheme: public FbTk::Theme {
|
||||
|
@ -39,7 +38,7 @@ public:
|
|||
void reconfigTheme();
|
||||
|
||||
|
||||
inline const BorderTheme &border() const { return m_border; }
|
||||
inline const FbTk::BorderTheme &border() const { return m_border; }
|
||||
inline const FbTk::Texture &toolbar() const { return *m_toolbar; }
|
||||
|
||||
bool fallback(FbTk::ThemeItem_base &item);
|
||||
|
@ -50,7 +49,7 @@ public:
|
|||
inline int buttonSize() const { return *m_button_size; }
|
||||
private:
|
||||
FbTk::ThemeItem<FbTk::Texture> m_toolbar;
|
||||
BorderTheme m_border;
|
||||
FbTk::BorderTheme m_border;
|
||||
|
||||
FbTk::ThemeItem<int> m_bevel_width;
|
||||
FbTk::ThemeItem<bool> m_shape;
|
||||
|
|
Loading…
Reference in a new issue