aboutsummaryrefslogtreecommitdiff
path: root/src/IconButton.cc
diff options
context:
space:
mode:
authormarkt <markt>2007-04-07 17:39:27 (GMT)
committermarkt <markt>2007-04-07 17:39:27 (GMT)
commit12a8b3c038c9ccb577c699d41a1d19602132a7a8 (patch)
tree2a23392db366c10c8b6f7ee444ee8ac578010b5c /src/IconButton.cc
parent416578138e899f817b875ad55a5252a19aa6cb07 (diff)
downloadfluxbox-12a8b3c038c9ccb577c699d41a1d19602132a7a8.zip
fluxbox-12a8b3c038c9ccb577c699d41a1d19602132a7a8.tar.bz2
more of the same
Diffstat (limited to 'src/IconButton.cc')
-rw-r--r--src/IconButton.cc18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/IconButton.cc b/src/IconButton.cc
index 5cb47d1..04fc391 100644
--- a/src/IconButton.cc
+++ b/src/IconButton.cc
@@ -60,6 +60,8 @@ IconButton::IconButton(const FbTk::FbWindow &parent, IconbarTheme &theme,
60 m_unfocused_pm(win.screen().imageControl()) { 60 m_unfocused_pm(win.screen().imageControl()) {
61 61
62 m_win.titleSig().attach(this); 62 m_win.titleSig().attach(this);
63 m_win.focusSig().attach(this);
64 m_win.attentionSig().attach(this);
63 65
64 FbTk::EventManager::instance()->add(*this, m_icon_window); 66 FbTk::EventManager::instance()->add(*this, m_icon_window);
65 67
@@ -129,12 +131,11 @@ void IconButton::reconfigTheme() {
129 width(), height(), m_theme.unfocusedTexture(), 131 width(), height(), m_theme.unfocusedTexture(),
130 orientation())); 132 orientation()));
131 else 133 else
132 m_unfocused_pm.reset( 0 ); 134 m_unfocused_pm.reset(0);
133 135
134 setAlpha(parent()->alpha()); 136 setAlpha(parent()->alpha());
135 137
136 // TODO: this ignores attention state, which isn't in Focusable.hh yet 138 if (m_win.isFocused() || m_win.getAttentionState()) {
137 if (m_win.isFocused()) {
138 if (m_focused_pm != 0) 139 if (m_focused_pm != 0)
139 setBackgroundPixmap(m_focused_pm); 140 setBackgroundPixmap(m_focused_pm);
140 else 141 else
@@ -163,12 +164,18 @@ void IconButton::reconfigTheme() {
163} 164}
164 165
165void IconButton::update(FbTk::Subject *subj) { 166void IconButton::update(FbTk::Subject *subj) {
167 // if the window's focus state changed, we need to update the background
168 if (subj == &m_win.focusSig() || subj == &m_win.attentionSig()) {
169 reconfigTheme();
170 clear();
171 return;
172 }
173
166 // we got signal that either title or 174 // we got signal that either title or
167 // icon pixmap was updated, 175 // icon pixmap was updated,
168 // so we refresh everything 176 // so we refresh everything
169 177
170 Display *display = FbTk::App::instance()->display(); 178 Display *display = FbTk::App::instance()->display();
171
172 int screen = m_win.screen().screenNumber(); 179 int screen = m_win.screen().screenNumber();
173 180
174 if (m_use_pixmap && m_win.icon().pixmap().drawable() != None) { 181 if (m_use_pixmap && m_win.icon().pixmap().drawable() != None) {
@@ -190,7 +197,8 @@ void IconButton::update(FbTk::Subject *subj) {
190 197
191 m_icon_window.moveResize(iconx, icony, neww, newh); 198 m_icon_window.moveResize(iconx, icony, neww, newh);
192 199
193 m_icon_pixmap.copy(m_win.icon().pixmap().drawable(), DefaultDepth(display, screen), screen); 200 m_icon_pixmap.copy(m_win.icon().pixmap().drawable(),
201 DefaultDepth(display, screen), screen);
194 m_icon_pixmap.scale(m_icon_window.width(), m_icon_window.height()); 202 m_icon_pixmap.scale(m_icon_window.width(), m_icon_window.height());
195 203
196 // rotate the icon or not?? lets go not for now, and see what they say... 204 // rotate the icon or not?? lets go not for now, and see what they say...