Scrollbars. Work in progress.

svn-id: r33264
This commit is contained in:
Vicent Marti 2008-07-24 18:40:36 +00:00
parent 7f0aa32d51
commit 7c56278896
3 changed files with 47 additions and 6 deletions

View File

@ -54,7 +54,7 @@ bool ThemeRenderer::loadDefaultXML() {
"<defaults fill = 'gradient' fg_color = '255, 255, 255' />"
"<drawdata id = 'text_selection' cache = false>"
"<drawstep func = 'square' fill = 'foreground' fg_color = '255, 255, 255' />"
"<drawstep func = 'roundedsq' radius = 4 fill = 'foreground' fg_color = '255, 255, 255' />"
"</drawdata>"
"<drawdata id = 'mainmenu_bg' cache = false>"
@ -66,7 +66,25 @@ bool ThemeRenderer::loadDefaultXML() {
"</drawdata>"
"<drawdata id = 'scrollbar_base' cache = false>"
"<drawstep func = 'roundedsq' stroke = 1 radius = 4 fill = 'none' fg_color = '255, 255, 255' />"
"<drawstep func = 'roundedsq' stroke = 1 radius = 6 fill = 'background' fg_color = '120, 120, 120' bg_color = '255, 243, 206' />"
"</drawdata>"
"<drawdata id = 'scrollbar_handle_hover' cache = false>"
"<drawstep func = 'roundedsq' stroke = 1 radius = 6 fill = 'gradient' fg_color = '255, 255, 255' gradient_start = '206, 121, 99' gradient_end = '173, 40, 8' />"
"</drawdata>"
"<drawdata id = 'scrollbar_handle_idle' cache = false>"
"<drawstep func = 'roundedsq' stroke = 1 radius = 6 fill = 'background' fg_color = '120, 120, 120' bg_color = '255, 255, 255' />"
"</drawdata>"
"<drawdata id = 'scrollbar_button_idle' cache = false>"
"<drawstep func = 'roundedsq' radius = '4' fill = 'none' fg_color = '120, 120, 120' stroke = 1 />"
"<drawstep func = 'triangle' fg_color = '0, 0, 0' fill = 'foreground' width = '9' height = '7' xpos = 'center' ypos = 'center' orientation = 'top' />"
"</drawdata>"
"<drawdata id = 'scrollbar_button_hover' cache = false>"
"<drawstep func = 'roundedsq' radius = '4' fill = 'background' fg_color = '120, 120, 120' bg_color = '206, 121, 99' stroke = 1 />"
"<drawstep func = 'triangle' fg_color = '0, 0, 0' fill = 'foreground' width = '9' height = '7' xpos = 'center' ypos = 'center' orientation = 'top' />"
"</drawdata>"
"<drawdata id = 'tab_active' cache = false>"

View File

@ -64,7 +64,12 @@ const ThemeRenderer::DrawDataInfo ThemeRenderer::kDrawDataDefaults[] = {
{kDDTabInactive, "tab_inactive", true, kDDNone},
{kDDScrollbarBase, "scrollbar_base", true, kDDNone},
{kDDScrollbarHandle, "scrollbar_handle", false, kDDScrollbarBase},
{kDDScrollbarButtonIdle, "scrollbar_button_idle", true, kDDNone},
{kDDScrollbarButtonHover, "scrollbar_button_hover", false, kDDScrollbarButtonIdle},
{kDDScrollbarHandleIdle, "scrollbar_handle_idle", false, kDDNone},
{kDDScrollbarHandleHover, "scrollbar_handle_hover", false, kDDScrollbarBase},
{kDDPopUpIdle, "popup_idle", true, kDDNone},
{kDDPopUpHover, "popup_hover", false, kDDPopUpIdle},
@ -461,12 +466,27 @@ void ThemeRenderer::drawSlider(const Common::Rect &r, int width, WidgetStateInfo
queueDD(kDDSliderFull, r2);
}
void ThemeRenderer::drawScrollbar(const Common::Rect &r, int sliderY, int sliderHeight, ScrollbarState sb_state, WidgetStateInfo state) {
void ThemeRenderer::drawScrollbar(const Common::Rect &r, int sliderY, int sliderHeight, ScrollbarState scrollState, WidgetStateInfo state) {
if (!ready())
return;
queueDD(kDDScrollbarBase, r);
// TODO: Need to find a scrollbar in the GUI for testing... :p
Common::Rect r2 = r;
const int buttonExtra = (r.width() * 120) / 100;
r2.bottom = r2.top + buttonExtra;
queueDD(scrollState == kScrollbarStateUp ? kDDScrollbarButtonHover : kDDScrollbarButtonIdle, r2);
r2.translate(0, r.height() - r2.height());
queueDD(scrollState == kScrollbarStateDown ? kDDScrollbarButtonHover : kDDScrollbarButtonIdle, r2);
r2 = r;
r2.left += 1;
r2.right -= 1;
r2.top += sliderY;
r2.bottom = r2.top + sliderHeight - 1;
queueDD(scrollState == kScrollbarStateSlider ? kDDScrollbarHandleHover : kDDScrollbarHandleIdle, r2);
}
void ThemeRenderer::drawDialogBackground(const Common::Rect &r, uint16 hints, WidgetStateInfo state) {

View File

@ -125,7 +125,10 @@ protected:
kDDTabInactive,
kDDScrollbarBase,
kDDScrollbarHandle,
kDDScrollbarButtonIdle,
kDDScrollbarButtonHover,
kDDScrollbarHandleIdle,
kDDScrollbarHandleHover,
kDDPopUpIdle,
kDDPopUpHover,