aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-11-26 16:40:57 (GMT)
committerfluxgen <fluxgen>2002-11-26 16:40:57 (GMT)
commit75eb138d4e07d6f1024963f4ac9561dfd7a34b54 (patch)
tree8328a46176eb5d9acf8f9371945fb93f9db7fd8d /src
parent48f3316064f1479ef29d1791903362e1fcc62aae (diff)
downloadfluxbox_paul-75eb138d4e07d6f1024963f4ac9561dfd7a34b54.zip
fluxbox_paul-75eb138d4e07d6f1024963f4ac9561dfd7a34b54.tar.bz2
using drawutil's doAligment function
Diffstat (limited to 'src')
-rw-r--r--src/Tab.cc32
1 files changed, 6 insertions, 26 deletions
diff --git a/src/Tab.cc b/src/Tab.cc
index c46d2c8..b2c0a3a 100644
--- a/src/Tab.cc
+++ b/src/Tab.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: Tab.cc,v 1.42 2002/11/25 14:07:21 fluxgen Exp $ 22// $Id: Tab.cc,v 1.43 2002/11/26 16:40:57 fluxgen Exp $
23 23
24#include "Tab.hh" 24#include "Tab.hh"
25 25
@@ -367,43 +367,23 @@ void Tab::draw(bool pressed) const {
367 GC gc = ((m_win->isFocused()) ? m_win->getScreen()->getWindowStyle()->tab.l_text_focus_gc : 367 GC gc = ((m_win->isFocused()) ? m_win->getScreen()->getWindowStyle()->tab.l_text_focus_gc :
368 m_win->getScreen()->getWindowStyle()->tab.l_text_unfocus_gc); 368 m_win->getScreen()->getWindowStyle()->tab.l_text_unfocus_gc);
369 369
370 int dx=0;
371 Theme::WindowStyle *winstyle = m_win->getScreen()->getWindowStyle(); 370 Theme::WindowStyle *winstyle = m_win->getScreen()->getWindowStyle();
372 size_t dlen = m_win->getTitle().size(); 371 size_t dlen = m_win->getTitle().size();
373 size_t l = winstyle->tab.font.textWidth(m_win->getTitle().c_str(), dlen);
374 372
375 size_t max_width = m_size_w; // special cases in rotated mode 373 size_t max_width = m_size_w; // special cases in rotated mode
376 if (winstyle->tab.font.isRotated()) 374 if (winstyle->tab.font.isRotated())
377 max_width = m_size_h; 375 max_width = m_size_h;
378 376
379 if ( l > m_size_w) { 377 int dx = DrawUtil::doAlignment(max_width, m_win->frame.bevel_w,
380 for (; dlen >= 0; dlen--) { 378 winstyle->tab.justify,
381 l = winstyle->tab.font.textWidth(m_win->getTitle().c_str(), dlen) + m_win->frame.bevel_w*4; 379 winstyle->tab.font,
382 380 m_win->getTitle().c_str(), m_win->getTitle().size(), dlen);
383 if (l < max_width || dlen == 0)
384 break;
385 }
386 }
387
388 switch (winstyle->tab.justify) {
389 case DrawUtil::Font::RIGHT:
390 dx += max_width - l - m_win->frame.bevel_w*3;
391 break;
392 case DrawUtil::Font::CENTER:
393 dx += (max_width - l) / 2;
394 break;
395 case DrawUtil::Font::LEFT:
396 dx = m_win->frame.bevel_w;
397 break;
398 default:
399 break;
400 }
401 381
402 int dy = winstyle->tab.font.ascent() + m_win->frame.bevel_w; 382 int dy = winstyle->tab.font.ascent() + m_win->frame.bevel_w;
403 // swap dx and dy if we're rotated 383 // swap dx and dy if we're rotated
404 if (winstyle->tab.font.isRotated()) { 384 if (winstyle->tab.font.isRotated()) {
405 int tmp = dy; 385 int tmp = dy;
406 dy = m_size_h - dx; // upside down 386 dy = m_size_h - dx; // upside down (reverse direction)
407 dx = tmp; 387 dx = tmp;
408 } 388 }
409 389