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