diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2019-03-10 19:55:42 +0100 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2019-08-29 20:10:53 +0900 |
commit | 0d0d564b00371c540a92d5fff2e884ee8b5e288b (patch) | |
tree | 6a09a3961a2a70014b7107db4e3c6509d8e8382f /vcl | |
parent | 3d8b12348d5dfa62854884b9fb4c7129cd6568a2 (diff) |
widget theme: draw listheader button and arrow
Also adds support for signaling if arrow points up or down, which
is signaled through extra attribute.
Change-Id: I5a87cdb31e18150495df521bf925c7b983e2313a
Reviewed-on: https://gerrit.libreoffice.org/69013
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
(cherry picked from commit 8ff3e9a418a6f154d3ecb2df669fbd70361ae0c0)
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/Package_theme_definitions.mk | 2 | ||||
-rw-r--r-- | vcl/inc/widgetdraw/WidgetDefinition.hxx | 6 | ||||
-rw-r--r-- | vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx | 7 | ||||
-rw-r--r-- | vcl/source/gdi/FileDefinitionWidgetDraw.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/WidgetDefinition.cxx | 53 | ||||
-rw-r--r-- | vcl/uiconfig/theme_definitions/arrow-down.svgx | 5 | ||||
-rw-r--r-- | vcl/uiconfig/theme_definitions/arrow-up.svgx | 5 | ||||
-rw-r--r-- | vcl/uiconfig/theme_definitions/definition.xml | 13 |
8 files changed, 69 insertions, 24 deletions
diff --git a/vcl/Package_theme_definitions.mk b/vcl/Package_theme_definitions.mk index 0ca04e765039..d9cc421fe794 100644 --- a/vcl/Package_theme_definitions.mk +++ b/vcl/Package_theme_definitions.mk @@ -45,6 +45,8 @@ $(eval $(call gb_Package_add_files,vcl_theme_definitions,$(LIBO_SHARE_FOLDER)/th scrollbar-vertical.svgx \ combobox.svgx \ combobox-disabled.svgx \ + arrow-up.svgx \ + arrow-down.svgx \ )) # vim: set noet sw=4 ts=4: diff --git a/vcl/inc/widgetdraw/WidgetDefinition.hxx b/vcl/inc/widgetdraw/WidgetDefinition.hxx index 7e1505c8daae..77baf0922cd8 100644 --- a/vcl/inc/widgetdraw/WidgetDefinition.hxx +++ b/vcl/inc/widgetdraw/WidgetDefinition.hxx @@ -202,8 +202,10 @@ public: sal_Int32 mnMarginHeight; OString msOrientation; - std::vector<std::shared_ptr<WidgetDefinitionState>> - getStates(ControlType eType, ControlState eState, ImplControlValue const& rValue); + std::vector<std::shared_ptr<WidgetDefinitionState>> getStates(ControlType eType, + ControlPart ePart, + ControlState eState, + ImplControlValue const& rValue); std::vector<std::shared_ptr<WidgetDefinitionState>> maStates; }; diff --git a/vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx b/vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx index c56379cc70c7..75dc559067fc 100644 --- a/vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx +++ b/vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx @@ -57,7 +57,8 @@ void WidgetDefinitionReaderTest::testRead() = ControlState::DEFAULT | ControlState::ENABLED | ControlState::ROLLOVER; std::vector<std::shared_ptr<vcl::WidgetDefinitionState>> aStates = aDefinition.getDefinition(ControlType::Pushbutton, ControlPart::Entire) - ->getStates(ControlType::Pushbutton, eState, ImplControlValue()); + ->getStates(ControlType::Pushbutton, ControlPart::Entire, eState, + ImplControlValue()); CPPUNIT_ASSERT_EQUAL(size_t(2), aStates.size()); @@ -71,7 +72,7 @@ void WidgetDefinitionReaderTest::testRead() { std::vector<std::shared_ptr<vcl::WidgetDefinitionState>> aStates = aDefinition.getDefinition(ControlType::Radiobutton, ControlPart::Entire) - ->getStates(ControlType::Radiobutton, ControlState::NONE, + ->getStates(ControlType::Radiobutton, ControlPart::Entire, ControlState::NONE, ImplControlValue(ButtonValue::On)); CPPUNIT_ASSERT_EQUAL(size_t(1), aStates.size()); CPPUNIT_ASSERT_EQUAL(size_t(2), aStates[0]->mpDrawCommands.size()); @@ -80,7 +81,7 @@ void WidgetDefinitionReaderTest::testRead() { std::vector<std::shared_ptr<vcl::WidgetDefinitionState>> aStates = aDefinition.getDefinition(ControlType::Radiobutton, ControlPart::Entire) - ->getStates(ControlType::Radiobutton, ControlState::NONE, + ->getStates(ControlType::Radiobutton, ControlPart::Entire, ControlState::NONE, ImplControlValue(ButtonValue::Off)); CPPUNIT_ASSERT_EQUAL(size_t(1), aStates.size()); CPPUNIT_ASSERT_EQUAL(size_t(1), aStates[0]->mpDrawCommands.size()); diff --git a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx index 9085753dbf25..b557021f4601 100644 --- a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx +++ b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx @@ -402,7 +402,7 @@ bool FileDefinitionWidgetDraw::resolveDefinition(ControlType eType, ControlPart auto const& pPart = m_pWidgetDefinition->getDefinition(eType, ePart); if (pPart) { - auto const& aStates = pPart->getStates(eType, eState, rValue); + auto const& aStates = pPart->getStates(eType, ePart, eState, rValue); if (!aStates.empty()) { // use last defined state diff --git a/vcl/source/gdi/WidgetDefinition.cxx b/vcl/source/gdi/WidgetDefinition.cxx index 5d316298da37..668fe74bf403 100644 --- a/vcl/source/gdi/WidgetDefinition.cxx +++ b/vcl/source/gdi/WidgetDefinition.cxx @@ -26,7 +26,7 @@ std::shared_ptr<WidgetDefinitionPart> WidgetDefinition::getDefinition(ControlTyp } std::vector<std::shared_ptr<WidgetDefinitionState>> -WidgetDefinitionPart::getStates(ControlType eType, ControlState eState, +WidgetDefinitionPart::getStates(ControlType eType, ControlPart ePart, ControlState eState, ImplControlValue const& rValue) { std::vector<std::shared_ptr<WidgetDefinitionState>> aStatesToAdd; @@ -69,26 +69,43 @@ WidgetDefinitionPart::getStates(ControlType eType, ControlState eState, bAdd = false; } - if (eType == ControlType::TabItem) - { - OString sExtra; - - auto const& rTabItemValue = static_cast<TabitemValue const&>(rValue); - - if (rTabItemValue.isLeftAligned() && rTabItemValue.isRightAligned() - && rTabItemValue.isFirst() && rTabItemValue.isLast()) - sExtra = "first_last"; - else if (rTabItemValue.isLeftAligned() || rTabItemValue.isFirst()) - sExtra = "first"; - else if (rTabItemValue.isRightAligned() || rTabItemValue.isLast()) - sExtra = "last"; - else - sExtra = "middle"; + OString sExtra = "any"; - if (state->msExtra != "any" && state->msExtra != sExtra) + switch (eType) + { + case ControlType::TabItem: + { + auto const& rTabItemValue = static_cast<TabitemValue const&>(rValue); + + if (rTabItemValue.isLeftAligned() && rTabItemValue.isRightAligned() + && rTabItemValue.isFirst() && rTabItemValue.isLast()) + sExtra = "first_last"; + else if (rTabItemValue.isLeftAligned() || rTabItemValue.isFirst()) + sExtra = "first"; + else if (rTabItemValue.isRightAligned() || rTabItemValue.isLast()) + sExtra = "last"; + else + sExtra = "middle"; + } + break; + case ControlType::ListHeader: { - bAdd = false; + if (ePart == ControlPart::Arrow) + { + if (rValue.getNumericVal() == 1) + sExtra = "down"; + else + sExtra = "up"; + } } + break; + default: + break; + } + + if (state->msExtra != "any" && state->msExtra != sExtra) + { + bAdd = false; } if (bAdd) diff --git a/vcl/uiconfig/theme_definitions/arrow-down.svgx b/vcl/uiconfig/theme_definitions/arrow-down.svgx new file mode 100644 index 000000000000..032df3df64b9 --- /dev/null +++ b/vcl/uiconfig/theme_definitions/arrow-down.svgx @@ -0,0 +1,5 @@ +<svg version="1.1" viewBox="0 0 11 20" xmlns="http://www.w3.org/2000/svg"> + <g transform="translate(245.46 49.566)"> + <path d="m-242.75-44.074h5.5903l-2.7951 8z" fill="#007aff" stroke="#007aff"/> + </g> +</svg> diff --git a/vcl/uiconfig/theme_definitions/arrow-up.svgx b/vcl/uiconfig/theme_definitions/arrow-up.svgx new file mode 100644 index 000000000000..524906f31018 --- /dev/null +++ b/vcl/uiconfig/theme_definitions/arrow-up.svgx @@ -0,0 +1,5 @@ +<svg version="1.1" viewBox="0 0 11 20" xmlns="http://www.w3.org/2000/svg"> + <g transform="translate(245.46 49.566)"> + <path d="m-242.75-35.066h5.5903l-2.7951-7.9855z" fill="#007aff" stroke="#007aff"/> + </g> +</svg> diff --git a/vcl/uiconfig/theme_definitions/definition.xml b/vcl/uiconfig/theme_definitions/definition.xml index 848f0e600d89..bdb1e700715b 100644 --- a/vcl/uiconfig/theme_definitions/definition.xml +++ b/vcl/uiconfig/theme_definitions/definition.xml @@ -432,6 +432,19 @@ </listnet> <listheader> + <part value="Button"> + <state> + <rect stroke="#8e8e93" fill="#f4f5f5" stroke-width="1" rx="1" ry="1"/> + </state> + </part> + <part value="Arrow"> + <state extra="up"> + <image source="arrow-up.svgx"/> + </state> + <state extra="down"> + <image source="arrow-down.svgx"/> + </state> + </part> </listheader> </widgets> |