From 6914d00eb772705ee9e2cced1629ac5938361cfe Mon Sep 17 00:00:00 2001 From: rathnor Date: Tue, 13 Jan 2004 14:41:32 +0000 Subject: toolbar transparency --- ChangeLog | 4 ++++ src/ButtonTool.cc | 4 +++- src/ClockTool.cc | 5 ++++- src/Container.cc | 15 +++++++++++---- src/GenericTool.cc | 4 +++- src/IconbarTheme.cc | 11 +++++++---- src/IconbarTheme.hh | 4 +++- src/IconbarTool.cc | 5 ++++- src/ToolTheme.cc | 9 +++++++-- src/ToolTheme.hh | 6 +++++- src/Toolbar.cc | 7 ++++++- src/WorkspaceNameTool.cc | 4 +++- 12 files changed, 60 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5a4076f..d1c3d01 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ (Format: Year/Month/Day) Changes for 0.9.8: +*04/01/14: + * Implement transparency for toolbar (Simon) + - can use toolbar.alpha, as well as toolbar..alpha + ToolTheme.hh/cc IconbarTheme.hh/cc *Tool.cc Container.cc Toolbar.cc *04/01/11: * Fixed ImageControl cache problem (Henrik) ImageControl.hh/cc diff --git a/src/ButtonTool.cc b/src/ButtonTool.cc index 6a3dfa4..a3b4d7b 100644 --- a/src/ButtonTool.cc +++ b/src/ButtonTool.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: ButtonTool.cc,v 1.2 2003/12/07 16:39:43 fluxgen Exp $ +// $Id: ButtonTool.cc,v 1.3 2004/01/13 14:41:32 rathnor Exp $ #include "ButtonTool.hh" @@ -54,6 +54,7 @@ void ButtonTool::renderTheme() { btn.setGC(static_cast(theme()).gc()); btn.setBorderColor(theme().border().color()); btn.setBorderWidth(theme().border().width()); + btn.setAlpha(theme().alpha()); Pixmap old_pm = m_cache_pm; if (!theme().texture().usePixmap()) { @@ -81,5 +82,6 @@ void ButtonTool::renderTheme() { m_image_ctrl.removeImage(old_pm); btn.clear(); + btn.updateTransparent(); } diff --git a/src/ClockTool.cc b/src/ClockTool.cc index 889c65e..a65a4ea 100644 --- a/src/ClockTool.cc +++ b/src/ClockTool.cc @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: ClockTool.cc,v 1.9 2003/12/19 18:26:48 fluxgen Exp $ +// $Id: ClockTool.cc,v 1.10 2004/01/13 14:41:32 rathnor Exp $ #include "ClockTool.hh" @@ -240,6 +240,7 @@ void ClockTool::updateTime() { } m_button.clear(); + m_button.updateTransparent(); } void ClockTool::renderTheme() { @@ -258,5 +259,7 @@ void ClockTool::renderTheme() { m_button.setJustify(m_theme.justify()); m_button.setBorderWidth(m_theme.border().width()); m_button.setBorderColor(m_theme.border().color()); + m_button.setAlpha(m_theme.alpha()); m_button.clear(); + m_button.updateTransparent(); } diff --git a/src/Container.cc b/src/Container.cc index e39c582..e41e4b5 100644 --- a/src/Container.cc +++ b/src/Container.cc @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Container.cc,v 1.10 2003/12/21 16:12:19 rathnor Exp $ +// $Id: Container.cc,v 1.11 2004/01/13 14:41:32 rathnor Exp $ #include "Container.hh" @@ -130,8 +130,10 @@ void Container::removeItem(int index) { void Container::removeAll() { m_selected = 0; m_item_list.clear(); - if (!m_update_lock) + if (!m_update_lock) { clear(); + updateTransparent(); + } } @@ -158,8 +160,10 @@ void Container::setSelected(int pos) { for (; pos != 0; --pos, ++it) continue; m_selected = *it; - if (m_selected) + if (m_selected) { m_selected->clear(); + m_selected->updateTransparent(); + } } } @@ -173,8 +177,10 @@ void Container::setAlignment(Container::Alignment a) { } void Container::exposeEvent(XExposeEvent &event) { - if (!m_update_lock) + if (!m_update_lock) { clearArea(event.x, event.y, event.width, event.height); + updateTransparent(event.x, event.y, event.width, event.height); + } } void Container::repositionItems() { @@ -212,6 +218,7 @@ void Container::repositionItems() { max_width_per_client + extra, height()); (*it)->clear(); + (*it)->updateTransparent(); } } diff --git a/src/GenericTool.cc b/src/GenericTool.cc index 0dcdf4c..05da41b 100644 --- a/src/GenericTool.cc +++ b/src/GenericTool.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: GenericTool.cc,v 1.2 2003/10/26 20:11:27 fluxgen Exp $ +// $Id: GenericTool.cc,v 1.3 2004/01/13 14:41:32 rathnor Exp $ #include "GenericTool.hh" #include "FbTk/FbWindow.hh" @@ -78,7 +78,9 @@ unsigned int GenericTool::borderWidth() const { void GenericTool::renderTheme() { + m_window->setAlpha(theme().alpha()); m_window->clear(); + m_window->updateTransparent(); } void GenericTool::update(FbTk::Subject *subj) { diff --git a/src/IconbarTheme.cc b/src/IconbarTheme.cc index 3c73376..69e0a7b 100644 --- a/src/IconbarTheme.cc +++ b/src/IconbarTheme.cc @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: IconbarTheme.cc,v 1.7 2003/08/29 00:48:41 fluxgen Exp $ +// $Id: IconbarTheme.cc,v 1.8 2004/01/13 14:41:32 rathnor Exp $ #include "IconbarTheme.hh" #include "FbTk/App.hh" @@ -37,7 +37,8 @@ IconbarTheme::IconbarTheme(int screen_num, m_border(*this, name, altname), m_focused_text(*this, name + ".focused", altname + ".Focused"), m_unfocused_text(*this, name + ".unfocused", altname + ".Unfocused"), - m_name(name) { + m_name(name), + m_alpha(*this, name+".alpha", altname+".Alpha") { FbTk::ThemeManager::instance().loadTheme(*this); @@ -103,9 +104,11 @@ bool IconbarTheme::fallback(FbTk::ThemeItem_base &item) { return tm.loadItem(item, "window.label.focus.textColor", "Window.Label.Focus.TextColor"); - } else if (item.name() == m_name + ".unfocused.textColor") + } else if (item.name() == m_name + ".unfocused.textColor") { return tm.loadItem(item, "window.label.unfocus.textColor", "Window.Label.Unfocus.TextColor"); - + } else if (item.name() == m_name + ".alpha") { + return tm.loadItem(item, "toolbar.alpha", "Toolbar.Alpha"); + } return false; } diff --git a/src/IconbarTheme.hh b/src/IconbarTheme.hh index 7545454..e0c76c6 100644 --- a/src/IconbarTheme.hh +++ b/src/IconbarTheme.hh @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: IconbarTheme.hh,v 1.5 2003/08/19 21:26:45 fluxgen Exp $ +// $Id: IconbarTheme.hh,v 1.6 2004/01/13 14:41:32 rathnor Exp $ #ifndef ICONBARTHEME_HH #define ICONBARTHEME_HH @@ -51,12 +51,14 @@ public: const FbTk::Texture &focusedTexture() const { return *m_focused_texture; } const FbTk::Texture &unfocusedTexture() const { return *m_unfocused_texture; } const FbTk::Texture &emptyTexture() const { return *m_empty_texture; } + inline unsigned char alpha() const { return *m_alpha; } private: FbTk::ThemeItem m_focused_texture, m_unfocused_texture, m_empty_texture; BorderTheme m_focused_border, m_unfocused_border, m_border; TextTheme m_focused_text, m_unfocused_text; std::string m_name; + FbTk::ThemeItem m_alpha; }; #endif // ICONBARTHEME_HH diff --git a/src/IconbarTool.cc b/src/IconbarTool.cc index ff10018..79ed89b 100644 --- a/src/IconbarTool.cc +++ b/src/IconbarTool.cc @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: IconbarTool.cc,v 1.28 2004/01/10 01:19:13 rathnor Exp $ +// $Id: IconbarTool.cc,v 1.29 2004/01/13 14:41:32 rathnor Exp $ #include "IconbarTool.hh" @@ -576,6 +576,7 @@ void IconbarTool::renderTheme() { m_icon_container.setBorderWidth(m_theme.border().width()); m_icon_container.setBorderColor(m_theme.border().color()); + m_icon_container.setAlpha(m_theme.alpha()); // update buttons IconList::iterator icon_it = m_icon_list.begin(); @@ -587,6 +588,7 @@ void IconbarTool::renderTheme() { void IconbarTool::renderButton(IconButton &button) { button.setPixmap(*m_rc_use_pixmap); + button.setAlpha(m_theme.alpha()); // if we're rendering a button, there must be a back button. // The last button is always the regular width @@ -628,6 +630,7 @@ void IconbarTool::renderButton(IconButton &button) { } button.clear(); + button.updateTransparent(); } void IconbarTool::deleteIcons() { diff --git a/src/ToolTheme.cc b/src/ToolTheme.cc index 730c9a3..f7dd118 100644 --- a/src/ToolTheme.cc +++ b/src/ToolTheme.cc @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: ToolTheme.cc,v 1.4 2003/08/29 00:46:18 fluxgen Exp $ +// $Id: ToolTheme.cc,v 1.5 2004/01/13 14:41:32 rathnor Exp $ #include "ToolTheme.hh" @@ -28,7 +28,8 @@ ToolTheme::ToolTheme(int screen_num, const std::string &name, const std::string FbTk::Theme(screen_num), TextTheme(*this, name, altname), m_texture(*this, name, altname), - m_border(*this, name, altname) { + m_border(*this, name, altname), + m_alpha(*this, name+".alpha", altname+".Alpha") { } @@ -46,6 +47,10 @@ bool ToolTheme::fallback(FbTk::ThemeItem_base &item) { return FbTk::ThemeManager::instance().loadItem(item, "toolbar.justify", "Toolbar.Justify"); + } else if (item.name().find(".alpha") != std::string::npos) { + return FbTk::ThemeManager::instance().loadItem(item, + "toolbar.alpha", + "Toolbar.Alpha"); } return false; diff --git a/src/ToolTheme.hh b/src/ToolTheme.hh index 24ae863..5ca5401 100644 --- a/src/ToolTheme.hh +++ b/src/ToolTheme.hh @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: ToolTheme.hh,v 1.4 2003/08/29 00:45:41 fluxgen Exp $ +// $Id: ToolTheme.hh,v 1.5 2004/01/13 14:41:32 rathnor Exp $ #ifndef TOOLTHEME_HH #define TOOLTHEME_HH @@ -34,6 +34,8 @@ #include #include +class ToolbarTheme; + /// Handles toolbar item theme for text and texture class ToolTheme: public FbTk::Theme, public TextTheme { public: @@ -46,6 +48,7 @@ public: // textures const FbTk::Texture &texture() const { return *m_texture; } const BorderTheme &border() const { return m_border; } + inline unsigned char alpha() const { return *m_alpha; } protected: FbTk::ThemeItem &textureTheme() { return m_texture; } @@ -53,6 +56,7 @@ protected: private: FbTk::ThemeItem m_texture; BorderTheme m_border; + FbTk::ThemeItem m_alpha; }; #endif // TOOLTHEME_HH diff --git a/src/Toolbar.cc b/src/Toolbar.cc index e804aed..b267b77 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Toolbar.cc,v 1.135 2004/01/11 16:08:57 fluxgen Exp $ +// $Id: Toolbar.cc,v 1.136 2004/01/13 14:41:32 rathnor Exp $ #include "Toolbar.hh" @@ -450,7 +450,9 @@ void Toolbar::reconfigure() { frame.window.setBorderColor(theme().border().color()); frame.window.setBorderWidth(theme().border().width()); + frame.window.setAlpha(theme().alpha()); frame.window.clear(); + frame.window.updateTransparent(); if (theme().shape() && m_shape.get()) m_shape->update(); @@ -543,6 +545,8 @@ void Toolbar::exposeEvent(XExposeEvent &ee) { if (ee.window == frame.window) { frame.window.clearArea(ee.x, ee.y, ee.width, ee.height); + frame.window.updateTransparent(ee.x, ee.y, + ee.width, ee.height); } } @@ -920,6 +924,7 @@ void Toolbar::rearrangeItems() { // unlock m_resize_lock = false; frame.window.clear(); + frame.window.updateTransparent(); } diff --git a/src/WorkspaceNameTool.cc b/src/WorkspaceNameTool.cc index e0a01f9..f2291e3 100644 --- a/src/WorkspaceNameTool.cc +++ b/src/WorkspaceNameTool.cc @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: WorkspaceNameTool.cc,v 1.6 2003/12/07 16:39:43 fluxgen Exp $ +// $Id: WorkspaceNameTool.cc,v 1.7 2004/01/13 14:41:32 rathnor Exp $ #include "WorkspaceNameTool.hh" @@ -123,5 +123,7 @@ void WorkspaceNameTool::renderTheme() { m_button.setJustify(m_theme.justify()); m_button.setBorderWidth(m_theme.border().width()); m_button.setBorderColor(m_theme.border().color()); + m_button.setAlpha(m_theme.alpha()); m_button.clear(); + m_button.updateTransparent(); } -- cgit v0.11.2