TextDialog and ToolTipWindow style rendering bugs fixed

TextDialog windows (such as 'set title', or 'edit clock format') now
properly render their titlebar to match the current style.  Previously,
the titlebar font settings were controlled by window.font.*, and this
became apparent because window.font.effect needed to be set to put
'halo' on the titlebar of these TextDialogs.  However,
window.font.effect controls the effect on the text within the editbox on
these as well, having these set in the same location is far from
desirable.  Specifically because the TextDialog essentially emulates the
titlebar of other windows.  So, after this change, window.font.effect
still controls the text in the editbox, but the titlebar area is themed
as the titlebars of other windows.

Text justification of titlebar and border width, is now respected in
TextDialog.  Also, previously the edit box was sized in an odd way; one
which left part of the window actually undrawn (so you'd get artifacts
from whatever happened to be on the screen in that position when it
opened); this has been addressed.

TextDialogs, rather than going to the center of the entire desktop, now
center on the _current head_, which prevents the awful positioning where
half of the window is on one screen and half is on another.

Lastly, when hovering your mouse over the iconbar button for a window
with a title that's too wide to fit on the button, a tooltip is
displayed.  This tooltip themes itself to match the button, however it
wasn't using the theme properly (similarly to how TextDialog was)... and
as such, also wasn't using the proper font effects.  This has been
addressed just as it was for the TextDialog.
This commit is contained in:
nacitar sevaht 2011-05-16 12:21:47 -05:00 committed by Mathias Gumz
parent 16c90dc19f
commit fd6fbb80e7
2 changed files with 17 additions and 11 deletions

View file

@ -44,7 +44,7 @@ TextDialog::TextDialog(BScreen &screen,
const string &title) :
FbTk::FbWindow(screen.rootWindow().screenNumber(), 0, 0, 200, 1, ExposureMask),
m_textbox(*this, screen.focusedWinFrameTheme()->font(), ""),
m_label(*this, screen.focusedWinFrameTheme()->font(), title),
m_label(*this, screen.focusedWinFrameTheme()->iconbarTheme().text().font(), title),
m_gc(m_textbox),
m_screen(screen),
m_move_x(0),
@ -156,6 +156,7 @@ void TextDialog::init() {
// we listen to motion notify too
m_label.setEventMask(m_label.eventMask() | ButtonPressMask | ButtonMotionMask);
m_label.setGC(m_screen.focusedWinFrameTheme()->iconbarTheme().text().textGC());
m_label.setJustify(m_screen.focusedWinFrameTheme()->iconbarTheme().text().justify());
m_label.show();
// setup text box
@ -167,10 +168,14 @@ void TextDialog::init() {
m_textbox.show();
// setup this window
setBorderWidth(1);
setBackgroundColor(white);
// move to center of the screen
move((m_screen.width() - width())/2, (m_screen.height() - height())/2);
setBorderWidth(m_screen.focusedWinFrameTheme()->border().width());
setBorderColor(m_screen.focusedWinFrameTheme()->border().color());
// move to center of the current head
unsigned int head = m_screen.getCurrHead();
move(m_screen.getHeadX(head) + (m_screen.getHeadWidth(head) - width()) / 2,
m_screen.getHeadY(head) + (m_screen.getHeadHeight(head) - height()) / 2);
updateSizes();
resize(width(), m_textbox.height() + m_label.height());
@ -185,6 +190,6 @@ void TextDialog::updateSizes() {
m_label.moveResize(0, 0,
width(), m_textbox.font().height() + 2);
m_textbox.moveResize(2, m_label.height(),
width() - 4, m_textbox.font().height() + 2);
m_textbox.moveResize(0, m_label.height(),
width(), m_textbox.font().height() + 2);
}

View file

@ -55,8 +55,8 @@ void TooltipWindow::raiseTooltip() {
resize(m_lastText);
reconfigTheme();
int h = theme()->font().height() + theme()->bevelWidth() * 2;
int w = theme()->font().textWidth(m_lastText) + theme()->bevelWidth() * 2;
int h = theme()->iconbarTheme().text().font().height() + theme()->bevelWidth() * 2;
int w = theme()->iconbarTheme().text().font().textWidth(m_lastText) + theme()->bevelWidth() * 2;
Window root_ret; // not used
Window window_ret; // not used
@ -90,11 +90,12 @@ void TooltipWindow::raiseTooltip() {
show();
clear();
theme()->font().drawText(*this, screen().screenNumber(),
// TODO: make this use a TextButton like TextDialog does
theme()->iconbarTheme().text().font().drawText(*this, screen().screenNumber(),
theme()->iconbarTheme().text().textGC(),
m_lastText,
theme()->bevelWidth(),
theme()->bevelWidth() + theme()->font().ascent());
theme()->bevelWidth() + theme()->iconbarTheme().text().font().ascent());
}
void TooltipWindow::updateText(const FbTk::BiDiString& text) {