[Libreoffice-commits] core.git: 2 commits - vcl/source vcl/uiconfig

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Mar 4 21:42:14 UTC 2019


 vcl/source/gdi/FileDefinitionWidgetDraw.cxx   |   58 ++++++++++++++++++++++----
 vcl/source/gdi/WidgetDefinitionReader.cxx     |   11 ++++
 vcl/uiconfig/theme_definitions/definition.xml |   33 ++++++++++++++
 3 files changed, 94 insertions(+), 8 deletions(-)

New commits:
commit 394bf64515273985b30f77033c95277b41f021c4
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue Jan 29 13:53:48 2019 +0100
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Mon Mar 4 22:42:00 2019 +0100

    Draw basic combobox from the theme definition
    
    Change-Id: I2ed631676be878bd5e89872077ab47937aabbf7a
    Reviewed-on: https://gerrit.libreoffice.org/68697
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
index a287f2c0fee7..6681d2190dd2 100644
--- a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
+++ b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
@@ -42,7 +42,7 @@ FileDefinitionWidgetDraw::FileDefinitionWidgetDraw(SalGraphics& rGraphics)
     pSVData->maNWFData.mbNoFocusRectsForFlatButtons = true;
 }
 
-bool FileDefinitionWidgetDraw::isNativeControlSupported(ControlType eType, ControlPart /*ePart*/)
+bool FileDefinitionWidgetDraw::isNativeControlSupported(ControlType eType, ControlPart ePart)
 {
     switch (eType)
     {
@@ -52,7 +52,9 @@ bool FileDefinitionWidgetDraw::isNativeControlSupported(ControlType eType, Contr
         case ControlType::Checkbox:
             return true;
         case ControlType::Combobox:
-            return false;
+            if (ePart == ControlPart::HasBackgroundTexture)
+                return false;
+            return true;
         case ControlType::Editbox:
         case ControlType::EditboxNoBorder:
         case ControlType::MultilineEditbox:
@@ -248,7 +250,21 @@ bool FileDefinitionWidgetDraw::drawNativeControl(ControlType eType, ControlPart
         }
         break;
         case ControlType::Combobox:
-            break;
+        {
+            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::Editbox:
         case ControlType::EditboxNoBorder:
         case ControlType::MultilineEditbox:
@@ -309,6 +325,9 @@ bool FileDefinitionWidgetDraw::getNativeControlRegion(
         case ControlType::Checkbox:
             rNativeContentRegion = tools::Rectangle(Point(), Size(48, 32));
             return true;
+        case ControlType::Radiobutton:
+            rNativeContentRegion = tools::Rectangle(Point(), Size(32, 32));
+            return true;
         default:
             break;
     }
diff --git a/vcl/source/gdi/WidgetDefinitionReader.cxx b/vcl/source/gdi/WidgetDefinitionReader.cxx
index 40dcbcee45bb..f37385cc09b9 100644
--- a/vcl/source/gdi/WidgetDefinitionReader.cxx
+++ b/vcl/source/gdi/WidgetDefinitionReader.cxx
@@ -153,6 +153,11 @@ bool getControlTypeForXmlString(OString const& rString, ControlType& reType)
         reType = ControlType::Checkbox;
         bReturn = true;
     }
+    else if (rString == "combobox")
+    {
+        reType = ControlType::Combobox;
+        bReturn = true;
+    }
 
     return bReturn;
 }
diff --git a/vcl/uiconfig/theme_definitions/definition.xml b/vcl/uiconfig/theme_definitions/definition.xml
index fa37bf8f5ba2..0cbdebaa078c 100644
--- a/vcl/uiconfig/theme_definitions/definition.xml
+++ b/vcl/uiconfig/theme_definitions/definition.xml
@@ -90,6 +90,26 @@
         </part>
     </checkbox>
 
+    <combobox>
+        <part value="Entire">
+            <state enabled="any" focused="any" pressed="any" rollover="any" default="any" selected="any" button-value="any">
+               <rect stroke="#4CD964" fill="#FFFFFF" stroke-width="1" rx="5" ry="5" />
+            </state>
+        </part>
+        <part value="ButtonUp">
+            <state enabled="any" focused="any" pressed="any" rollover="any" default="any" selected="any" button-value="any">
+                <line stroke="#C7C7C7" stroke-width="4" x1="0.2" y1="0.6" x2="0.5" y2="0.4"/>
+                <line stroke="#C7C7C7" stroke-width="4" x1="0.5" y1="0.4" x2="0.8" y2="0.6"/>
+            </state>
+        </part>
+        <part value="ButtonDown">
+            <state enabled="any" focused="any" pressed="any" rollover="any" default="any" selected="any" button-value="any">
+                <line stroke="#C7C7C7" stroke-width="4" x1="0.2" y1="0.4" x2="0.5" y2="0.6"/>
+                <line stroke="#C7C7C7" stroke-width="4" x1="0.5" y1="0.6" x2="0.8" y2="0.4"/>
+            </state>
+        </part>
+    </combobox>
+
     <editbox>
         <part value="Entire">
             <state enabled="any" focused="any" pressed="any" rollover="any" default="any" selected="any" button-value="any">
commit c4378dd23edd70110cada99b97a8df6d6f6d47d2
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue Jan 29 13:51:50 2019 +0100
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Mon Mar 4 22:41:51 2019 +0100

    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 at gmail.com>

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">


More information about the Libreoffice-commits mailing list