summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2019-03-03 10:13:35 +0100
committerTomaž Vajngerl <quikee@gmail.com>2019-03-06 20:59:59 +0100
commitcddf072a62208d2514f97ba5c0d3577d7d88b8de (patch)
tree4161a878d642a9a902f290a60b803799d3bfa350 /vcl
parentfd57cdfc772713c9d7ccd4544063deedf744c633 (diff)
Update drawing of spinbox from definition
Use SVG to describe the left, right spin button and the entire spinbox widget. Change-Id: I082ee08942fa3fa4145fd7bf53fc2cfc9fc06fd2 Reviewed-on: https://gerrit.libreoffice.org/68818 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/Package_theme_definitions.mk1
-rw-r--r--vcl/source/gdi/FileDefinitionWidgetDraw.cxx106
-rw-r--r--vcl/uiconfig/theme_definitions/definition.xml11
-rw-r--r--vcl/uiconfig/theme_definitions/spinbox-entire.svgx3
-rw-r--r--vcl/uiconfig/theme_definitions/spinbox-left.svgx6
-rw-r--r--vcl/uiconfig/theme_definitions/spinbox-right.svgx7
6 files changed, 88 insertions, 46 deletions
diff --git a/vcl/Package_theme_definitions.mk b/vcl/Package_theme_definitions.mk
index e28ae0911733..282a07a47df4 100644
--- a/vcl/Package_theme_definitions.mk
+++ b/vcl/Package_theme_definitions.mk
@@ -25,6 +25,7 @@ $(eval $(call gb_Package_add_files,vcl_theme_definitions,$(LIBO_SHARE_FOLDER)/th
tick-on-disabled.svgx \
spinbox-left.svgx \
spinbox-right.svgx \
+ spinbox-entire.svgx \
))
# vim: set noet sw=4 ts=4:
diff --git a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
index 4160a2a0ada4..804bddb527fe 100644
--- a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
+++ b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
@@ -565,46 +565,88 @@ bool FileDefinitionWidgetDraw::getNativeControlRegion(
ControlState /*eState*/, const ImplControlValue& /*aValue*/, const OUString& /*aCaption*/,
tools::Rectangle& rNativeBoundingRegion, tools::Rectangle& rNativeContentRegion)
{
+ Point aLocation(rBoundingControlRegion.TopLeft());
+
switch (eType)
{
case ControlType::Spinbox:
{
- Size aButtonSize(32, 32);
- Point aLocation(rBoundingControlRegion.TopLeft());
+ Size aButtonSize(44, 26);
+ OString sOrientation = "decrease-edit-increase";
- if (ePart == ControlPart::ButtonUp)
- {
- rNativeContentRegion = tools::Rectangle(
- Point(aLocation.X() + rBoundingControlRegion.GetWidth() - aButtonSize.Width(),
- aLocation.Y()),
- aButtonSize);
- rNativeBoundingRegion = rNativeContentRegion;
- return true;
- }
- else if (ePart == ControlPart::ButtonDown)
+ if (sOrientation == "decrease-edit-increase")
{
- rNativeContentRegion
- = tools::Rectangle(Point(aLocation.X() + rBoundingControlRegion.GetWidth()
- - (2 * aButtonSize.Width()),
- aLocation.Y()),
- aButtonSize);
- rNativeBoundingRegion = rNativeContentRegion;
- return true;
- }
- else if (ePart == ControlPart::SubEdit)
- {
- rNativeContentRegion = tools::Rectangle(
- aLocation, Size(rBoundingControlRegion.GetWidth() - (2 * aButtonSize.Width()),
- aButtonSize.Height()));
- rNativeBoundingRegion = rNativeContentRegion;
- return true;
+ if (ePart == ControlPart::ButtonUp)
+ {
+ rNativeContentRegion
+ = tools::Rectangle(Point(aLocation.X() + rBoundingControlRegion.GetWidth()
+ - aButtonSize.Width(),
+ aLocation.Y()),
+ aButtonSize);
+ rNativeBoundingRegion = rNativeContentRegion;
+ return true;
+ }
+ else if (ePart == ControlPart::ButtonDown)
+ {
+ rNativeContentRegion = tools::Rectangle(aLocation, aButtonSize);
+ rNativeBoundingRegion = rNativeContentRegion;
+ return true;
+ }
+ else if (ePart == ControlPart::SubEdit)
+ {
+ Point aPoint(aLocation.X() + aButtonSize.getWidth(), aLocation.Y());
+ Size aSize(rBoundingControlRegion.GetWidth() - (2 * aButtonSize.Width()),
+ aButtonSize.Height());
+ rNativeContentRegion = tools::Rectangle(aPoint, aSize);
+ rNativeBoundingRegion = rNativeContentRegion;
+ return true;
+ }
+ else if (ePart == ControlPart::Entire)
+ {
+ rNativeContentRegion = tools::Rectangle(
+ aLocation, Size(rBoundingControlRegion.GetWidth(), aButtonSize.Height()));
+ rNativeBoundingRegion = rNativeContentRegion;
+ return true;
+ }
}
- else if (ePart == ControlPart::Entire)
+ else
{
- rNativeContentRegion = tools::Rectangle(
- aLocation, Size(rBoundingControlRegion.GetWidth(), aButtonSize.Height()));
- rNativeBoundingRegion = rNativeContentRegion;
- return true;
+ if (ePart == ControlPart::ButtonUp)
+ {
+ rNativeContentRegion
+ = tools::Rectangle(Point(aLocation.X() + rBoundingControlRegion.GetWidth()
+ - aButtonSize.Width(),
+ aLocation.Y()),
+ aButtonSize);
+ rNativeBoundingRegion = rNativeContentRegion;
+ return true;
+ }
+ else if (ePart == ControlPart::ButtonDown)
+ {
+ rNativeContentRegion
+ = tools::Rectangle(Point(aLocation.X() + rBoundingControlRegion.GetWidth()
+ - (2 * aButtonSize.Width()),
+ aLocation.Y()),
+ aButtonSize);
+ rNativeBoundingRegion = rNativeContentRegion;
+ return true;
+ }
+ else if (ePart == ControlPart::SubEdit)
+ {
+ rNativeContentRegion
+ = tools::Rectangle(aLocation, Size(rBoundingControlRegion.GetWidth()
+ - (2 * aButtonSize.Width()),
+ aButtonSize.Height()));
+ rNativeBoundingRegion = rNativeContentRegion;
+ return true;
+ }
+ else if (ePart == ControlPart::Entire)
+ {
+ rNativeContentRegion = tools::Rectangle(
+ aLocation, Size(rBoundingControlRegion.GetWidth(), aButtonSize.Height()));
+ rNativeBoundingRegion = rNativeContentRegion;
+ return true;
+ }
}
}
break;
diff --git a/vcl/uiconfig/theme_definitions/definition.xml b/vcl/uiconfig/theme_definitions/definition.xml
index ddfe9cdff99d..a44ab10134e7 100644
--- a/vcl/uiconfig/theme_definitions/definition.xml
+++ b/vcl/uiconfig/theme_definitions/definition.xml
@@ -173,22 +173,17 @@
<spinbox>
<part value="Entire">
<state enabled="any" focused="any" pressed="any" rollover="any" default="any" selected="any" button-value="any">
- <rect stroke="#007AFF" fill="#FFFFFF" stroke-width="1" rx="5" ry="5" margin="0"/>
+ <external source="spinbox-entire.svgx" />
</state>
</part>
<part value="ButtonDown">
<state enabled="any" focused="any" pressed="any" rollover="any" default="any" selected="any" button-value="any">
- <rect stroke="#007AFF" fill="#FFFFFF" stroke-width="1" rx="5" ry="5" margin="0"/>
- <line stroke="#007AFF" stroke-width="2" x1="0.4" y1="0.5" x2="0.6" y2="0.5"/>
- <!-- <image source="spinbox-left.svgx" /> -->
+ <external source="spinbox-left.svgx" />
</state>
</part>
<part value="ButtonUp">
<state enabled="any" focused="any" pressed="any" rollover="any" default="any" selected="any" button-value="any">
- <rect stroke="#007AFF" fill="#FFFFFF" stroke-width="1" rx="5" ry="5" margin="0"/>
- <line stroke="#007AFF" stroke-width="2" x1="0.4" y1="0.5" x2="0.6" y2="0.5"/>
- <line stroke="#007AFF" stroke-width="2" x1="0.5" y1="0.4" x2="0.5" y2="0.6"/>
- <!-- <image source="spinbox-right.svgx" /> -->
+ <external source="spinbox-right.svgx" />
</state>
</part>
</spinbox>
diff --git a/vcl/uiconfig/theme_definitions/spinbox-entire.svgx b/vcl/uiconfig/theme_definitions/spinbox-entire.svgx
new file mode 100644
index 000000000000..24a3b12c2d58
--- /dev/null
+++ b/vcl/uiconfig/theme_definitions/spinbox-entire.svgx
@@ -0,0 +1,3 @@
+<svg version="1.1" viewBox="0 0 44 26" xmlns="http://www.w3.org/2000/svg">
+ <rect x=".5" y=".5" width="43" height="25" rx="2" ry="2" fill="#fff" stroke="#007aff"/>
+</svg>
diff --git a/vcl/uiconfig/theme_definitions/spinbox-left.svgx b/vcl/uiconfig/theme_definitions/spinbox-left.svgx
index 3f98280a106b..aff42a99fbc0 100644
--- a/vcl/uiconfig/theme_definitions/spinbox-left.svgx
+++ b/vcl/uiconfig/theme_definitions/spinbox-left.svgx
@@ -1,4 +1,4 @@
-<svg version="1.1" width="44px" height="26px" viewBox="0 0 44 26" xmlns="http://www.w3.org/2000/svg">
- <path d="m43 1.001v24h-40c-1.21 5.9e-5 -2-0.9039-2-2v-20c0-1.164 0.8606-2 2-2 13.33 0.03661 40 0 40 0z" fill="#fff" stroke="#007aff" stroke-width="2"/>
- <rect x="18.5" y="12.25" width="7" height="1.5" color="#bebebe" fill="#007aff"/>
+<svg version="1.1" viewBox="0 0 44 26" xmlns="http://www.w3.org/2000/svg">
+ <path d="m43.5 0.5007v25h-40.95c-1.239 6.1e-5 -2.048-0.9415-2.048-2.083v-20.83c0-1.212 0.8811-2.083 2.048-2.083 13.65 0.03813 40.95 0 40.95 0z" fill="#fff" stroke="#007aff"/>
+ <rect x="17" y="12" width="10" height="2" color="#bebebe" fill="#007aff"/>
</svg>
diff --git a/vcl/uiconfig/theme_definitions/spinbox-right.svgx b/vcl/uiconfig/theme_definitions/spinbox-right.svgx
index 07ce83c388db..dec02f432aaf 100644
--- a/vcl/uiconfig/theme_definitions/spinbox-right.svgx
+++ b/vcl/uiconfig/theme_definitions/spinbox-right.svgx
@@ -1,4 +1,5 @@
-<svg version="1.1" width="44px" height="26px" viewBox="0 0 44 26" xmlns="http://www.w3.org/2000/svg">
- <path d="m40.84 24.99-39.84-0.002673v-23.99l39.84-0.00267c1.195-8.299e-5 2.156 0.9296 2.156 2.084v19.83c0 1.155-0.9616 2.088-2.156 2.084z" fill="#fff" stroke="#007aff" stroke-width="2"/>
- <path d="m21.27 9.428v2.857h-2.915v1.429h2.915v2.857h1.458v-2.857h2.915v-1.429h-2.915v-2.857z" color="#bebebe" fill="#007aff"/>
+<svg version="1.1" viewBox="0 0 44 26" xmlns="http://www.w3.org/2000/svg">
+ <path d="m41.29 25.49-40.79-0.002785v-24.99l40.79-0.002781c1.224-8.635e-5 2.208 0.9683 2.208 2.171v20.66c0 1.203-0.9846 2.175-2.208 2.171z" fill="none" stroke="#007aff"/>
+ <rect x="17" y="12" width="10" height="2" fill="#007aff"/>
+ <rect x="21" y="8" width="2" height="10" fill="#007aff"/>
</svg>