aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVicent Marti2008-07-24 18:40:36 +0000
committerVicent Marti2008-07-24 18:40:36 +0000
commit7c562788968060e7fe764b9946384fa88cdd4de4 (patch)
tree5f18678d03862f7274546c00982ee4a630b2d5a1
parent7f0aa32d51878f83d0af941561408b4b727a4a5e (diff)
downloadscummvm-rg350-7c562788968060e7fe764b9946384fa88cdd4de4.tar.gz
scummvm-rg350-7c562788968060e7fe764b9946384fa88cdd4de4.tar.bz2
scummvm-rg350-7c562788968060e7fe764b9946384fa88cdd4de4.zip
Scrollbars. Work in progress.
svn-id: r33264
-rw-r--r--gui/ThemeDefaultXML.cpp22
-rw-r--r--gui/ThemeRenderer.cpp26
-rw-r--r--gui/ThemeRenderer.h5
3 files changed, 47 insertions, 6 deletions
diff --git a/gui/ThemeDefaultXML.cpp b/gui/ThemeDefaultXML.cpp
index ba7689567e..64641b13a3 100644
--- a/gui/ThemeDefaultXML.cpp
+++ b/gui/ThemeDefaultXML.cpp
@@ -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>"
diff --git a/gui/ThemeRenderer.cpp b/gui/ThemeRenderer.cpp
index 8c111741b9..52c4e895a6 100644
--- a/gui/ThemeRenderer.cpp
+++ b/gui/ThemeRenderer.cpp
@@ -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) {
diff --git a/gui/ThemeRenderer.h b/gui/ThemeRenderer.h
index 1e3bec55b1..836f7d05fd 100644
--- a/gui/ThemeRenderer.h
+++ b/gui/ThemeRenderer.h
@@ -125,7 +125,10 @@ protected:
kDDTabInactive,
kDDScrollbarBase,
- kDDScrollbarHandle,
+ kDDScrollbarButtonIdle,
+ kDDScrollbarButtonHover,
+ kDDScrollbarHandleIdle,
+ kDDScrollbarHandleHover,
kDDPopUpIdle,
kDDPopUpHover,