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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Mar 5 19:24:21 UTC 2019


 vcl/inc/FileDefinitionWidgetDraw.hxx          |    4 ++
 vcl/source/gdi/FileDefinitionWidgetDraw.cxx   |   34 +++++++++++++++++++-
 vcl/uiconfig/theme_definitions/definition.xml |   43 ++++++++++++++++++++++++++
 3 files changed, 79 insertions(+), 2 deletions(-)

New commits:
commit ae9eab1cf666a6cf58cc473e4e5bdd92088fbd30
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue Feb 19 14:12:42 2019 +0100
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Tue Mar 5 20:23:55 2019 +0100

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

diff --git a/vcl/inc/FileDefinitionWidgetDraw.hxx b/vcl/inc/FileDefinitionWidgetDraw.hxx
index ba34cbe13467..dc3ee7f8967c 100644
--- a/vcl/inc/FileDefinitionWidgetDraw.hxx
+++ b/vcl/inc/FileDefinitionWidgetDraw.hxx
@@ -24,6 +24,10 @@ private:
     SalGraphics& m_rGraphics;
     WidgetDefinition m_aWidgetDefinition;
 
+    bool resolveDefinition(ControlType eType, ControlPart ePart, ControlState eState,
+                           const ImplControlValue& rValue, long nX, long nY, long nWidth,
+                           long nHeight);
+
 public:
     FileDefinitionWidgetDraw(SalGraphics& rGraphics);
 
diff --git a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
index bb6756bf1b9c..317cb3455641 100644
--- a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
+++ b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
@@ -75,8 +75,12 @@ bool FileDefinitionWidgetDraw::isNativeControlSupported(ControlType eType, Contr
         case ControlType::TabPane:
         case ControlType::TabHeader:
         case ControlType::TabBody:
-        case ControlType::Scrollbar:
             return false;
+        case ControlType::Scrollbar:
+            if (ePart == ControlPart::DrawBackgroundHorz
+                || ePart == ControlPart::DrawBackgroundVert)
+                return false;
+            return true;
         case ControlType::Slider:
             return true;
         case ControlType::Fixedline:
@@ -201,6 +205,29 @@ void munchDrawCommands(std::vector<std::shared_ptr<DrawCommand>> const& rDrawCom
 
 } // end anonymous namespace
 
+bool FileDefinitionWidgetDraw::resolveDefinition(ControlType eType, ControlPart ePart,
+                                                 ControlState eState,
+                                                 const ImplControlValue& rValue, long nX, long nY,
+                                                 long nWidth, long nHeight)
+{
+    bool bOK = false;
+    auto const& pPart = m_aWidgetDefinition.getDefinition(eType, ePart);
+    if (pPart)
+    {
+        auto const& aStates = pPart->getStates(eState, rValue);
+        if (!aStates.empty())
+        {
+            // use last defined state
+            auto const& pState = aStates.back();
+            {
+                munchDrawCommands(pState->mpDrawCommands, m_rGraphics, nX, nY, nWidth, nHeight);
+                bOK = true;
+            }
+        }
+    }
+    return bOK;
+}
+
 bool FileDefinitionWidgetDraw::drawNativeControl(ControlType eType, ControlPart ePart,
                                                  const tools::Rectangle& rControlRegion,
                                                  ControlState eState,
@@ -377,7 +404,10 @@ bool FileDefinitionWidgetDraw::drawNativeControl(ControlType eType, ControlPart
         case ControlType::TabPane:
         case ControlType::TabBody:
         case ControlType::Scrollbar:
-            break;
+        {
+            bOK = resolveDefinition(eType, ePart, eState, rValue, nX, nY, nWidth, nHeight);
+        }
+        break;
         case ControlType::Slider:
         {
             {
diff --git a/vcl/uiconfig/theme_definitions/definition.xml b/vcl/uiconfig/theme_definitions/definition.xml
index 1286ea7fb8c9..e57404c94013 100644
--- a/vcl/uiconfig/theme_definitions/definition.xml
+++ b/vcl/uiconfig/theme_definitions/definition.xml
@@ -140,6 +140,49 @@
         </part>
     </editbox>
 
+    <scrollbar>
+        <part value="ThumbHorz">
+            <state enabled="any" focused="any" pressed="any" rollover="any" default="any" selected="any" button-value="any">
+                <rect stroke="#C7C7C7" fill="#C7C7C7" stroke-width="1" />
+                <line stroke="#007AFF" stroke-width="5" x1="0.01" y1="0.5" x2="0.99" y2="0.5"/>
+            </state>
+        </part>
+        <part value="ThumbVert">
+            <state enabled="any" focused="any" pressed="any" rollover="any" default="any" selected="any" button-value="any">
+                <rect stroke="#C7C7C7" fill="#C7C7C7" stroke-width="1" />
+                <line stroke="#007AFF" stroke-width="5" x1="0.5" y1="0.01" x2="0.5" y2="0.99"/>
+            </state>
+        </part>
+        <part value="ButtonUp">
+        </part>
+        <part value="ButtonDown">
+        </part>
+        <part value="ButtonLeft">
+        </part>
+        <part value="ButtonRight">
+        </part>
+        <part value="TrackHorzLeft">
+            <state enabled="any" focused="any" pressed="any" rollover="any" default="any" selected="any" button-value="any">
+                <rect stroke="#C7C7C7" fill="#C7C7C7" stroke-width="1" />
+            </state>
+        </part>
+        <part value="TrackHorzRight">
+            <state enabled="any" focused="any" pressed="any" rollover="any" default="any" selected="any" button-value="any">
+                <rect stroke="#C7C7C7" fill="#C7C7C7" stroke-width="1" />
+            </state>
+        </part>
+        <part value="TrackVertUpper">
+            <state enabled="any" focused="any" pressed="any" rollover="any" default="any" selected="any" button-value="any">
+                <rect stroke="#C7C7C7" fill="#C7C7C7" stroke-width="1" />
+            </state>
+        </part>
+        <part value="TrackVertLower">
+            <state enabled="any" focused="any" pressed="any" rollover="any" default="any" selected="any" button-value="any">
+                <rect stroke="#C7C7C7" fill="#C7C7C7" stroke-width="1" />
+            </state>
+        </part>
+    </scrollbar>
+
     <slider>
         <part value="Button">
             <state enabled="any" focused="any" pressed="any" rollover="any" default="any" selected="any" button-value="any">


More information about the Libreoffice-commits mailing list