updated for new toolbar
This commit is contained in:
parent
f6d07eacb3
commit
6016857678
2 changed files with 33 additions and 11 deletions
|
@ -19,7 +19,7 @@
|
||||||
// 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: ToolbarTheme.cc,v 1.5 2003/07/10 13:48:35 fluxgen Exp $
|
// $Id: ToolbarTheme.cc,v 1.6 2003/08/11 16:54:46 fluxgen Exp $
|
||||||
|
|
||||||
#include "ToolbarTheme.hh"
|
#include "ToolbarTheme.hh"
|
||||||
|
|
||||||
|
@ -55,8 +55,10 @@ ToolbarTheme::ToolbarTheme(int screen_num):
|
||||||
m_button_color(*this,
|
m_button_color(*this,
|
||||||
"toolbar.button.picColor", "Toolbar.Button.PicColor"),
|
"toolbar.button.picColor", "Toolbar.Button.PicColor"),
|
||||||
m_border_color(*this,
|
m_border_color(*this,
|
||||||
"toolbar.borderColor", "toolbar.borderColor"),
|
"toolbar.borderColor", "Toolbar.BorderColor"),
|
||||||
m_toolbar(*this, "toolbar", "Toolbar"),
|
m_toolbar(*this, "toolbar", "Toolbar"),
|
||||||
|
m_iconbar_focused(*this, "toolbar.iconbar.focused", "Toolbar.Iconbar.Focused"),
|
||||||
|
m_iconbar_unfocused(*this, "toolbar.iconbar.unfocused", "Toolbar.Iconbar.Unfocused"),
|
||||||
m_label(*this, "toolbar.label", "Toolbar.Label"),
|
m_label(*this, "toolbar.label", "Toolbar.Label"),
|
||||||
m_window(*this, "toolbar.windowLabel", "Toolbar.WindowLabel"),
|
m_window(*this, "toolbar.windowLabel", "Toolbar.WindowLabel"),
|
||||||
m_button(*this, "toolbar.button", "Toolbar.Button"),
|
m_button(*this, "toolbar.button", "Toolbar.Button"),
|
||||||
|
@ -64,11 +66,13 @@ ToolbarTheme::ToolbarTheme(int screen_num):
|
||||||
"toolbar.button.pressed", "Toolbar.Button.Pressed"),
|
"toolbar.button.pressed", "Toolbar.Button.Pressed"),
|
||||||
m_clock(*this, "toolbar.clock", "Toolbar.Clock"),
|
m_clock(*this, "toolbar.clock", "Toolbar.Clock"),
|
||||||
m_font(*this, "toolbar.font", "Toolbar.Font"),
|
m_font(*this, "toolbar.font", "Toolbar.Font"),
|
||||||
|
m_icon_font(*this, "toolbar.iconFont", "Toolbar.IconFont"),
|
||||||
m_justify(*this, "toolbar.justify", "Toolbar.Justify"),
|
m_justify(*this, "toolbar.justify", "Toolbar.Justify"),
|
||||||
m_border_width(*this, "toolbar.borderWidth", "Toolbar.BorderWidth"),
|
m_border_width(*this, "toolbar.borderWidth", "Toolbar.BorderWidth"),
|
||||||
m_bevel_width(*this, "toolbar.bevelWidth", "Toolbar.BevelWidth"),
|
m_bevel_width(*this, "toolbar.bevelWidth", "Toolbar.BevelWidth"),
|
||||||
m_button_border_width(*this, "toolbar.button.borderWidth", "Toolbar.Button.BorderWidth"),
|
m_button_border_width(*this, "toolbar.button.borderWidth", "Toolbar.Button.BorderWidth"),
|
||||||
m_shape(*this, "toolbar.shaped", "Toolbar.Shaped"),
|
m_shape(*this, "toolbar.shaped", "Toolbar.Shaped"),
|
||||||
|
m_alpha(*this, "toolbar.alpha", "Toolbar.Alpha"),
|
||||||
m_display(FbTk::App::instance()->display()) {
|
m_display(FbTk::App::instance()->display()) {
|
||||||
|
|
||||||
Window rootwindow = RootWindow(m_display, screen_num);
|
Window rootwindow = RootWindow(m_display, screen_num);
|
||||||
|
@ -96,6 +100,16 @@ ToolbarTheme::ToolbarTheme(int screen_num):
|
||||||
m_button_pic_gc =
|
m_button_pic_gc =
|
||||||
XCreateGC(m_display, rootwindow,
|
XCreateGC(m_display, rootwindow,
|
||||||
gc_value_mask, &gcv);
|
gc_value_mask, &gcv);
|
||||||
|
|
||||||
|
gcv.foreground = m_iconbar_focused->color().pixel();
|
||||||
|
m_icon_text_focused_gc =
|
||||||
|
XCreateGC(m_display, rootwindow,
|
||||||
|
gc_value_mask, &gcv);
|
||||||
|
|
||||||
|
m_icon_text_unfocused_gc =
|
||||||
|
XCreateGC(m_display, rootwindow,
|
||||||
|
gc_value_mask, &gcv);
|
||||||
|
|
||||||
// load from current database
|
// load from current database
|
||||||
FbTk::ThemeManager::instance().loadTheme(*this);
|
FbTk::ThemeManager::instance().loadTheme(*this);
|
||||||
}
|
}
|
||||||
|
@ -108,6 +122,10 @@ ToolbarTheme::~ToolbarTheme() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToolbarTheme::reconfigTheme() {
|
void ToolbarTheme::reconfigTheme() {
|
||||||
|
if (*m_alpha > 255)
|
||||||
|
*m_alpha = 255;
|
||||||
|
else if (*m_alpha < 0)
|
||||||
|
*m_alpha = 0;
|
||||||
|
|
||||||
XGCValues gcv;
|
XGCValues gcv;
|
||||||
unsigned long gc_value_mask = GCForeground;
|
unsigned long gc_value_mask = GCForeground;
|
||||||
|
@ -129,6 +147,4 @@ void ToolbarTheme::reconfigTheme() {
|
||||||
XChangeGC(m_display, m_button_pic_gc,
|
XChangeGC(m_display, m_button_pic_gc,
|
||||||
gc_value_mask, &gcv);
|
gc_value_mask, &gcv);
|
||||||
|
|
||||||
// notify listeners
|
|
||||||
m_theme_change_sig.notify();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
// 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: ToolbarTheme.hh,v 1.5 2003/07/10 13:48:35 fluxgen Exp $
|
// $Id: ToolbarTheme.hh,v 1.6 2003/08/11 16:54:46 fluxgen Exp $
|
||||||
|
|
||||||
#ifndef TOOLBARTHEME_HH
|
#ifndef TOOLBARTHEME_HH
|
||||||
#define TOOLBARTHEME_HH
|
#define TOOLBARTHEME_HH
|
||||||
|
@ -54,6 +54,8 @@ public:
|
||||||
*/
|
*/
|
||||||
///@{
|
///@{
|
||||||
const FbTk::Texture &toolbar() const { return *m_toolbar; }
|
const FbTk::Texture &toolbar() const { return *m_toolbar; }
|
||||||
|
const FbTk::Texture &iconbarFocused() const { return *m_iconbar_focused; }
|
||||||
|
const FbTk::Texture &iconbarUnfocused() const { return *m_iconbar_unfocused; }
|
||||||
const FbTk::Texture &label() const { return *m_label; }
|
const FbTk::Texture &label() const { return *m_label; }
|
||||||
const FbTk::Texture &window() const { return *m_window; }
|
const FbTk::Texture &window() const { return *m_window; }
|
||||||
const FbTk::Texture &button() const { return *m_button; }
|
const FbTk::Texture &button() const { return *m_button; }
|
||||||
|
@ -62,6 +64,8 @@ public:
|
||||||
///@}
|
///@}
|
||||||
const FbTk::Font &font() const { return *m_font; }
|
const FbTk::Font &font() const { return *m_font; }
|
||||||
FbTk::Font &font() { return *m_font; }
|
FbTk::Font &font() { return *m_font; }
|
||||||
|
const FbTk::Font &iconFont() const { return *m_icon_font; }
|
||||||
|
FbTk::Font &iconFont() { return *m_icon_font; }
|
||||||
/**
|
/**
|
||||||
@name graphic context
|
@name graphic context
|
||||||
*/
|
*/
|
||||||
|
@ -70,6 +74,8 @@ public:
|
||||||
GC windowTextGC() const { return m_window_text_gc; }
|
GC windowTextGC() const { return m_window_text_gc; }
|
||||||
GC clockTextGC() const { return m_clock_text_gc; }
|
GC clockTextGC() const { return m_clock_text_gc; }
|
||||||
GC buttonPicGC() const { return m_button_pic_gc; }
|
GC buttonPicGC() const { return m_button_pic_gc; }
|
||||||
|
GC iconTextFocusedGC() const { return m_icon_text_focused_gc; }
|
||||||
|
GC iconTextUnfocusedGC() const { return m_icon_text_unfocused_gc; }
|
||||||
///@}
|
///@}
|
||||||
FbTk::Justify justify() const { return *m_justify; }
|
FbTk::Justify justify() const { return *m_justify; }
|
||||||
|
|
||||||
|
@ -77,27 +83,27 @@ public:
|
||||||
inline int bevelWidth() const { return *m_bevel_width; }
|
inline int bevelWidth() const { return *m_bevel_width; }
|
||||||
inline int buttonBorderWidth() const { return *m_button_border_width; }
|
inline int buttonBorderWidth() const { return *m_button_border_width; }
|
||||||
inline bool shape() const { return *m_shape; }
|
inline bool shape() const { return *m_shape; }
|
||||||
|
inline unsigned char alpha() const { return *m_alpha; }
|
||||||
void addListener(FbTk::Observer &obs) { m_theme_change_sig.attach(&obs); }
|
|
||||||
void removeListener(FbTk::Observer &obs) { m_theme_change_sig.detach(&obs); }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// text colors
|
// text colors
|
||||||
FbTk::ThemeItem<FbTk::Color> m_label_textcolor, m_window_textcolor, m_clock_textcolor;
|
FbTk::ThemeItem<FbTk::Color> m_label_textcolor, m_window_textcolor, m_clock_textcolor;
|
||||||
FbTk::ThemeItem<FbTk::Color> m_button_color, m_border_color;
|
FbTk::ThemeItem<FbTk::Color> m_button_color, m_border_color;
|
||||||
// textures
|
// textures
|
||||||
FbTk::ThemeItem<FbTk::Texture> m_toolbar, m_label, m_window, m_button, m_pressed_button, m_clock;
|
FbTk::ThemeItem<FbTk::Texture> m_toolbar, m_iconbar_focused, m_iconbar_unfocused,
|
||||||
FbTk::ThemeItem<FbTk::Font> m_font;
|
m_label, m_window, m_button, m_pressed_button, m_clock;
|
||||||
|
FbTk::ThemeItem<FbTk::Font> m_font, m_icon_font;
|
||||||
FbTk::ThemeItem<FbTk::Justify> m_justify;
|
FbTk::ThemeItem<FbTk::Justify> m_justify;
|
||||||
|
|
||||||
FbTk::ThemeItem<int> m_border_width, m_bevel_width, m_button_border_width;
|
FbTk::ThemeItem<int> m_border_width, m_bevel_width, m_button_border_width;
|
||||||
FbTk::ThemeItem<bool> m_shape;
|
FbTk::ThemeItem<bool> m_shape;
|
||||||
|
FbTk::ThemeItem<int> m_alpha;
|
||||||
|
|
||||||
// graphic context
|
// graphic context
|
||||||
GC m_label_text_gc, m_window_text_gc, m_clock_text_gc, m_button_pic_gc;
|
GC m_label_text_gc, m_window_text_gc, m_clock_text_gc, m_button_pic_gc;
|
||||||
|
GC m_icon_text_unfocused_gc, m_icon_text_focused_gc;
|
||||||
Display *m_display;
|
Display *m_display;
|
||||||
|
|
||||||
FbTk::Subject m_theme_change_sig;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TOOLBARTHEME_HH
|
#endif // TOOLBARTHEME_HH
|
||||||
|
|
Loading…
Reference in a new issue