diff options
author | unknown <unknown> | 2002-01-11 11:59:54 (GMT) |
---|---|---|
committer | unknown <unknown> | 2002-01-11 11:59:54 (GMT) |
commit | 61661d638e34b3ce6c986d5a53b8c08c1051d422 (patch) | |
tree | f0b87676e95070afee163f76902efd0c4d5b5fe6 /src/IconBar.cc | |
parent | f98c3c9045397bd9497621deb55b310366f8a5de (diff) | |
parent | a3d2a1cf0a5ab724e19a91915fe97842f52260d5 (diff) | |
download | fluxbox-c325ffaa4e094163340f957e87463c8a526b4d5b.zip fluxbox-c325ffaa4e094163340f957e87463c8a526b4d5b.tar.bz2 |
This commit was manufactured by cvs2svn to create tagRelease-0_1_6
'Release-0_1_6'.
Diffstat (limited to 'src/IconBar.cc')
-rw-r--r-- | src/IconBar.cc | 61 |
1 files changed, 42 insertions, 19 deletions
diff --git a/src/IconBar.cc b/src/IconBar.cc index db3eabc..13f39c9 100644 --- a/src/IconBar.cc +++ b/src/IconBar.cc | |||
@@ -1,5 +1,5 @@ | |||
1 | // IconBar.cc | 1 | // IconBar.cc for Fluxbox Window Manager |
2 | // Copyright (c) 2001 Henrik Kinnunen (fluxgen@linuxmail.org) | 2 | // Copyright (c) 2001 - 2002 Henrik Kinnunen (fluxgen@linuxmail.org) |
3 | // | 3 | // |
4 | // Permission is hereby granted, free of charge, to any person obtaining a | 4 | // Permission is hereby granted, free of charge, to any person obtaining a |
5 | // copy of this software and associated documentation files (the "Software"), | 5 | // copy of this software and associated documentation files (the "Software"), |
@@ -19,21 +19,25 @@ | |||
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.7 2002/01/09 14:11:20 fluxgen Exp $ | ||
23 | |||
22 | #include "IconBar.hh" | 24 | #include "IconBar.hh" |
23 | #include "i18n.hh" | 25 | #include "i18n.hh" |
24 | 26 | ||
25 | IconBarObj::IconBarObj(FluxboxWindow *fluxboxwin, Window iconwin) { | 27 | IconBarObj::IconBarObj(FluxboxWindow *fluxboxwin, Window iconwin) |
26 | m_iconwin = iconwin; | 28 | { |
27 | m_fluxboxwin = fluxboxwin; | 29 | m_fluxboxwin = fluxboxwin; |
30 | m_iconwin = iconwin; | ||
28 | } | 31 | } |
29 | 32 | ||
30 | IconBarObj::~IconBarObj() { | 33 | IconBarObj::~IconBarObj() { |
31 | 34 | ||
32 | } | 35 | } |
33 | 36 | ||
34 | IconBar::IconBar(BScreen *scrn, Window parent) { | 37 | IconBar::IconBar(BScreen *scrn, Window parent): |
35 | m_parent = parent; | 38 | m_screen(scrn), |
36 | m_screen = scrn; | 39 | m_parent(parent) |
40 | { | ||
37 | m_iconlist = new IconList; | 41 | m_iconlist = new IconList; |
38 | m_display = scrn->getBaseDisplay()->getXDisplay(); | 42 | m_display = scrn->getBaseDisplay()->getXDisplay(); |
39 | } | 43 | } |
@@ -90,10 +94,10 @@ void IconBar::loadTheme(unsigned int width, unsigned int height) { | |||
90 | Pixmap tmp = m_focus_pm; | 94 | Pixmap tmp = m_focus_pm; |
91 | BTexture *texture = &(m_screen->getWindowStyle()->tab.l_focus); | 95 | BTexture *texture = &(m_screen->getWindowStyle()->tab.l_focus); |
92 | 96 | ||
93 | if (texture->getTexture() & BImage_ParentRelative ) { | 97 | if (texture->getTexture() & BImage::PARENTRELATIVE ) { |
94 | 98 | ||
95 | BTexture *pt = &(m_screen->getWindowStyle()->tab.t_focus); | 99 | BTexture *pt = &(m_screen->getWindowStyle()->tab.t_focus); |
96 | if (pt->getTexture() == (BImage_Flat | BImage_Solid)) { | 100 | if (pt->getTexture() == (BImage::FLAT | BImage::SOLID)) { |
97 | m_focus_pm = None; | 101 | m_focus_pm = None; |
98 | m_focus_pixel = pt->getColor()->getPixel(); | 102 | m_focus_pixel = pt->getColor()->getPixel(); |
99 | } else | 103 | } else |
@@ -102,7 +106,7 @@ void IconBar::loadTheme(unsigned int width, unsigned int height) { | |||
102 | 106 | ||
103 | } else { | 107 | } else { |
104 | 108 | ||
105 | if (texture->getTexture() == (BImage_Flat | BImage_Solid)) { | 109 | if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { |
106 | m_focus_pm = None; | 110 | m_focus_pm = None; |
107 | m_focus_pixel = texture->getColor()->getPixel(); | 111 | m_focus_pixel = texture->getColor()->getPixel(); |
108 | } else | 112 | } else |
@@ -150,14 +154,14 @@ void IconBar::exposeEvent(XExposeEvent *ee) { | |||
150 | } | 154 | } |
151 | 155 | ||
152 | if (obj) { | 156 | if (obj) { |
153 | 157 | ||
154 | Window root; | 158 | Window root; |
155 | unsigned int width, height; | 159 | unsigned int width, height; |
156 | unsigned int border_width, depth; //not used | 160 | unsigned int border_width, depth; //not used |
157 | int x, y; | 161 | int x, y; |
158 | XGetGeometry(m_display, m_parent, &root, &x, &y, &width, &height, | 162 | XGetGeometry(m_display, m_parent, &root, &x, &y, &width, &height, |
159 | &border_width, &depth); | 163 | &border_width, &depth); |
160 | 164 | ||
161 | //max width on every icon | 165 | //max width on every icon |
162 | unsigned int icon_width = width / m_iconlist->count(); | 166 | unsigned int icon_width = width / m_iconlist->count(); |
163 | 167 | ||
@@ -188,7 +192,7 @@ void IconBar::repositionIcons(void) { | |||
188 | 192 | ||
189 | //load right size of theme | 193 | //load right size of theme |
190 | loadTheme(icon_width, height); | 194 | loadTheme(icon_width, height); |
191 | 195 | ||
192 | IconListIterator it(m_iconlist); | 196 | IconListIterator it(m_iconlist); |
193 | 197 | ||
194 | for (x = 0; it.current(); it++, x+=icon_width) { | 198 | for (x = 0; it.current(); it++, x+=icon_width) { |
@@ -269,20 +273,19 @@ void IconBar::draw(IconBarObj *obj, int width) { | |||
269 | if (l < width) | 273 | if (l < width) |
270 | break; | 274 | break; |
271 | } | 275 | } |
272 | 276 | ||
273 | |||
274 | switch (m_screen->getWindowStyle()->tab.font.justify) { | 277 | switch (m_screen->getWindowStyle()->tab.font.justify) { |
275 | case FFont::Right: | 278 | case DrawUtil::Font::RIGHT: |
276 | dx += width - l; | 279 | dx += width - l; |
277 | break; | 280 | break; |
278 | case FFont::Center: | 281 | case DrawUtil::Font::CENTER: |
279 | dx += (width - l) / 2; | 282 | dx += (width - l) / 2; |
280 | break; | 283 | break; |
281 | default: | 284 | default: |
282 | break; | 285 | break; |
283 | } | 286 | } |
284 | 287 | ||
285 | //Draw title to m_tabwin | 288 | //Draw title to m_iconwin |
286 | 289 | ||
287 | XClearWindow(m_display, iconwin); | 290 | XClearWindow(m_display, iconwin); |
288 | 291 | ||
@@ -326,6 +329,7 @@ FluxboxWindow *IconBar::findWindow(Window w) { | |||
326 | // returns pointer to IconBarObj on success else | 329 | // returns pointer to IconBarObj on success else |
327 | // 0 on failure | 330 | // 0 on failure |
328 | //------------------------------------ | 331 | //------------------------------------ |
332 | |||
329 | IconBarObj *IconBar::findIcon(FluxboxWindow *fluxboxwin) { | 333 | IconBarObj *IconBar::findIcon(FluxboxWindow *fluxboxwin) { |
330 | 334 | ||
331 | IconListIterator it(m_iconlist); | 335 | IconListIterator it(m_iconlist); |
@@ -339,3 +343,22 @@ IconBarObj *IconBar::findIcon(FluxboxWindow *fluxboxwin) { | |||
339 | 343 | ||
340 | return 0; | 344 | return 0; |
341 | } | 345 | } |
346 | |||
347 | //---------- getIconWidth ------------ | ||
348 | // will return the width of an icon | ||
349 | // window | ||
350 | //------------------------------------ | ||
351 | unsigned int IconBarObj::getWidth() { | ||
352 | Window root; | ||
353 | |||
354 | unsigned int width, height; | ||
355 | unsigned int border_width, depth; //not used | ||
356 | int x, y; //not used | ||
357 | |||
358 | Display *m_display = Fluxbox::instance()->getXDisplay(); | ||
359 | |||
360 | XGetGeometry(m_display, m_iconwin, &root, &x, &y, | ||
361 | &width, &height, &border_width, &depth); | ||
362 | |||
363 | return width; | ||
364 | } | ||