summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-04-15 12:06:11 (GMT)
committerfluxgen <fluxgen>2003-04-15 12:06:11 (GMT)
commitc09fbcd48073eac2beeca99e1e86acde5d768ba1 (patch)
tree0bb15daee4f94b2e3df321ab5fd86ac92844e3c5 /src
parent78d4f8f6105e07d289c8d5a63f46ab5a35bcfc33 (diff)
downloadfluxbox_lack-c09fbcd48073eac2beeca99e1e86acde5d768ba1.zip
fluxbox_lack-c09fbcd48073eac2beeca99e1e86acde5d768ba1.tar.bz2
minor cleaning
Diffstat (limited to 'src')
-rw-r--r--src/IconBar.cc61
-rw-r--r--src/IconBar.hh8
2 files changed, 26 insertions, 43 deletions
diff --git a/src/IconBar.cc b/src/IconBar.cc
index d4a3748..7a65b09 100644
--- a/src/IconBar.cc
+++ b/src/IconBar.cc
@@ -19,13 +19,12 @@
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.29 2003/04/14 14:44:17 fluxgen Exp $ 22// $Id: IconBar.cc,v 1.30 2003/04/15 12:05:47 fluxgen Exp $
23 23
24#include "IconBar.hh" 24#include "IconBar.hh"
25 25
26#include "i18n.hh" 26#include "i18n.hh"
27#include "Screen.hh" 27#include "Screen.hh"
28#include "fluxbox.hh"
29#include "Window.hh" 28#include "Window.hh"
30#include "ImageControl.hh" 29#include "ImageControl.hh"
31#include "Text.hh" 30#include "Text.hh"
@@ -52,9 +51,9 @@ unsigned int IconBarObj::width() const {
52 unsigned int border_width, depth; //not used 51 unsigned int border_width, depth; //not used
53 int x, y; //not used 52 int x, y; //not used
54 53
55 Display *m_display = Fluxbox::instance()->getXDisplay(); 54 Display *disp = FbTk::App::instance()->display();
56 55
57 XGetGeometry(m_display, m_iconwin, &root, &x, &y, 56 XGetGeometry(disp, m_iconwin, &root, &x, &y,
58 &width, &height, &border_width, &depth); 57 &width, &height, &border_width, &depth);
59 58
60 return width; 59 return width;
@@ -68,23 +67,24 @@ unsigned int IconBarObj::height() const {
68 unsigned int border_width, depth; //not used 67 unsigned int border_width, depth; //not used
69 int x, y; //not used 68 int x, y; //not used
70 69
71 Display *m_display = Fluxbox::instance()->getXDisplay(); 70 Display *disp = FbTk::App::instance()->display();
72 71
73 XGetGeometry(m_display, m_iconwin, &root, &x, &y, 72 XGetGeometry(disp, m_iconwin, &root, &x, &y,
74 &width, &height, &border_width, &depth); 73 &width, &height, &border_width, &depth);
75 74
76 return height; 75 return height;
77} 76}
78 77
79 78
80IconBar::IconBar(BScreen *scrn, Window parent, FbTk::Font &font): 79IconBar::IconBar(BScreen &scrn, Window parent, FbTk::Font &font):
81 m_screen(scrn), 80 m_screen(scrn),
81 m_display(FbTk::App::instance()->display()),
82 m_parent(parent), 82 m_parent(parent),
83 m_focus_pm(None), 83 m_focus_pm(None),
84 m_vertical(false), 84 m_vertical(false),
85 m_font(font) 85 m_font(font)
86{ 86{
87 m_display = scrn->getBaseDisplay()->getXDisplay(); 87
88} 88}
89 89
90IconBar::~IconBar() { 90IconBar::~IconBar() {
@@ -157,13 +157,13 @@ IconBar::WindowList *IconBar::delAllIcons() {
157 with the size width * height 157 with the size width * height
158*/ 158*/
159void IconBar::loadTheme(unsigned int width, unsigned int height) { 159void IconBar::loadTheme(unsigned int width, unsigned int height) {
160 FbTk::ImageControl *image_ctrl = m_screen->getImageControl(); 160 FbTk::ImageControl *image_ctrl = screen().getImageControl();
161 Pixmap tmp = m_focus_pm; 161 Pixmap tmp = m_focus_pm;
162 const FbTk::Texture *texture = &(m_screen->getWindowStyle()->tab.l_focus); 162 const FbTk::Texture *texture = &(screen().getWindowStyle()->tab.l_focus);
163 163
164 //If we are working on a PARENTRELATIVE, change to right focus value 164 //If we are working on a PARENTRELATIVE, change to right focus value
165 if (texture->type() & FbTk::Texture::PARENTRELATIVE ) { 165 if (texture->type() & FbTk::Texture::PARENTRELATIVE ) {
166 texture = &(m_screen->getWindowStyle()->tab.t_focus); 166 texture = &(screen().getWindowStyle()->tab.t_focus);
167 } 167 }
168 168
169 if (texture->type() == (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { 169 if (texture->type() == (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) {
@@ -184,8 +184,8 @@ void IconBar::loadTheme(unsigned int width, unsigned int height) {
184*/ 184*/
185void IconBar::decorate(Window win) { 185void IconBar::decorate(Window win) {
186 186
187 XSetWindowBorderWidth(m_display, win, m_screen->getWindowStyle()->tab.border_width); 187 XSetWindowBorderWidth(m_display, win, screen().getWindowStyle()->tab.border_width);
188 XSetWindowBorder(m_display, win, m_screen->getWindowStyle()->tab.border_color.pixel()); 188 XSetWindowBorder(m_display, win, screen().getWindowStyle()->tab.border_color.pixel());
189 if (m_focus_pm) 189 if (m_focus_pm)
190 XSetWindowBackgroundPixmap(m_display, win, m_focus_pm); 190 XSetWindowBackgroundPixmap(m_display, win, m_focus_pm);
191 else 191 else
@@ -314,34 +314,16 @@ void IconBar::draw(const IconBarObj * const obj, int width) const {
314 314
315 title_text_w = m_font.textWidth( 315 title_text_w = m_font.textWidth(
316 fluxboxwin->getIconTitle().c_str(), fluxboxwin->getIconTitle().size()); 316 fluxboxwin->getIconTitle().c_str(), fluxboxwin->getIconTitle().size());
317 int l = title_text_w; 317
318 unsigned int dlen=fluxboxwin->getIconTitle().size(); 318 unsigned int bevel_w = screen().getBevelWidth();
319 unsigned int bevel_w = m_screen->getBevelWidth();
320 int dx=bevel_w*2; 319 int dx=bevel_w*2;
321 /*
322 for (; dlen >= 0; dlen--) {
323 l = m_font.textWidth(
324 fluxboxwin->getIconTitle().c_str(), dlen);
325 l += (bevel_w * 4);
326
327 if (l < width)
328 break;
329 }
330 320
331 switch (m_screen->getWindowStyle()->tab.justify) {
332 case Text::Font::RIGHT:
333 dx += width - l;
334 break;
335 case Text::CENTER:
336 dx += (width - l) / 2;
337 break;
338 default:
339 break;
340 }*/
341 // center by default 321 // center by default
342 unsigned int newlen = 0; 322 unsigned int newlen = 0;
343 dx = FbTk::doAlignment(m_vertical ? obj->height() : obj->width(), bevel_w*2, FbTk::CENTER, m_font, 323 dx = FbTk::doAlignment(m_vertical ? obj->height() : obj->width(),
344 fluxboxwin->getIconTitle().c_str(), fluxboxwin->getIconTitle().size(), 324 bevel_w*2, FbTk::CENTER, m_font,
325 fluxboxwin->getIconTitle().c_str(),
326 fluxboxwin->getIconTitle().size(),
345 newlen); 327 newlen);
346 //Draw title to m_iconwin 328 //Draw title to m_iconwin
347 329
@@ -352,12 +334,11 @@ void IconBar::draw(const IconBarObj * const obj, int width) const {
352 dy = obj->height() - dx; 334 dy = obj->height() - dx;
353 dx = tmp; 335 dx = tmp;
354 } 336 }
355 //cerr<<"Drawing text: "<<dx<<", "<<dy<<endl;
356 337
357 m_font.drawText( 338 m_font.drawText(
358 iconwin, 339 iconwin,
359 m_screen->getScreenNumber(), 340 screen().getScreenNumber(),
360 m_screen->getWindowStyle()->tab.l_text_focus_gc, 341 screen().getWindowStyle()->tab.l_text_focus_gc,
361 fluxboxwin->getIconTitle().c_str(), newlen, 342 fluxboxwin->getIconTitle().c_str(), newlen,
362 dx, dy, m_vertical); 343 dx, dy, m_vertical);
363 344
diff --git a/src/IconBar.hh b/src/IconBar.hh
index f169fb0..ca2bd6d 100644
--- a/src/IconBar.hh
+++ b/src/IconBar.hh
@@ -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.hh,v 1.13 2003/04/14 14:43:58 fluxgen Exp $ 22// $Id: IconBar.hh,v 1.14 2003/04/15 12:06:11 fluxgen Exp $
23 23
24#ifndef ICONBAR_HH 24#ifndef ICONBAR_HH
25#define ICONBAR_HH 25#define ICONBAR_HH
@@ -58,7 +58,7 @@ class IconBar
58{ 58{
59public: 59public:
60 typedef std::list<Window> WindowList; 60 typedef std::list<Window> WindowList;
61 IconBar(BScreen *scrn, Window parent, FbTk::Font &font); 61 IconBar(BScreen &scrn, Window parent, FbTk::Font &font);
62 ~IconBar(); 62 ~IconBar();
63 void draw(); //TODO 63 void draw(); //TODO
64 void reconfigure(); 64 void reconfigure();
@@ -73,6 +73,8 @@ public:
73 73
74 void draw(const IconBarObj * const obj, int width) const; 74 void draw(const IconBarObj * const obj, int width) const;
75 void setVertical(bool value) { m_vertical = value; } 75 void setVertical(bool value) { m_vertical = value; }
76 BScreen &screen() { return m_screen; }
77 const BScreen &screen() const { return m_screen; }
76private: 78private:
77 typedef std::list<IconBarObj *> IconList; 79 typedef std::list<IconBarObj *> IconList;
78 80
@@ -80,7 +82,7 @@ private:
80 void decorate(Window win); 82 void decorate(Window win);
81 void repositionIcons(); 83 void repositionIcons();
82 Window createIconWindow(FluxboxWindow *fluxboxwin, Window parent); 84 Window createIconWindow(FluxboxWindow *fluxboxwin, Window parent);
83 BScreen *m_screen; 85 BScreen &m_screen;
84 Display *m_display; 86 Display *m_display;
85 Window m_parent; 87 Window m_parent;
86 IconList m_iconlist; 88 IconList m_iconlist;