diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Tab.cc | 52 |
1 files changed, 37 insertions, 15 deletions
@@ -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.34 2002/10/15 17:06:29 fluxgen Exp $ | 22 | // $Id: Tab.cc,v 1.35 2002/10/22 14:42:58 fluxgen Exp $ |
23 | 23 | ||
24 | #include "Tab.hh" | 24 | #include "Tab.hh" |
25 | 25 | ||
@@ -383,20 +383,42 @@ void Tab::draw(bool pressed) const { | |||
383 | 383 | ||
384 | } else { | 384 | } else { |
385 | */ | 385 | */ |
386 | XClearWindow(m_display, m_tabwin); | 386 | int dx=m_win->frame.bevel_w*2; |
387 | Theme::WindowStyle *winstyle = m_win->getScreen()->getWindowStyle(); | ||
388 | int dlen = m_win->getTitle().size(); | ||
389 | int l = dlen; | ||
390 | if ( dlen > m_size_w) { | ||
391 | for (; dlen >= 0; dlen--) { | ||
392 | l = winstyle->tab.font.textWidth(m_win->getTitle().c_str(), dlen); | ||
393 | l += (dx * 4); | ||
394 | |||
395 | if (l < m_size_w) | ||
396 | break; | ||
397 | } | ||
398 | } | ||
399 | |||
400 | switch (winstyle->tab.justify) { | ||
401 | case DrawUtil::Font::RIGHT: | ||
402 | dx += m_size_w - l; | ||
403 | break; | ||
387 | 404 | ||
388 | tabtext_w = m_win->getScreen()->getWindowStyle()->tab.font.textWidth( | 405 | case DrawUtil::Font::CENTER: |
389 | m_win->getTitle().c_str(), m_win->getTitle().size()); | 406 | dx += (m_size_w - l) / 2; |
390 | tabtext_w += (m_win->frame.bevel_w * 4); | 407 | break; |
408 | default: | ||
409 | break; | ||
410 | } | ||
411 | |||
412 | XClearWindow(m_display, m_tabwin); | ||
391 | 413 | ||
392 | m_win->getScreen()->getWindowStyle()->tab.font.drawText( | 414 | m_win->getScreen()->getWindowStyle()->tab.font.drawText( |
393 | m_tabwin, | 415 | m_tabwin, |
394 | m_win->getScreen()->getScreenNumber(), | 416 | m_win->getScreen()->getScreenNumber(), |
395 | gc, | 417 | gc, |
396 | m_win->getTitle().c_str(), m_win->getTitle().size(), | 418 | m_win->getTitle().c_str(), dlen, |
397 | m_win->frame.bevel_w, | 419 | dx, |
398 | m_win->getScreen()->getWindowStyle()->tab.font.height()); | 420 | m_win->getScreen()->getWindowStyle()->tab.font.ascent() + m_win->frame.bevel_w); |
399 | //} | 421 | |
400 | } | 422 | } |
401 | 423 | ||
402 | //----------------------------------------------- | 424 | //----------------------------------------------- |
@@ -408,10 +430,10 @@ void Tab::draw(bool pressed) const { | |||
408 | int Tab::setPositionShadingHelper(bool shaded) { | 430 | int Tab::setPositionShadingHelper(bool shaded) { |
409 | if (shaded) { | 431 | if (shaded) { |
410 | return m_win->getYFrame() + m_win->getTitleHeight() + | 432 | return m_win->getYFrame() + m_win->getTitleHeight() + |
411 | m_win->getScreen()->getBorderWidth2x(); | 433 | m_win->getScreen()->getBorderWidth2x(); |
412 | } else { | 434 | } else { |
413 | return m_win->getYFrame() + m_win->getHeight() + | 435 | return m_win->getYFrame() + m_win->getHeight() + |
414 | m_win->getScreen()->getBorderWidth2x(); | 436 | m_win->getScreen()->getBorderWidth2x(); |
415 | } | 437 | } |
416 | } | 438 | } |
417 | 439 | ||