diff options
Diffstat (limited to 'gui/ScrollBarWidget.cpp')
-rw-r--r-- | gui/ScrollBarWidget.cpp | 75 |
1 files changed, 12 insertions, 63 deletions
diff --git a/gui/ScrollBarWidget.cpp b/gui/ScrollBarWidget.cpp index e373f04a1e..03182b35c0 100644 --- a/gui/ScrollBarWidget.cpp +++ b/gui/ScrollBarWidget.cpp @@ -179,73 +179,22 @@ void ScrollBarWidget::recalc() { } void ScrollBarWidget::drawWidget(bool hilite) { - NewGui *gui = &g_gui; - int bottomY = _y + _h - UP_DOWN_BOX_HEIGHT; - bool isSinglePage = (_numEntries <= _entriesPerPage); - OverlayColor color; - Graphics::Surface &surf = g_gui.getScreen(); - const int B = 3; - Common::Point p0, p1, p2; - - gui->frameRect(_x, _y, _w, _h, gui->_shadowcolor); - if (_draggingPart != kNoPart) _part = _draggingPart; - const int arrowSize = (_w / 2 - B + 1); - - // - // Up arrow - // - color = isSinglePage ? gui->_color : - (hilite && _part == kUpArrowPart) ? gui->_textcolorhi : gui->_textcolor; - gui->frameRect(_x, _y, _w, UP_DOWN_BOX_HEIGHT, gui->_color); - p0 = Common::Point(_x + _w / 2, _y + (UP_DOWN_BOX_HEIGHT - arrowSize - 1) / 2); - p1 = Common::Point(p0.x - arrowSize, p0.y + arrowSize); - p2 = Common::Point(p0.x + arrowSize, p0.y + arrowSize); -#if 0 - surf.drawLine(p0.x, p0.y, p1.x, p1.y, color); - surf.drawLine(p0.x, p0.y, p2.x, p2.y, color); -// surf.drawLine(p1.x, p1.y, p2.x, p2.y, color); -#else - // Evil HACK to draw filled triangle - for (; p1.x <= p2.x; ++p1.x) - surf.drawLine(p0.x, p0.y, p1.x, p1.y, color); -#endif - - // - // Down arrow - // - color = isSinglePage ? gui->_color : - (hilite && _part == kDownArrowPart) ? gui->_textcolorhi : gui->_textcolor; - gui->frameRect(_x, bottomY, _w, UP_DOWN_BOX_HEIGHT, gui->_color); - p0 = Common::Point(_x + _w / 2, bottomY + (UP_DOWN_BOX_HEIGHT + arrowSize + 1) / 2); - p1 = Common::Point(p0.x - arrowSize, p0.y - arrowSize); - p2 = Common::Point(p0.x + arrowSize, p0.y - arrowSize); - -#if 0 - surf.drawLine(p0.x, p0.y, p1.x, p1.y, color); - surf.drawLine(p0.x, p0.y, p2.x, p2.y, color); -// surf.drawLine(p1.x, p1.y, p2.x, p2.y, color); -#else - // Evil HACK to draw filled triangle - for (; p1.x <= p2.x; ++p1.x) - surf.drawLine(p0.x, p0.y, p1.x, p1.y, color); -#endif - - // - // Slider - // - if (!isSinglePage) { - gui->fillRect(_x, _y + _sliderPos, _w, _sliderHeight, - (hilite && _part == kSliderPart) ? gui->_textcolorhi : gui->_textcolor); - gui->frameRect(_x, _y + _sliderPos, _w, _sliderHeight, gui->_color); - int y = _y + _sliderPos + _sliderHeight / 2; - color = (hilite && _part == kSliderPart) ? gui->_color : gui->_shadowcolor; - gui->hLine(_x + 2, y - 2, _x + _w - 3, color); - gui->hLine(_x + 2, y, _x + _w - 3, color); - gui->hLine(_x + 2, y + 2, _x + _w-3, color); + Theme::kScrollbarState state = Theme::kScrollbarStateNo; + if (_numEntries <= _entriesPerPage) { + state = Theme::kScrollbarStateSinglePage; + } else if (_part == kUpArrowPart) { + state = Theme::kScrollbarStateUp; + } else if (_part == kDownArrowPart) { + state = Theme::kScrollbarStateDown; + } else if (_part == kSliderPart) { + state = Theme::kScrollbarStateSlider; } + + g_gui.theme()->drawScrollbar(Common::Rect(_x, _y, _x+_w, _y+_h), _sliderPos, _sliderHeight, state, + isEnabled() ? (hilite ? Theme::kStateHighlight : Theme::kStateEnabled) : Theme::kStateDisabled); } } // End of namespace GUI |