update code to use ThemeProxy
This commit is contained in:
parent
60ba709c2f
commit
ac1bd7e098
55 changed files with 503 additions and 474 deletions
|
@ -34,8 +34,8 @@
|
||||||
#include "FbTk/I18n.hh"
|
#include "FbTk/I18n.hh"
|
||||||
#include "Window.hh"
|
#include "Window.hh"
|
||||||
|
|
||||||
AlphaMenu::AlphaMenu(FbTk::MenuTheme &tm, FbTk::ImageControl &imgctrl,
|
AlphaMenu::AlphaMenu(FbTk::ThemeProxy<FbTk::MenuTheme> &tm,
|
||||||
FbTk::XLayer &layer):
|
FbTk::ImageControl &imgctrl, FbTk::XLayer &layer):
|
||||||
ToggleMenu(tm, imgctrl, layer)
|
ToggleMenu(tm, imgctrl, layer)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,8 @@
|
||||||
|
|
||||||
class AlphaMenu : public ToggleMenu {
|
class AlphaMenu : public ToggleMenu {
|
||||||
public:
|
public:
|
||||||
AlphaMenu(FbTk::MenuTheme &tm, FbTk::ImageControl &imgctrl,
|
AlphaMenu(FbTk::ThemeProxy<FbTk::MenuTheme> &tm,
|
||||||
FbTk::XLayer &layer);
|
FbTk::ImageControl &imgctrl, FbTk::XLayer &layer);
|
||||||
|
|
||||||
// we override these to update the menu when the active window changes
|
// we override these to update the menu when the active window changes
|
||||||
void move(int x, int y);
|
void move(int x, int y);
|
||||||
|
|
|
@ -46,8 +46,8 @@ public:
|
||||||
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
||||||
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
|
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
|
||||||
|
|
||||||
virtual ButtonTheme *operator ->() { return this; }
|
virtual ButtonTheme &operator *() { return *this; }
|
||||||
virtual const ButtonTheme *operator ->() const { return this; }
|
virtual const ButtonTheme &operator *() const { return *this; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FbTk::ThemeItem<FbTk::Color> m_pic_color;
|
FbTk::ThemeItem<FbTk::Color> m_pic_color;
|
||||||
|
|
|
@ -26,9 +26,9 @@
|
||||||
|
|
||||||
ButtonTool::ButtonTool(FbTk::Button *button,
|
ButtonTool::ButtonTool(FbTk::Button *button,
|
||||||
ToolbarItem::Type type,
|
ToolbarItem::Type type,
|
||||||
ButtonTheme &theme,
|
FbTk::ThemeProxy<ButtonTheme> &theme,
|
||||||
FbTk::ImageControl &img_ctrl):
|
FbTk::ImageControl &img_ctrl):
|
||||||
GenericTool(button, type, theme),
|
GenericTool(button, type, dynamic_cast<FbTk::ThemeProxy<ToolTheme> &>(theme)),
|
||||||
m_cache_pm(0),
|
m_cache_pm(0),
|
||||||
m_cache_pressed_pm(0),
|
m_cache_pressed_pm(0),
|
||||||
m_image_ctrl(img_ctrl) {
|
m_image_ctrl(img_ctrl) {
|
||||||
|
@ -46,37 +46,37 @@ ButtonTool::~ButtonTool() {
|
||||||
|
|
||||||
void ButtonTool::updateSizing() {
|
void ButtonTool::updateSizing() {
|
||||||
FbTk::Button &btn = static_cast<FbTk::Button &>(window());
|
FbTk::Button &btn = static_cast<FbTk::Button &>(window());
|
||||||
btn.setBorderWidth(theme().border().width());
|
btn.setBorderWidth(theme()->border().width());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ButtonTool::renderTheme(unsigned char alpha) {
|
void ButtonTool::renderTheme(unsigned char alpha) {
|
||||||
FbTk::Button &btn = static_cast<FbTk::Button &>(window());
|
FbTk::Button &btn = static_cast<FbTk::Button &>(window());
|
||||||
|
|
||||||
btn.setGC(static_cast<const ButtonTheme &>(theme()).gc());
|
btn.setGC(static_cast<const ButtonTheme &>(*theme()).gc());
|
||||||
btn.setBorderColor(theme().border().color());
|
btn.setBorderColor(theme()->border().color());
|
||||||
btn.setBorderWidth(theme().border().width());
|
btn.setBorderWidth(theme()->border().width());
|
||||||
btn.setAlpha(alpha);
|
btn.setAlpha(alpha);
|
||||||
btn.updateTheme(static_cast<const FbTk::Theme &>(theme()));
|
btn.updateTheme(*theme());
|
||||||
|
|
||||||
Pixmap old_pm = m_cache_pm;
|
Pixmap old_pm = m_cache_pm;
|
||||||
if (!theme().texture().usePixmap()) {
|
if (!theme()->texture().usePixmap()) {
|
||||||
m_cache_pm = 0;
|
m_cache_pm = 0;
|
||||||
btn.setBackgroundColor(theme().texture().color());
|
btn.setBackgroundColor(theme()->texture().color());
|
||||||
} else {
|
} else {
|
||||||
m_cache_pm = m_image_ctrl.renderImage(width(), height(),
|
m_cache_pm = m_image_ctrl.renderImage(width(), height(),
|
||||||
theme().texture(), orientation());
|
theme()->texture(), orientation());
|
||||||
btn.setBackgroundPixmap(m_cache_pm);
|
btn.setBackgroundPixmap(m_cache_pm);
|
||||||
}
|
}
|
||||||
if (old_pm)
|
if (old_pm)
|
||||||
m_image_ctrl.removeImage(old_pm);
|
m_image_ctrl.removeImage(old_pm);
|
||||||
|
|
||||||
old_pm = m_cache_pressed_pm;
|
old_pm = m_cache_pressed_pm;
|
||||||
if (! static_cast<const ButtonTheme &>(theme()).pressed().usePixmap()) {
|
if (! static_cast<const ButtonTheme &>(*theme()).pressed().usePixmap()) {
|
||||||
m_cache_pressed_pm = 0;
|
m_cache_pressed_pm = 0;
|
||||||
btn.setPressedColor(static_cast<const ButtonTheme &>(theme()).pressed().color());
|
btn.setPressedColor(static_cast<const ButtonTheme &>(*theme()).pressed().color());
|
||||||
} else {
|
} else {
|
||||||
m_cache_pressed_pm = m_image_ctrl.renderImage(width(), height(),
|
m_cache_pressed_pm = m_image_ctrl.renderImage(width(), height(),
|
||||||
static_cast<const ButtonTheme &>(theme()).pressed(), orientation());
|
static_cast<const ButtonTheme &>(*theme()).pressed(), orientation());
|
||||||
btn.setPressedPixmap(m_cache_pressed_pm);
|
btn.setPressedPixmap(m_cache_pressed_pm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,8 @@ class ImageControl;
|
||||||
class ButtonTool: public GenericTool {
|
class ButtonTool: public GenericTool {
|
||||||
public:
|
public:
|
||||||
ButtonTool(FbTk::Button *button, ToolbarItem::Type type,
|
ButtonTool(FbTk::Button *button, ToolbarItem::Type type,
|
||||||
ButtonTheme &theme, FbTk::ImageControl &img_ctrl);
|
FbTk::ThemeProxy<ButtonTheme> &theme,
|
||||||
|
FbTk::ImageControl &img_ctrl);
|
||||||
virtual ~ButtonTool();
|
virtual ~ButtonTool();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -134,9 +134,10 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
ClockTool::ClockTool(const FbTk::FbWindow &parent,
|
ClockTool::ClockTool(const FbTk::FbWindow &parent,
|
||||||
ToolTheme &theme, BScreen &screen, FbTk::Menu &menu):
|
FbTk::ThemeProxy<ToolTheme> &theme, BScreen &screen,
|
||||||
|
FbTk::Menu &menu):
|
||||||
ToolbarItem(ToolbarItem::FIXED),
|
ToolbarItem(ToolbarItem::FIXED),
|
||||||
m_button(parent, theme.font(), ""),
|
m_button(parent, theme->font(), ""),
|
||||||
m_theme(theme),
|
m_theme(theme),
|
||||||
m_screen(screen),
|
m_screen(screen),
|
||||||
m_pixmap(0),
|
m_pixmap(0),
|
||||||
|
@ -164,7 +165,7 @@ ClockTool::ClockTool(const FbTk::FbWindow &parent,
|
||||||
m_timer.setCommand(update_graphic);
|
m_timer.setCommand(update_graphic);
|
||||||
m_timer.start();
|
m_timer.start();
|
||||||
|
|
||||||
m_button.setGC(m_theme.textGC());
|
m_button.setGC(m_theme->textGC());
|
||||||
|
|
||||||
// setup menu
|
// setup menu
|
||||||
FbTk::RefCount<FbTk::Command> saverc(FbTk::ObjectRegistry<FbTk::Command>::instance().parse("saverc"));
|
FbTk::RefCount<FbTk::Command> saverc(FbTk::ObjectRegistry<FbTk::Command>::instance().parse("saverc"));
|
||||||
|
@ -233,16 +234,13 @@ void ClockTool::update(FbTk::Subject *subj) {
|
||||||
unsigned int new_width = m_button.width();
|
unsigned int new_width = m_button.width();
|
||||||
unsigned int new_height = m_button.height();
|
unsigned int new_height = m_button.height();
|
||||||
translateSize(orientation(), new_width, new_height);
|
translateSize(orientation(), new_width, new_height);
|
||||||
new_width = m_theme.font().textWidth(text.c_str(), text.size());
|
new_width = m_theme->font().textWidth(text.c_str(), text.size());
|
||||||
translateSize(orientation(), new_width, new_height);
|
translateSize(orientation(), new_width, new_height);
|
||||||
if (new_width != m_button.width() || new_height != m_button.height()) {
|
if (new_width != m_button.width() || new_height != m_button.height()) {
|
||||||
resize(new_width, new_height);
|
resize(new_width, new_height);
|
||||||
resizeSig().notify();
|
resizeSig().notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (subj != 0 && typeid(*subj) == typeid(ToolTheme))
|
|
||||||
renderTheme(m_button.alpha());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int ClockTool::borderWidth() const {
|
unsigned int ClockTool::borderWidth() const {
|
||||||
|
@ -280,7 +278,7 @@ void ClockTool::updateTime() {
|
||||||
|
|
||||||
m_button.setText(text);
|
m_button.setText(text);
|
||||||
|
|
||||||
unsigned int new_width = m_theme.font().textWidth(time_string, time_string_len) + 2;
|
unsigned int new_width = m_theme->font().textWidth(time_string, time_string_len) + 2;
|
||||||
if (new_width > m_button.width()) {
|
if (new_width > m_button.width()) {
|
||||||
resize(new_width, m_button.height());
|
resize(new_width, m_button.height());
|
||||||
resizeSig().notify();
|
resizeSig().notify();
|
||||||
|
@ -293,7 +291,7 @@ void ClockTool::updateTime() {
|
||||||
|
|
||||||
// Just change things that affect the size
|
// Just change things that affect the size
|
||||||
void ClockTool::updateSizing() {
|
void ClockTool::updateSizing() {
|
||||||
m_button.setBorderWidth(m_theme.border().width());
|
m_button.setBorderWidth(m_theme->border().width());
|
||||||
// resizes if new timeformat
|
// resizes if new timeformat
|
||||||
update(0);
|
update(0);
|
||||||
}
|
}
|
||||||
|
@ -302,25 +300,25 @@ void ClockTool::reRender() {
|
||||||
if (m_pixmap)
|
if (m_pixmap)
|
||||||
m_screen.imageControl().removeImage(m_pixmap);
|
m_screen.imageControl().removeImage(m_pixmap);
|
||||||
|
|
||||||
if (m_theme.texture().usePixmap()) {
|
if (m_theme->texture().usePixmap()) {
|
||||||
m_pixmap = m_screen.imageControl().renderImage(width(), height(),
|
m_pixmap = m_screen.imageControl().renderImage(width(), height(),
|
||||||
m_theme.texture(), orientation());
|
m_theme->texture(), orientation());
|
||||||
m_button.setBackgroundPixmap(m_pixmap);
|
m_button.setBackgroundPixmap(m_pixmap);
|
||||||
} else {
|
} else {
|
||||||
m_pixmap = 0;
|
m_pixmap = 0;
|
||||||
m_button.setBackgroundColor(m_theme.texture().color());
|
m_button.setBackgroundColor(m_theme->texture().color());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ClockTool::renderTheme(unsigned char alpha) {
|
void ClockTool::renderTheme(unsigned char alpha) {
|
||||||
m_button.setAlpha(alpha);
|
m_button.setAlpha(alpha);
|
||||||
m_button.setJustify(m_theme.justify());
|
m_button.setJustify(m_theme->justify());
|
||||||
|
|
||||||
reRender();
|
reRender();
|
||||||
|
|
||||||
m_button.setBorderWidth(m_theme.border().width());
|
m_button.setBorderWidth(m_theme->border().width());
|
||||||
m_button.setBorderColor(m_theme.border().color());
|
m_button.setBorderColor(m_theme->border().color());
|
||||||
m_button.clear();
|
m_button.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,11 +39,13 @@ namespace FbTk {
|
||||||
class ImageControl;
|
class ImageControl;
|
||||||
class Subject;
|
class Subject;
|
||||||
class Menu;
|
class Menu;
|
||||||
|
template <class T> class ThemeProxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
class ClockTool:public ToolbarItem, public FbTk::Observer {
|
class ClockTool:public ToolbarItem, public FbTk::Observer {
|
||||||
public:
|
public:
|
||||||
ClockTool(const FbTk::FbWindow &parent, ToolTheme &theme, BScreen &screen, FbTk::Menu &menu);
|
ClockTool(const FbTk::FbWindow &parent, FbTk::ThemeProxy<ToolTheme> &theme,
|
||||||
|
BScreen &screen, FbTk::Menu &menu);
|
||||||
virtual ~ClockTool();
|
virtual ~ClockTool();
|
||||||
|
|
||||||
void move(int x, int y);
|
void move(int x, int y);
|
||||||
|
@ -73,7 +75,7 @@ private:
|
||||||
|
|
||||||
FbTk::TextButton m_button;
|
FbTk::TextButton m_button;
|
||||||
|
|
||||||
const ToolTheme &m_theme;
|
const FbTk::ThemeProxy<ToolTheme> &m_theme;
|
||||||
BScreen &m_screen;
|
BScreen &m_screen;
|
||||||
Pixmap m_pixmap;
|
Pixmap m_pixmap;
|
||||||
FbTk::Timer m_timer;
|
FbTk::Timer m_timer;
|
||||||
|
|
|
@ -50,8 +50,8 @@ using std::out_of_range;
|
||||||
CommandDialog::CommandDialog(BScreen &screen,
|
CommandDialog::CommandDialog(BScreen &screen,
|
||||||
const string &title, const string precommand) :
|
const string &title, const string precommand) :
|
||||||
FbTk::FbWindow(screen.rootWindow().screenNumber(), 0, 0, 200, 1, ExposureMask),
|
FbTk::FbWindow(screen.rootWindow().screenNumber(), 0, 0, 200, 1, ExposureMask),
|
||||||
m_textbox(*this, screen.winFrameTheme().font(), ""),
|
m_textbox(*this, screen.winFrameTheme()->font(), ""),
|
||||||
m_label(*this, screen.winFrameTheme().font(), title),
|
m_label(*this, screen.winFrameTheme()->font(), title),
|
||||||
m_gc(m_textbox),
|
m_gc(m_textbox),
|
||||||
m_screen(screen),
|
m_screen(screen),
|
||||||
m_move_x(0),
|
m_move_x(0),
|
||||||
|
@ -190,12 +190,12 @@ void CommandDialog::tabComplete() {
|
||||||
|
|
||||||
void CommandDialog::render() {
|
void CommandDialog::render() {
|
||||||
Pixmap tmp = m_pixmap;
|
Pixmap tmp = m_pixmap;
|
||||||
if (!m_screen.winFrameTheme().iconbarTheme().focusedTexture().usePixmap()) {
|
if (!m_screen.winFrameTheme()->iconbarTheme().focusedTexture().usePixmap()) {
|
||||||
m_label.setBackgroundColor(m_screen.winFrameTheme().iconbarTheme().focusedTexture().color());
|
m_label.setBackgroundColor(m_screen.winFrameTheme()->iconbarTheme().focusedTexture().color());
|
||||||
m_pixmap = 0;
|
m_pixmap = 0;
|
||||||
} else {
|
} else {
|
||||||
m_pixmap = m_screen.imageControl().renderImage(m_label.width(), m_label.height(),
|
m_pixmap = m_screen.imageControl().renderImage(m_label.width(), m_label.height(),
|
||||||
m_screen.winFrameTheme().iconbarTheme().focusedTexture());
|
m_screen.winFrameTheme()->iconbarTheme().focusedTexture());
|
||||||
m_label.setBackgroundPixmap(m_pixmap);
|
m_label.setBackgroundPixmap(m_pixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ void CommandDialog::init() {
|
||||||
// setup label
|
// setup label
|
||||||
// we listen to motion notify too
|
// we listen to motion notify too
|
||||||
m_label.setEventMask(m_label.eventMask() | ButtonPressMask | ButtonMotionMask);
|
m_label.setEventMask(m_label.eventMask() | ButtonPressMask | ButtonMotionMask);
|
||||||
m_label.setGC(m_screen.winFrameTheme().iconbarTheme().focusedText().textGC());
|
m_label.setGC(m_screen.winFrameTheme()->iconbarTheme().focusedText().textGC());
|
||||||
m_label.show();
|
m_label.show();
|
||||||
|
|
||||||
// setup text box
|
// setup text box
|
||||||
|
|
10
src/Ewmh.cc
10
src/Ewmh.cc
|
@ -974,11 +974,11 @@ bool Ewmh::checkClientMessage(const XClientMessageEvent &ce,
|
||||||
} else if (ce.message_type == m_net->request_frame_extents) {
|
} else if (ce.message_type == m_net->request_frame_extents) {
|
||||||
if (!screen)
|
if (!screen)
|
||||||
return true;
|
return true;
|
||||||
FbWinFrameTheme &theme = screen->winFrameTheme();
|
FbTk::ThemeProxy<FbWinFrameTheme> &theme = screen->winFrameTheme();
|
||||||
unsigned int bw = theme.border(true).width();
|
unsigned int bw = theme->border(true).width();
|
||||||
long title_h = theme.titleHeight() ||
|
long title_h = theme->titleHeight() ||
|
||||||
theme.font().height() + 2*theme.bevelWidth() + 2 + 2*bw;
|
theme->font().height() + 2*theme->bevelWidth() + 2 + 2*bw;
|
||||||
long handle_h = theme.handleWidth() + 2*bw;
|
long handle_h = theme->handleWidth() + 2*bw;
|
||||||
long extents[4];
|
long extents[4];
|
||||||
// our frames currently don't protrude from left/right
|
// our frames currently don't protrude from left/right
|
||||||
extents[0] = bw;
|
extents[0] = bw;
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
#include "fluxbox.hh"
|
#include "fluxbox.hh"
|
||||||
#include "Screen.hh"
|
#include "Screen.hh"
|
||||||
|
|
||||||
FbMenu::FbMenu(FbTk::MenuTheme &tm, FbTk::ImageControl &imgctrl,
|
FbMenu::FbMenu(FbTk::ThemeProxy<FbTk::MenuTheme> &tm,
|
||||||
FbTk::XLayer &layer):
|
FbTk::ImageControl &imgctrl, FbTk::XLayer &layer):
|
||||||
FbTk::Menu(tm, imgctrl),
|
FbTk::Menu(tm, imgctrl),
|
||||||
m_layeritem(fbwindow(), layer) {
|
m_layeritem(fbwindow(), layer) {
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ class MenuTheme;
|
||||||
/// a layered and shaped menu
|
/// a layered and shaped menu
|
||||||
class FbMenu:public FbTk::Menu {
|
class FbMenu:public FbTk::Menu {
|
||||||
public:
|
public:
|
||||||
FbMenu(FbTk::MenuTheme &tm, FbTk::ImageControl &imgctrl,
|
FbMenu(FbTk::ThemeProxy<FbTk::MenuTheme> &tm, FbTk::ImageControl &imgctrl,
|
||||||
FbTk::XLayer &layer);
|
FbTk::XLayer &layer);
|
||||||
virtual ~FbMenu() { }
|
virtual ~FbMenu() { }
|
||||||
void raise() { m_layeritem.raise(); }
|
void raise() { m_layeritem.raise(); }
|
||||||
|
|
124
src/FbTk/Menu.cc
124
src/FbTk/Menu.cc
|
@ -81,17 +81,17 @@ Menu *Menu::shown = 0;
|
||||||
|
|
||||||
Menu *Menu::s_focused = 0;
|
Menu *Menu::s_focused = 0;
|
||||||
|
|
||||||
Menu::Menu(MenuTheme &tm, ImageControl &imgctrl):
|
Menu::Menu(FbTk::ThemeProxy<MenuTheme> &tm, ImageControl &imgctrl):
|
||||||
m_theme(tm),
|
m_theme(tm),
|
||||||
m_parent(0),
|
m_parent(0),
|
||||||
m_image_ctrl(imgctrl),
|
m_image_ctrl(imgctrl),
|
||||||
m_screen_x(0),
|
m_screen_x(0),
|
||||||
m_screen_y(0),
|
m_screen_y(0),
|
||||||
m_screen_width(DisplayWidth(FbTk::App::instance()->display(), tm.screenNum())),
|
m_screen_width(DisplayWidth(FbTk::App::instance()->display(), tm->screenNum())),
|
||||||
m_screen_height(DisplayHeight(FbTk::App::instance()->display(), tm.screenNum())),
|
m_screen_height(DisplayHeight(FbTk::App::instance()->display(), tm->screenNum())),
|
||||||
m_alignment(ALIGNDONTCARE),
|
m_alignment(ALIGNDONTCARE),
|
||||||
m_active_index(-1),
|
m_active_index(-1),
|
||||||
m_shape(new Shape(fbwindow(), tm.shapePlaces())),
|
m_shape(new Shape(fbwindow(), tm->shapePlaces())),
|
||||||
m_need_update(true) {
|
m_need_update(true) {
|
||||||
// setup timers
|
// setup timers
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ Menu::Menu(MenuTheme &tm, ImageControl &imgctrl):
|
||||||
menu.hilite_pixmap = None;
|
menu.hilite_pixmap = None;
|
||||||
|
|
||||||
menu.item_w = menu.frame_h =
|
menu.item_w = menu.frame_h =
|
||||||
theme().titleFont().height() + theme().bevelWidth() * 2;
|
theme()->titleFont().height() + theme()->bevelWidth() * 2;
|
||||||
|
|
||||||
menu.sublevels =
|
menu.sublevels =
|
||||||
menu.persub =
|
menu.persub =
|
||||||
|
@ -137,7 +137,7 @@ Menu::Menu(MenuTheme &tm, ImageControl &imgctrl):
|
||||||
long event_mask = ButtonPressMask | ButtonReleaseMask |
|
long event_mask = ButtonPressMask | ButtonReleaseMask |
|
||||||
ButtonMotionMask | KeyPressMask | ExposureMask | FocusChangeMask;
|
ButtonMotionMask | KeyPressMask | ExposureMask | FocusChangeMask;
|
||||||
// create menu window
|
// create menu window
|
||||||
menu.window = FbTk::FbWindow(tm.screenNum(),
|
menu.window = FbTk::FbWindow(tm->screenNum(),
|
||||||
0, 0, 10, 10,
|
0, 0, 10, 10,
|
||||||
event_mask,
|
event_mask,
|
||||||
true, // override redirect
|
true, // override redirect
|
||||||
|
@ -153,7 +153,7 @@ Menu::Menu(MenuTheme &tm, ImageControl &imgctrl):
|
||||||
event_mask |= EnterWindowMask | LeaveWindowMask;
|
event_mask |= EnterWindowMask | LeaveWindowMask;
|
||||||
//create menu title
|
//create menu title
|
||||||
menu.title = FbTk::FbWindow(menu.window, // parent
|
menu.title = FbTk::FbWindow(menu.window, // parent
|
||||||
0, 0, width(), theme().titleHeight(), // pos and size
|
0, 0, width(), theme()->titleHeight(), // pos and size
|
||||||
event_mask, // mask
|
event_mask, // mask
|
||||||
false, // override redirect
|
false, // override redirect
|
||||||
true); // save under
|
true); // save under
|
||||||
|
@ -163,7 +163,7 @@ Menu::Menu(MenuTheme &tm, ImageControl &imgctrl):
|
||||||
|
|
||||||
event_mask |= PointerMotionMask;
|
event_mask |= PointerMotionMask;
|
||||||
menu.frame = FbTk::FbWindow(menu.window, // parent
|
menu.frame = FbTk::FbWindow(menu.window, // parent
|
||||||
0, theme().titleHeight(), // pos
|
0, theme()->titleHeight(), // pos
|
||||||
width(), menu.frame_h ? menu.frame_h : 1, // size
|
width(), menu.frame_h ? menu.frame_h : 1, // size
|
||||||
event_mask, // mask
|
event_mask, // mask
|
||||||
false, // override redirect
|
false, // override redirect
|
||||||
|
@ -366,9 +366,9 @@ void Menu::enableTitle() {
|
||||||
|
|
||||||
void Menu::updateMenu(int active_index) {
|
void Menu::updateMenu(int active_index) {
|
||||||
if (m_title_vis) {
|
if (m_title_vis) {
|
||||||
menu.item_w = theme().titleFont().textWidth(menu.label,
|
menu.item_w = theme()->titleFont().textWidth(menu.label,
|
||||||
menu.label.size());
|
menu.label.size());
|
||||||
menu.item_w += (theme().bevelWidth() * 2);
|
menu.item_w += (theme()->bevelWidth() * 2);
|
||||||
} else
|
} else
|
||||||
menu.item_w = 1;
|
menu.item_w = 1;
|
||||||
|
|
||||||
|
@ -386,8 +386,8 @@ void Menu::updateMenu(int active_index) {
|
||||||
if (!menuitems.empty()) {
|
if (!menuitems.empty()) {
|
||||||
menu.sublevels = 1;
|
menu.sublevels = 1;
|
||||||
|
|
||||||
while (theme().itemHeight() * (menuitems.size() + 1) / menu.sublevels +
|
while (theme()->itemHeight() * (menuitems.size() + 1) / menu.sublevels +
|
||||||
theme().titleHeight() + theme().borderWidth() > m_screen_height) {
|
theme()->titleHeight() + theme()->borderWidth() > m_screen_height) {
|
||||||
menu.sublevels++;
|
menu.sublevels++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,14 +401,14 @@ void Menu::updateMenu(int active_index) {
|
||||||
menu.persub = 0;
|
menu.persub = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int itmp = (theme().itemHeight() * menu.persub);
|
int itmp = (theme()->itemHeight() * menu.persub);
|
||||||
menu.frame_h = itmp < 1 ? 1 : itmp;
|
menu.frame_h = itmp < 1 ? 1 : itmp;
|
||||||
|
|
||||||
unsigned int new_width = (menu.sublevels * menu.item_w);
|
unsigned int new_width = (menu.sublevels * menu.item_w);
|
||||||
unsigned int new_height = menu.frame_h;
|
unsigned int new_height = menu.frame_h;
|
||||||
|
|
||||||
if (m_title_vis)
|
if (m_title_vis)
|
||||||
new_height += theme().titleHeight() + ((menu.frame_h > 0)?menu.title.borderWidth():0);
|
new_height += theme()->titleHeight() + ((menu.frame_h > 0)?menu.title.borderWidth():0);
|
||||||
|
|
||||||
|
|
||||||
if (new_width == 0)
|
if (new_width == 0)
|
||||||
|
@ -431,29 +431,29 @@ void Menu::updateMenu(int active_index) {
|
||||||
menu.frame.setAlpha(alpha());
|
menu.frame.setAlpha(alpha());
|
||||||
|
|
||||||
Pixmap tmp = menu.hilite_pixmap;
|
Pixmap tmp = menu.hilite_pixmap;
|
||||||
const FbTk::Texture &hilite_tex = theme().hiliteTexture();
|
const FbTk::Texture &hilite_tex = theme()->hiliteTexture();
|
||||||
if (!hilite_tex.usePixmap()) {
|
if (!hilite_tex.usePixmap()) {
|
||||||
menu.hilite_pixmap = None;
|
menu.hilite_pixmap = None;
|
||||||
} else
|
} else
|
||||||
menu.hilite_pixmap =
|
menu.hilite_pixmap =
|
||||||
m_image_ctrl.renderImage(menu.item_w, theme().itemHeight(), hilite_tex);
|
m_image_ctrl.renderImage(menu.item_w, theme()->itemHeight(), hilite_tex);
|
||||||
if (tmp)
|
if (tmp)
|
||||||
m_image_ctrl.removeImage(tmp);
|
m_image_ctrl.removeImage(tmp);
|
||||||
|
|
||||||
|
|
||||||
if (!theme().selectedPixmap().pixmap().drawable()) {
|
if (!theme()->selectedPixmap().pixmap().drawable()) {
|
||||||
int hw = theme().itemHeight() / 2;
|
int hw = theme()->itemHeight() / 2;
|
||||||
m_theme.setSelectedPixmap(m_image_ctrl.renderImage(hw, hw, theme().hiliteTexture()), true);
|
theme()->setSelectedPixmap(m_image_ctrl.renderImage(hw, hw, theme()->hiliteTexture()), true);
|
||||||
|
|
||||||
if (!theme().highlightSelectedPixmap().pixmap().drawable()) {
|
if (!theme()->highlightSelectedPixmap().pixmap().drawable()) {
|
||||||
int hw = theme().itemHeight() / 2;
|
int hw = theme()->itemHeight() / 2;
|
||||||
m_theme.setHighlightSelectedPixmap(m_image_ctrl.renderImage(hw, hw, theme().frameTexture()), true);
|
theme()->setHighlightSelectedPixmap(m_image_ctrl.renderImage(hw, hw, theme()->frameTexture()), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_title_vis) {
|
if (m_title_vis) {
|
||||||
menu.title.moveResize(-menu.title.borderWidth(), -menu.title.borderWidth(),
|
menu.title.moveResize(-menu.title.borderWidth(), -menu.title.borderWidth(),
|
||||||
width() + menu.title.borderWidth(), theme().titleHeight());
|
width() + menu.title.borderWidth(), theme()->titleHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
menu.frame.moveResize(0, ((m_title_vis) ? menu.title.y() + menu.title.height() +
|
menu.frame.moveResize(0, ((m_title_vis) ? menu.title.y() + menu.title.height() +
|
||||||
|
@ -462,13 +462,13 @@ void Menu::updateMenu(int active_index) {
|
||||||
|
|
||||||
if (m_title_vis && m_need_update) {
|
if (m_title_vis && m_need_update) {
|
||||||
tmp = menu.title_pixmap;
|
tmp = menu.title_pixmap;
|
||||||
const FbTk::Texture &tex = theme().titleTexture();
|
const FbTk::Texture &tex = theme()->titleTexture();
|
||||||
if (!tex.usePixmap()) {
|
if (!tex.usePixmap()) {
|
||||||
menu.title_pixmap = None;
|
menu.title_pixmap = None;
|
||||||
menu.title.setBackgroundColor(tex.color());
|
menu.title.setBackgroundColor(tex.color());
|
||||||
} else {
|
} else {
|
||||||
menu.title_pixmap =
|
menu.title_pixmap =
|
||||||
m_image_ctrl.renderImage(width(), theme().titleHeight(), tex);
|
m_image_ctrl.renderImage(width(), theme()->titleHeight(), tex);
|
||||||
// set pixmap that we have as real face to the user
|
// set pixmap that we have as real face to the user
|
||||||
menu.title.setBackgroundPixmap(menu.title_pixmap);
|
menu.title.setBackgroundPixmap(menu.title_pixmap);
|
||||||
}
|
}
|
||||||
|
@ -478,7 +478,7 @@ void Menu::updateMenu(int active_index) {
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp = menu.frame_pixmap;
|
tmp = menu.frame_pixmap;
|
||||||
const FbTk::Texture &frame_tex = theme().frameTexture();
|
const FbTk::Texture &frame_tex = theme()->frameTexture();
|
||||||
if (m_need_update) {
|
if (m_need_update) {
|
||||||
if (!frame_tex.usePixmap()) {
|
if (!frame_tex.usePixmap()) {
|
||||||
menu.frame_pixmap = None;
|
menu.frame_pixmap = None;
|
||||||
|
@ -630,12 +630,12 @@ void Menu::move(int x, int y) {
|
||||||
|
|
||||||
void Menu::redrawTitle(FbDrawable &drawable) {
|
void Menu::redrawTitle(FbDrawable &drawable) {
|
||||||
|
|
||||||
const FbTk::Font &font = theme().titleFont();
|
const FbTk::Font &font = theme()->titleFont();
|
||||||
int dx = theme().bevelWidth();
|
int dx = theme()->bevelWidth();
|
||||||
size_t len = menu.label.size();
|
size_t len = menu.label.size();
|
||||||
unsigned int l = font.textWidth(menu.label, len) + theme().bevelWidth()*2;
|
unsigned int l = font.textWidth(menu.label, len) + theme()->bevelWidth()*2;
|
||||||
|
|
||||||
switch (theme().titleFontJustify()) {
|
switch (theme()->titleFontJustify()) {
|
||||||
case FbTk::RIGHT:
|
case FbTk::RIGHT:
|
||||||
dx += width() - l;
|
dx += width() - l;
|
||||||
break;
|
break;
|
||||||
|
@ -648,12 +648,12 @@ void Menu::redrawTitle(FbDrawable &drawable) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// difference between height based on font, and style-set height
|
// difference between height based on font, and style-set height
|
||||||
int height_offset = theme().titleHeight() - (font.height() + 2*theme().bevelWidth());
|
int height_offset = theme()->titleHeight() - (font.height() + 2*theme()->bevelWidth());
|
||||||
font.drawText(drawable, // drawable
|
font.drawText(drawable, // drawable
|
||||||
screenNumber(),
|
screenNumber(),
|
||||||
theme().titleTextGC().gc(), // graphic context
|
theme()->titleTextGC().gc(), // graphic context
|
||||||
menu.label, len, // text string with length
|
menu.label, len, // text string with length
|
||||||
dx, font.ascent() + theme().bevelWidth() + height_offset/2); // position
|
dx, font.ascent() + theme()->bevelWidth() + height_offset/2); // position
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -683,14 +683,14 @@ void Menu::drawSubmenu(unsigned int index) {
|
||||||
int new_y;
|
int new_y;
|
||||||
|
|
||||||
if (m_alignment == ALIGNTOP) {
|
if (m_alignment == ALIGNTOP) {
|
||||||
new_y = (y() + ((m_title_vis) ? theme().titleHeight() + menu.title.borderWidth() : 0) -
|
new_y = (y() + ((m_title_vis) ? theme()->titleHeight() + menu.title.borderWidth() : 0) -
|
||||||
((item->submenu()->m_title_vis) ?
|
((item->submenu()->m_title_vis) ?
|
||||||
item->submenu()->theme().titleHeight() + menu.window.borderWidth() : 0));
|
item->submenu()->theme()->titleHeight() + menu.window.borderWidth() : 0));
|
||||||
} else {
|
} else {
|
||||||
new_y = (y() + (theme().itemHeight() * i) +
|
new_y = (y() + (theme()->itemHeight() * i) +
|
||||||
((m_title_vis) ? theme().titleHeight() + menu.window.borderWidth() : 0) -
|
((m_title_vis) ? theme()->titleHeight() + menu.window.borderWidth() : 0) -
|
||||||
((item->submenu()->m_title_vis) ?
|
((item->submenu()->m_title_vis) ?
|
||||||
item->submenu()->theme().titleHeight() + menu.window.borderWidth() : 0));
|
item->submenu()->theme()->titleHeight() + menu.window.borderWidth() : 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_alignment == ALIGNBOTTOM &&
|
if (m_alignment == ALIGNBOTTOM &&
|
||||||
|
@ -745,7 +745,7 @@ int Menu::drawItem(FbDrawable &drawable, unsigned int index,
|
||||||
if (! item) return 0;
|
if (! item) return 0;
|
||||||
|
|
||||||
int sbl = index / menu.persub, i = index - (sbl * menu.persub);
|
int sbl = index / menu.persub, i = index - (sbl * menu.persub);
|
||||||
int item_x = (sbl * menu.item_w), item_y = (i * theme().itemHeight());
|
int item_x = (sbl * menu.item_w), item_y = (i * theme()->itemHeight());
|
||||||
|
|
||||||
if (exclusive_drawable)
|
if (exclusive_drawable)
|
||||||
item_x = item_y = 0;
|
item_x = item_y = 0;
|
||||||
|
@ -753,7 +753,7 @@ int Menu::drawItem(FbDrawable &drawable, unsigned int index,
|
||||||
item->draw(drawable, theme(), highlight,
|
item->draw(drawable, theme(), highlight,
|
||||||
exclusive_drawable, true, // draw fg, draw bg
|
exclusive_drawable, true, // draw fg, draw bg
|
||||||
item_x, item_y,
|
item_x, item_y,
|
||||||
menu.item_w, theme().itemHeight());
|
menu.item_w, theme()->itemHeight());
|
||||||
|
|
||||||
return item_y;
|
return item_y;
|
||||||
}
|
}
|
||||||
|
@ -845,7 +845,7 @@ void Menu::buttonPressEvent(XButtonEvent &be) {
|
||||||
|
|
||||||
if (be.window == menu.frame && menu.item_w != 0) {
|
if (be.window == menu.frame && menu.item_w != 0) {
|
||||||
|
|
||||||
int sbl = (be.x / menu.item_w), i = (be.y / theme().itemHeight());
|
int sbl = (be.x / menu.item_w), i = (be.y / theme()->itemHeight());
|
||||||
int w = (sbl * menu.persub) + i;
|
int w = (sbl * menu.persub) + i;
|
||||||
|
|
||||||
if (validIndex(w) && isItemSelectable(static_cast<unsigned int>(w))) {
|
if (validIndex(w) && isItemSelectable(static_cast<unsigned int>(w))) {
|
||||||
|
@ -885,14 +885,14 @@ void Menu::buttonReleaseEvent(XButtonEvent &re) {
|
||||||
|
|
||||||
} else if (re.window == menu.frame) {
|
} else if (re.window == menu.frame) {
|
||||||
|
|
||||||
int sbl = (re.x / menu.item_w), i = (re.y / theme().itemHeight()),
|
int sbl = (re.x / menu.item_w), i = (re.y / theme()->itemHeight()),
|
||||||
ix = sbl * menu.item_w, iy = i * theme().itemHeight(),
|
ix = sbl * menu.item_w, iy = i * theme()->itemHeight(),
|
||||||
w = (sbl * menu.persub) + i;
|
w = (sbl * menu.persub) + i;
|
||||||
|
|
||||||
if (validIndex(w) && isItemSelectable(static_cast<unsigned int>(w))) {
|
if (validIndex(w) && isItemSelectable(static_cast<unsigned int>(w))) {
|
||||||
if (m_active_index == w && isItemEnabled(w) &&
|
if (m_active_index == w && isItemEnabled(w) &&
|
||||||
re.x > ix && re.x < (signed) (ix + menu.item_w) &&
|
re.x > ix && re.x < (signed) (ix + menu.item_w) &&
|
||||||
re.y > iy && re.y < (signed) (iy + theme().itemHeight())) {
|
re.y > iy && re.y < (signed) (iy + theme()->itemHeight())) {
|
||||||
menuitems[w]->click(re.button, re.time, re.state);
|
menuitems[w]->click(re.button, re.time, re.state);
|
||||||
} else {
|
} else {
|
||||||
int old = m_active_index;
|
int old = m_active_index;
|
||||||
|
@ -930,7 +930,7 @@ void Menu::motionNotifyEvent(XMotionEvent &me) {
|
||||||
} else if (!(me.state & Button1Mask) && me.window == menu.frame) {
|
} else if (!(me.state & Button1Mask) && me.window == menu.frame) {
|
||||||
stopHide();
|
stopHide();
|
||||||
int sbl = (me.x / menu.item_w),
|
int sbl = (me.x / menu.item_w),
|
||||||
i = (me.y / theme().itemHeight()),
|
i = (me.y / theme()->itemHeight()),
|
||||||
w = (sbl * menu.persub) + i;
|
w = (sbl * menu.persub) + i;
|
||||||
|
|
||||||
if (w == m_active_index || !validIndex(w))
|
if (w == m_active_index || !validIndex(w))
|
||||||
|
@ -960,11 +960,11 @@ void Menu::motionNotifyEvent(XMotionEvent &me) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itmp->submenu() && theme().menuMode() == MenuTheme::DELAY_OPEN) {
|
if (itmp->submenu() && theme()->menuMode() == MenuTheme::DELAY_OPEN) {
|
||||||
// start submenu open delay
|
// start submenu open delay
|
||||||
timeval timeout;
|
timeval timeout;
|
||||||
timeout.tv_sec = 0;
|
timeout.tv_sec = 0;
|
||||||
timeout.tv_usec = theme().delayOpen() * 1000; // transformed to usec
|
timeout.tv_usec = theme()->delayOpen() * 1000; // transformed to usec
|
||||||
m_submenu_timer.setTimeout(timeout);
|
m_submenu_timer.setTimeout(timeout);
|
||||||
m_submenu_timer.start();
|
m_submenu_timer.start();
|
||||||
} else if (isItemSelectable(w)){
|
} else if (isItemSelectable(w)){
|
||||||
|
@ -986,11 +986,11 @@ void Menu::exposeEvent(XExposeEvent &ee) {
|
||||||
// first... we see in which sub level the expose starts... and how many
|
// first... we see in which sub level the expose starts... and how many
|
||||||
// items down in that sublevel
|
// items down in that sublevel
|
||||||
|
|
||||||
int sbl = (ee.x / menu.item_w), id = (ee.y / theme().itemHeight()),
|
int sbl = (ee.x / menu.item_w), id = (ee.y / theme()->itemHeight()),
|
||||||
// next... figure out how many sublevels over the redrawspans
|
// next... figure out how many sublevels over the redrawspans
|
||||||
sbl_d = ((ee.x + ee.width) / menu.item_w),
|
sbl_d = ((ee.x + ee.width) / menu.item_w),
|
||||||
// then we see how many items down to redraw
|
// then we see how many items down to redraw
|
||||||
id_d = ((ee.y + ee.height) / theme().itemHeight());
|
id_d = ((ee.y + ee.height) / theme()->itemHeight());
|
||||||
|
|
||||||
if (id_d > menu.persub) id_d = menu.persub;
|
if (id_d > menu.persub) id_d = menu.persub;
|
||||||
// draw the sublevels and the number of items the exposure spans
|
// draw the sublevels and the number of items the exposure spans
|
||||||
|
@ -1093,7 +1093,7 @@ void Menu::keyPressEvent(XKeyEvent &event) {
|
||||||
|
|
||||||
|
|
||||||
void Menu::reconfigure() {
|
void Menu::reconfigure() {
|
||||||
m_shape->setPlaces(theme().shapePlaces());
|
m_shape->setPlaces(theme()->shapePlaces());
|
||||||
|
|
||||||
if (FbTk::Transparent::haveComposite()) {
|
if (FbTk::Transparent::haveComposite()) {
|
||||||
menu.window.setOpaque(alpha());
|
menu.window.setOpaque(alpha());
|
||||||
|
@ -1107,12 +1107,12 @@ void Menu::reconfigure() {
|
||||||
|
|
||||||
m_need_update = true; // redraw items
|
m_need_update = true; // redraw items
|
||||||
|
|
||||||
menu.window.setBorderColor(theme().borderColor());
|
menu.window.setBorderColor(theme()->borderColor());
|
||||||
menu.title.setBorderColor(theme().borderColor());
|
menu.title.setBorderColor(theme()->borderColor());
|
||||||
menu.frame.setBorderColor(theme().borderColor());
|
menu.frame.setBorderColor(theme()->borderColor());
|
||||||
|
|
||||||
menu.window.setBorderWidth(theme().borderWidth());
|
menu.window.setBorderWidth(theme()->borderWidth());
|
||||||
menu.title.setBorderWidth(theme().borderWidth());
|
menu.title.setBorderWidth(theme()->borderWidth());
|
||||||
|
|
||||||
updateMenu();
|
updateMenu();
|
||||||
}
|
}
|
||||||
|
@ -1145,7 +1145,7 @@ void Menu::closeMenu() {
|
||||||
void Menu::startHide() {
|
void Menu::startHide() {
|
||||||
timeval timeout;
|
timeval timeout;
|
||||||
timeout.tv_sec = 0;
|
timeout.tv_sec = 0;
|
||||||
timeout.tv_usec = theme().delayClose() * 1000; // transformed to usec
|
timeout.tv_usec = theme()->delayClose() * 1000; // transformed to usec
|
||||||
m_hide_timer.setTimeout(timeout);
|
m_hide_timer.setTimeout(timeout);
|
||||||
m_hide_timer.start();
|
m_hide_timer.start();
|
||||||
}
|
}
|
||||||
|
@ -1192,7 +1192,7 @@ void Menu::clearItem(int index, bool clear, int search_index) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int sbl = index / menu.persub, i = index - (sbl * menu.persub);
|
int sbl = index / menu.persub, i = index - (sbl * menu.persub);
|
||||||
unsigned int item_w = menu.item_w, item_h = theme().itemHeight();
|
unsigned int item_w = menu.item_w, item_h = theme()->itemHeight();
|
||||||
int item_x = (sbl * item_w), item_y = (i * item_h);
|
int item_x = (sbl * item_w), item_y = (i * item_h);
|
||||||
bool highlight = (index == m_active_index && isItemSelectable(index));
|
bool highlight = (index == m_active_index && isItemSelectable(index));
|
||||||
|
|
||||||
|
@ -1224,7 +1224,7 @@ void Menu::clearItem(int index, bool clear, int search_index) {
|
||||||
// Area must have been cleared before calling highlight
|
// Area must have been cleared before calling highlight
|
||||||
void Menu::highlightItem(int index) {
|
void Menu::highlightItem(int index) {
|
||||||
int sbl = index / menu.persub, i = index - (sbl * menu.persub);
|
int sbl = index / menu.persub, i = index - (sbl * menu.persub);
|
||||||
unsigned int item_w = menu.item_w, item_h = theme().itemHeight();
|
unsigned int item_w = menu.item_w, item_h = theme()->itemHeight();
|
||||||
int item_x = (sbl * menu.item_w), item_y = (i * item_h);
|
int item_x = (sbl * menu.item_w), item_y = (i * item_h);
|
||||||
|
|
||||||
FbPixmap buffer = FbPixmap(menu.frame, item_w, item_h, menu.frame.depth());
|
FbPixmap buffer = FbPixmap(menu.frame, item_w, item_h, menu.frame.depth());
|
||||||
|
@ -1234,18 +1234,18 @@ void Menu::highlightItem(int index) {
|
||||||
int pixmap_x = parent_rel ? item_x : 0, pixmap_y = parent_rel ? item_y : 0;
|
int pixmap_x = parent_rel ? item_x : 0, pixmap_y = parent_rel ? item_y : 0;
|
||||||
if (pixmap) {
|
if (pixmap) {
|
||||||
buffer.copyArea(pixmap,
|
buffer.copyArea(pixmap,
|
||||||
theme().hiliteGC().gc(), pixmap_x, pixmap_y,
|
theme()->hiliteGC().gc(), pixmap_x, pixmap_y,
|
||||||
0, 0,
|
0, 0,
|
||||||
item_w, item_h);
|
item_w, item_h);
|
||||||
} else {
|
} else {
|
||||||
buffer.fillRectangle(theme().hiliteGC().gc(),
|
buffer.fillRectangle(theme()->hiliteGC().gc(),
|
||||||
0, 0, item_w, item_h);
|
0, 0, item_w, item_h);
|
||||||
}
|
}
|
||||||
menu.frame.updateTransparent(item_x, item_y, item_w, item_h, buffer.drawable(), true);
|
menu.frame.updateTransparent(item_x, item_y, item_w, item_h, buffer.drawable(), true);
|
||||||
|
|
||||||
drawItem(buffer, index, true, true);
|
drawItem(buffer, index, true, true);
|
||||||
|
|
||||||
menu.frame.copyArea(buffer.drawable(), theme().hiliteGC().gc(),
|
menu.frame.copyArea(buffer.drawable(), theme()->hiliteGC().gc(),
|
||||||
0, 0,
|
0, 0,
|
||||||
item_x, item_y,
|
item_x, item_y,
|
||||||
item_w, item_h);
|
item_w, item_h);
|
||||||
|
@ -1278,7 +1278,7 @@ void Menu::drawLine(int index, int size){
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int sbl = index / menu.persub, i = index - (sbl * menu.persub);
|
int sbl = index / menu.persub, i = index - (sbl * menu.persub);
|
||||||
int item_x = (sbl * menu.item_w), item_y = (i * theme().itemHeight());
|
int item_x = (sbl * menu.item_w), item_y = (i * theme()->itemHeight());
|
||||||
|
|
||||||
FbTk::MenuItem *item = find(index);
|
FbTk::MenuItem *item = find(index);
|
||||||
item->drawLine(menu.frame, theme(), size, item_x, item_y, menu.item_w);
|
item->drawLine(menu.frame, theme(), size, item_x, item_y, menu.item_w);
|
||||||
|
|
|
@ -55,7 +55,7 @@ public:
|
||||||
*/
|
*/
|
||||||
enum { EMPTY = 0, SQUARE, TRIANGLE, DIAMOND };
|
enum { EMPTY = 0, SQUARE, TRIANGLE, DIAMOND };
|
||||||
|
|
||||||
Menu(MenuTheme &tm, ImageControl &imgctrl);
|
Menu(FbTk::ThemeProxy<MenuTheme> &tm, ImageControl &imgctrl);
|
||||||
virtual ~Menu();
|
virtual ~Menu();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -151,8 +151,9 @@ public:
|
||||||
bool isItemSelected(unsigned int index) const;
|
bool isItemSelected(unsigned int index) const;
|
||||||
bool isItemEnabled(unsigned int index) const;
|
bool isItemEnabled(unsigned int index) const;
|
||||||
bool isItemSelectable(unsigned int index) const;
|
bool isItemSelectable(unsigned int index) const;
|
||||||
const MenuTheme &theme() const { return m_theme; }
|
FbTk::ThemeProxy<MenuTheme> &theme() { return m_theme; }
|
||||||
unsigned char alpha() const { return theme().alpha(); }
|
const FbTk::ThemeProxy<MenuTheme> &theme() const { return m_theme; }
|
||||||
|
unsigned char alpha() const { return theme()->alpha(); }
|
||||||
static Menu *shownMenu() { return shown; }
|
static Menu *shownMenu() { return shown; }
|
||||||
static Menu *focused() { return s_focused; }
|
static Menu *focused() { return s_focused; }
|
||||||
static void hideShownMenu();
|
static void hideShownMenu();
|
||||||
|
@ -198,7 +199,7 @@ private:
|
||||||
void startHide();
|
void startHide();
|
||||||
void stopHide();
|
void stopHide();
|
||||||
|
|
||||||
MenuTheme &m_theme;
|
FbTk::ThemeProxy<MenuTheme> &m_theme;
|
||||||
Menu *m_parent;
|
Menu *m_parent;
|
||||||
ImageControl &m_image_ctrl;
|
ImageControl &m_image_ctrl;
|
||||||
|
|
||||||
|
|
|
@ -42,26 +42,27 @@ void MenuItem::click(int button, int time, unsigned int mods) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuItem::drawLine(FbDrawable &draw, const MenuTheme &theme, size_t size,
|
void MenuItem::drawLine(FbDrawable &draw,
|
||||||
|
const FbTk::ThemeProxy<MenuTheme> &theme, size_t size,
|
||||||
int text_x, int text_y, unsigned int width) const {
|
int text_x, int text_y, unsigned int width) const {
|
||||||
|
|
||||||
unsigned int height = theme.itemHeight();
|
unsigned int height = theme->itemHeight();
|
||||||
int bevelW = theme.bevelWidth();
|
int bevelW = theme->bevelWidth();
|
||||||
|
|
||||||
int font_top = (height - theme.frameFont().height())/2;
|
int font_top = (height - theme->frameFont().height())/2;
|
||||||
int underline_height = font_top + theme.frameFont().ascent() + 2;
|
int underline_height = font_top + theme->frameFont().ascent() + 2;
|
||||||
int bottom = height - bevelW - 1;
|
int bottom = height - bevelW - 1;
|
||||||
|
|
||||||
text_y += bottom > underline_height ? underline_height : bottom;
|
text_y += bottom > underline_height ? underline_height : bottom;
|
||||||
int text_w = theme.frameFont().textWidth(m_label.c_str(), m_label.size());
|
int text_w = theme->frameFont().textWidth(m_label.c_str(), m_label.size());
|
||||||
|
|
||||||
// width of the searchstring
|
// width of the searchstring
|
||||||
size = size > m_label.length() ? m_label.length() : size;
|
size = size > m_label.length() ? m_label.length() : size;
|
||||||
std::string search_string = m_label.substr(0,size);
|
std::string search_string = m_label.substr(0,size);
|
||||||
int search_string_w = theme.frameFont().textWidth(search_string.c_str(), size);
|
int search_string_w = theme->frameFont().textWidth(search_string.c_str(), size);
|
||||||
|
|
||||||
// pay attention to the text justification
|
// pay attention to the text justification
|
||||||
switch(theme.frameFontJustify()) {
|
switch(theme->frameFontJustify()) {
|
||||||
case FbTk::LEFT:
|
case FbTk::LEFT:
|
||||||
text_x += bevelW + height + 1;
|
text_x += bevelW + height + 1;
|
||||||
break;
|
break;
|
||||||
|
@ -75,13 +76,13 @@ void MenuItem::drawLine(FbDrawable &draw, const MenuTheme &theme, size_t size,
|
||||||
|
|
||||||
// avoid drawing an ugly dot
|
// avoid drawing an ugly dot
|
||||||
if (size != 0)
|
if (size != 0)
|
||||||
draw.drawLine(theme.frameUnderlineGC().gc(),
|
draw.drawLine(theme->frameUnderlineGC().gc(),
|
||||||
text_x, text_y, text_x + search_string_w, text_y);
|
text_x, text_y, text_x + search_string_w, text_y);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuItem::draw(FbDrawable &draw,
|
void MenuItem::draw(FbDrawable &draw,
|
||||||
const MenuTheme &theme,
|
const FbTk::ThemeProxy<MenuTheme> &theme,
|
||||||
bool highlight, bool draw_foreground, bool draw_background,
|
bool highlight, bool draw_foreground, bool draw_background,
|
||||||
int x, int y,
|
int x, int y,
|
||||||
unsigned int width, unsigned int height) const {
|
unsigned int width, unsigned int height) const {
|
||||||
|
@ -101,16 +102,16 @@ void MenuItem::draw(FbDrawable &draw,
|
||||||
tmp_mask.copy(icon()->mask());
|
tmp_mask.copy(icon()->mask());
|
||||||
|
|
||||||
// scale pixmap to right size
|
// scale pixmap to right size
|
||||||
if (height - 2*theme.bevelWidth() != tmp_pixmap.height()) {
|
if (height - 2*theme->bevelWidth() != tmp_pixmap.height()) {
|
||||||
unsigned int scale_size = height - 2*theme.bevelWidth();
|
unsigned int scale_size = height - 2*theme->bevelWidth();
|
||||||
tmp_pixmap.scale(scale_size, scale_size);
|
tmp_pixmap.scale(scale_size, scale_size);
|
||||||
tmp_mask.scale(scale_size, scale_size);
|
tmp_mask.scale(scale_size, scale_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tmp_pixmap.drawable() != 0) {
|
if (tmp_pixmap.drawable() != 0) {
|
||||||
GC gc = theme.frameTextGC().gc();
|
GC gc = theme->frameTextGC().gc();
|
||||||
int icon_x = x + theme.bevelWidth();
|
int icon_x = x + theme->bevelWidth();
|
||||||
int icon_y = y + theme.bevelWidth();
|
int icon_y = y + theme->bevelWidth();
|
||||||
// enable clip mask
|
// enable clip mask
|
||||||
XSetClipMask(disp, gc, tmp_mask.drawable());
|
XSetClipMask(disp, gc, tmp_mask.drawable());
|
||||||
XSetClipOrigin(disp, gc, icon_x, icon_y);
|
XSetClipOrigin(disp, gc, icon_x, icon_y);
|
||||||
|
@ -126,9 +127,9 @@ void MenuItem::draw(FbDrawable &draw,
|
||||||
XGetGCValues(draw.display(), gc, GCForeground|GCBackground,
|
XGetGCValues(draw.display(), gc, GCForeground|GCBackground,
|
||||||
&backup);
|
&backup);
|
||||||
XSetForeground(draw.display(), gc,
|
XSetForeground(draw.display(), gc,
|
||||||
Color("black", theme.screenNum()).pixel());
|
Color("black", theme->screenNum()).pixel());
|
||||||
XSetBackground(draw.display(), gc,
|
XSetBackground(draw.display(), gc,
|
||||||
Color("white", theme.screenNum()).pixel());
|
Color("white", theme->screenNum()).pixel());
|
||||||
XCopyPlane(draw.display(), tmp_pixmap.drawable(),
|
XCopyPlane(draw.display(), tmp_pixmap.drawable(),
|
||||||
draw.drawable(), gc,
|
draw.drawable(), gc,
|
||||||
0, 0, tmp_pixmap.width(), tmp_pixmap.height(),
|
0, 0, tmp_pixmap.width(), tmp_pixmap.height(),
|
||||||
|
@ -149,46 +150,46 @@ void MenuItem::draw(FbDrawable &draw,
|
||||||
// text is background
|
// text is background
|
||||||
if (draw_background) {
|
if (draw_background) {
|
||||||
const GContext &tgc =
|
const GContext &tgc =
|
||||||
(highlight ? theme.hiliteTextGC() :
|
(highlight ? theme->hiliteTextGC() :
|
||||||
(isEnabled() ? theme.frameTextGC() : theme.disableTextGC() ) );
|
(isEnabled() ? theme->frameTextGC() : theme->disableTextGC() ) );
|
||||||
//
|
//
|
||||||
// Text
|
// Text
|
||||||
//
|
//
|
||||||
int text_y = y, text_x = x;
|
int text_y = y, text_x = x;
|
||||||
|
|
||||||
int text_w = theme.frameFont().textWidth(label().c_str(), label().size());
|
int text_w = theme->frameFont().textWidth(label().c_str(), label().size());
|
||||||
|
|
||||||
int height_offset = theme.itemHeight() - (theme.frameFont().height() + 2*theme.bevelWidth());
|
int height_offset = theme->itemHeight() - (theme->frameFont().height() + 2*theme->bevelWidth());
|
||||||
text_y = y + theme.bevelWidth() + theme.frameFont().ascent() + height_offset/2;
|
text_y = y + theme->bevelWidth() + theme->frameFont().ascent() + height_offset/2;
|
||||||
|
|
||||||
switch(theme.frameFontJustify()) {
|
switch(theme->frameFontJustify()) {
|
||||||
case FbTk::LEFT:
|
case FbTk::LEFT:
|
||||||
text_x = x + theme.bevelWidth() + height + 1;
|
text_x = x + theme->bevelWidth() + height + 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FbTk::RIGHT:
|
case FbTk::RIGHT:
|
||||||
text_x = x + width - (height + theme.bevelWidth() + text_w);
|
text_x = x + width - (height + theme->bevelWidth() + text_w);
|
||||||
break;
|
break;
|
||||||
default: //center
|
default: //center
|
||||||
text_x = x + ((width + 1 - text_w) / 2);
|
text_x = x + ((width + 1 - text_w) / 2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
theme.frameFont().drawText(draw, // drawable
|
theme->frameFont().drawText(draw, // drawable
|
||||||
theme.screenNum(),
|
theme->screenNum(),
|
||||||
tgc.gc(),
|
tgc.gc(),
|
||||||
label().c_str(), label().size(), // text string and lenght
|
label().c_str(), label().size(), // text string and lenght
|
||||||
text_x, text_y); // position
|
text_x, text_y); // position
|
||||||
}
|
}
|
||||||
|
|
||||||
GC gc = (highlight) ? theme.hiliteTextGC().gc() :
|
GC gc = (highlight) ? theme->hiliteTextGC().gc() :
|
||||||
theme.frameTextGC().gc();
|
theme->frameTextGC().gc();
|
||||||
int sel_x = x;
|
int sel_x = x;
|
||||||
int sel_y = y;
|
int sel_y = y;
|
||||||
unsigned int item_pm_height = theme.itemHeight();
|
unsigned int item_pm_height = theme->itemHeight();
|
||||||
|
|
||||||
if (theme.bulletPos() == FbTk::RIGHT)
|
if (theme->bulletPos() == FbTk::RIGHT)
|
||||||
sel_x += width - height - theme.bevelWidth();
|
sel_x += width - height - theme->bevelWidth();
|
||||||
|
|
||||||
// selected pixmap is foreground
|
// selected pixmap is foreground
|
||||||
if (draw_foreground && isToggleItem()) {
|
if (draw_foreground && isToggleItem()) {
|
||||||
|
@ -199,15 +200,15 @@ void MenuItem::draw(FbDrawable &draw,
|
||||||
const PixmapWithMask *pm = 0;
|
const PixmapWithMask *pm = 0;
|
||||||
|
|
||||||
if (isSelected()) {
|
if (isSelected()) {
|
||||||
if (highlight && theme.highlightSelectedPixmap().pixmap().drawable() != 0)
|
if (highlight && theme->highlightSelectedPixmap().pixmap().drawable() != 0)
|
||||||
pm = &theme.highlightSelectedPixmap();
|
pm = &theme->highlightSelectedPixmap();
|
||||||
else
|
else
|
||||||
pm = &theme.selectedPixmap();
|
pm = &theme->selectedPixmap();
|
||||||
} else {
|
} else {
|
||||||
if (highlight && theme.highlightUnselectedPixmap().pixmap().drawable() != 0)
|
if (highlight && theme->highlightUnselectedPixmap().pixmap().drawable() != 0)
|
||||||
pm = &theme.highlightUnselectedPixmap();
|
pm = &theme->highlightUnselectedPixmap();
|
||||||
else
|
else
|
||||||
pm = &theme.unselectedPixmap();
|
pm = &theme->unselectedPixmap();
|
||||||
}
|
}
|
||||||
if (pm != 0 && pm->pixmap().drawable() != 0) {
|
if (pm != 0 && pm->pixmap().drawable() != 0) {
|
||||||
unsigned int selw = pm->width();
|
unsigned int selw = pm->width();
|
||||||
|
@ -231,7 +232,7 @@ void MenuItem::draw(FbDrawable &draw,
|
||||||
// disable clip mask
|
// disable clip mask
|
||||||
XSetClipMask(disp, gc, None);
|
XSetClipMask(disp, gc, None);
|
||||||
} else if (isSelected()) {
|
} else if (isSelected()) {
|
||||||
draw.fillRectangle(theme.hiliteGC().gc(),
|
draw.fillRectangle(theme->hiliteGC().gc(),
|
||||||
sel_x+item_pm_height/4, sel_y+item_pm_height/4, item_pm_height/2, item_pm_height/2);
|
sel_x+item_pm_height/4, sel_y+item_pm_height/4, item_pm_height/2, item_pm_height/2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -243,10 +244,10 @@ void MenuItem::draw(FbDrawable &draw,
|
||||||
|
|
||||||
const PixmapWithMask *pm = 0;
|
const PixmapWithMask *pm = 0;
|
||||||
|
|
||||||
if (highlight && theme.highlightBulletPixmap().pixmap().drawable() != 0)
|
if (highlight && theme->highlightBulletPixmap().pixmap().drawable() != 0)
|
||||||
pm = &theme.highlightBulletPixmap();
|
pm = &theme->highlightBulletPixmap();
|
||||||
else
|
else
|
||||||
pm = &theme.bulletPixmap();
|
pm = &theme->bulletPixmap();
|
||||||
|
|
||||||
if (pm && pm->pixmap().drawable() != 0) {
|
if (pm && pm->pixmap().drawable() != 0) {
|
||||||
unsigned int selw = pm->width();
|
unsigned int selw = pm->width();
|
||||||
|
@ -273,13 +274,13 @@ void MenuItem::draw(FbDrawable &draw,
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
unsigned int half_w = item_pm_height / 2, quarter_w = item_pm_height / 4;
|
unsigned int half_w = item_pm_height / 2, quarter_w = item_pm_height / 4;
|
||||||
switch (theme.bullet()) {
|
switch (theme->bullet()) {
|
||||||
case MenuTheme::SQUARE:
|
case MenuTheme::SQUARE:
|
||||||
draw.drawRectangle(gc, sel_x+quarter_w, y+quarter_w, half_w, half_w);
|
draw.drawRectangle(gc, sel_x+quarter_w, y+quarter_w, half_w, half_w);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MenuTheme::TRIANGLE:
|
case MenuTheme::TRIANGLE:
|
||||||
draw.drawTriangle(gc, ((theme.bulletPos() == FbTk::RIGHT)?
|
draw.drawTriangle(gc, ((theme->bulletPos() == FbTk::RIGHT)?
|
||||||
FbTk::FbDrawable::RIGHT:
|
FbTk::FbDrawable::RIGHT:
|
||||||
FbTk::FbDrawable::LEFT),
|
FbTk::FbDrawable::LEFT),
|
||||||
sel_x, sel_y,
|
sel_x, sel_y,
|
||||||
|
@ -327,23 +328,23 @@ void MenuItem::setIcon(const std::string &filename, int screen_num) {
|
||||||
screen_num));
|
screen_num));
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int MenuItem::height(const MenuTheme &theme) const {
|
unsigned int MenuItem::height(const FbTk::ThemeProxy<MenuTheme> &theme) const {
|
||||||
return std::max(theme.frameFont().height() + 2*theme.bevelWidth(), theme.itemHeight());
|
return std::max(theme->frameFont().height() + 2*theme->bevelWidth(), theme->itemHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int MenuItem::width(const MenuTheme &theme) const {
|
unsigned int MenuItem::width(const FbTk::ThemeProxy<MenuTheme> &theme) const {
|
||||||
// textwidth + bevel width on each side of the text
|
// textwidth + bevel width on each side of the text
|
||||||
const unsigned int icon_width = height(theme);
|
const unsigned int icon_width = height(theme);
|
||||||
const unsigned int normal = theme.frameFont().textWidth(label(), label().size()) +
|
const unsigned int normal = theme->frameFont().textWidth(label(), label().size()) +
|
||||||
2 * (theme.bevelWidth() + icon_width);
|
2 * (theme->bevelWidth() + icon_width);
|
||||||
return m_icon.get() == 0 ? normal : normal + icon_width;
|
return m_icon.get() == 0 ? normal : normal + icon_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuItem::updateTheme(const MenuTheme &theme) {
|
void MenuItem::updateTheme(const FbTk::ThemeProxy<MenuTheme> &theme) {
|
||||||
if (m_icon.get() == 0)
|
if (m_icon.get() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_icon->pixmap.reset(Image::load(m_icon->filename.c_str(), theme.screenNum()));
|
m_icon->pixmap.reset(Image::load(m_icon->filename.c_str(), theme->screenNum()));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ namespace FbTk {
|
||||||
class Menu;
|
class Menu;
|
||||||
class MenuTheme;
|
class MenuTheme;
|
||||||
class FbDrawable;
|
class FbDrawable;
|
||||||
|
template <class T> class ThemeProxy;
|
||||||
|
|
||||||
/// An interface for a menu item in Menu
|
/// An interface for a menu item in Menu
|
||||||
class MenuItem : public FbTk::ITypeAheadable {
|
class MenuItem : public FbTk::ITypeAheadable {
|
||||||
|
@ -116,21 +117,21 @@ public:
|
||||||
virtual int getIndex() { return m_index; }
|
virtual int getIndex() { return m_index; }
|
||||||
const std::string &iTypeString() const { return m_label; }
|
const std::string &iTypeString() const { return m_label; }
|
||||||
virtual void drawLine(FbDrawable &draw,
|
virtual void drawLine(FbDrawable &draw,
|
||||||
const MenuTheme &theme,
|
const FbTk::ThemeProxy<MenuTheme> &theme,
|
||||||
size_t size,
|
size_t size,
|
||||||
int text_x, int text_y,
|
int text_x, int text_y,
|
||||||
unsigned int width) const;
|
unsigned int width) const;
|
||||||
|
|
||||||
virtual unsigned int width(const MenuTheme &theme) const;
|
virtual unsigned int width(const FbTk::ThemeProxy<MenuTheme> &theme) const;
|
||||||
virtual unsigned int height(const MenuTheme &theme) const;
|
virtual unsigned int height(const FbTk::ThemeProxy<MenuTheme> &theme) const;
|
||||||
virtual void draw(FbDrawable &drawable,
|
virtual void draw(FbDrawable &drawable,
|
||||||
const MenuTheme &theme,
|
const FbTk::ThemeProxy<MenuTheme> &theme,
|
||||||
bool highlight,
|
bool highlight,
|
||||||
// "foreground" is the transient bits - more likely to change
|
// "foreground" is the transient bits - more likely to change
|
||||||
bool draw_foreground, bool draw_background,
|
bool draw_foreground, bool draw_background,
|
||||||
int x, int y,
|
int x, int y,
|
||||||
unsigned int width, unsigned int height) const;
|
unsigned int width, unsigned int height) const;
|
||||||
virtual void updateTheme(const MenuTheme &theme);
|
virtual void updateTheme(const FbTk::ThemeProxy<MenuTheme> &theme);
|
||||||
/**
|
/**
|
||||||
Called when the item was clicked with a specific button
|
Called when the item was clicked with a specific button
|
||||||
@param button the button number
|
@param button the button number
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
namespace FbTk {
|
namespace FbTk {
|
||||||
|
|
||||||
void MenuSeparator::draw(FbDrawable &drawable,
|
void MenuSeparator::draw(FbDrawable &drawable,
|
||||||
const MenuTheme &theme,
|
const FbTk::ThemeProxy<MenuTheme> &theme,
|
||||||
bool highlight, bool draw_foreground, bool draw_background,
|
bool highlight, bool draw_foreground, bool draw_background,
|
||||||
int x, int y,
|
int x, int y,
|
||||||
unsigned int width, unsigned int height) const {
|
unsigned int width, unsigned int height) const {
|
||||||
|
@ -37,13 +37,13 @@ void MenuSeparator::draw(FbDrawable &drawable,
|
||||||
if (draw_background) {
|
if (draw_background) {
|
||||||
const GContext &tgc =
|
const GContext &tgc =
|
||||||
// its a separator, it shouldn't be highlighted! or shown as disabled
|
// its a separator, it shouldn't be highlighted! or shown as disabled
|
||||||
// (highlight ? theme.hiliteTextGC() :
|
// (highlight ? theme->hiliteTextGC() :
|
||||||
// (isEnabled() ? theme.frameTextGC() : theme.disableTextGC() ) );
|
// (isEnabled() ? theme->frameTextGC() : theme->disableTextGC() ) );
|
||||||
theme.frameTextGC();
|
theme->frameTextGC();
|
||||||
|
|
||||||
drawable.drawRectangle(tgc.gc(),
|
drawable.drawRectangle(tgc.gc(),
|
||||||
x + theme.bevelWidth() + height + 1, y + height / 2,
|
x + theme->bevelWidth() + height + 1, y + height / 2,
|
||||||
width - ((theme.bevelWidth() + height) * 2) - 1, 0);
|
width - ((theme->bevelWidth() + height) * 2) - 1, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace FbTk {
|
||||||
class MenuSeparator: public MenuItem {
|
class MenuSeparator: public MenuItem {
|
||||||
public:
|
public:
|
||||||
virtual void draw(FbDrawable &drawable,
|
virtual void draw(FbDrawable &drawable,
|
||||||
const MenuTheme &theme,
|
const FbTk::ThemeProxy<MenuTheme> &theme,
|
||||||
bool highlight, bool draw_foreground, bool draw_background,
|
bool highlight, bool draw_foreground, bool draw_background,
|
||||||
int x, int y,
|
int x, int y,
|
||||||
unsigned int width, unsigned int height) const;
|
unsigned int width, unsigned int height) const;
|
||||||
|
|
|
@ -143,8 +143,8 @@ public:
|
||||||
virtual Subject &reconfigSig() { return Theme::reconfigSig(); }
|
virtual Subject &reconfigSig() { return Theme::reconfigSig(); }
|
||||||
virtual const Subject &reconfigSig() const { return Theme::reconfigSig(); }
|
virtual const Subject &reconfigSig() const { return Theme::reconfigSig(); }
|
||||||
|
|
||||||
virtual MenuTheme *operator ->() { return this; }
|
virtual MenuTheme &operator *() { return *this; }
|
||||||
virtual const MenuTheme *operator ->() const { return this; }
|
virtual const MenuTheme &operator *() const { return *this; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ThemeItem<Color> t_text, f_text, h_text, d_text, u_text;
|
ThemeItem<Color> t_text, f_text, h_text, d_text, u_text;
|
||||||
|
|
|
@ -127,8 +127,10 @@ public:
|
||||||
virtual Subject &reconfigSig() = 0;
|
virtual Subject &reconfigSig() = 0;
|
||||||
virtual const Subject &reconfigSig() const = 0;
|
virtual const Subject &reconfigSig() const = 0;
|
||||||
|
|
||||||
virtual BaseTheme *operator ->() = 0;
|
virtual BaseTheme &operator *() = 0;
|
||||||
virtual const BaseTheme *operator ->() const = 0;
|
virtual const BaseTheme &operator *() const = 0;
|
||||||
|
virtual BaseTheme *operator ->() { return &(**this); }
|
||||||
|
virtual const BaseTheme *operator ->() const { return &(**this); }
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Singleton theme manager
|
/// Singleton theme manager
|
||||||
|
|
|
@ -39,14 +39,16 @@
|
||||||
using std::mem_fun;
|
using std::mem_fun;
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
FbWinFrame::FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageControl &imgctrl,
|
FbWinFrame::FbWinFrame(BScreen &screen,
|
||||||
|
FbTk::ThemeProxy<FbWinFrameTheme> &theme,
|
||||||
|
FbTk::ImageControl &imgctrl,
|
||||||
FbTk::XLayer &layer,
|
FbTk::XLayer &layer,
|
||||||
int x, int y,
|
int x, int y,
|
||||||
unsigned int width, unsigned int height):
|
unsigned int width, unsigned int height):
|
||||||
m_screen(screen),
|
m_screen(screen),
|
||||||
m_theme(theme),
|
m_theme(theme),
|
||||||
m_imagectrl(imgctrl),
|
m_imagectrl(imgctrl),
|
||||||
m_window(theme.screenNum(), x, y, width, height,
|
m_window(theme->screenNum(), x, y, width, height,
|
||||||
ButtonPressMask | ButtonReleaseMask |
|
ButtonPressMask | ButtonReleaseMask |
|
||||||
ButtonMotionMask | EnterWindowMask |
|
ButtonMotionMask | EnterWindowMask |
|
||||||
LeaveWindowMask, true),
|
LeaveWindowMask, true),
|
||||||
|
@ -56,7 +58,7 @@ FbWinFrame::FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageContr
|
||||||
ButtonMotionMask | ExposureMask |
|
ButtonMotionMask | ExposureMask |
|
||||||
EnterWindowMask | LeaveWindowMask),
|
EnterWindowMask | LeaveWindowMask),
|
||||||
m_tab_container(m_titlebar),
|
m_tab_container(m_titlebar),
|
||||||
m_label(m_titlebar, m_theme.font(), ""),
|
m_label(m_titlebar, m_theme->font(), ""),
|
||||||
m_handle(m_window, 0, 0, 100, 5,
|
m_handle(m_window, 0, 0, 100, 5,
|
||||||
ButtonPressMask | ButtonReleaseMask |
|
ButtonPressMask | ButtonReleaseMask |
|
||||||
ButtonMotionMask | ExposureMask |
|
ButtonMotionMask | ExposureMask |
|
||||||
|
@ -88,9 +90,9 @@ FbWinFrame::FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageContr
|
||||||
m_button_size(1),
|
m_button_size(1),
|
||||||
m_height_before_shade(1),
|
m_height_before_shade(1),
|
||||||
m_shaded(false),
|
m_shaded(false),
|
||||||
m_focused_alpha(AlphaAcc(theme, &FbWinFrameTheme::focusedAlpha)),
|
m_focused_alpha(AlphaAcc(*theme, &FbWinFrameTheme::focusedAlpha)),
|
||||||
m_unfocused_alpha(AlphaAcc(theme, &FbWinFrameTheme::unfocusedAlpha)),
|
m_unfocused_alpha(AlphaAcc(*theme, &FbWinFrameTheme::unfocusedAlpha)),
|
||||||
m_shape(m_window, theme.shapePlace()),
|
m_shape(m_window, theme->shapePlace()),
|
||||||
m_disable_themeshape(false) {
|
m_disable_themeshape(false) {
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
@ -117,7 +119,7 @@ bool FbWinFrame::setTabMode(TabMode tabmode) {
|
||||||
if (tabmode == EXTERNAL) {
|
if (tabmode == EXTERNAL) {
|
||||||
m_label.show();
|
m_label.show();
|
||||||
m_tab_container.setBorderWidth(m_window.borderWidth());
|
m_tab_container.setBorderWidth(m_window.borderWidth());
|
||||||
m_tab_container.setBorderColor(theme().border(m_focused).color());
|
m_tab_container.setBorderColor(theme()->border(m_focused).color());
|
||||||
m_tab_container.setEventMask(
|
m_tab_container.setEventMask(
|
||||||
ButtonPressMask | ButtonReleaseMask |
|
ButtonPressMask | ButtonReleaseMask |
|
||||||
ButtonMotionMask | ExposureMask |
|
ButtonMotionMask | ExposureMask |
|
||||||
|
@ -484,10 +486,10 @@ void FbWinFrame::setFocus(bool newvalue) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_decoration_mask & DECORM_BORDER &&
|
if (m_decoration_mask & DECORM_BORDER &&
|
||||||
(theme().border(true).width() != theme().border(false).width() ||
|
(theme()->border(true).width() != theme()->border(false).width() ||
|
||||||
theme().border(true).color().pixel() !=
|
theme()->border(true).color().pixel() !=
|
||||||
theme().border(false).color().pixel()))
|
theme()->border(false).color().pixel()))
|
||||||
setBorderWidth(theme().border(newvalue).width());
|
setBorderWidth(theme()->border(newvalue).width());
|
||||||
|
|
||||||
applyAll();
|
applyAll();
|
||||||
clearAll();
|
clearAll();
|
||||||
|
@ -562,7 +564,7 @@ void FbWinFrame::removeAllButtons() {
|
||||||
}
|
}
|
||||||
|
|
||||||
IconButton *FbWinFrame::createTab(Focusable &client) {
|
IconButton *FbWinFrame::createTab(Focusable &client) {
|
||||||
IconButton *button = new IconButton(m_tab_container, theme().iconbarTheme(),
|
IconButton *button = new IconButton(m_tab_container, theme()->iconbarTheme(),
|
||||||
client);
|
client);
|
||||||
|
|
||||||
button->show();
|
button->show();
|
||||||
|
@ -742,7 +744,7 @@ bool FbWinFrame::hideHandle() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FbWinFrame::showHandle() {
|
bool FbWinFrame::showHandle() {
|
||||||
if (m_use_handle || theme().handleWidth() == 0)
|
if (m_use_handle || theme()->handleWidth() == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_use_handle = true;
|
m_use_handle = true;
|
||||||
|
@ -870,19 +872,19 @@ void FbWinFrame::reconfigure() {
|
||||||
// negate gravity
|
// negate gravity
|
||||||
gravityTranslate(grav_x, grav_y, -m_active_gravity, m_active_orig_client_bw, false);
|
gravityTranslate(grav_x, grav_y, -m_active_gravity, m_active_orig_client_bw, false);
|
||||||
|
|
||||||
m_bevel = theme().bevelWidth();
|
m_bevel = theme()->bevelWidth();
|
||||||
// reconfigure can't set borderwidth, as it doesn't know
|
// reconfigure can't set borderwidth, as it doesn't know
|
||||||
// if it's meant to be borderless or not
|
// if it's meant to be borderless or not
|
||||||
|
|
||||||
unsigned int orig_handle_h = handle().height();
|
unsigned int orig_handle_h = handle().height();
|
||||||
if (m_use_handle && orig_handle_h != theme().handleWidth())
|
if (m_use_handle && orig_handle_h != theme()->handleWidth())
|
||||||
m_window.resize(m_window.width(), m_window.height() -
|
m_window.resize(m_window.width(), m_window.height() -
|
||||||
orig_handle_h + theme().handleWidth());
|
orig_handle_h + theme()->handleWidth());
|
||||||
|
|
||||||
handle().resize(handle().width(),
|
handle().resize(handle().width(),
|
||||||
theme().handleWidth());
|
theme()->handleWidth());
|
||||||
gripLeft().resize(buttonHeight(),
|
gripLeft().resize(buttonHeight(),
|
||||||
theme().handleWidth());
|
theme()->handleWidth());
|
||||||
gripRight().resize(gripLeft().width(),
|
gripRight().resize(gripLeft().width(),
|
||||||
gripLeft().height());
|
gripLeft().height());
|
||||||
|
|
||||||
|
@ -988,7 +990,7 @@ void FbWinFrame::reconfigure() {
|
||||||
if (m_disable_themeshape)
|
if (m_disable_themeshape)
|
||||||
m_shape.setPlaces(FbTk::Shape::NONE);
|
m_shape.setPlaces(FbTk::Shape::NONE);
|
||||||
else
|
else
|
||||||
m_shape.setPlaces(theme().shapePlace());
|
m_shape.setPlaces(theme()->shapePlace());
|
||||||
|
|
||||||
m_shape.setShapeOffsets(0, titlebarHeight());
|
m_shape.setShapeOffsets(0, titlebarHeight());
|
||||||
|
|
||||||
|
@ -1001,7 +1003,7 @@ void FbWinFrame::setUseShape(bool value) {
|
||||||
if (m_disable_themeshape)
|
if (m_disable_themeshape)
|
||||||
m_shape.setPlaces(FbTk::Shape::NONE);
|
m_shape.setPlaces(FbTk::Shape::NONE);
|
||||||
else
|
else
|
||||||
m_shape.setPlaces(theme().shapePlace());
|
m_shape.setPlaces(theme()->shapePlace());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1038,10 +1040,10 @@ void FbWinFrame::reconfigureTitlebar() {
|
||||||
|
|
||||||
int orig_height = m_titlebar.height();
|
int orig_height = m_titlebar.height();
|
||||||
// resize titlebar to window size with font height
|
// resize titlebar to window size with font height
|
||||||
int title_height = m_theme.font().height() == 0 ? 16 :
|
int title_height = theme()->font().height() == 0 ? 16 :
|
||||||
m_theme.font().height() + m_bevel*2 + 2;
|
theme()->font().height() + m_bevel*2 + 2;
|
||||||
if (m_theme.titleHeight() != 0)
|
if (theme()->titleHeight() != 0)
|
||||||
title_height = m_theme.titleHeight();
|
title_height = theme()->titleHeight();
|
||||||
|
|
||||||
// if the titlebar grows in size, make sure the whole window does too
|
// if the titlebar grows in size, make sure the whole window does too
|
||||||
if (orig_height != title_height)
|
if (orig_height != title_height)
|
||||||
|
@ -1128,21 +1130,21 @@ void FbWinFrame::renderTitlebar() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// render pixmaps
|
// render pixmaps
|
||||||
render(m_theme.titleFocusTexture(), m_title_focused_color,
|
render(theme()->titleFocusTexture(), m_title_focused_color,
|
||||||
m_title_focused_pm,
|
m_title_focused_pm,
|
||||||
m_titlebar.width(), m_titlebar.height());
|
m_titlebar.width(), m_titlebar.height());
|
||||||
|
|
||||||
render(m_theme.titleUnfocusTexture(), m_title_unfocused_color,
|
render(theme()->titleUnfocusTexture(), m_title_unfocused_color,
|
||||||
m_title_unfocused_pm,
|
m_title_unfocused_pm,
|
||||||
m_titlebar.width(), m_titlebar.height());
|
m_titlebar.width(), m_titlebar.height());
|
||||||
|
|
||||||
//!! TODO: don't render label if internal tabs
|
//!! TODO: don't render label if internal tabs
|
||||||
|
|
||||||
render(m_theme.iconbarTheme().focusedTexture(), m_label_focused_color,
|
render(theme()->iconbarTheme()->focusedTexture(), m_label_focused_color,
|
||||||
m_label_focused_pm,
|
m_label_focused_pm,
|
||||||
m_label.width(), m_label.height());
|
m_label.width(), m_label.height());
|
||||||
|
|
||||||
render(m_theme.iconbarTheme().unfocusedTexture(), m_label_unfocused_color,
|
render(theme()->iconbarTheme()->unfocusedTexture(), m_label_unfocused_color,
|
||||||
m_label_unfocused_pm,
|
m_label_unfocused_pm,
|
||||||
m_label.width(), m_label.height());
|
m_label.width(), m_label.height());
|
||||||
|
|
||||||
|
@ -1154,13 +1156,13 @@ void FbWinFrame::renderTabContainer() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const FbTk::Texture *tc_focused = &m_theme.iconbarTheme().focusedTexture();
|
const FbTk::Texture *tc_focused = &theme()->iconbarTheme()->focusedTexture();
|
||||||
const FbTk::Texture *tc_unfocused = &m_theme.iconbarTheme().unfocusedTexture();
|
const FbTk::Texture *tc_unfocused = &theme()->iconbarTheme()->unfocusedTexture();
|
||||||
|
|
||||||
if (m_tabmode == EXTERNAL && tc_focused->type() & FbTk::Texture::PARENTRELATIVE)
|
if (m_tabmode == EXTERNAL && tc_focused->type() & FbTk::Texture::PARENTRELATIVE)
|
||||||
tc_focused = &m_theme.titleFocusTexture();
|
tc_focused = &theme()->titleFocusTexture();
|
||||||
if (m_tabmode == EXTERNAL && tc_unfocused->type() & FbTk::Texture::PARENTRELATIVE)
|
if (m_tabmode == EXTERNAL && tc_unfocused->type() & FbTk::Texture::PARENTRELATIVE)
|
||||||
tc_unfocused = &m_theme.titleUnfocusTexture();
|
tc_unfocused = &theme()->titleUnfocusTexture();
|
||||||
|
|
||||||
render(*tc_focused, m_tabcontainer_focused_color,
|
render(*tc_focused, m_tabcontainer_focused_color,
|
||||||
m_tabcontainer_focused_pm,
|
m_tabcontainer_focused_pm,
|
||||||
|
@ -1190,11 +1192,11 @@ void FbWinFrame::applyTitlebar() {
|
||||||
|
|
||||||
if (m_tabmode != INTERNAL) {
|
if (m_tabmode != INTERNAL) {
|
||||||
m_label.setGC(m_focused ?
|
m_label.setGC(m_focused ?
|
||||||
theme().iconbarTheme().focusedText().textGC() :
|
theme()->iconbarTheme()->focusedText().textGC() :
|
||||||
theme().iconbarTheme().unfocusedText().textGC());
|
theme()->iconbarTheme()->unfocusedText().textGC());
|
||||||
m_label.setJustify(m_focused ?
|
m_label.setJustify(m_focused ?
|
||||||
theme().iconbarTheme().focusedText().justify() :
|
theme()->iconbarTheme()->focusedText().justify() :
|
||||||
theme().iconbarTheme().unfocusedText().justify());
|
theme()->iconbarTheme()->unfocusedText().justify());
|
||||||
|
|
||||||
if (label_pm != 0)
|
if (label_pm != 0)
|
||||||
m_label.setBackgroundPixmap(label_pm);
|
m_label.setBackgroundPixmap(label_pm);
|
||||||
|
@ -1220,18 +1222,18 @@ void FbWinFrame::renderHandles() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
render(m_theme.handleFocusTexture(), m_handle_focused_color,
|
render(theme()->handleFocusTexture(), m_handle_focused_color,
|
||||||
m_handle_focused_pm,
|
m_handle_focused_pm,
|
||||||
m_handle.width(), m_handle.height());
|
m_handle.width(), m_handle.height());
|
||||||
|
|
||||||
render(m_theme.handleUnfocusTexture(), m_handle_unfocused_color,
|
render(theme()->handleUnfocusTexture(), m_handle_unfocused_color,
|
||||||
m_handle_unfocused_pm,
|
m_handle_unfocused_pm,
|
||||||
m_handle.width(), m_handle.height());
|
m_handle.width(), m_handle.height());
|
||||||
|
|
||||||
render(m_theme.gripFocusTexture(), m_grip_focused_color, m_grip_focused_pm,
|
render(theme()->gripFocusTexture(), m_grip_focused_color, m_grip_focused_pm,
|
||||||
m_grip_left.width(), m_grip_left.height());
|
m_grip_left.width(), m_grip_left.height());
|
||||||
|
|
||||||
render(m_theme.gripUnfocusTexture(), m_grip_unfocused_color,
|
render(theme()->gripUnfocusTexture(), m_grip_unfocused_color,
|
||||||
m_grip_unfocused_pm,
|
m_grip_unfocused_pm,
|
||||||
m_grip_left.width(), m_grip_left.height());
|
m_grip_left.width(), m_grip_left.height());
|
||||||
|
|
||||||
|
@ -1286,15 +1288,15 @@ void FbWinFrame::renderButtons() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
render(m_theme.buttonFocusTexture(), m_button_color,
|
render(theme()->buttonFocusTexture(), m_button_color,
|
||||||
m_button_pm,
|
m_button_pm,
|
||||||
m_button_size, m_button_size);
|
m_button_size, m_button_size);
|
||||||
|
|
||||||
render(m_theme.buttonUnfocusTexture(), m_button_unfocused_color,
|
render(theme()->buttonUnfocusTexture(), m_button_unfocused_color,
|
||||||
m_button_unfocused_pm,
|
m_button_unfocused_pm,
|
||||||
m_button_size, m_button_size);
|
m_button_size, m_button_size);
|
||||||
|
|
||||||
render(m_theme.buttonPressedTexture(), m_button_pressed_color,
|
render(theme()->buttonPressedTexture(), m_button_pressed_color,
|
||||||
m_button_pressed_pm,
|
m_button_pressed_pm,
|
||||||
m_button_size, m_button_size);
|
m_button_size, m_button_size);
|
||||||
}
|
}
|
||||||
|
@ -1310,7 +1312,7 @@ void FbWinFrame::applyButtons() {
|
||||||
|
|
||||||
void FbWinFrame::init() {
|
void FbWinFrame::init() {
|
||||||
|
|
||||||
if (theme().handleWidth() == 0)
|
if (theme()->handleWidth() == 0)
|
||||||
m_use_handle = false;
|
m_use_handle = false;
|
||||||
|
|
||||||
m_disable_themeshape = false;
|
m_disable_themeshape = false;
|
||||||
|
@ -1357,7 +1359,7 @@ void FbWinFrame::applyButton(FbTk::Button &btn) {
|
||||||
if (focused()) { // focused
|
if (focused()) { // focused
|
||||||
btn.setAlpha(getAlpha(true));
|
btn.setAlpha(getAlpha(true));
|
||||||
|
|
||||||
btn.setGC(m_theme.buttonPicFocusGC());
|
btn.setGC(theme()->buttonPicFocusGC());
|
||||||
if (m_button_pm)
|
if (m_button_pm)
|
||||||
btn.setBackgroundPixmap(m_button_pm);
|
btn.setBackgroundPixmap(m_button_pm);
|
||||||
else
|
else
|
||||||
|
@ -1365,7 +1367,7 @@ void FbWinFrame::applyButton(FbTk::Button &btn) {
|
||||||
} else { // unfocused
|
} else { // unfocused
|
||||||
btn.setAlpha(getAlpha(false));
|
btn.setAlpha(getAlpha(false));
|
||||||
|
|
||||||
btn.setGC(m_theme.buttonPicUnfocusGC());
|
btn.setGC(theme()->buttonPicUnfocusGC());
|
||||||
if (m_button_unfocused_pm)
|
if (m_button_unfocused_pm)
|
||||||
btn.setBackgroundPixmap(m_button_unfocused_pm);
|
btn.setBackgroundPixmap(m_button_unfocused_pm);
|
||||||
else
|
else
|
||||||
|
@ -1463,21 +1465,21 @@ void FbWinFrame::setBorderWidth(unsigned int border_width) {
|
||||||
bw_changes += static_cast<signed>(border_width - handle().borderWidth());
|
bw_changes += static_cast<signed>(border_width - handle().borderWidth());
|
||||||
|
|
||||||
window().setBorderWidth(border_width);
|
window().setBorderWidth(border_width);
|
||||||
window().setBorderColor(theme().border(m_focused).color());
|
window().setBorderColor(theme()->border(m_focused).color());
|
||||||
|
|
||||||
setTabMode(NOTSET);
|
setTabMode(NOTSET);
|
||||||
|
|
||||||
titlebar().setBorderWidth(border_width);
|
titlebar().setBorderWidth(border_width);
|
||||||
titlebar().setBorderColor(theme().border(m_focused).color());
|
titlebar().setBorderColor(theme()->border(m_focused).color());
|
||||||
|
|
||||||
handle().setBorderWidth(border_width);
|
handle().setBorderWidth(border_width);
|
||||||
handle().setBorderColor(theme().border(m_focused).color());
|
handle().setBorderColor(theme()->border(m_focused).color());
|
||||||
|
|
||||||
gripLeft().setBorderWidth(border_width);
|
gripLeft().setBorderWidth(border_width);
|
||||||
gripLeft().setBorderColor(theme().border(m_focused).color());
|
gripLeft().setBorderColor(theme()->border(m_focused).color());
|
||||||
|
|
||||||
gripRight().setBorderWidth(border_width);
|
gripRight().setBorderWidth(border_width);
|
||||||
gripRight().setBorderColor(theme().border(m_focused).color());
|
gripRight().setBorderColor(theme()->border(m_focused).color());
|
||||||
|
|
||||||
if (bw_changes != 0)
|
if (bw_changes != 0)
|
||||||
resize(width(), height() + bw_changes);
|
resize(width(), height() + bw_changes);
|
||||||
|
|
|
@ -46,6 +46,7 @@ class ImageControl;
|
||||||
class Command;
|
class Command;
|
||||||
class Texture;
|
class Texture;
|
||||||
class XLayer;
|
class XLayer;
|
||||||
|
template <class T> class ThemeProxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// holds a window frame with a client window
|
/// holds a window frame with a client window
|
||||||
|
@ -95,7 +96,8 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
/// create a top level window
|
/// create a top level window
|
||||||
FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageControl &imgctrl,
|
FbWinFrame(BScreen &screen, FbTk::ThemeProxy<FbWinFrameTheme> &theme,
|
||||||
|
FbTk::ImageControl &imgctrl,
|
||||||
FbTk::XLayer &layer,
|
FbTk::XLayer &layer,
|
||||||
int x, int y,
|
int x, int y,
|
||||||
unsigned int width, unsigned int height);
|
unsigned int width, unsigned int height);
|
||||||
|
@ -254,7 +256,7 @@ public:
|
||||||
const IconButton *currentLabel() const { return m_current_label; }
|
const IconButton *currentLabel() const { return m_current_label; }
|
||||||
bool focused() const { return m_focused; }
|
bool focused() const { return m_focused; }
|
||||||
bool isShaded() const { return m_shaded; }
|
bool isShaded() const { return m_shaded; }
|
||||||
FbWinFrameTheme &theme() const { return m_theme; }
|
FbTk::ThemeProxy<FbWinFrameTheme> &theme() const { return m_theme; }
|
||||||
/// @return titlebar height
|
/// @return titlebar height
|
||||||
unsigned int titlebarHeight() const { return (m_use_titlebar?m_titlebar.height()+m_window.borderWidth():0); }
|
unsigned int titlebarHeight() const { return (m_use_titlebar?m_titlebar.height()+m_window.borderWidth():0); }
|
||||||
unsigned int handleHeight() const { return (m_use_handle?m_handle.height()+m_window.borderWidth():0); }
|
unsigned int handleHeight() const { return (m_use_handle?m_handle.height()+m_window.borderWidth():0); }
|
||||||
|
@ -313,7 +315,7 @@ private:
|
||||||
|
|
||||||
BScreen &m_screen;
|
BScreen &m_screen;
|
||||||
|
|
||||||
FbWinFrameTheme &m_theme; ///< theme to be used
|
FbTk::ThemeProxy<FbWinFrameTheme> &m_theme; ///< theme to be used
|
||||||
FbTk::ImageControl &m_imagectrl; ///< Image control for rendering
|
FbTk::ImageControl &m_imagectrl; ///< Image control for rendering
|
||||||
/**
|
/**
|
||||||
@name windows
|
@name windows
|
||||||
|
|
|
@ -97,8 +97,8 @@ public:
|
||||||
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
||||||
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
|
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
|
||||||
|
|
||||||
virtual FbWinFrameTheme *operator ->() { return this; }
|
virtual FbWinFrameTheme &operator *() { return *this; }
|
||||||
virtual const FbWinFrameTheme *operator ->() const { return this; }
|
virtual const FbWinFrameTheme &operator *() const { return *this; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FbTk::ThemeItem<FbTk::Texture> m_title_focus, m_title_unfocus;
|
FbTk::ThemeItem<FbTk::Texture> m_title_focus, m_title_unfocus;
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
GenericTool::GenericTool(FbTk::FbWindow *new_window, ToolbarItem::Type type,
|
GenericTool::GenericTool(FbTk::FbWindow *new_window, ToolbarItem::Type type,
|
||||||
ToolTheme &theme):
|
FbTk::ThemeProxy<ToolTheme> &theme):
|
||||||
ToolbarItem(type),
|
ToolbarItem(type),
|
||||||
m_window(new_window),
|
m_window(new_window),
|
||||||
m_theme(theme) {
|
m_theme(theme) {
|
||||||
|
|
|
@ -33,12 +33,14 @@ class ToolTheme;
|
||||||
|
|
||||||
namespace FbTk {
|
namespace FbTk {
|
||||||
class FbWindow;
|
class FbWindow;
|
||||||
|
template <class T> class ThemeProxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// helper class for simple tools, i.e buttons etc
|
/// helper class for simple tools, i.e buttons etc
|
||||||
class GenericTool: public ToolbarItem, public FbTk::Observer, private FbTk::NotCopyable {
|
class GenericTool: public ToolbarItem, public FbTk::Observer, private FbTk::NotCopyable {
|
||||||
public:
|
public:
|
||||||
GenericTool(FbTk::FbWindow *new_window, ToolbarItem::Type type, ToolTheme &theme);
|
GenericTool(FbTk::FbWindow *new_window, ToolbarItem::Type type,
|
||||||
|
FbTk::ThemeProxy<ToolTheme> &theme);
|
||||||
virtual ~GenericTool();
|
virtual ~GenericTool();
|
||||||
void move(int x, int y);
|
void move(int x, int y);
|
||||||
void resize(unsigned int x, unsigned int y);
|
void resize(unsigned int x, unsigned int y);
|
||||||
|
@ -53,7 +55,7 @@ public:
|
||||||
|
|
||||||
void parentMoved();
|
void parentMoved();
|
||||||
|
|
||||||
const ToolTheme &theme() const { return m_theme; }
|
const FbTk::ThemeProxy<ToolTheme> &theme() const { return m_theme; }
|
||||||
FbTk::FbWindow &window() { return *m_window; }
|
FbTk::FbWindow &window() { return *m_window; }
|
||||||
const FbTk::FbWindow &window() const { return *m_window; }
|
const FbTk::FbWindow &window() const { return *m_window; }
|
||||||
|
|
||||||
|
@ -64,7 +66,7 @@ private:
|
||||||
void update(FbTk::Subject *subj);
|
void update(FbTk::Subject *subj);
|
||||||
|
|
||||||
std::auto_ptr<FbTk::FbWindow> m_window;
|
std::auto_ptr<FbTk::FbWindow> m_window;
|
||||||
ToolTheme &m_theme;
|
FbTk::ThemeProxy<ToolTheme> &m_theme;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GENERICTOOL_HH
|
#endif // GENERICTOOL_HH
|
||||||
|
|
|
@ -46,9 +46,9 @@
|
||||||
#endif // SHAPE
|
#endif // SHAPE
|
||||||
|
|
||||||
|
|
||||||
IconButton::IconButton(const FbTk::FbWindow &parent, IconbarTheme &theme,
|
IconButton::IconButton(const FbTk::FbWindow &parent,
|
||||||
Focusable &win):
|
FbTk::ThemeProxy<IconbarTheme> &theme, Focusable &win):
|
||||||
FbTk::TextButton(parent, theme.focusedText().font(), win.title()),
|
FbTk::TextButton(parent, theme->focusedText().font(), win.title()),
|
||||||
m_win(win),
|
m_win(win),
|
||||||
m_icon_window(*this, 1, 1, 1, 1,
|
m_icon_window(*this, 1, 1, 1, 1,
|
||||||
ExposureMask | ButtonPressMask | ButtonReleaseMask),
|
ExposureMask | ButtonPressMask | ButtonReleaseMask),
|
||||||
|
@ -118,16 +118,16 @@ void IconButton::setPixmap(bool use) {
|
||||||
|
|
||||||
void IconButton::reconfigTheme() {
|
void IconButton::reconfigTheme() {
|
||||||
|
|
||||||
if (m_theme.focusedTexture().usePixmap())
|
if (m_theme->focusedTexture().usePixmap())
|
||||||
m_focused_pm.reset(m_win.screen().imageControl().renderImage(
|
m_focused_pm.reset(m_win.screen().imageControl().renderImage(
|
||||||
width(), height(), m_theme.focusedTexture(),
|
width(), height(), m_theme->focusedTexture(),
|
||||||
orientation()));
|
orientation()));
|
||||||
else
|
else
|
||||||
m_focused_pm.reset(0);
|
m_focused_pm.reset(0);
|
||||||
|
|
||||||
if (m_theme.unfocusedTexture().usePixmap())
|
if (m_theme->unfocusedTexture().usePixmap())
|
||||||
m_unfocused_pm.reset(m_win.screen().imageControl().renderImage(
|
m_unfocused_pm.reset(m_win.screen().imageControl().renderImage(
|
||||||
width(), height(), m_theme.unfocusedTexture(),
|
width(), height(), m_theme->unfocusedTexture(),
|
||||||
orientation()));
|
orientation()));
|
||||||
else
|
else
|
||||||
m_unfocused_pm.reset(0);
|
m_unfocused_pm.reset(0);
|
||||||
|
@ -138,25 +138,25 @@ void IconButton::reconfigTheme() {
|
||||||
if (m_focused_pm != 0)
|
if (m_focused_pm != 0)
|
||||||
setBackgroundPixmap(m_focused_pm);
|
setBackgroundPixmap(m_focused_pm);
|
||||||
else
|
else
|
||||||
setBackgroundColor(m_theme.focusedTexture().color());
|
setBackgroundColor(m_theme->focusedTexture().color());
|
||||||
|
|
||||||
setGC(m_theme.focusedText().textGC());
|
setGC(m_theme->focusedText().textGC());
|
||||||
setFont(m_theme.focusedText().font());
|
setFont(m_theme->focusedText().font());
|
||||||
setJustify(m_theme.focusedText().justify());
|
setJustify(m_theme->focusedText().justify());
|
||||||
setBorderWidth(m_theme.focusedBorder().width());
|
setBorderWidth(m_theme->focusedBorder().width());
|
||||||
setBorderColor(m_theme.focusedBorder().color());
|
setBorderColor(m_theme->focusedBorder().color());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (m_unfocused_pm != 0)
|
if (m_unfocused_pm != 0)
|
||||||
setBackgroundPixmap(m_unfocused_pm);
|
setBackgroundPixmap(m_unfocused_pm);
|
||||||
else
|
else
|
||||||
setBackgroundColor(m_theme.unfocusedTexture().color());
|
setBackgroundColor(m_theme->unfocusedTexture().color());
|
||||||
|
|
||||||
setGC(m_theme.unfocusedText().textGC());
|
setGC(m_theme->unfocusedText().textGC());
|
||||||
setFont(m_theme.unfocusedText().font());
|
setFont(m_theme->unfocusedText().font());
|
||||||
setJustify(m_theme.unfocusedText().justify());
|
setJustify(m_theme->unfocusedText().justify());
|
||||||
setBorderWidth(m_theme.unfocusedBorder().width());
|
setBorderWidth(m_theme->unfocusedBorder().width());
|
||||||
setBorderColor(m_theme.unfocusedBorder().color());
|
setBorderColor(m_theme->unfocusedBorder().color());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,10 +31,14 @@
|
||||||
class Focusable;
|
class Focusable;
|
||||||
class IconbarTheme;
|
class IconbarTheme;
|
||||||
|
|
||||||
|
namespace FbTk {
|
||||||
|
template <class T> class ThemeProxy;
|
||||||
|
}
|
||||||
|
|
||||||
class IconButton: public FbTk::TextButton, public FbTk::Observer {
|
class IconButton: public FbTk::TextButton, public FbTk::Observer {
|
||||||
public:
|
public:
|
||||||
IconButton(const FbTk::FbWindow &parent, IconbarTheme &theme,
|
IconButton(const FbTk::FbWindow &parent,
|
||||||
Focusable &window);
|
FbTk::ThemeProxy<IconbarTheme> &theme, Focusable &window);
|
||||||
virtual ~IconButton();
|
virtual ~IconButton();
|
||||||
|
|
||||||
void exposeEvent(XExposeEvent &event);
|
void exposeEvent(XExposeEvent &event);
|
||||||
|
@ -67,7 +71,7 @@ private:
|
||||||
FbTk::FbPixmap m_icon_mask;
|
FbTk::FbPixmap m_icon_mask;
|
||||||
bool m_use_pixmap;
|
bool m_use_pixmap;
|
||||||
|
|
||||||
IconbarTheme &m_theme;
|
FbTk::ThemeProxy<IconbarTheme> &m_theme;
|
||||||
// cached pixmaps
|
// cached pixmaps
|
||||||
FbTk::CachedPixmap m_focused_pm, m_unfocused_pm;
|
FbTk::CachedPixmap m_focused_pm, m_unfocused_pm;
|
||||||
};
|
};
|
||||||
|
|
|
@ -50,8 +50,8 @@ public:
|
||||||
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
||||||
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
|
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
|
||||||
|
|
||||||
virtual IconbarTheme *operator ->() { return this; }
|
virtual IconbarTheme &operator *() { return *this; }
|
||||||
virtual const IconbarTheme *operator ->() const { return this; }
|
virtual const IconbarTheme &operator *() const { return *this; }
|
||||||
|
|
||||||
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;
|
||||||
|
|
|
@ -252,7 +252,8 @@ private:
|
||||||
|
|
||||||
}; // end anonymous namespace
|
}; // end anonymous namespace
|
||||||
|
|
||||||
IconbarTool::IconbarTool(const FbTk::FbWindow &parent, IconbarTheme &theme,
|
IconbarTool::IconbarTool(const FbTk::FbWindow &parent,
|
||||||
|
FbTk::ThemeProxy<IconbarTheme> &theme,
|
||||||
BScreen &screen, FbTk::Menu &menu):
|
BScreen &screen, FbTk::Menu &menu):
|
||||||
ToolbarItem(ToolbarItem::RELATIVE),
|
ToolbarItem(ToolbarItem::RELATIVE),
|
||||||
m_screen(screen),
|
m_screen(screen),
|
||||||
|
@ -467,7 +468,7 @@ void IconbarTool::reset() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void IconbarTool::updateSizing() {
|
void IconbarTool::updateSizing() {
|
||||||
m_icon_container.setBorderWidth(m_theme.border().width());
|
m_icon_container.setBorderWidth(m_theme->border().width());
|
||||||
|
|
||||||
IconMap::iterator icon_it = m_icons.begin();
|
IconMap::iterator icon_it = m_icons.begin();
|
||||||
const IconMap::iterator icon_it_end = m_icons.end();
|
const IconMap::iterator icon_it_end = m_icons.end();
|
||||||
|
@ -488,14 +489,14 @@ void IconbarTool::renderTheme() {
|
||||||
updateSizing();
|
updateSizing();
|
||||||
|
|
||||||
// if we dont have any icons then we should render empty texture
|
// if we dont have any icons then we should render empty texture
|
||||||
if (!m_theme.emptyTexture().usePixmap()) {
|
if (!m_theme->emptyTexture().usePixmap()) {
|
||||||
m_empty_pm.reset( 0 );
|
m_empty_pm.reset( 0 );
|
||||||
m_icon_container.setBackgroundColor(m_theme.emptyTexture().color());
|
m_icon_container.setBackgroundColor(m_theme->emptyTexture().color());
|
||||||
} else {
|
} else {
|
||||||
m_empty_pm.reset(m_screen.imageControl().
|
m_empty_pm.reset(m_screen.imageControl().
|
||||||
renderImage(m_icon_container.width(),
|
renderImage(m_icon_container.width(),
|
||||||
m_icon_container.height(),
|
m_icon_container.height(),
|
||||||
m_theme.emptyTexture(), orientation()));
|
m_theme->emptyTexture(), orientation()));
|
||||||
m_icon_container.setBackgroundPixmap(m_empty_pm);
|
m_icon_container.setBackgroundPixmap(m_empty_pm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,8 @@ class IconbarTool: public ToolbarItem, public FbTk::Observer {
|
||||||
public:
|
public:
|
||||||
typedef std::map<Focusable *, IconButton *> IconMap;
|
typedef std::map<Focusable *, IconButton *> IconMap;
|
||||||
|
|
||||||
IconbarTool(const FbTk::FbWindow &parent, IconbarTheme &theme,
|
IconbarTool(const FbTk::FbWindow &parent,
|
||||||
|
FbTk::ThemeProxy<IconbarTheme> &theme,
|
||||||
BScreen &screen, FbTk::Menu &menu);
|
BScreen &screen, FbTk::Menu &menu);
|
||||||
~IconbarTool();
|
~IconbarTool();
|
||||||
|
|
||||||
|
@ -95,7 +96,7 @@ private:
|
||||||
|
|
||||||
BScreen &m_screen;
|
BScreen &m_screen;
|
||||||
FbTk::Container m_icon_container;
|
FbTk::Container m_icon_container;
|
||||||
IconbarTheme &m_theme;
|
FbTk::ThemeProxy<IconbarTheme> &m_theme;
|
||||||
FbTk::CachedPixmap m_empty_pm; ///< pixmap for empty container
|
FbTk::CachedPixmap m_empty_pm; ///< pixmap for empty container
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,8 @@
|
||||||
#include "FbTk/SimpleCommand.hh"
|
#include "FbTk/SimpleCommand.hh"
|
||||||
#include "FbTk/I18n.hh"
|
#include "FbTk/I18n.hh"
|
||||||
|
|
||||||
LayerMenu::LayerMenu(FbTk::MenuTheme &tm, FbTk::ImageControl &imgctrl,
|
LayerMenu::LayerMenu(FbTk::ThemeProxy<FbTk::MenuTheme> &tm,
|
||||||
|
FbTk::ImageControl &imgctrl,
|
||||||
FbTk::XLayer &layer, LayerObject *object, bool save_rc):
|
FbTk::XLayer &layer, LayerObject *object, bool save_rc):
|
||||||
ToggleMenu(tm, imgctrl, layer) {
|
ToggleMenu(tm, imgctrl, layer) {
|
||||||
_FB_USES_NLS;
|
_FB_USES_NLS;
|
||||||
|
|
|
@ -62,7 +62,8 @@ private:
|
||||||
/// Create a layer menu inside from the given menu
|
/// Create a layer menu inside from the given menu
|
||||||
class LayerMenu : public ToggleMenu {
|
class LayerMenu : public ToggleMenu {
|
||||||
public:
|
public:
|
||||||
LayerMenu(class FbTk::MenuTheme &tm, FbTk::ImageControl &imgctrl,
|
LayerMenu(FbTk::ThemeProxy<FbTk::MenuTheme> &tm,
|
||||||
|
FbTk::ImageControl &imgctrl,
|
||||||
FbTk::XLayer &layer, LayerObject *item, bool save_rc);
|
FbTk::XLayer &layer, LayerObject *item, bool save_rc);
|
||||||
void show();
|
void show();
|
||||||
};
|
};
|
||||||
|
|
|
@ -57,8 +57,8 @@ public:
|
||||||
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
||||||
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
|
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
|
||||||
|
|
||||||
virtual RootTheme *operator ->() { return this; }
|
virtual RootTheme &operator *() { return *this; }
|
||||||
virtual const RootTheme *operator ->() const { return this; }
|
virtual const RootTheme &operator *() const { return *this; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BackgroundItem *m_background;///< background image/texture
|
BackgroundItem *m_background;///< background image/texture
|
||||||
|
|
|
@ -34,12 +34,6 @@
|
||||||
#include "FocusControl.hh"
|
#include "FocusControl.hh"
|
||||||
#include "ScreenPlacement.hh"
|
#include "ScreenPlacement.hh"
|
||||||
|
|
||||||
// themes
|
|
||||||
#include "FbWinFrameTheme.hh"
|
|
||||||
#include "RootTheme.hh"
|
|
||||||
#include "WinButtonTheme.hh"
|
|
||||||
#include "SlitTheme.hh"
|
|
||||||
|
|
||||||
// menu items
|
// menu items
|
||||||
#include "FbTk/BoolMenuItem.hh"
|
#include "FbTk/BoolMenuItem.hh"
|
||||||
#include "FbTk/IntMenuItem.hh"
|
#include "FbTk/IntMenuItem.hh"
|
||||||
|
@ -451,7 +445,7 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
|
||||||
|
|
||||||
imageControl().setDither(*resource.image_dither);
|
imageControl().setDither(*resource.image_dither);
|
||||||
|
|
||||||
winFrameTheme().reconfigSig().attach(this);// for geom window
|
winFrameTheme()->reconfigSig().attach(this);// for geom window
|
||||||
|
|
||||||
|
|
||||||
geom_visible = false;
|
geom_visible = false;
|
||||||
|
@ -1799,13 +1793,13 @@ void BScreen::showPosition(int x, int y) {
|
||||||
|
|
||||||
m_pos_window.clear();
|
m_pos_window.clear();
|
||||||
|
|
||||||
winFrameTheme().font().drawText(m_pos_window,
|
winFrameTheme()->font().drawText(m_pos_window,
|
||||||
screenNumber(),
|
screenNumber(),
|
||||||
winFrameTheme().iconbarTheme().focusedText().textGC(),
|
winFrameTheme()->iconbarTheme().focusedText().textGC(),
|
||||||
label, strlen(label),
|
label, strlen(label),
|
||||||
winFrameTheme().bevelWidth(),
|
winFrameTheme()->bevelWidth(),
|
||||||
winFrameTheme().bevelWidth() +
|
winFrameTheme()->bevelWidth() +
|
||||||
winFrameTheme().font().ascent());
|
winFrameTheme()->font().ascent());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1851,13 +1845,13 @@ void BScreen::showGeometry(int gx, int gy) {
|
||||||
m_geom_window.clear();
|
m_geom_window.clear();
|
||||||
|
|
||||||
//!! TODO: geom window again?! repeated
|
//!! TODO: geom window again?! repeated
|
||||||
winFrameTheme().font().drawText(m_geom_window,
|
winFrameTheme()->font().drawText(m_geom_window,
|
||||||
screenNumber(),
|
screenNumber(),
|
||||||
winFrameTheme().iconbarTheme().focusedText().textGC(),
|
winFrameTheme()->iconbarTheme().focusedText().textGC(),
|
||||||
label, strlen(label),
|
label, strlen(label),
|
||||||
winFrameTheme().bevelWidth(),
|
winFrameTheme()->bevelWidth(),
|
||||||
winFrameTheme().bevelWidth() +
|
winFrameTheme()->bevelWidth() +
|
||||||
winFrameTheme().font().ascent());
|
winFrameTheme()->font().ascent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1914,32 +1908,32 @@ void BScreen::renderGeomWindow() {
|
||||||
"W: %04d x H: %04d", "Representative maximum sized text for width and height dialog").c_str(),
|
"W: %04d x H: %04d", "Representative maximum sized text for width and height dialog").c_str(),
|
||||||
0, 0);
|
0, 0);
|
||||||
|
|
||||||
int geom_h = winFrameTheme().font().height() + winFrameTheme().bevelWidth()*2;
|
int geom_h = winFrameTheme()->font().height() + winFrameTheme()->bevelWidth()*2;
|
||||||
int geom_w = winFrameTheme().font().textWidth(label, strlen(label)) + winFrameTheme().bevelWidth()*2;
|
int geom_w = winFrameTheme()->font().textWidth(label, strlen(label)) + winFrameTheme()->bevelWidth()*2;
|
||||||
m_geom_window.resize(geom_w, geom_h);
|
m_geom_window.resize(geom_w, geom_h);
|
||||||
|
|
||||||
m_geom_window.setBorderWidth(winFrameTheme().border(true).width());
|
m_geom_window.setBorderWidth(winFrameTheme()->border(true).width());
|
||||||
m_geom_window.setBorderColor(winFrameTheme().border(true).color());
|
m_geom_window.setBorderColor(winFrameTheme()->border(true).color());
|
||||||
|
|
||||||
|
|
||||||
Pixmap tmp = geom_pixmap;
|
Pixmap tmp = geom_pixmap;
|
||||||
|
|
||||||
if (winFrameTheme().iconbarTheme().focusedTexture().type() & FbTk::Texture::PARENTRELATIVE) {
|
if (winFrameTheme()->iconbarTheme().focusedTexture().type() & FbTk::Texture::PARENTRELATIVE) {
|
||||||
if (!winFrameTheme().titleFocusTexture().usePixmap()) {
|
if (!winFrameTheme()->titleFocusTexture().usePixmap()) {
|
||||||
geom_pixmap = None;
|
geom_pixmap = None;
|
||||||
m_geom_window.setBackgroundColor(winFrameTheme().titleFocusTexture().color());
|
m_geom_window.setBackgroundColor(winFrameTheme()->titleFocusTexture().color());
|
||||||
} else {
|
} else {
|
||||||
geom_pixmap = imageControl().renderImage(m_geom_window.width(), m_geom_window.height(),
|
geom_pixmap = imageControl().renderImage(m_geom_window.width(), m_geom_window.height(),
|
||||||
winFrameTheme().titleFocusTexture());
|
winFrameTheme()->titleFocusTexture());
|
||||||
m_geom_window.setBackgroundPixmap(geom_pixmap);
|
m_geom_window.setBackgroundPixmap(geom_pixmap);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!winFrameTheme().iconbarTheme().focusedTexture().usePixmap()) {
|
if (!winFrameTheme()->iconbarTheme().focusedTexture().usePixmap()) {
|
||||||
geom_pixmap = None;
|
geom_pixmap = None;
|
||||||
m_geom_window.setBackgroundColor(winFrameTheme().iconbarTheme().focusedTexture().color());
|
m_geom_window.setBackgroundColor(winFrameTheme()->iconbarTheme().focusedTexture().color());
|
||||||
} else {
|
} else {
|
||||||
geom_pixmap = imageControl().renderImage(m_geom_window.width(), m_geom_window.height(),
|
geom_pixmap = imageControl().renderImage(m_geom_window.width(), m_geom_window.height(),
|
||||||
winFrameTheme().iconbarTheme().focusedTexture());
|
winFrameTheme()->iconbarTheme().focusedTexture());
|
||||||
m_geom_window.setBackgroundPixmap(geom_pixmap);
|
m_geom_window.setBackgroundPixmap(geom_pixmap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1952,32 +1946,32 @@ void BScreen::renderGeomWindow() {
|
||||||
|
|
||||||
void BScreen::renderPosWindow() {
|
void BScreen::renderPosWindow() {
|
||||||
|
|
||||||
int pos_h = winFrameTheme().font().height() + winFrameTheme().bevelWidth()*2;
|
int pos_h = winFrameTheme()->font().height() + winFrameTheme()->bevelWidth()*2;
|
||||||
int pos_w = winFrameTheme().font().textWidth("0:00000 x 0:00000", 17) + winFrameTheme().bevelWidth()*2;
|
int pos_w = winFrameTheme()->font().textWidth("0:00000 x 0:00000", 17) + winFrameTheme()->bevelWidth()*2;
|
||||||
m_pos_window.resize(pos_w, pos_h);
|
m_pos_window.resize(pos_w, pos_h);
|
||||||
|
|
||||||
m_pos_window.setBorderWidth(winFrameTheme().border(true).width());
|
m_pos_window.setBorderWidth(winFrameTheme()->border(true).width());
|
||||||
m_pos_window.setBorderColor(winFrameTheme().border(true).color());
|
m_pos_window.setBorderColor(winFrameTheme()->border(true).color());
|
||||||
|
|
||||||
|
|
||||||
Pixmap tmp = pos_pixmap;
|
Pixmap tmp = pos_pixmap;
|
||||||
|
|
||||||
if (winFrameTheme().iconbarTheme().focusedTexture().type() & FbTk::Texture::PARENTRELATIVE) {
|
if (winFrameTheme()->iconbarTheme().focusedTexture().type() & FbTk::Texture::PARENTRELATIVE) {
|
||||||
if (!winFrameTheme().titleFocusTexture().usePixmap()) {
|
if (!winFrameTheme()->titleFocusTexture().usePixmap()) {
|
||||||
pos_pixmap = None;
|
pos_pixmap = None;
|
||||||
m_pos_window.setBackgroundColor(winFrameTheme().titleFocusTexture().color());
|
m_pos_window.setBackgroundColor(winFrameTheme()->titleFocusTexture().color());
|
||||||
} else {
|
} else {
|
||||||
pos_pixmap = imageControl().renderImage(m_pos_window.width(), m_pos_window.height(),
|
pos_pixmap = imageControl().renderImage(m_pos_window.width(), m_pos_window.height(),
|
||||||
winFrameTheme().titleFocusTexture());
|
winFrameTheme()->titleFocusTexture());
|
||||||
m_pos_window.setBackgroundPixmap(pos_pixmap);
|
m_pos_window.setBackgroundPixmap(pos_pixmap);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!winFrameTheme().iconbarTheme().focusedTexture().usePixmap()) {
|
if (!winFrameTheme()->iconbarTheme().focusedTexture().usePixmap()) {
|
||||||
pos_pixmap = None;
|
pos_pixmap = None;
|
||||||
m_pos_window.setBackgroundColor(winFrameTheme().iconbarTheme().focusedTexture().color());
|
m_pos_window.setBackgroundColor(winFrameTheme()->iconbarTheme().focusedTexture().color());
|
||||||
} else {
|
} else {
|
||||||
pos_pixmap = imageControl().renderImage(m_pos_window.width(), m_pos_window.height(),
|
pos_pixmap = imageControl().renderImage(m_pos_window.width(), m_pos_window.height(),
|
||||||
winFrameTheme().iconbarTheme().focusedTexture());
|
winFrameTheme()->iconbarTheme().focusedTexture());
|
||||||
m_pos_window.setBackgroundPixmap(pos_pixmap);
|
m_pos_window.setBackgroundPixmap(pos_pixmap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,9 @@
|
||||||
|
|
||||||
#include "FbWinFrame.hh"
|
#include "FbWinFrame.hh"
|
||||||
#include "FbRootWindow.hh"
|
#include "FbRootWindow.hh"
|
||||||
|
#include "RootTheme.hh"
|
||||||
|
#include "WinButtonTheme.hh"
|
||||||
|
#include "FbWinFrameTheme.hh"
|
||||||
|
|
||||||
#include "FbTk/MenuTheme.hh"
|
#include "FbTk/MenuTheme.hh"
|
||||||
#include "FbTk/EventHandler.hh"
|
#include "FbTk/EventHandler.hh"
|
||||||
|
@ -52,9 +55,6 @@
|
||||||
class ClientPattern;
|
class ClientPattern;
|
||||||
class Focusable;
|
class Focusable;
|
||||||
class FluxboxWindow;
|
class FluxboxWindow;
|
||||||
class FbWinFrameTheme;
|
|
||||||
class RootTheme;
|
|
||||||
class WinButtonTheme;
|
|
||||||
class WinClient;
|
class WinClient;
|
||||||
class Workspace;
|
class Workspace;
|
||||||
class Strut;
|
class Strut;
|
||||||
|
@ -273,13 +273,13 @@ public:
|
||||||
|
|
||||||
void saveMenu(FbTk::Menu &menu) { m_rootmenu_list.push_back(&menu); }
|
void saveMenu(FbTk::Menu &menu) { m_rootmenu_list.push_back(&menu); }
|
||||||
|
|
||||||
FbWinFrameTheme &winFrameTheme() { return *m_windowtheme.get(); }
|
FbTk::ThemeProxy<FbWinFrameTheme> &winFrameTheme() { return *m_windowtheme.get(); }
|
||||||
const FbWinFrameTheme &winFrameTheme() const { return *m_windowtheme.get(); }
|
const FbTk::ThemeProxy<FbWinFrameTheme> &winFrameTheme() const { return *m_windowtheme.get(); }
|
||||||
FbTk::MenuTheme &menuTheme() { return *m_menutheme.get(); }
|
FbTk::ThemeProxy<FbTk::MenuTheme> &menuTheme() { return *m_menutheme.get(); }
|
||||||
const FbTk::MenuTheme &menuTheme() const { return *m_menutheme.get(); }
|
const FbTk::ThemeProxy<FbTk::MenuTheme> &menuTheme() const { return *m_menutheme.get(); }
|
||||||
const RootTheme &rootTheme() const { return *m_root_theme.get(); }
|
const FbTk::ThemeProxy<RootTheme> &rootTheme() const { return *m_root_theme.get(); }
|
||||||
WinButtonTheme &winButtonTheme() { return *m_winbutton_theme.get(); }
|
FbTk::ThemeProxy<WinButtonTheme> &winButtonTheme() { return *m_winbutton_theme.get(); }
|
||||||
const WinButtonTheme &winButtonTheme() const { return *m_winbutton_theme.get(); }
|
const FbTk::ThemeProxy<WinButtonTheme> &winButtonTheme() const { return *m_winbutton_theme.get(); }
|
||||||
|
|
||||||
FbRootWindow &rootWindow() { return m_root_window; }
|
FbRootWindow &rootWindow() { return m_root_window; }
|
||||||
const FbRootWindow &rootWindow() const { return m_root_window; }
|
const FbRootWindow &rootWindow() const { return m_root_window; }
|
||||||
|
|
12
src/Slit.cc
12
src/Slit.cc
|
@ -304,7 +304,7 @@ Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename)
|
||||||
_FB_USES_NLS;
|
_FB_USES_NLS;
|
||||||
|
|
||||||
// attach to theme and root window change signal
|
// attach to theme and root window change signal
|
||||||
m_slit_theme->reconfigSig().attach(this);
|
theme().reconfigSig().attach(this);
|
||||||
scr.resizeSig().attach(this);
|
scr.resizeSig().attach(this);
|
||||||
scr.bgChangeSig().attach(this);
|
scr.bgChangeSig().attach(this);
|
||||||
scr.reconfigureSig().attach(this); // if alpha changed (we disablethis signal when we get theme change sig)
|
scr.reconfigureSig().attach(this); // if alpha changed (we disablethis signal when we get theme change sig)
|
||||||
|
@ -634,7 +634,7 @@ void Slit::reconfigure() {
|
||||||
// Need to count windows because not all client list entries
|
// Need to count windows because not all client list entries
|
||||||
// actually correspond to mapped windows.
|
// actually correspond to mapped windows.
|
||||||
int num_windows = 0;
|
int num_windows = 0;
|
||||||
const int bevel_width = theme().bevelWidth();
|
const int bevel_width = theme()->bevelWidth();
|
||||||
// determine width or height increase
|
// determine width or height increase
|
||||||
bool height_inc = false;
|
bool height_inc = false;
|
||||||
switch (direction()) {
|
switch (direction()) {
|
||||||
|
@ -686,8 +686,8 @@ void Slit::reconfigure() {
|
||||||
|
|
||||||
Display *disp = FbTk::App::instance()->display();
|
Display *disp = FbTk::App::instance()->display();
|
||||||
|
|
||||||
frame.window.setBorderWidth(theme().borderWidth());
|
frame.window.setBorderWidth(theme()->borderWidth());
|
||||||
frame.window.setBorderColor(theme().borderColor());
|
frame.window.setBorderColor(theme()->borderColor());
|
||||||
|
|
||||||
Pixmap tmp = frame.pixmap;
|
Pixmap tmp = frame.pixmap;
|
||||||
FbTk::ImageControl &image_ctrl = screen().imageControl();
|
FbTk::ImageControl &image_ctrl = screen().imageControl();
|
||||||
|
@ -817,8 +817,8 @@ void Slit::reposition() {
|
||||||
head_h = screen().height();
|
head_h = screen().height();
|
||||||
}
|
}
|
||||||
|
|
||||||
int border_width = theme().borderWidth();
|
int border_width = theme()->borderWidth();
|
||||||
int bevel_width = theme().bevelWidth();
|
int bevel_width = theme()->bevelWidth();
|
||||||
// make sure at leaste one pixel is visible
|
// make sure at leaste one pixel is visible
|
||||||
if (border_width >= bevel_width)
|
if (border_width >= bevel_width)
|
||||||
bevel_width = border_width + 1;
|
bevel_width = border_width + 1;
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#ifndef SLIT_HH
|
#ifndef SLIT_HH
|
||||||
#define SLIT_HH
|
#define SLIT_HH
|
||||||
|
|
||||||
|
#include "SlitTheme.hh"
|
||||||
#include "LayerMenu.hh"
|
#include "LayerMenu.hh"
|
||||||
#include "Layer.hh"
|
#include "Layer.hh"
|
||||||
|
|
||||||
|
@ -40,7 +40,6 @@
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
class SlitTheme;
|
|
||||||
class SlitClient;
|
class SlitClient;
|
||||||
class BScreen;
|
class BScreen;
|
||||||
class FbMenu;
|
class FbMenu;
|
||||||
|
@ -102,8 +101,8 @@ public:
|
||||||
|
|
||||||
BScreen &screen() { return m_screen; }
|
BScreen &screen() { return m_screen; }
|
||||||
const BScreen &screen() const { return m_screen; }
|
const BScreen &screen() const { return m_screen; }
|
||||||
SlitTheme &theme() { return *m_slit_theme.get(); }
|
FbTk::ThemeProxy<SlitTheme> &theme() { return *m_slit_theme.get(); }
|
||||||
const SlitTheme &theme() const { return *m_slit_theme.get(); }
|
const FbTk::ThemeProxy<SlitTheme> &theme() const { return *m_slit_theme.get(); }
|
||||||
|
|
||||||
int layerNumber() const { return m_layeritem->getLayerNum(); }
|
int layerNumber() const { return m_layeritem->getLayerNum(); }
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,8 @@ public:
|
||||||
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
||||||
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
|
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
|
||||||
|
|
||||||
virtual SlitTheme *operator ->() { return this; }
|
virtual SlitTheme &operator *() { return *this; }
|
||||||
virtual const SlitTheme *operator ->() const { return this; }
|
virtual const SlitTheme &operator *() const { return *this; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FbTk::ThemeItem<FbTk::Texture> m_texture;
|
FbTk::ThemeItem<FbTk::Texture> m_texture;
|
||||||
|
|
|
@ -153,7 +153,8 @@ private:
|
||||||
SystemTray &m_tray;
|
SystemTray &m_tray;
|
||||||
};
|
};
|
||||||
|
|
||||||
SystemTray::SystemTray(const FbTk::FbWindow& parent, ButtonTheme& theme, BScreen& screen):
|
SystemTray::SystemTray(const FbTk::FbWindow& parent,
|
||||||
|
FbTk::ThemeProxy<ButtonTheme> &theme, BScreen& screen):
|
||||||
ToolbarItem(ToolbarItem::FIXED),
|
ToolbarItem(ToolbarItem::FIXED),
|
||||||
m_window(parent, 0, 0, 1, 1, ExposureMask | ButtonPressMask | ButtonReleaseMask |
|
m_window(parent, 0, 0, 1, 1, ExposureMask | ButtonPressMask | ButtonReleaseMask |
|
||||||
SubstructureNotifyMask | SubstructureRedirectMask),
|
SubstructureNotifyMask | SubstructureRedirectMask),
|
||||||
|
@ -164,7 +165,7 @@ SystemTray::SystemTray(const FbTk::FbWindow& parent, ButtonTheme& theme, BScreen
|
||||||
|
|
||||||
FbTk::EventManager::instance()->add(*this, m_window);
|
FbTk::EventManager::instance()->add(*this, m_window);
|
||||||
FbTk::EventManager::instance()->add(*this, m_selection_owner);
|
FbTk::EventManager::instance()->add(*this, m_selection_owner);
|
||||||
m_theme.reconfigSig().attach(this);
|
m_theme->reconfigSig().attach(this);
|
||||||
screen.bgChangeSig().attach(this);
|
screen.bgChangeSig().attach(this);
|
||||||
|
|
||||||
Fluxbox* fluxbox = Fluxbox::instance();
|
Fluxbox* fluxbox = Fluxbox::instance();
|
||||||
|
@ -282,14 +283,14 @@ unsigned int SystemTray::width() const {
|
||||||
if (orientation() == FbTk::ROT90 || orientation() == FbTk::ROT270)
|
if (orientation() == FbTk::ROT90 || orientation() == FbTk::ROT270)
|
||||||
return m_window.width();
|
return m_window.width();
|
||||||
|
|
||||||
return m_num_visible_clients * (height() - 2 * m_theme.border().width());
|
return m_num_visible_clients * (height() - 2 * m_theme->border().width());
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int SystemTray::height() const {
|
unsigned int SystemTray::height() const {
|
||||||
if (orientation() == FbTk::ROT0 || orientation() == FbTk::ROT180)
|
if (orientation() == FbTk::ROT0 || orientation() == FbTk::ROT180)
|
||||||
return m_window.height();
|
return m_window.height();
|
||||||
|
|
||||||
return m_num_visible_clients * (width() - 2 * m_theme.border().width());
|
return m_num_visible_clients * (width() - 2 * m_theme->border().width());
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int SystemTray::borderWidth() const {
|
unsigned int SystemTray::borderWidth() const {
|
||||||
|
@ -463,7 +464,7 @@ void SystemTray::handleEvent(XEvent &event) {
|
||||||
|
|
||||||
void SystemTray::rearrangeClients() {
|
void SystemTray::rearrangeClients() {
|
||||||
unsigned int w_rot0 = width(), h_rot0 = height();
|
unsigned int w_rot0 = width(), h_rot0 = height();
|
||||||
const unsigned int bw = m_theme.border().width();
|
const unsigned int bw = m_theme->border().width();
|
||||||
FbTk::translateSize(orientation(), w_rot0, h_rot0);
|
FbTk::translateSize(orientation(), w_rot0, h_rot0);
|
||||||
unsigned int trayw = m_num_visible_clients*h_rot0 + bw, trayh = h_rot0;
|
unsigned int trayw = m_num_visible_clients*h_rot0 + bw, trayh = h_rot0;
|
||||||
FbTk::translateSize(orientation(), trayw, trayh);
|
FbTk::translateSize(orientation(), trayw, trayh);
|
||||||
|
@ -529,14 +530,14 @@ void SystemTray::showClient(TrayWindow *traywin) {
|
||||||
|
|
||||||
void SystemTray::update(FbTk::Subject* subject) {
|
void SystemTray::update(FbTk::Subject* subject) {
|
||||||
|
|
||||||
if (!m_theme.texture().usePixmap()) {
|
if (!m_theme->texture().usePixmap()) {
|
||||||
m_window.setBackgroundColor(m_theme.texture().color());
|
m_window.setBackgroundColor(m_theme->texture().color());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(m_pixmap)
|
if(m_pixmap)
|
||||||
m_screen.imageControl().removeImage(m_pixmap);
|
m_screen.imageControl().removeImage(m_pixmap);
|
||||||
m_pixmap = m_screen.imageControl().renderImage(width(), height(),
|
m_pixmap = m_screen.imageControl().renderImage(width(), height(),
|
||||||
m_theme.texture(), orientation());
|
m_theme->texture(), orientation());
|
||||||
m_window.setBackgroundPixmap(m_pixmap);
|
m_window.setBackgroundPixmap(m_pixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,10 +36,15 @@ class ButtonTheme;
|
||||||
class TrayWindow;
|
class TrayWindow;
|
||||||
class AtomHandler;
|
class AtomHandler;
|
||||||
|
|
||||||
|
namespace FbTk {
|
||||||
|
template <class T> class ThemeProxy;
|
||||||
|
}
|
||||||
|
|
||||||
class SystemTray: public ToolbarItem, public FbTk::EventHandler, public FbTk::Observer {
|
class SystemTray: public ToolbarItem, public FbTk::EventHandler, public FbTk::Observer {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
explicit SystemTray(const FbTk::FbWindow &parent, ButtonTheme &theme, BScreen& screen);
|
explicit SystemTray(const FbTk::FbWindow &parent,
|
||||||
|
FbTk::ThemeProxy<ButtonTheme> &theme, BScreen& screen);
|
||||||
virtual ~SystemTray();
|
virtual ~SystemTray();
|
||||||
|
|
||||||
void move(int x, int y);
|
void move(int x, int y);
|
||||||
|
@ -85,7 +90,7 @@ private:
|
||||||
void showClient(TrayWindow *traywin);
|
void showClient(TrayWindow *traywin);
|
||||||
|
|
||||||
FbTk::FbWindow m_window;
|
FbTk::FbWindow m_window;
|
||||||
ButtonTheme& m_theme;
|
FbTk::ThemeProxy<ButtonTheme> &m_theme;
|
||||||
BScreen& m_screen;
|
BScreen& m_screen;
|
||||||
Pixmap m_pixmap;
|
Pixmap m_pixmap;
|
||||||
|
|
||||||
|
|
|
@ -30,9 +30,10 @@
|
||||||
*/
|
*/
|
||||||
class ToggleMenu: public FbMenu {
|
class ToggleMenu: public FbMenu {
|
||||||
public:
|
public:
|
||||||
ToggleMenu(class FbTk::MenuTheme &tm, FbTk::ImageControl &imgctrl,
|
ToggleMenu(class FbTk::ThemeProxy<FbTk::MenuTheme> &tm,
|
||||||
FbTk::XLayer &layer):FbMenu(tm, imgctrl, layer)
|
FbTk::ImageControl &imgctrl, FbTk::XLayer &layer):
|
||||||
{}
|
FbMenu(tm, imgctrl, layer) { }
|
||||||
|
|
||||||
virtual ~ToggleMenu() {}
|
virtual ~ToggleMenu() {}
|
||||||
void buttonReleaseEvent(XButtonEvent &ev) {
|
void buttonReleaseEvent(XButtonEvent &ev) {
|
||||||
|
|
||||||
|
|
|
@ -84,8 +84,8 @@ ToolbarItem *ToolFactory::create(const std::string &name, const FbTk::FbWindow &
|
||||||
ToolbarItem * item = 0;
|
ToolbarItem * item = 0;
|
||||||
|
|
||||||
unsigned int button_size = 24;
|
unsigned int button_size = 24;
|
||||||
if (tbar.theme().buttonSize() > 0)
|
if (tbar.theme()->buttonSize() > 0)
|
||||||
button_size = tbar.theme().buttonSize();
|
button_size = tbar.theme()->buttonSize();
|
||||||
|
|
||||||
if (name == "workspacename") {
|
if (name == "workspacename") {
|
||||||
WorkspaceNameTool *witem = new WorkspaceNameTool(parent,
|
WorkspaceNameTool *witem = new WorkspaceNameTool(parent,
|
||||||
|
|
|
@ -47,8 +47,8 @@ public:
|
||||||
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
||||||
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
|
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
|
||||||
|
|
||||||
virtual ToolTheme *operator ->() { return this; }
|
virtual ToolTheme &operator *() { return *this; }
|
||||||
virtual const ToolTheme *operator ->() const { return this; }
|
virtual const ToolTheme &operator *() const { return *this; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
FbTk::ThemeItem<FbTk::Texture> &textureTheme() { return m_texture; }
|
FbTk::ThemeItem<FbTk::Texture> &textureTheme() { return m_texture; }
|
||||||
|
|
|
@ -328,22 +328,22 @@ void Toolbar::updateStrut() {
|
||||||
case TOPLEFT:
|
case TOPLEFT:
|
||||||
case TOPCENTER:
|
case TOPCENTER:
|
||||||
case TOPRIGHT:
|
case TOPRIGHT:
|
||||||
top = height() + 2 * theme().border().width();
|
top = height() + 2 * theme()->border().width();
|
||||||
break;
|
break;
|
||||||
case BOTTOMLEFT:
|
case BOTTOMLEFT:
|
||||||
case BOTTOMCENTER:
|
case BOTTOMCENTER:
|
||||||
case BOTTOMRIGHT:
|
case BOTTOMRIGHT:
|
||||||
bottom = height() + 2 * theme().border().width();
|
bottom = height() + 2 * theme()->border().width();
|
||||||
break;
|
break;
|
||||||
case RIGHTTOP:
|
case RIGHTTOP:
|
||||||
case RIGHTCENTER:
|
case RIGHTCENTER:
|
||||||
case RIGHTBOTTOM:
|
case RIGHTBOTTOM:
|
||||||
right = width() + 2 * theme().border().width();
|
right = width() + 2 * theme()->border().width();
|
||||||
break;
|
break;
|
||||||
case LEFTTOP:
|
case LEFTTOP:
|
||||||
case LEFTCENTER:
|
case LEFTCENTER:
|
||||||
case LEFTBOTTOM:
|
case LEFTBOTTOM:
|
||||||
left = width() + 2 * theme().border().width();
|
left = width() + 2 * theme()->border().width();
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
m_strut = screen().requestStrut(getOnHead(), left, right, top, bottom);
|
m_strut = screen().requestStrut(getOnHead(), left, right, top, bottom);
|
||||||
|
@ -442,12 +442,12 @@ void Toolbar::reconfigure() {
|
||||||
if (doAutoHide())
|
if (doAutoHide())
|
||||||
m_hide_timer.start();
|
m_hide_timer.start();
|
||||||
|
|
||||||
frame.bevel_w = theme().bevelWidth();
|
frame.bevel_w = theme()->bevelWidth();
|
||||||
// destroy shape if the theme wasn't specified with one,
|
// destroy shape if the theme wasn't specified with one,
|
||||||
// or create one
|
// or create one
|
||||||
if (theme().shape() == false && m_shape.get())
|
if (theme()->shape() == false && m_shape.get())
|
||||||
m_shape.reset(0);
|
m_shape.reset(0);
|
||||||
else if (theme().shape() && m_shape.get() == 0) {
|
else if (theme()->shape() && m_shape.get() == 0) {
|
||||||
m_shape.reset(new FbTk::Shape(frame.window, 0));
|
m_shape.reset(new FbTk::Shape(frame.window, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,9 +464,9 @@ void Toolbar::reconfigure() {
|
||||||
|
|
||||||
// render frame window
|
// render frame window
|
||||||
Pixmap tmp = m_window_pm;
|
Pixmap tmp = m_window_pm;
|
||||||
if (!theme().toolbar().usePixmap()) {
|
if (!theme()->toolbar().usePixmap()) {
|
||||||
m_window_pm = 0;
|
m_window_pm = 0;
|
||||||
frame.window.setBackgroundColor(theme().toolbar().color());
|
frame.window.setBackgroundColor(theme()->toolbar().color());
|
||||||
} else {
|
} else {
|
||||||
FbTk::Orientation orient = FbTk::ROT0;
|
FbTk::Orientation orient = FbTk::ROT0;
|
||||||
Toolbar::Placement where = *m_rc_placement;
|
Toolbar::Placement where = *m_rc_placement;
|
||||||
|
@ -477,14 +477,14 @@ void Toolbar::reconfigure() {
|
||||||
|
|
||||||
m_window_pm = screen().imageControl().renderImage(
|
m_window_pm = screen().imageControl().renderImage(
|
||||||
frame.window.width(), frame.window.height(),
|
frame.window.width(), frame.window.height(),
|
||||||
theme().toolbar(), orient);
|
theme()->toolbar(), orient);
|
||||||
frame.window.setBackgroundPixmap(m_window_pm);
|
frame.window.setBackgroundPixmap(m_window_pm);
|
||||||
}
|
}
|
||||||
if (tmp)
|
if (tmp)
|
||||||
screen().imageControl().removeImage(tmp);
|
screen().imageControl().removeImage(tmp);
|
||||||
|
|
||||||
frame.window.setBorderColor(theme().border().color());
|
frame.window.setBorderColor(theme()->border().color());
|
||||||
frame.window.setBorderWidth(theme().border().width());
|
frame.window.setBorderWidth(theme()->border().width());
|
||||||
|
|
||||||
bool have_composite = FbTk::Transparent::haveComposite();
|
bool have_composite = FbTk::Transparent::haveComposite();
|
||||||
// have_composite could have changed, so we need to change both
|
// have_composite could have changed, so we need to change both
|
||||||
|
@ -497,7 +497,7 @@ void Toolbar::reconfigure() {
|
||||||
}
|
}
|
||||||
frame.window.clear();
|
frame.window.clear();
|
||||||
|
|
||||||
if (theme().shape() && m_shape.get())
|
if (theme()->shape() && m_shape.get())
|
||||||
m_shape->update();
|
m_shape->update();
|
||||||
|
|
||||||
ItemList::iterator item_it = m_item_list.begin();
|
ItemList::iterator item_it = m_item_list.begin();
|
||||||
|
@ -637,16 +637,16 @@ void Toolbar::setPlacement(Toolbar::Placement where) {
|
||||||
head_h = screen().getHeadHeight(head);
|
head_h = screen().getHeadHeight(head);
|
||||||
}
|
}
|
||||||
|
|
||||||
int bevel_width = theme().bevelWidth();
|
int bevel_width = theme()->bevelWidth();
|
||||||
int border_width = theme().border().width();
|
int border_width = theme()->border().width();
|
||||||
|
|
||||||
frame.width = (head_w - 2*border_width) * (*m_rc_width_percent) / 100;
|
frame.width = (head_w - 2*border_width) * (*m_rc_width_percent) / 100;
|
||||||
//!! TODO: change this
|
//!! TODO: change this
|
||||||
// max height of each toolbar items font...
|
// max height of each toolbar items font...
|
||||||
unsigned int max_height = m_tool_factory.maxFontHeight() + 2;
|
unsigned int max_height = m_tool_factory.maxFontHeight() + 2;
|
||||||
|
|
||||||
if (theme().height() > 0)
|
if (theme()->height() > 0)
|
||||||
max_height = theme().height();
|
max_height = theme()->height();
|
||||||
|
|
||||||
if (*m_rc_height > 0 && *m_rc_height < 100)
|
if (*m_rc_height > 0 && *m_rc_height < 100)
|
||||||
max_height = *m_rc_height;
|
max_height = *m_rc_height;
|
||||||
|
@ -971,7 +971,7 @@ void Toolbar::rearrangeItems() {
|
||||||
// calculate size for fixed items
|
// calculate size for fixed items
|
||||||
ItemList::iterator item_it = m_item_list.begin();
|
ItemList::iterator item_it = m_item_list.begin();
|
||||||
ItemList::iterator item_it_end = m_item_list.end();
|
ItemList::iterator item_it_end = m_item_list.end();
|
||||||
int bevel_width = theme().bevelWidth();
|
int bevel_width = theme()->bevelWidth();
|
||||||
int fixed_width = bevel_width; // combined size of all fixed items
|
int fixed_width = bevel_width; // combined size of all fixed items
|
||||||
int relative_items = 0;
|
int relative_items = 0;
|
||||||
int last_bw = 0; // we show the largest border of adjoining items
|
int last_bw = 0; // we show the largest border of adjoining items
|
||||||
|
|
|
@ -121,8 +121,8 @@ public:
|
||||||
int y() const { return isHidden() ? frame.y_hidden : frame.y; }
|
int y() const { return isHidden() ? frame.y_hidden : frame.y; }
|
||||||
Placement placement() const { return *m_rc_placement; }
|
Placement placement() const { return *m_rc_placement; }
|
||||||
/// @return pointer to iconbar if it got one, else 0
|
/// @return pointer to iconbar if it got one, else 0
|
||||||
const ToolbarTheme &theme() const { return m_theme; }
|
const FbTk::ThemeProxy<ToolbarTheme> &theme() const { return m_theme; }
|
||||||
ToolbarTheme &theme() { return m_theme; }
|
FbTk::ThemeProxy<ToolbarTheme> &theme() { return m_theme; }
|
||||||
bool isVertical() const;
|
bool isVertical() const;
|
||||||
|
|
||||||
int getOnHead() const { return *m_rc_on_head; }
|
int getOnHead() const { return *m_rc_on_head; }
|
||||||
|
|
|
@ -47,8 +47,8 @@ public:
|
||||||
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
||||||
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
|
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
|
||||||
|
|
||||||
virtual ToolbarTheme *operator ->() { return this; }
|
virtual ToolbarTheme &operator *() { return *this; }
|
||||||
virtual const ToolbarTheme *operator ->() const { return this; }
|
virtual const ToolbarTheme &operator *() const { return *this; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FbTk::ThemeItem<FbTk::Texture> m_toolbar;
|
FbTk::ThemeItem<FbTk::Texture> m_toolbar;
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
|
|
||||||
WinButton::WinButton(const FluxboxWindow &listen_to,
|
WinButton::WinButton(const FluxboxWindow &listen_to,
|
||||||
WinButtonTheme &theme,
|
FbTk::ThemeProxy<WinButtonTheme> &theme,
|
||||||
Type buttontype, const FbTk::FbWindow &parent,
|
Type buttontype, const FbTk::FbWindow &parent,
|
||||||
int x, int y,
|
int x, int y,
|
||||||
unsigned int width, unsigned int height):
|
unsigned int width, unsigned int height):
|
||||||
|
@ -112,59 +112,59 @@ Pixmap WinButton::getBackgroundPixmap() const {
|
||||||
switch(m_type) {
|
switch(m_type) {
|
||||||
case MAXIMIZE:
|
case MAXIMIZE:
|
||||||
if (focused)
|
if (focused)
|
||||||
return m_theme.maximizePixmap().pixmap().drawable();
|
return m_theme->maximizePixmap().pixmap().drawable();
|
||||||
else
|
else
|
||||||
return m_theme.maximizeUnfocusPixmap().pixmap().drawable();
|
return m_theme->maximizeUnfocusPixmap().pixmap().drawable();
|
||||||
break;
|
break;
|
||||||
case MINIMIZE:
|
case MINIMIZE:
|
||||||
if (focused)
|
if (focused)
|
||||||
return m_theme.iconifyPixmap().pixmap().drawable();
|
return m_theme->iconifyPixmap().pixmap().drawable();
|
||||||
else
|
else
|
||||||
return m_theme.iconifyUnfocusPixmap().pixmap().drawable();
|
return m_theme->iconifyUnfocusPixmap().pixmap().drawable();
|
||||||
break;
|
break;
|
||||||
case STICK:
|
case STICK:
|
||||||
if (m_listen_to.isStuck()) {
|
if (m_listen_to.isStuck()) {
|
||||||
if (focused)
|
if (focused)
|
||||||
return m_theme.stuckPixmap().pixmap().drawable();
|
return m_theme->stuckPixmap().pixmap().drawable();
|
||||||
else
|
else
|
||||||
return m_theme.stuckUnfocusPixmap().pixmap().drawable();
|
return m_theme->stuckUnfocusPixmap().pixmap().drawable();
|
||||||
} else {
|
} else {
|
||||||
if (focused)
|
if (focused)
|
||||||
return m_theme.stickPixmap().pixmap().drawable();
|
return m_theme->stickPixmap().pixmap().drawable();
|
||||||
else
|
else
|
||||||
return m_theme.stickUnfocusPixmap().pixmap().drawable();
|
return m_theme->stickUnfocusPixmap().pixmap().drawable();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CLOSE:
|
case CLOSE:
|
||||||
if (focused)
|
if (focused)
|
||||||
return m_theme.closePixmap().pixmap().drawable();
|
return m_theme->closePixmap().pixmap().drawable();
|
||||||
else
|
else
|
||||||
return m_theme.closeUnfocusPixmap().pixmap().drawable();
|
return m_theme->closeUnfocusPixmap().pixmap().drawable();
|
||||||
break;
|
break;
|
||||||
case SHADE:
|
case SHADE:
|
||||||
if (m_listen_to.isShaded()) {
|
if (m_listen_to.isShaded()) {
|
||||||
if (focused)
|
if (focused)
|
||||||
return m_theme.unshadePixmap().pixmap().drawable();
|
return m_theme->unshadePixmap().pixmap().drawable();
|
||||||
else
|
else
|
||||||
return m_theme.unshadeUnfocusPixmap().pixmap().drawable();
|
return m_theme->unshadeUnfocusPixmap().pixmap().drawable();
|
||||||
} else {
|
} else {
|
||||||
if (focused)
|
if (focused)
|
||||||
return m_theme.shadePixmap().pixmap().drawable();
|
return m_theme->shadePixmap().pixmap().drawable();
|
||||||
else
|
else
|
||||||
return m_theme.shadeUnfocusPixmap().pixmap().drawable();
|
return m_theme->shadeUnfocusPixmap().pixmap().drawable();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MENUICON:
|
case MENUICON:
|
||||||
if (m_icon_pixmap.drawable()) {
|
if (m_icon_pixmap.drawable()) {
|
||||||
if (focused)
|
if (focused)
|
||||||
return m_theme.titleFocusPixmap().pixmap().drawable();
|
return m_theme->titleFocusPixmap().pixmap().drawable();
|
||||||
else
|
else
|
||||||
return m_theme.titleUnfocusPixmap().pixmap().drawable();
|
return m_theme->titleUnfocusPixmap().pixmap().drawable();
|
||||||
} else {
|
} else {
|
||||||
if (focused)
|
if (focused)
|
||||||
return m_theme.menuiconPixmap().pixmap().drawable();
|
return m_theme->menuiconPixmap().pixmap().drawable();
|
||||||
else
|
else
|
||||||
return m_theme.menuiconUnfocusPixmap().pixmap().drawable();
|
return m_theme->menuiconUnfocusPixmap().pixmap().drawable();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -174,26 +174,26 @@ Pixmap WinButton::getBackgroundPixmap() const {
|
||||||
Pixmap WinButton::getPressedPixmap() const {
|
Pixmap WinButton::getPressedPixmap() const {
|
||||||
switch(m_type) {
|
switch(m_type) {
|
||||||
case MAXIMIZE:
|
case MAXIMIZE:
|
||||||
return m_theme.maximizePressedPixmap().pixmap().drawable();
|
return m_theme->maximizePressedPixmap().pixmap().drawable();
|
||||||
case MINIMIZE:
|
case MINIMIZE:
|
||||||
return m_theme.iconifyPressedPixmap().pixmap().drawable();
|
return m_theme->iconifyPressedPixmap().pixmap().drawable();
|
||||||
case STICK:
|
case STICK:
|
||||||
return m_theme.stickPressedPixmap().pixmap().drawable();
|
return m_theme->stickPressedPixmap().pixmap().drawable();
|
||||||
case CLOSE:
|
case CLOSE:
|
||||||
return m_theme.closePressedPixmap().pixmap().drawable();
|
return m_theme->closePressedPixmap().pixmap().drawable();
|
||||||
case SHADE:
|
case SHADE:
|
||||||
if (m_listen_to.isShaded())
|
if (m_listen_to.isShaded())
|
||||||
return m_theme.unshadePressedPixmap().pixmap().drawable();
|
return m_theme->unshadePressedPixmap().pixmap().drawable();
|
||||||
else
|
else
|
||||||
return m_theme.shadePressedPixmap().pixmap().drawable();
|
return m_theme->shadePressedPixmap().pixmap().drawable();
|
||||||
case MENUICON:
|
case MENUICON:
|
||||||
if (m_icon_pixmap.drawable())
|
if (m_icon_pixmap.drawable())
|
||||||
if (m_listen_to.isFocused())
|
if (m_listen_to.isFocused())
|
||||||
return m_theme.titleFocusPixmap().pixmap().drawable();
|
return m_theme->titleFocusPixmap().pixmap().drawable();
|
||||||
else
|
else
|
||||||
return m_theme.titleUnfocusPixmap().pixmap().drawable();
|
return m_theme->titleUnfocusPixmap().pixmap().drawable();
|
||||||
else
|
else
|
||||||
return m_theme.menuiconPressedPixmap().pixmap().drawable();
|
return m_theme->menuiconPressedPixmap().pixmap().drawable();
|
||||||
}
|
}
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ class WinButtonTheme;
|
||||||
|
|
||||||
namespace FbTk{
|
namespace FbTk{
|
||||||
class Color;
|
class Color;
|
||||||
|
template <class T> class ThemeProxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// draws and handles basic window button graphic
|
/// draws and handles basic window button graphic
|
||||||
|
@ -39,7 +40,7 @@ public:
|
||||||
/// draw type for the button
|
/// draw type for the button
|
||||||
enum Type {MAXIMIZE, MINIMIZE, SHADE, STICK, CLOSE, MENUICON};
|
enum Type {MAXIMIZE, MINIMIZE, SHADE, STICK, CLOSE, MENUICON};
|
||||||
WinButton(const FluxboxWindow &listen_to,
|
WinButton(const FluxboxWindow &listen_to,
|
||||||
WinButtonTheme &theme,
|
FbTk::ThemeProxy<WinButtonTheme> &theme,
|
||||||
Type buttontype, const FbTk::FbWindow &parent, int x, int y,
|
Type buttontype, const FbTk::FbWindow &parent, int x, int y,
|
||||||
unsigned int width, unsigned int height);
|
unsigned int width, unsigned int height);
|
||||||
/// override for drawing
|
/// override for drawing
|
||||||
|
@ -59,7 +60,7 @@ private:
|
||||||
void drawType();
|
void drawType();
|
||||||
Type m_type; ///< the button type
|
Type m_type; ///< the button type
|
||||||
const FluxboxWindow &m_listen_to;
|
const FluxboxWindow &m_listen_to;
|
||||||
WinButtonTheme &m_theme;
|
FbTk::ThemeProxy<WinButtonTheme> &m_theme;
|
||||||
|
|
||||||
FbTk::FbPixmap m_icon_pixmap;
|
FbTk::FbPixmap m_icon_pixmap;
|
||||||
FbTk::FbPixmap m_icon_mask;
|
FbTk::FbPixmap m_icon_mask;
|
||||||
|
|
|
@ -27,7 +27,8 @@
|
||||||
|
|
||||||
#include "FbWinFrameTheme.hh"
|
#include "FbWinFrameTheme.hh"
|
||||||
|
|
||||||
WinButtonTheme::WinButtonTheme(int screen_num, FbWinFrameTheme &frame_theme):
|
WinButtonTheme::WinButtonTheme(int screen_num,
|
||||||
|
FbTk::ThemeProxy<FbWinFrameTheme> &frame_theme):
|
||||||
FbTk::Theme(screen_num),
|
FbTk::Theme(screen_num),
|
||||||
m_close_pm(*this, "window.close.pixmap", "Window.Close.Pixmap"),
|
m_close_pm(*this, "window.close.pixmap", "Window.Close.Pixmap"),
|
||||||
m_close_unfocus_pm(*this, "window.close.unfocus.pixmap", "Window.Close.Unfocus.Pixmap"),
|
m_close_unfocus_pm(*this, "window.close.unfocus.pixmap", "Window.Close.Unfocus.Pixmap"),
|
||||||
|
@ -66,11 +67,11 @@ WinButtonTheme::~WinButtonTheme() {
|
||||||
void WinButtonTheme::reconfigTheme() {
|
void WinButtonTheme::reconfigTheme() {
|
||||||
// rescale the pixmaps to match frame theme height
|
// rescale the pixmaps to match frame theme height
|
||||||
|
|
||||||
unsigned int size = m_frame_theme.titleHeight()
|
unsigned int size = m_frame_theme->titleHeight()
|
||||||
- 2 * m_frame_theme.bevelWidth();
|
- 2 * m_frame_theme->bevelWidth();
|
||||||
if (m_frame_theme.titleHeight() == 0) {
|
if (m_frame_theme->titleHeight() == 0) {
|
||||||
// calculate height from font and border width to scale pixmaps
|
// calculate height from font and border width to scale pixmaps
|
||||||
size = m_frame_theme.font().height() + 2;
|
size = m_frame_theme->font().height() + 2;
|
||||||
|
|
||||||
} // else use specified height to scale pixmaps
|
} // else use specified height to scale pixmaps
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,8 @@ class FbWinFrameTheme;
|
||||||
class WinButtonTheme: public FbTk::Theme,
|
class WinButtonTheme: public FbTk::Theme,
|
||||||
public FbTk::ThemeProxy<WinButtonTheme> {
|
public FbTk::ThemeProxy<WinButtonTheme> {
|
||||||
public:
|
public:
|
||||||
WinButtonTheme(int screen_num, FbWinFrameTheme &frame_theme);
|
WinButtonTheme(int screen_num,
|
||||||
|
FbTk::ThemeProxy<FbWinFrameTheme> &frame_theme);
|
||||||
~WinButtonTheme();
|
~WinButtonTheme();
|
||||||
|
|
||||||
void reconfigTheme();
|
void reconfigTheme();
|
||||||
|
@ -88,8 +89,8 @@ public:
|
||||||
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
||||||
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
|
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
|
||||||
|
|
||||||
virtual WinButtonTheme *operator ->() { return this; }
|
virtual WinButtonTheme &operator *() { return *this; }
|
||||||
virtual const WinButtonTheme *operator ->() const { return this; }
|
virtual const WinButtonTheme &operator *() const { return *this; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -104,7 +105,7 @@ private:
|
||||||
FbTk::ThemeItem<FbTk::PixmapWithMask> m_stick_pm, m_stick_unfocus_pm, m_stick_pressed_pm;
|
FbTk::ThemeItem<FbTk::PixmapWithMask> m_stick_pm, m_stick_unfocus_pm, m_stick_pressed_pm;
|
||||||
FbTk::ThemeItem<FbTk::PixmapWithMask> m_stuck_pm, m_stuck_unfocus_pm;
|
FbTk::ThemeItem<FbTk::PixmapWithMask> m_stuck_pm, m_stuck_unfocus_pm;
|
||||||
|
|
||||||
FbWinFrameTheme &m_frame_theme;
|
FbTk::ThemeProxy<FbWinFrameTheme> &m_frame_theme;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WINBUTTONTHEME_HH
|
#endif // WINBUTTONTHEME_HH
|
||||||
|
|
|
@ -261,8 +261,8 @@ private:
|
||||||
|
|
||||||
int FluxboxWindow::s_num_grabs = 0;
|
int FluxboxWindow::s_num_grabs = 0;
|
||||||
|
|
||||||
FluxboxWindow::FluxboxWindow(WinClient &client, FbWinFrameTheme &tm,
|
FluxboxWindow::FluxboxWindow(WinClient &client,
|
||||||
FbTk::XLayer &layer):
|
FbTk::ThemeProxy<FbWinFrameTheme> &tm, FbTk::XLayer &layer):
|
||||||
Focusable(client.screen(), this),
|
Focusable(client.screen(), this),
|
||||||
oplock(false),
|
oplock(false),
|
||||||
m_hintsig(*this),
|
m_hintsig(*this),
|
||||||
|
@ -401,8 +401,8 @@ void FluxboxWindow::init() {
|
||||||
Fluxbox &fluxbox = *Fluxbox::instance();
|
Fluxbox &fluxbox = *Fluxbox::instance();
|
||||||
|
|
||||||
// setup cursors for resize grips
|
// setup cursors for resize grips
|
||||||
frame().gripLeft().setCursor(frame().theme().lowerLeftAngleCursor());
|
frame().gripLeft().setCursor(frame().theme()->lowerLeftAngleCursor());
|
||||||
frame().gripRight().setCursor(frame().theme().lowerRightAngleCursor());
|
frame().gripRight().setCursor(frame().theme()->lowerRightAngleCursor());
|
||||||
|
|
||||||
associateClient(*m_client);
|
associateClient(*m_client);
|
||||||
|
|
||||||
|
@ -2777,12 +2777,12 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
|
||||||
doSnapping(dx, dy);
|
doSnapping(dx, dy);
|
||||||
|
|
||||||
if (! screen().doOpaqueMove()) {
|
if (! screen().doOpaqueMove()) {
|
||||||
parent().drawRectangle(screen().rootTheme().opGC(),
|
parent().drawRectangle(screen().rootTheme()->opGC(),
|
||||||
m_last_move_x, m_last_move_y,
|
m_last_move_x, m_last_move_y,
|
||||||
frame().width() + 2*frame().window().borderWidth()-1,
|
frame().width() + 2*frame().window().borderWidth()-1,
|
||||||
frame().height() + 2*frame().window().borderWidth()-1);
|
frame().height() + 2*frame().window().borderWidth()-1);
|
||||||
|
|
||||||
parent().drawRectangle(screen().rootTheme().opGC(),
|
parent().drawRectangle(screen().rootTheme()->opGC(),
|
||||||
dx, dy,
|
dx, dy,
|
||||||
frame().width() + 2*frame().window().borderWidth()-1,
|
frame().width() + 2*frame().window().borderWidth()-1,
|
||||||
frame().height() + 2*frame().window().borderWidth()-1);
|
frame().height() + 2*frame().window().borderWidth()-1);
|
||||||
|
@ -2874,13 +2874,13 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
|
||||||
old_resize_h != m_last_resize_h ) {
|
old_resize_h != m_last_resize_h ) {
|
||||||
|
|
||||||
// draw over old rect
|
// draw over old rect
|
||||||
parent().drawRectangle(screen().rootTheme().opGC(),
|
parent().drawRectangle(screen().rootTheme()->opGC(),
|
||||||
old_resize_x, old_resize_y,
|
old_resize_x, old_resize_y,
|
||||||
old_resize_w - 1 + 2 * frame().window().borderWidth(),
|
old_resize_w - 1 + 2 * frame().window().borderWidth(),
|
||||||
old_resize_h - 1 + 2 * frame().window().borderWidth());
|
old_resize_h - 1 + 2 * frame().window().borderWidth());
|
||||||
|
|
||||||
// draw resize rectangle
|
// draw resize rectangle
|
||||||
parent().drawRectangle(screen().rootTheme().opGC(),
|
parent().drawRectangle(screen().rootTheme()->opGC(),
|
||||||
m_last_resize_x, m_last_resize_y,
|
m_last_resize_x, m_last_resize_y,
|
||||||
m_last_resize_w - 1 + 2 * frame().window().borderWidth(),
|
m_last_resize_w - 1 + 2 * frame().window().borderWidth(),
|
||||||
m_last_resize_h - 1 + 2 * frame().window().borderWidth());
|
m_last_resize_h - 1 + 2 * frame().window().borderWidth());
|
||||||
|
@ -2897,10 +2897,10 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
|
||||||
// so we update drag'n'drop-rectangle
|
// so we update drag'n'drop-rectangle
|
||||||
int dx = me.x_root - m_button_grab_x, dy = me.y_root - m_button_grab_y;
|
int dx = me.x_root - m_button_grab_x, dy = me.y_root - m_button_grab_y;
|
||||||
|
|
||||||
parent().drawRectangle(screen().rootTheme().opGC(),
|
parent().drawRectangle(screen().rootTheme()->opGC(),
|
||||||
m_last_move_x, m_last_move_y,
|
m_last_move_x, m_last_move_y,
|
||||||
m_last_resize_w, m_last_resize_h);
|
m_last_resize_w, m_last_resize_h);
|
||||||
parent().drawRectangle(screen().rootTheme().opGC(),
|
parent().drawRectangle(screen().rootTheme()->opGC(),
|
||||||
dx, dy,
|
dx, dy,
|
||||||
m_last_resize_w, m_last_resize_h);
|
m_last_resize_w, m_last_resize_h);
|
||||||
|
|
||||||
|
@ -3010,7 +3010,7 @@ void FluxboxWindow::update(FbTk::Subject *subj) {
|
||||||
if (FocusControl::focusedFbWindow())
|
if (FocusControl::focusedFbWindow())
|
||||||
setFullscreenLayer();
|
setFullscreenLayer();
|
||||||
}
|
}
|
||||||
} else if (subj == &frame().theme().reconfigSig()) {
|
} else if (subj == &frame().theme()->reconfigSig()) {
|
||||||
reconfigTheme();
|
reconfigTheme();
|
||||||
frame().reconfigure();
|
frame().reconfigure();
|
||||||
}
|
}
|
||||||
|
@ -3022,7 +3022,7 @@ void FluxboxWindow::applyDecorations(bool initial) {
|
||||||
|
|
||||||
unsigned int border_width = 0;
|
unsigned int border_width = 0;
|
||||||
if (decorations.border)
|
if (decorations.border)
|
||||||
border_width = frame().theme().border(m_focused).width();
|
border_width = frame().theme()->border(m_focused).width();
|
||||||
|
|
||||||
bool client_move = false;
|
bool client_move = false;
|
||||||
|
|
||||||
|
@ -3165,7 +3165,7 @@ void FluxboxWindow::startMoving(int x, int y) {
|
||||||
// freely map and unmap the window we're moving.
|
// freely map and unmap the window we're moving.
|
||||||
grabPointer(screen().rootWindow().window(), False, ButtonMotionMask |
|
grabPointer(screen().rootWindow().window(), False, ButtonMotionMask |
|
||||||
ButtonReleaseMask, GrabModeAsync, GrabModeAsync,
|
ButtonReleaseMask, GrabModeAsync, GrabModeAsync,
|
||||||
screen().rootWindow().window(), frame().theme().moveCursor(), CurrentTime);
|
screen().rootWindow().window(), frame().theme()->moveCursor(), CurrentTime);
|
||||||
|
|
||||||
if (menu().isVisible())
|
if (menu().isVisible())
|
||||||
menu().hide();
|
menu().hide();
|
||||||
|
@ -3176,7 +3176,7 @@ void FluxboxWindow::startMoving(int x, int y) {
|
||||||
m_last_move_y = frame().y();
|
m_last_move_y = frame().y();
|
||||||
if (! screen().doOpaqueMove()) {
|
if (! screen().doOpaqueMove()) {
|
||||||
fluxbox->grab();
|
fluxbox->grab();
|
||||||
parent().drawRectangle(screen().rootTheme().opGC(),
|
parent().drawRectangle(screen().rootTheme()->opGC(),
|
||||||
frame().x(), frame().y(),
|
frame().x(), frame().y(),
|
||||||
frame().width() + 2*frame().window().borderWidth()-1,
|
frame().width() + 2*frame().window().borderWidth()-1,
|
||||||
frame().height() + 2*frame().window().borderWidth()-1);
|
frame().height() + 2*frame().window().borderWidth()-1);
|
||||||
|
@ -3200,7 +3200,7 @@ void FluxboxWindow::stopMoving(bool interrupted) {
|
||||||
|
|
||||||
|
|
||||||
if (! screen().doOpaqueMove()) {
|
if (! screen().doOpaqueMove()) {
|
||||||
parent().drawRectangle(screen().rootTheme().opGC(),
|
parent().drawRectangle(screen().rootTheme()->opGC(),
|
||||||
m_last_move_x, m_last_move_y,
|
m_last_move_x, m_last_move_y,
|
||||||
frame().width() + 2*frame().window().borderWidth()-1,
|
frame().width() + 2*frame().window().borderWidth()-1,
|
||||||
frame().height() + 2*frame().window().borderWidth()-1);
|
frame().height() + 2*frame().window().borderWidth()-1);
|
||||||
|
@ -3230,7 +3230,7 @@ void FluxboxWindow::pauseMoving() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
parent().drawRectangle(screen().rootTheme().opGC(),
|
parent().drawRectangle(screen().rootTheme()->opGC(),
|
||||||
m_last_move_x, m_last_move_y,
|
m_last_move_x, m_last_move_y,
|
||||||
frame().width() + 2*frame().window().borderWidth()-1,
|
frame().width() + 2*frame().window().borderWidth()-1,
|
||||||
frame().height() + 2*frame().window().borderWidth()-1);
|
frame().height() + 2*frame().window().borderWidth()-1);
|
||||||
|
@ -3250,7 +3250,7 @@ void FluxboxWindow::resumeMoving() {
|
||||||
|
|
||||||
FbTk::App::instance()->sync(false);
|
FbTk::App::instance()->sync(false);
|
||||||
|
|
||||||
parent().drawRectangle(screen().rootTheme().opGC(),
|
parent().drawRectangle(screen().rootTheme()->opGC(),
|
||||||
m_last_move_x, m_last_move_y,
|
m_last_move_x, m_last_move_y,
|
||||||
frame().width() + 2*frame().window().borderWidth()-1,
|
frame().width() + 2*frame().window().borderWidth()-1,
|
||||||
frame().height() + 2*frame().window().borderWidth()-1);
|
frame().height() + 2*frame().window().borderWidth()-1);
|
||||||
|
@ -3463,14 +3463,14 @@ void FluxboxWindow::startResizing(int x, int y, ResizeDirection dir) {
|
||||||
resizing = true;
|
resizing = true;
|
||||||
maximized = MAX_NONE;
|
maximized = MAX_NONE;
|
||||||
|
|
||||||
const Cursor& cursor = (m_resize_corner == LEFTTOP) ? frame().theme().upperLeftAngleCursor() :
|
const Cursor& cursor = (m_resize_corner == LEFTTOP) ? frame().theme()->upperLeftAngleCursor() :
|
||||||
(m_resize_corner == RIGHTTOP) ? frame().theme().upperRightAngleCursor() :
|
(m_resize_corner == RIGHTTOP) ? frame().theme()->upperRightAngleCursor() :
|
||||||
(m_resize_corner == RIGHTBOTTOM) ? frame().theme().lowerRightAngleCursor() :
|
(m_resize_corner == RIGHTBOTTOM) ? frame().theme()->lowerRightAngleCursor() :
|
||||||
(m_resize_corner == LEFT) ? frame().theme().leftSideCursor() :
|
(m_resize_corner == LEFT) ? frame().theme()->leftSideCursor() :
|
||||||
(m_resize_corner == RIGHT) ? frame().theme().rightSideCursor() :
|
(m_resize_corner == RIGHT) ? frame().theme()->rightSideCursor() :
|
||||||
(m_resize_corner == TOP) ? frame().theme().topSideCursor() :
|
(m_resize_corner == TOP) ? frame().theme()->topSideCursor() :
|
||||||
(m_resize_corner == BOTTOM) ? frame().theme().bottomSideCursor() :
|
(m_resize_corner == BOTTOM) ? frame().theme()->bottomSideCursor() :
|
||||||
frame().theme().lowerLeftAngleCursor();
|
frame().theme()->lowerLeftAngleCursor();
|
||||||
|
|
||||||
grabPointer(fbWindow().window(),
|
grabPointer(fbWindow().window(),
|
||||||
false, ButtonMotionMask | ButtonReleaseMask,
|
false, ButtonMotionMask | ButtonReleaseMask,
|
||||||
|
@ -3488,7 +3488,7 @@ void FluxboxWindow::startResizing(int x, int y, ResizeDirection dir) {
|
||||||
|
|
||||||
screen().showGeometry(gx, gy);
|
screen().showGeometry(gx, gy);
|
||||||
|
|
||||||
parent().drawRectangle(screen().rootTheme().opGC(),
|
parent().drawRectangle(screen().rootTheme()->opGC(),
|
||||||
m_last_resize_x, m_last_resize_y,
|
m_last_resize_x, m_last_resize_y,
|
||||||
m_last_resize_w - 1 + 2 * frame().window().borderWidth(),
|
m_last_resize_w - 1 + 2 * frame().window().borderWidth(),
|
||||||
m_last_resize_h - 1 + 2 * frame().window().borderWidth());
|
m_last_resize_h - 1 + 2 * frame().window().borderWidth());
|
||||||
|
@ -3497,7 +3497,7 @@ void FluxboxWindow::startResizing(int x, int y, ResizeDirection dir) {
|
||||||
void FluxboxWindow::stopResizing(bool interrupted) {
|
void FluxboxWindow::stopResizing(bool interrupted) {
|
||||||
resizing = false;
|
resizing = false;
|
||||||
|
|
||||||
parent().drawRectangle(screen().rootTheme().opGC(),
|
parent().drawRectangle(screen().rootTheme()->opGC(),
|
||||||
m_last_resize_x, m_last_resize_y,
|
m_last_resize_x, m_last_resize_y,
|
||||||
m_last_resize_w - 1 + 2 * frame().window().borderWidth(),
|
m_last_resize_w - 1 + 2 * frame().window().borderWidth(),
|
||||||
m_last_resize_h - 1 + 2 * frame().window().borderWidth());
|
m_last_resize_h - 1 + 2 * frame().window().borderWidth());
|
||||||
|
@ -3533,7 +3533,7 @@ void FluxboxWindow::startTabbing(const XButtonEvent &be) {
|
||||||
// start drag'n'drop for tab
|
// start drag'n'drop for tab
|
||||||
grabPointer(be.window, False, ButtonMotionMask |
|
grabPointer(be.window, False, ButtonMotionMask |
|
||||||
ButtonReleaseMask, GrabModeAsync, GrabModeAsync,
|
ButtonReleaseMask, GrabModeAsync, GrabModeAsync,
|
||||||
None, frame().theme().moveCursor(), CurrentTime);
|
None, frame().theme()->moveCursor(), CurrentTime);
|
||||||
|
|
||||||
// relative position on the button
|
// relative position on the button
|
||||||
m_button_grab_x = be.x;
|
m_button_grab_x = be.x;
|
||||||
|
@ -3558,7 +3558,7 @@ void FluxboxWindow::startTabbing(const XButtonEvent &be) {
|
||||||
m_last_resize_h = frame().height() + bw;
|
m_last_resize_h = frame().height() + bw;
|
||||||
}
|
}
|
||||||
|
|
||||||
parent().drawRectangle(screen().rootTheme().opGC(),
|
parent().drawRectangle(screen().rootTheme()->opGC(),
|
||||||
m_last_move_x, m_last_move_y,
|
m_last_move_x, m_last_move_y,
|
||||||
m_last_resize_w, m_last_resize_h);
|
m_last_resize_w, m_last_resize_h);
|
||||||
|
|
||||||
|
@ -3569,7 +3569,7 @@ void FluxboxWindow::attachTo(int x, int y, bool interrupted) {
|
||||||
if (m_attaching_tab == 0)
|
if (m_attaching_tab == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
parent().drawRectangle(screen().rootTheme().opGC(),
|
parent().drawRectangle(screen().rootTheme()->opGC(),
|
||||||
m_last_move_x, m_last_move_y,
|
m_last_move_x, m_last_move_y,
|
||||||
m_last_resize_w, m_last_resize_h);
|
m_last_resize_w, m_last_resize_h);
|
||||||
|
|
||||||
|
@ -3978,7 +3978,7 @@ void FluxboxWindow::updateButtons() {
|
||||||
CommandRef stick_cmd(new WindowCmd(*this, &FluxboxWindow::stick));
|
CommandRef stick_cmd(new WindowCmd(*this, &FluxboxWindow::stick));
|
||||||
CommandRef show_menu_cmd(new WindowCmd(*this, &FluxboxWindow::popupMenu));
|
CommandRef show_menu_cmd(new WindowCmd(*this, &FluxboxWindow::popupMenu));
|
||||||
|
|
||||||
WinButtonTheme &winbutton_theme = screen().winButtonTheme();
|
FbTk::ThemeProxy<WinButtonTheme> &winbutton_theme = screen().winButtonTheme();
|
||||||
|
|
||||||
for (size_t c = 0; c < 2 ; c++) {
|
for (size_t c = 0; c < 2 ; c++) {
|
||||||
// get titlebar configuration for current side
|
// get titlebar configuration for current side
|
||||||
|
@ -4073,8 +4073,8 @@ void FluxboxWindow::updateButtons() {
|
||||||
void FluxboxWindow::reconfigTheme() {
|
void FluxboxWindow::reconfigTheme() {
|
||||||
|
|
||||||
m_frame.setBorderWidth(decorations.border ?
|
m_frame.setBorderWidth(decorations.border ?
|
||||||
frame().theme().border(m_focused).width() : 0);
|
frame().theme()->border(m_focused).width() : 0);
|
||||||
if (decorations.handle && frame().theme().handleWidth() != 0)
|
if (decorations.handle && frame().theme()->handleWidth() != 0)
|
||||||
frame().showHandle();
|
frame().showHandle();
|
||||||
else
|
else
|
||||||
frame().hideHandle();
|
frame().hideHandle();
|
||||||
|
|
|
@ -151,8 +151,7 @@ public:
|
||||||
|
|
||||||
/// create a window from a client
|
/// create a window from a client
|
||||||
FluxboxWindow(WinClient &client,
|
FluxboxWindow(WinClient &client,
|
||||||
FbWinFrameTheme &tm,
|
FbTk::ThemeProxy<FbWinFrameTheme> &tm, FbTk::XLayer &layer);
|
||||||
FbTk::XLayer &layer);
|
|
||||||
|
|
||||||
virtual ~FluxboxWindow();
|
virtual ~FluxboxWindow();
|
||||||
|
|
||||||
|
|
|
@ -49,8 +49,8 @@ public:
|
||||||
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); }
|
||||||
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
|
virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }
|
||||||
|
|
||||||
virtual WorkspaceNameTheme *operator ->() { return this; }
|
virtual WorkspaceNameTheme &operator *() { return *this; }
|
||||||
virtual const WorkspaceNameTheme *operator ->() const { return this; }
|
virtual const WorkspaceNameTheme &operator *() const { return *this; }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -31,14 +31,14 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
WorkspaceNameTool::WorkspaceNameTool(const FbTk::FbWindow &parent,
|
WorkspaceNameTool::WorkspaceNameTool(const FbTk::FbWindow &parent,
|
||||||
ToolTheme &theme, BScreen &screen):
|
FbTk::ThemeProxy<ToolTheme> &theme, BScreen &screen):
|
||||||
ToolbarItem(ToolbarItem::FIXED),
|
ToolbarItem(ToolbarItem::FIXED),
|
||||||
m_button(parent, theme.font(), "a workspace name"),
|
m_button(parent, theme->font(), "a workspace name"),
|
||||||
m_theme(theme),
|
m_theme(theme),
|
||||||
m_screen(screen),
|
m_screen(screen),
|
||||||
m_pixmap(0) {
|
m_pixmap(0) {
|
||||||
// set text
|
// set text
|
||||||
m_button.setGC(m_theme.textGC());
|
m_button.setGC(m_theme->textGC());
|
||||||
m_button.setText(m_screen.currentWorkspace()->name());
|
m_button.setText(m_screen.currentWorkspace()->name());
|
||||||
|
|
||||||
// setup signals
|
// setup signals
|
||||||
|
@ -88,7 +88,7 @@ unsigned int WorkspaceNameTool::width() const {
|
||||||
BScreen::Workspaces::const_iterator it;
|
BScreen::Workspaces::const_iterator it;
|
||||||
for (it = workspaces.begin(); it != workspaces.end(); it++) {
|
for (it = workspaces.begin(); it != workspaces.end(); it++) {
|
||||||
const std::string &name = (*it)->name();
|
const std::string &name = (*it)->name();
|
||||||
max_size = std::max(m_theme.font().textWidth(name, name.size()),
|
max_size = std::max(m_theme->font().textWidth(name, name.size()),
|
||||||
max_size);
|
max_size);
|
||||||
}
|
}
|
||||||
// so align text dont cut the last character
|
// so align text dont cut the last character
|
||||||
|
@ -106,7 +106,7 @@ unsigned int WorkspaceNameTool::height() const {
|
||||||
BScreen::Workspaces::const_iterator it;
|
BScreen::Workspaces::const_iterator it;
|
||||||
for (it = workspaces.begin(); it != workspaces.end(); it++) {
|
for (it = workspaces.begin(); it != workspaces.end(); it++) {
|
||||||
const std::string &name = (*it)->name();
|
const std::string &name = (*it)->name();
|
||||||
max_size = std::max(m_theme.font().textWidth(name, name.size()),
|
max_size = std::max(m_theme->font().textWidth(name, name.size()),
|
||||||
max_size);
|
max_size);
|
||||||
}
|
}
|
||||||
// so align text dont cut the last character
|
// so align text dont cut the last character
|
||||||
|
@ -128,31 +128,31 @@ void WorkspaceNameTool::hide() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorkspaceNameTool::updateSizing() {
|
void WorkspaceNameTool::updateSizing() {
|
||||||
m_button.setBorderWidth(m_theme.border().width());
|
m_button.setBorderWidth(m_theme->border().width());
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorkspaceNameTool::reRender() {
|
void WorkspaceNameTool::reRender() {
|
||||||
if (m_theme.texture().usePixmap()) {
|
if (m_theme->texture().usePixmap()) {
|
||||||
if (m_pixmap)
|
if (m_pixmap)
|
||||||
m_screen.imageControl().removeImage(m_pixmap);
|
m_screen.imageControl().removeImage(m_pixmap);
|
||||||
m_pixmap = m_screen.imageControl().renderImage(width(), height(),
|
m_pixmap = m_screen.imageControl().renderImage(width(), height(),
|
||||||
m_theme.texture(), orientation());
|
m_theme->texture(), orientation());
|
||||||
m_button.setBackgroundPixmap(m_pixmap);
|
m_button.setBackgroundPixmap(m_pixmap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorkspaceNameTool::renderTheme(unsigned char alpha) {
|
void WorkspaceNameTool::renderTheme(unsigned char alpha) {
|
||||||
|
|
||||||
m_button.setJustify(m_theme.justify());
|
m_button.setJustify(m_theme->justify());
|
||||||
m_button.setBorderWidth(m_theme.border().width());
|
m_button.setBorderWidth(m_theme->border().width());
|
||||||
m_button.setBorderColor(m_theme.border().color());
|
m_button.setBorderColor(m_theme->border().color());
|
||||||
m_button.setAlpha(alpha);
|
m_button.setAlpha(alpha);
|
||||||
|
|
||||||
if (!m_theme.texture().usePixmap()) {
|
if (!m_theme->texture().usePixmap()) {
|
||||||
if (m_pixmap)
|
if (m_pixmap)
|
||||||
m_screen.imageControl().removeImage(m_pixmap);
|
m_screen.imageControl().removeImage(m_pixmap);
|
||||||
m_pixmap = 0;
|
m_pixmap = 0;
|
||||||
m_button.setBackgroundColor(m_theme.texture().color());
|
m_button.setBackgroundColor(m_theme->texture().color());
|
||||||
} else {
|
} else {
|
||||||
reRender();
|
reRender();
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,9 +31,13 @@
|
||||||
class BScreen;
|
class BScreen;
|
||||||
class ToolTheme;
|
class ToolTheme;
|
||||||
|
|
||||||
|
namespace FbTk {
|
||||||
|
template <class T> class ThemeProxy;
|
||||||
|
}
|
||||||
|
|
||||||
class WorkspaceNameTool: public ToolbarItem, public FbTk::Observer {
|
class WorkspaceNameTool: public ToolbarItem, public FbTk::Observer {
|
||||||
public:
|
public:
|
||||||
WorkspaceNameTool(const FbTk::FbWindow &parent, ToolTheme &theme, BScreen &screen);
|
WorkspaceNameTool(const FbTk::FbWindow &parent, FbTk::ThemeProxy<ToolTheme> &theme, BScreen &screen);
|
||||||
virtual ~WorkspaceNameTool();
|
virtual ~WorkspaceNameTool();
|
||||||
|
|
||||||
void move(int x, int y);
|
void move(int x, int y);
|
||||||
|
@ -59,7 +63,7 @@ private:
|
||||||
void reRender();
|
void reRender();
|
||||||
void updateSizing();
|
void updateSizing();
|
||||||
FbTk::TextButton m_button;
|
FbTk::TextButton m_button;
|
||||||
const ToolTheme &m_theme;
|
const FbTk::ThemeProxy<ToolTheme> &m_theme;
|
||||||
BScreen &m_screen;
|
BScreen &m_screen;
|
||||||
Pixmap m_pixmap;
|
Pixmap m_pixmap;
|
||||||
};
|
};
|
||||||
|
|
|
@ -61,8 +61,9 @@ private:
|
||||||
template <typename ItemType>
|
template <typename ItemType>
|
||||||
class XineramaHeadMenu : public FbMenu {
|
class XineramaHeadMenu : public FbMenu {
|
||||||
public:
|
public:
|
||||||
XineramaHeadMenu(FbTk::MenuTheme &tm, BScreen &screen, FbTk::ImageControl &imgctrl,
|
XineramaHeadMenu(FbTk::ThemeProxy<FbTk::MenuTheme> &tm, BScreen &screen,
|
||||||
FbTk::XLayer &layer, ItemType &item, const FbTk::FbString & title = "");
|
FbTk::ImageControl &imgctrl, FbTk::XLayer &layer,
|
||||||
|
ItemType &item, const FbTk::FbString & title = "");
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ItemType &m_object;
|
ItemType &m_object;
|
||||||
|
@ -70,8 +71,10 @@ private:
|
||||||
|
|
||||||
|
|
||||||
template <typename ItemType>
|
template <typename ItemType>
|
||||||
XineramaHeadMenu<ItemType>::XineramaHeadMenu(FbTk::MenuTheme &tm, BScreen &screen, FbTk::ImageControl &imgctrl,
|
XineramaHeadMenu<ItemType>::XineramaHeadMenu(
|
||||||
FbTk::XLayer &layer, ItemType &item, const FbTk::FbString & title):
|
FbTk::ThemeProxy<FbTk::MenuTheme> &tm, BScreen &screen,
|
||||||
|
FbTk::ImageControl &imgctrl, FbTk::XLayer &layer, ItemType &item,
|
||||||
|
const FbTk::FbString & title):
|
||||||
FbMenu(tm, imgctrl, layer),
|
FbMenu(tm, imgctrl, layer),
|
||||||
m_object(item)
|
m_object(item)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue