mirror of https://github.com/buggins/dlangui.git
fix theme; fix slider style
This commit is contained in:
parent
3dc06f6057
commit
64a74bb277
|
@ -452,10 +452,10 @@ extern (C) int UIAppMain(string[] args) {
|
||||||
HorizontalLayout line2 = new HorizontalLayout();
|
HorizontalLayout line2 = new HorizontalLayout();
|
||||||
controls.addChild(line2);
|
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));
|
gb5.addChild(new ScrollBar("sb1", Orientation.Horizontal).layoutWidth(FILL_PARENT));
|
||||||
line2.addChild(gb5);
|
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));
|
gb6.addChild(new SliderWidget("sb2", Orientation.Horizontal).layoutWidth(FILL_PARENT));
|
||||||
line2.addChild(gb6);
|
line2.addChild(gb6);
|
||||||
|
|
||||||
|
|
|
@ -1319,8 +1319,9 @@ class SliderWidget : AbstractSlider, OnClickHandler {
|
||||||
/// create with ID parameter
|
/// create with ID parameter
|
||||||
this(string ID, Orientation orient = Orientation.Horizontal) {
|
this(string ID, Orientation orient = Orientation.Horizontal) {
|
||||||
super(ID);
|
super(ID);
|
||||||
styleId = STYLE_SCROLLBAR;
|
styleId = STYLE_SLIDER;
|
||||||
_orientation = orient;
|
_orientation = orient;
|
||||||
|
_pageSize = 1;
|
||||||
_pageUp = new PageScrollButton("PAGE_UP");
|
_pageUp = new PageScrollButton("PAGE_UP");
|
||||||
_pageDown = new PageScrollButton("PAGE_DOWN");
|
_pageDown = new PageScrollButton("PAGE_DOWN");
|
||||||
_indicator = new SliderButton(style.customDrawableId(_orientation == Orientation.Vertical ? ATTR_SCROLLBAR_INDICATOR_VERTICAL : ATTR_SCROLLBAR_INDICATOR_HORIZONTAL));
|
_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) {
|
override void onDraw(DrawBuf buf) {
|
||||||
if (visibility != Visibility.Visible && !buf.isClippedOut(_pos))
|
if (visibility != Visibility.Visible && !buf.isClippedOut(_pos))
|
||||||
return;
|
return;
|
||||||
super.onDraw(buf);
|
|
||||||
Rect rc = _pos;
|
Rect rc = _pos;
|
||||||
applyMargins(rc);
|
applyMargins(rc);
|
||||||
applyPadding(rc);
|
|
||||||
auto saver = ClipRectSaver(buf, rc, alpha);
|
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);
|
_pageUp.onDraw(buf);
|
||||||
_pageDown.onDraw(buf);
|
_pageDown.onDraw(buf);
|
||||||
_indicator.onDraw(buf);
|
_indicator.onDraw(buf);
|
||||||
|
|
|
@ -71,14 +71,14 @@ immutable string STYLE_HSPACER = "HSPACER";
|
||||||
immutable string STYLE_VSPACER = "VSPACER";
|
immutable string STYLE_VSPACER = "VSPACER";
|
||||||
/// standard style id for ScrollBar
|
/// standard style id for ScrollBar
|
||||||
immutable string STYLE_SCROLLBAR = "SCROLLBAR";
|
immutable string STYLE_SCROLLBAR = "SCROLLBAR";
|
||||||
|
/// standard style id for SliderWidget
|
||||||
|
immutable string STYLE_SLIDER = "SLIDER";
|
||||||
/// standard style id for ScrollBar button
|
/// standard style id for ScrollBar button
|
||||||
immutable string STYLE_SCROLLBAR_BUTTON = "SCROLLBAR_BUTTON";
|
immutable string STYLE_SCROLLBAR_BUTTON = "SCROLLBAR_BUTTON";
|
||||||
/// standard style id for ScrollBar button
|
/// standard style id for ScrollBar button
|
||||||
immutable string STYLE_SCROLLBAR_BUTTON_TRANSPARENT = "SCROLLBAR_BUTTON_TRANSPARENT";
|
immutable string STYLE_SCROLLBAR_BUTTON_TRANSPARENT = "SCROLLBAR_BUTTON_TRANSPARENT";
|
||||||
/// standard style id for ScrollBar page control
|
/// standard style id for ScrollBar page control
|
||||||
immutable string STYLE_PAGE_SCROLL = "PAGE_SCROLL";
|
immutable string STYLE_PAGE_SCROLL = "PAGE_SCROLL";
|
||||||
/// standard style id for Slider
|
|
||||||
immutable string STYLE_SLIDER = "SLIDER";
|
|
||||||
/// standard style id for TabWidget
|
/// standard style id for TabWidget
|
||||||
immutable string STYLE_TAB_WIDGET = "TAB_WIDGET";
|
immutable string STYLE_TAB_WIDGET = "TAB_WIDGET";
|
||||||
/// standard style id for Tab with Up alignment
|
/// standard style id for Tab with Up alignment
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 245 B |
|
@ -148,6 +148,10 @@
|
||||||
backgroundColor="#dce2e8"
|
backgroundColor="#dce2e8"
|
||||||
align="Center"
|
align="Center"
|
||||||
/>
|
/>
|
||||||
|
<style id="SLIDER"
|
||||||
|
backgroundImageId="slider_background"
|
||||||
|
align="Center"
|
||||||
|
/>
|
||||||
<style id="SCROLLBAR_BUTTON"
|
<style id="SCROLLBAR_BUTTON"
|
||||||
backgroundImageId="scrollbar_btn_background"
|
backgroundImageId="scrollbar_btn_background"
|
||||||
align="Center"
|
align="Center"
|
||||||
|
|
|
@ -50,6 +50,7 @@ res/frame_blue.9.png
|
||||||
res/group_box_frame_bottom.9.png
|
res/group_box_frame_bottom.9.png
|
||||||
res/group_box_frame_up_left.9.png
|
res/group_box_frame_up_left.9.png
|
||||||
res/group_box_frame_up_right.9.png
|
res/group_box_frame_up_right.9.png
|
||||||
|
res/slider_background.9.png
|
||||||
res/i18n/std_en.ini
|
res/i18n/std_en.ini
|
||||||
res/i18n/std_ru.ini
|
res/i18n/std_ru.ini
|
||||||
res/list_item_background.xml
|
res/list_item_background.xml
|
||||||
|
|
Loading…
Reference in New Issue