aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-10-29 15:53:45 (GMT)
committerfluxgen <fluxgen>2002-10-29 15:53:45 (GMT)
commit37b629be4b3740be11145923926c41dbc6ad5e79 (patch)
treea8293c1d4005c1427db0b559611c87b346c6fadd
parent4490ea459084752c9e4ae28cd91d5bf5debef290 (diff)
downloadfluxbox_paul-37b629be4b3740be11145923926c41dbc6ad5e79.zip
fluxbox_paul-37b629be4b3740be11145923926c41dbc6ad5e79.tar.bz2
cleaning and const fixes
-rw-r--r--src/IconBar.cc62
1 files changed, 20 insertions, 42 deletions
diff --git a/src/IconBar.cc b/src/IconBar.cc
index ed091a6..d49b60d 100644
--- a/src/IconBar.cc
+++ b/src/IconBar.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: IconBar.cc,v 1.17 2002/10/25 20:59:56 fluxgen Exp $ 22// $Id: IconBar.cc,v 1.18 2002/10/29 15:53:45 fluxgen Exp $
23 23
24#include "IconBar.hh" 24#include "IconBar.hh"
25#include "i18n.hh" 25#include "i18n.hh"
@@ -198,7 +198,7 @@ void IconBar::exposeEvent(XExposeEvent *ee) {
198//------------ repositionIcons ------------ 198//------------ repositionIcons ------------
199// Calculates and moves/resizes the icons 199// Calculates and moves/resizes the icons
200//----------------------------------------- 200//-----------------------------------------
201void IconBar::repositionIcons(void) { 201void IconBar::repositionIcons() {
202 if (m_iconlist.size() == 0) 202 if (m_iconlist.size() == 0)
203 return; 203 return;
204 204
@@ -255,26 +255,14 @@ Window IconBar::createIconWindow(FluxboxWindow *fluxboxwin, Window parent) {
255//------------ draw ------------------ 255//------------ draw ------------------
256// Draws theme and string to Window w 256// Draws theme and string to Window w
257//------------------------------------ 257//------------------------------------
258void IconBar::draw(IconBarObj *obj, int width) { 258void IconBar::draw(const IconBarObj * const obj, int width) const {
259 if (!obj) 259 if (!obj)
260 return; 260 return;
261 261
262 FluxboxWindow *fluxboxwin = obj->getFluxboxWin(); 262 const FluxboxWindow * const fluxboxwin = obj->getFluxboxWin();
263 Window iconwin = obj->getIconWin(); 263 Window iconwin = obj->getIconWin();
264 unsigned int title_text_w; 264 unsigned int title_text_w;
265 /* 265
266 const int multibyte = I18n::instance()->multibyte();
267
268 if (multibyte) {
269 XRectangle ink, logical;
270 XmbTextExtents(m_screen->getWindowStyle()->font.set,
271 fluxboxwin->getIconTitle().c_str(), fluxboxwin->getIconTitle().size(), &ink, &logical);
272 title_text_w = logical.width;
273 } else {
274 title_text_w = XTextWidth(m_screen->getWindowStyle()->font.fontstruct,
275 fluxboxwin->getIconTitle().c_str(), fluxboxwin->getIconTitle().size());
276 }
277 */
278 title_text_w = m_screen->getWindowStyle()->font.textWidth( 266 title_text_w = m_screen->getWindowStyle()->font.textWidth(
279 fluxboxwin->getIconTitle().c_str(), fluxboxwin->getIconTitle().size()); 267 fluxboxwin->getIconTitle().c_str(), fluxboxwin->getIconTitle().size());
280 int l = title_text_w; 268 int l = title_text_w;
@@ -283,16 +271,6 @@ void IconBar::draw(IconBarObj *obj, int width) {
283 int dx=bevel_w*2; 271 int dx=bevel_w*2;
284 272
285 for (; dlen >= 0; dlen--) { 273 for (; dlen >= 0; dlen--) {
286 /*if (multibyte) {
287 XRectangle ink, logical;
288 XmbTextExtents(m_screen->getWindowStyle()->tab.font.set,
289 fluxboxwin->getIconTitle().c_str(), dlen,
290 &ink, &logical);
291 l = logical.width;
292 } else
293 l = XTextWidth(m_screen->getWindowStyle()->tab.font.fontstruct,
294 fluxboxwin->getIconTitle().c_str(), dlen);
295 */
296 l = m_screen->getWindowStyle()->tab.font.textWidth( 274 l = m_screen->getWindowStyle()->tab.font.textWidth(
297 fluxboxwin->getIconTitle().c_str(), dlen); 275 fluxboxwin->getIconTitle().c_str(), dlen);
298 l += (bevel_w * 4); 276 l += (bevel_w * 4);
@@ -315,26 +293,13 @@ void IconBar::draw(IconBarObj *obj, int width) {
315 //Draw title to m_iconwin 293 //Draw title to m_iconwin
316 294
317 XClearWindow(m_display, iconwin); 295 XClearWindow(m_display, iconwin);
318 /* 296
319 if (multibyte) {
320 XmbDrawString(m_display, iconwin,
321 m_screen->getWindowStyle()->tab.font.set,
322 m_screen->getWindowStyle()->tab.l_text_focus_gc, dx,
323 1 - m_screen->getWindowStyle()->tab.font.set_extents->max_ink_extent.y,
324 fluxboxwin->getIconTitle().c_str(), dlen);
325 } else {
326 XDrawString(m_display, iconwin,
327 m_screen->getWindowStyle()->tab.l_text_focus_gc, dx,
328 m_screen->getWindowStyle()->tab.font.fontstruct->ascent + 1,
329 fluxboxwin->getIconTitle().c_str(), dlen);
330 }
331 */
332 m_screen->getWindowStyle()->tab.font.drawText( 297 m_screen->getWindowStyle()->tab.font.drawText(
333 iconwin, 298 iconwin,
334 m_screen->getScreenNumber(), 299 m_screen->getScreenNumber(),
335 m_screen->getWindowStyle()->tab.l_text_focus_gc, 300 m_screen->getWindowStyle()->tab.l_text_focus_gc,
336 fluxboxwin->getIconTitle().c_str(), dlen, 301 fluxboxwin->getIconTitle().c_str(), dlen,
337 dx, m_screen->getWindowStyle()->tab.font.height()); 302 dx, 1+ m_screen->getWindowStyle()->tab.font.ascent());
338 303
339} 304}
340 305
@@ -378,3 +343,16 @@ IconBarObj *IconBar::findIcon(FluxboxWindow *fluxboxwin) {
378 return 0; 343 return 0;
379} 344}
380 345
346const IconBarObj *IconBar::findIcon(const FluxboxWindow * const fluxboxwin) const {
347
348 IconList::const_iterator it = m_iconlist.begin();
349 IconList::const_iterator it_end = m_iconlist.end();
350 for (; it != it_end; ++it) {
351 IconBarObj *tmp = (*it);
352 if (tmp)
353 if (tmp->getFluxboxWin() == fluxboxwin)
354 return tmp;
355 }
356
357 return 0;
358}