diff --git a/examples/spreadsheet/src/dlangui/widgets/spreadsheet.d b/examples/spreadsheet/src/dlangui/widgets/spreadsheet.d
index fa6323c6..e9de0d83 100644
--- a/examples/spreadsheet/src/dlangui/widgets/spreadsheet.d
+++ b/examples/spreadsheet/src/dlangui/widgets/spreadsheet.d
@@ -218,6 +218,19 @@ class SpreadSheetWidget : WidgetGroupDefaultDrawing, OnScrollHandler, CellSelect
/// Callback for handling of view scroll (top left visible cell change)
void onViewScrolled(GridWidgetBase source, int col, int row) {
+ if (source == _viewTopLeft) {
+ _viewTopRight.scrollTo(-1, row, source, false);
+ _viewBottomLeft.scrollTo(col, -1, source, false);
+ } else if (source == _viewTopRight) {
+ _viewTopLeft.scrollTo(-1, row, source, false);
+ _viewBottomRight.scrollTo(col, -1, source, false);
+ } else if (source == _viewBottomLeft) {
+ _viewTopLeft.scrollTo(col, -1, source, false);
+ _viewBottomRight.scrollTo(-1, row, source, false);
+ } else if (source == _viewBottomRight) {
+ _viewTopRight.scrollTo(col, -1, source, false);
+ _viewBottomLeft.scrollTo(-1, row, source, false);
+ }
}
}
diff --git a/src/dlangui/widgets/controls.d b/src/dlangui/widgets/controls.d
index 6200e178..4f7b66b3 100644
--- a/src/dlangui/widgets/controls.d
+++ b/src/dlangui/widgets/controls.d
@@ -623,7 +623,7 @@ class ScrollBar : AbstractSlider, OnClickHandler {
this(string resourceId) {
super("SLIDER", resourceId);
- styleId = STYLE_BUTTON_NOMARGINS;
+ styleId = STYLE_SCROLLBAR_BUTTON;
trackHover = true;
}
@@ -801,8 +801,8 @@ class ScrollBar : AbstractSlider, OnClickHandler {
_btnForward = new ImageButton("FORWARD", style.customDrawableId(_orientation == Orientation.Vertical ? ATTR_SCROLLBAR_BUTTON_DOWN : ATTR_SCROLLBAR_BUTTON_RIGHT));
_pageUp = new PageScrollButton("PAGE_UP");
_pageDown = new PageScrollButton("PAGE_DOWN");
- _btnBack.styleId = STYLE_SCROLLBAR_BUTTON;
- _btnForward.styleId = STYLE_SCROLLBAR_BUTTON;
+ _btnBack.styleId = STYLE_SCROLLBAR_BUTTON_TRANSPARENT;
+ _btnForward.styleId = STYLE_SCROLLBAR_BUTTON_TRANSPARENT;
_indicator = new SliderButton(style.customDrawableId(_orientation == Orientation.Vertical ? ATTR_SCROLLBAR_INDICATOR_VERTICAL : ATTR_SCROLLBAR_INDICATOR_HORIZONTAL));
addChild(_btnBack);
addChild(_btnForward);
diff --git a/src/dlangui/widgets/grid.d b/src/dlangui/widgets/grid.d
index 84779a55..74a59663 100644
--- a/src/dlangui/widgets/grid.d
+++ b/src/dlangui/widgets/grid.d
@@ -535,12 +535,12 @@ class GridWidgetBase : ScrollWidgetBase {
return scrollTo(_headerCols + _fixedCols + _scrollCol + dx, _headerRows + _fixedRows + _scrollRow + dy);
}
- /// set scroll position to show specified cell as top left in scrollable area
- bool scrollTo(int col, int row) {
+ /// set scroll position to show specified cell as top left in scrollable area; col or row -1 value means no change
+ bool scrollTo(int col, int row, GridWidgetBase source = null, bool doNotify = true) {
int oldx = _scrollCol;
int oldy = _scrollRow;
- int newScrollCol = col - _headerCols - _fixedCols;
- int newScrollRow = row - _headerRows - _fixedRows;
+ int newScrollCol = col == -1 ? _scrollCol : col - _headerCols - _fixedCols;
+ int newScrollRow = row == -1 ? _scrollRow : row - _headerRows - _fixedRows;
if (newScrollCol > _maxScrollCol)
newScrollCol = _maxScrollCol;
if (newScrollCol < 0)
@@ -565,7 +565,13 @@ class GridWidgetBase : ScrollWidgetBase {
//if (changed)
updateScrollBars();
invalidate();
- return oldx != _scrollCol || oldy != _scrollRow;
+ bool changed = oldx != _scrollCol || oldy != _scrollRow;
+ if (doNotify && changed && viewScrolled.assigned) {
+ if (source is null)
+ source = this;
+ viewScrolled(source, col, row);
+ }
+ return changed;
}
/// process horizontal scrollbar event
@@ -635,6 +641,9 @@ class GridWidgetBase : ScrollWidgetBase {
if (scrolled) {
updateScrollBars();
invalidate();
+ if (viewScrolled.assigned) {
+ viewScrolled(this, _scrollCol + _headerCols + _fixedCols, _scrollRow + _headerRows + _fixedRows);
+ }
}
}
diff --git a/src/dlangui/widgets/styles.d b/src/dlangui/widgets/styles.d
index 96821a98..fdef49c2 100644
--- a/src/dlangui/widgets/styles.d
+++ b/src/dlangui/widgets/styles.d
@@ -69,6 +69,8 @@ immutable string STYLE_VSPACER = "VSPACER";
immutable string STYLE_SCROLLBAR = "SCROLLBAR";
/// 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
diff --git a/views/res/scrollbar_btn_background.xml b/views/res/scrollbar_btn_background.xml
new file mode 100644
index 00000000..8d354638
--- /dev/null
+++ b/views/res/scrollbar_btn_background.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
diff --git a/views/res/scrollbar_btn_background_dark.xml b/views/res/scrollbar_btn_background_dark.xml
new file mode 100644
index 00000000..7c86b3e0
--- /dev/null
+++ b/views/res/scrollbar_btn_background_dark.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/views/res/scrollbar_btn_background_disabled.9.png b/views/res/scrollbar_btn_background_disabled.9.png
new file mode 100644
index 00000000..7dccd4ce
Binary files /dev/null and b/views/res/scrollbar_btn_background_disabled.9.png differ
diff --git a/views/res/scrollbar_btn_background_hover.9.png b/views/res/scrollbar_btn_background_hover.9.png
new file mode 100644
index 00000000..c018279f
Binary files /dev/null and b/views/res/scrollbar_btn_background_hover.9.png differ
diff --git a/views/res/scrollbar_btn_background_normal.9.png b/views/res/scrollbar_btn_background_normal.9.png
new file mode 100644
index 00000000..b3131244
Binary files /dev/null and b/views/res/scrollbar_btn_background_normal.9.png differ
diff --git a/views/res/scrollbar_btn_background_pressed.9.png b/views/res/scrollbar_btn_background_pressed.9.png
new file mode 100644
index 00000000..c6f7e46c
Binary files /dev/null and b/views/res/scrollbar_btn_background_pressed.9.png differ
diff --git a/views/res/scrollbar_btn_down.png b/views/res/scrollbar_btn_down.png
index 19ab977b..d37d8cc4 100644
Binary files a/views/res/scrollbar_btn_down.png and b/views/res/scrollbar_btn_down.png differ
diff --git a/views/res/scrollbar_btn_left.png b/views/res/scrollbar_btn_left.png
index 24ff0845..06ad0323 100644
Binary files a/views/res/scrollbar_btn_left.png and b/views/res/scrollbar_btn_left.png differ
diff --git a/views/res/scrollbar_btn_right.png b/views/res/scrollbar_btn_right.png
index 081a183b..fc03a576 100644
Binary files a/views/res/scrollbar_btn_right.png and b/views/res/scrollbar_btn_right.png differ
diff --git a/views/res/scrollbar_btn_transparent_background.xml b/views/res/scrollbar_btn_transparent_background.xml
new file mode 100644
index 00000000..43fe44f1
--- /dev/null
+++ b/views/res/scrollbar_btn_transparent_background.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
diff --git a/views/res/scrollbar_btn_up.png b/views/res/scrollbar_btn_up.png
index 1a229062..0fff3cff 100644
Binary files a/views/res/scrollbar_btn_up.png and b/views/res/scrollbar_btn_up.png differ
diff --git a/views/res/scrollbar_indicator_horizontal.png b/views/res/scrollbar_indicator_horizontal.png
index 1151c1e8..ea431b15 100644
Binary files a/views/res/scrollbar_indicator_horizontal.png and b/views/res/scrollbar_indicator_horizontal.png differ
diff --git a/views/res/scrollbar_indicator_vertical.png b/views/res/scrollbar_indicator_vertical.png
index ac0e1ae2..7b4f578c 100644
Binary files a/views/res/scrollbar_indicator_vertical.png and b/views/res/scrollbar_indicator_vertical.png differ
diff --git a/views/res/theme_default.xml b/views/res/theme_default.xml
index 86b9560c..bf7ba7a1 100644
--- a/views/res/theme_default.xml
+++ b/views/res/theme_default.xml
@@ -131,10 +131,16 @@
-
+
diff --git a/views/standard_resources.list b/views/standard_resources.list
index 0efcb2f3..1be15d16 100644
--- a/views/standard_resources.list
+++ b/views/standard_resources.list
@@ -213,12 +213,19 @@ res/menu_item_background.xml
res/menu_item_background_dark.xml
res/popup_menu_background_normal.9.png
res/popup_menu_background_normal_dark.9.png
+res/scrollbar_btn_background.xml
+res/scrollbar_btn_background_dark.xml
+res/scrollbar_btn_background_disabled.9.png
+res/scrollbar_btn_background_hover.9.png
+res/scrollbar_btn_background_normal.9.png
+res/scrollbar_btn_background_pressed.9.png
res/scrollbar_btn_down.png
res/scrollbar_btn_down_dark.png
res/scrollbar_btn_left.png
res/scrollbar_btn_left_dark.png
res/scrollbar_btn_right.png
res/scrollbar_btn_right_dark.png
+res/scrollbar_btn_transparent_background.xml
res/scrollbar_btn_up.png
res/scrollbar_btn_up_dark.png
res/scrollbar_indicator_horizontal.png