justification fixes

This commit is contained in:
fluxgen 2002-11-17 13:40:01 +00:00
parent 1193d5b6e2
commit c515dc040a

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: Tab.cc,v 1.40 2002/11/15 14:06:33 fluxgen Exp $ // $Id: Tab.cc,v 1.41 2002/11/17 13:40:01 fluxgen Exp $
#include "Tab.hh" #include "Tab.hh"
@ -385,30 +385,31 @@ void Tab::draw(bool pressed) const {
} else { } else {
*/ */
int dx=m_win->frame.bevel_w*2; int dx=0;
Theme::WindowStyle *winstyle = m_win->getScreen()->getWindowStyle(); Theme::WindowStyle *winstyle = m_win->getScreen()->getWindowStyle();
size_t dlen = m_win->getTitle().size(); size_t dlen = m_win->getTitle().size();
size_t l = dlen; size_t l = winstyle->tab.font.textWidth(m_win->getTitle().c_str(), dlen);
if ( dlen > m_size_w) { if ( l > m_size_w) {
for (; dlen >= 0; dlen--) { for (; dlen >= 0; dlen--) {
l = winstyle->tab.font.textWidth(m_win->getTitle().c_str(), dlen); l = winstyle->tab.font.textWidth(m_win->getTitle().c_str(), dlen) + m_win->frame.bevel_w*4;
l += (dx * 4);
if (l < m_size_w || dlen == 0) if (l < m_size_w || dlen == 0)
break; break;
} }
} }
switch (winstyle->tab.justify) { switch (winstyle->tab.justify) {
case DrawUtil::Font::RIGHT: case DrawUtil::Font::RIGHT:
dx += m_size_w - l; dx += m_size_w - l - m_win->frame.bevel_w*3;
break; break;
case DrawUtil::Font::CENTER: case DrawUtil::Font::CENTER:
dx += (m_size_w - l) / 2; dx += (m_size_w - l) / 2;
break; break;
case DrawUtil::Font::LEFT:
dx = m_win->frame.bevel_w;
break;
default: default:
break; break;
} }
m_win->getScreen()->getWindowStyle()->tab.font.drawText( m_win->getScreen()->getWindowStyle()->tab.font.drawText(