diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2019-01-29 13:51:50 +0100 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2019-03-04 22:41:51 +0100 |
commit | c4378dd23edd70110cada99b97a8df6d6f6d47d2 (patch) | |
tree | 8fa27efd48a933e55c2ca016b1b341be7bf26294 | |
parent | 1042c2c5a349588c03a00f45c77fb1b8f1f1d4ea (diff) |
Draw basic checkbox from the theme definition
Change-Id: I8b8a0bbe0d17736dd19151cebe4ad2d5344ea691
Reviewed-on: https://gerrit.libreoffice.org/68693
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r-- | vcl/source/gdi/FileDefinitionWidgetDraw.cxx | 33 | ||||
-rw-r--r-- | vcl/source/gdi/WidgetDefinitionReader.cxx | 6 | ||||
-rw-r--r-- | vcl/uiconfig/theme_definitions/definition.xml | 13 |
3 files changed, 47 insertions, 5 deletions
diff --git a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx index bc46bcbdd67f..a287f2c0fee7 100644 --- a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx +++ b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx @@ -49,8 +49,8 @@ bool FileDefinitionWidgetDraw::isNativeControlSupported(ControlType eType, Contr case ControlType::Generic: case ControlType::Pushbutton: case ControlType::Radiobutton: - return true; case ControlType::Checkbox: + return true; case ControlType::Combobox: return false; case ControlType::Editbox: @@ -232,6 +232,21 @@ bool FileDefinitionWidgetDraw::drawNativeControl(ControlType eType, ControlPart } break; case ControlType::Checkbox: + { + std::shared_ptr<WidgetDefinitionPart> pPart + = m_aWidgetDefinition.getDefinition(eType, ePart); + if (pPart) + { + auto aStates = pPart->getStates(eState, rValue); + if (!aStates.empty()) + { + std::shared_ptr<WidgetDefinitionState> pState = aStates.back(); + munchDrawCommands(pState->mpDrawCommands, m_rGraphics, nX, nY, nWidth, nHeight); + bOK = true; + } + } + } + break; case ControlType::Combobox: break; case ControlType::Editbox: @@ -285,11 +300,19 @@ bool FileDefinitionWidgetDraw::drawNativeControl(ControlType eType, ControlPart } bool FileDefinitionWidgetDraw::getNativeControlRegion( - ControlType /*eType*/, ControlPart /*ePart*/, - const tools::Rectangle& /*rBoundingControlRegion*/, ControlState /*eState*/, - const ImplControlValue& /*aValue*/, const OUString& /*aCaption*/, - tools::Rectangle& /*rNativeBoundingRegion*/, tools::Rectangle& /*rNativeContentRegion*/) + ControlType eType, ControlPart /*ePart*/, const tools::Rectangle& /*rBoundingControlRegion*/, + ControlState /*eState*/, const ImplControlValue& /*aValue*/, const OUString& /*aCaption*/, + tools::Rectangle& /*rNativeBoundingRegion*/, tools::Rectangle& rNativeContentRegion) { + switch (eType) + { + case ControlType::Checkbox: + rNativeContentRegion = tools::Rectangle(Point(), Size(48, 32)); + return true; + default: + break; + } + return false; } diff --git a/vcl/source/gdi/WidgetDefinitionReader.cxx b/vcl/source/gdi/WidgetDefinitionReader.cxx index 7f45a99b1aff..40dcbcee45bb 100644 --- a/vcl/source/gdi/WidgetDefinitionReader.cxx +++ b/vcl/source/gdi/WidgetDefinitionReader.cxx @@ -148,6 +148,12 @@ bool getControlTypeForXmlString(OString const& rString, ControlType& reType) reType = ControlType::Editbox; bReturn = true; } + else if (rString == "checkbox") + { + reType = ControlType::Checkbox; + bReturn = true; + } + return bReturn; } diff --git a/vcl/uiconfig/theme_definitions/definition.xml b/vcl/uiconfig/theme_definitions/definition.xml index 0fdbdb659683..fa37bf8f5ba2 100644 --- a/vcl/uiconfig/theme_definitions/definition.xml +++ b/vcl/uiconfig/theme_definitions/definition.xml @@ -77,6 +77,19 @@ </part> </radiobutton> + <checkbox> + <part value="Entire"> + <state enabled="any" focused="any" pressed="any" rollover="any" default="any" selected="any" button-value="false"> + <rect stroke="#4CD964" fill="#FFFFFF" stroke-width="1" rx="16" ry="16" /> + <circ stroke="#4CD964" fill="#FFFFFF" stroke-width="1" x1="0.0" y1="0.0" x2="0.66" y2="1.0"/> + </state> + <state enabled="any" focused="any" pressed="any" rollover="any" default="any" selected="any" button-value="true"> + <rect stroke="#4CD964" fill="#4CD964" stroke-width="1" rx="16" ry="16" /> + <circ stroke="#4CD964" fill="#FFFFFF" stroke-width="1" x1="0.33" y1="0.0" x2="1.0" y2="1.0"/> + </state> + </part> + </checkbox> + <editbox> <part value="Entire"> <state enabled="any" focused="any" pressed="any" rollover="any" default="any" selected="any" button-value="any"> |