toolbar transparency

This commit is contained in:
rathnor 2004-01-13 14:41:32 +00:00
parent 9475d7bc82
commit 6914d00eb7
12 changed files with 60 additions and 18 deletions

View file

@ -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.<tool>.alpha
ToolTheme.hh/cc IconbarTheme.hh/cc *Tool.cc Container.cc Toolbar.cc
*04/01/11:
* Fixed ImageControl cache problem (Henrik)
ImageControl.hh/cc

View file

@ -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<const ButtonTheme &>(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();
}

View file

@ -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();
}

View file

@ -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();
}
}

View file

@ -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) {

View file

@ -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;
}

View file

@ -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<FbTk::Texture> m_focused_texture, m_unfocused_texture, m_empty_texture;
BorderTheme m_focused_border, m_unfocused_border, m_border;
TextTheme m_focused_text, m_unfocused_text;
std::string m_name;
FbTk::ThemeItem<int> m_alpha;
};
#endif // ICONBARTHEME_HH

View file

@ -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() {

View file

@ -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;

View file

@ -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 <X11/Xlib.h>
#include <string>
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<FbTk::Texture> &textureTheme() { return m_texture; }
@ -53,6 +56,7 @@ protected:
private:
FbTk::ThemeItem<FbTk::Texture> m_texture;
BorderTheme m_border;
FbTk::ThemeItem<int> m_alpha;
};
#endif // TOOLTHEME_HH

View file

@ -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();
}

View file

@ -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();
}