diff --git a/examples/example1/src/example1.d b/examples/example1/src/example1.d
index 42dd6944..22ed6a74 100644
--- a/examples/example1/src/example1.d
+++ b/examples/example1/src/example1.d
@@ -452,10 +452,10 @@ extern (C) int UIAppMain(string[] args) {
HorizontalLayout line2 = new HorizontalLayout();
controls.addChild(line2);
- GroupBox gb5 = new GroupBox("scrollbar", "horizontal ScrollBar"d, Orientation.Horizontal);
+ GroupBox gb5 = new GroupBox("scrollbar", "horizontal ScrollBar"d);
gb5.addChild(new ScrollBar("sb1", Orientation.Horizontal).layoutWidth(FILL_PARENT));
line2.addChild(gb5);
- GroupBox gb6 = new GroupBox("scrollbar", "horizontal SliderWidget"d, Orientation.Horizontal);
+ GroupBox gb6 = new GroupBox("scrollbar", "horizontal SliderWidget"d);
gb6.addChild(new SliderWidget("sb2", Orientation.Horizontal).layoutWidth(FILL_PARENT));
line2.addChild(gb6);
diff --git a/src/dlangui/widgets/controls.d b/src/dlangui/widgets/controls.d
index 09e22275..bdd13d0a 100644
--- a/src/dlangui/widgets/controls.d
+++ b/src/dlangui/widgets/controls.d
@@ -1319,8 +1319,9 @@ class SliderWidget : AbstractSlider, OnClickHandler {
/// create with ID parameter
this(string ID, Orientation orient = Orientation.Horizontal) {
super(ID);
- styleId = STYLE_SCROLLBAR;
+ styleId = STYLE_SLIDER;
_orientation = orient;
+ _pageSize = 1;
_pageUp = new PageScrollButton("PAGE_UP");
_pageDown = new PageScrollButton("PAGE_DOWN");
_indicator = new SliderButton(style.customDrawableId(_orientation == Orientation.Vertical ? ATTR_SCROLLBAR_INDICATOR_VERTICAL : ATTR_SCROLLBAR_INDICATOR_HORIZONTAL));
@@ -1498,11 +1499,29 @@ class SliderWidget : AbstractSlider, OnClickHandler {
override void onDraw(DrawBuf buf) {
if (visibility != Visibility.Visible && !buf.isClippedOut(_pos))
return;
- super.onDraw(buf);
Rect rc = _pos;
applyMargins(rc);
- applyPadding(rc);
auto saver = ClipRectSaver(buf, rc, alpha);
+ DrawableRef bg = backgroundDrawable;
+ if (!bg.isNull) {
+ Rect r = rc;
+ if (_orientation == Orientation.Vertical) {
+ int dw = bg.width;
+ r.left += (rc.width - dw)/2;
+ r.right = left + dw;
+ } else {
+ int dw = bg.height;
+ r.top += (rc.height - dw)/2;
+ r.bottom = top + dw;
+ }
+ bg.drawTo(buf, r, state);
+ }
+ applyPadding(rc);
+ if (state & State.Focused) {
+ rc.expand(FOCUS_RECT_PADDING, FOCUS_RECT_PADDING);
+ drawFocusRect(buf, rc);
+ }
+ _needDraw = false;
_pageUp.onDraw(buf);
_pageDown.onDraw(buf);
_indicator.onDraw(buf);
diff --git a/src/dlangui/widgets/styles.d b/src/dlangui/widgets/styles.d
index 53b3012e..c9639617 100644
--- a/src/dlangui/widgets/styles.d
+++ b/src/dlangui/widgets/styles.d
@@ -71,14 +71,14 @@ immutable string STYLE_HSPACER = "HSPACER";
immutable string STYLE_VSPACER = "VSPACER";
/// standard style id for ScrollBar
immutable string STYLE_SCROLLBAR = "SCROLLBAR";
+/// standard style id for SliderWidget
+immutable string STYLE_SLIDER = "SLIDER";
/// standard style id for ScrollBar button
immutable string STYLE_SCROLLBAR_BUTTON = "SCROLLBAR_BUTTON";
/// standard style id for ScrollBar button
immutable string STYLE_SCROLLBAR_BUTTON_TRANSPARENT = "SCROLLBAR_BUTTON_TRANSPARENT";
/// standard style id for ScrollBar page control
immutable string STYLE_PAGE_SCROLL = "PAGE_SCROLL";
-/// standard style id for Slider
-immutable string STYLE_SLIDER = "SLIDER";
/// standard style id for TabWidget
immutable string STYLE_TAB_WIDGET = "TAB_WIDGET";
/// standard style id for Tab with Up alignment
diff --git a/views/res/slider_background.9.png b/views/res/slider_background.9.png
new file mode 100644
index 00000000..3e4cdfba
Binary files /dev/null and b/views/res/slider_background.9.png differ
diff --git a/views/res/theme_default.xml b/views/res/theme_default.xml
index 2a4f496a..b6ddc260 100644
--- a/views/res/theme_default.xml
+++ b/views/res/theme_default.xml
@@ -148,6 +148,10 @@
backgroundColor="#dce2e8"
align="Center"
/>
+