Widget backgrounds

svn-id: r33005
This commit is contained in:
Vicent Marti 2008-07-11 13:25:23 +00:00
parent a90be07c3e
commit e64711378e
3 changed files with 19 additions and 10 deletions

View File

@ -61,11 +61,12 @@ bool ThemeRenderer::loadDefaultXML() {
"</drawdata>" "</drawdata>"
"<drawdata id = 'checkbox_disabled' cache = false>" "<drawdata id = 'checkbox_disabled' cache = false>"
"<text vertical_align = 'center' horizontal_align = 'center' color = '255, 0, 0' />" "<text vertical_align = 'top' horizontal_align = 'left' color = '255, 255, 255' />"
"<drawstep func = 'square' fill = 'gradient' gradient_start = '206, 121, 99' gradient_end = '173, 40, 8' size = 'auto' shadow = 0 />" "<drawstep func = 'square' fill = 'gradient' gradient_start = '206, 121, 99' gradient_end = '173, 40, 8' size = 'auto' shadow = 0 />"
"</drawdata>" "</drawdata>"
"<drawdata id = 'checkbox_enabled' cache = false>" "<drawdata id = 'checkbox_enabled' cache = false>"
"<text vertical_align = 'top' horizontal_align = 'left' color = '255, 255, 255' />"
"<drawstep func = 'square' fill = 'gradient' gradient_start = '206, 121, 99' gradient_end = '173, 40, 8' size = 'auto' shadow = 0 />" "<drawstep func = 'square' fill = 'gradient' gradient_start = '206, 121, 99' gradient_end = '173, 40, 8' size = 'auto' shadow = 0 />"
"<drawstep func = 'circle' radius = 'auto' fill = 'foreground' />" "<drawstep func = 'circle' radius = 'auto' fill = 'foreground' />"
"</drawdata>" "</drawdata>"

View File

@ -323,18 +323,17 @@ void ThemeRenderer::drawCheckbox(const Common::Rect &r, const Common::String &st
return; return;
Common::Rect r2 = r; Common::Rect r2 = r;
int checkBoxSize = getFontHeight(); const int checkBoxSize = MIN((int)r.height(), getFontHeight());
if (checkBoxSize > r.height())
checkBoxSize = r.height();
r2.bottom = r2.top + checkBoxSize; r2.bottom = r2.top + checkBoxSize;
r2.right = r2.left + checkBoxSize; r2.right = r2.left + checkBoxSize;
drawDD(checked ? kDDCheckboxEnabled : kDDCheckboxDisabled, r2); drawDD(checked ? kDDCheckboxEnabled : kDDCheckboxDisabled, r2);
// TODO: text drawing r2.left = r2.right + checkBoxSize;
// getFont()->drawString(&_screen, str, r2.left, r2.top, r2.width(), getColor(state), Graphics::kTextAlignLeft, 0, false); r2.right = r.right;
drawDDText(checked ? kDDCheckboxEnabled : kDDCheckboxDisabled, r2, str);
addDirtyRect(r); addDirtyRect(r);
debugWidgetPosition(r); debugWidgetPosition(r);
@ -365,7 +364,16 @@ void ThemeRenderer::drawScrollbar(const Common::Rect &r, int sliderY, int slider
void ThemeRenderer::drawDialogBackground(const Common::Rect &r, uint16 hints, WidgetStateInfo state) { void ThemeRenderer::drawDialogBackground(const Common::Rect &r, uint16 hints, WidgetStateInfo state) {
if (!ready()) if (!ready())
return; return;
if (hints & THEME_HINT_MAIN_DIALOG)
drawDD(kDDMainDialogBackground, r);
else if (hints & THEME_HINT_SPECIAL_COLOR)
drawDD(kDDSpecialColorBackground, r);
else if (hints & THEME_HINT_PLAIN_COLOR)
drawDD(kDDPlainColorBackground, r);
else
drawDD(kDDDefaultBackground, r);
debugWidgetPosition(r); debugWidgetPosition(r);
} }

View File

@ -85,7 +85,7 @@ public:
kDDMainDialogBackground, kDDMainDialogBackground,
kDDSpecialColorBackground, kDDSpecialColorBackground,
kDDPlainColorBackground, kDDPlainColorBackground,
kDDDefaulBackground, kDDDefaultBackground,
kDDButtonIdle, kDDButtonIdle,
kDDButtonHover, kDDButtonHover,