summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2019-02-19 14:12:42 +0100
committerTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2019-08-29 20:10:48 +0900
commit26dd15be08627ae644e888d16d46cdde56d35e5a (patch)
treeb3f606f9f9637e655a5bfbb028c9396227094b98
parent6bf174f3722cdabfebb71ad4279e5b30827e2d57 (diff)
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@gmail.com> (cherry picked from commit ae9eab1cf666a6cf58cc473e4e5bdd92088fbd30)
-rw-r--r--vcl/inc/FileDefinitionWidgetDraw.hxx4
-rw-r--r--vcl/source/gdi/FileDefinitionWidgetDraw.cxx34
-rw-r--r--vcl/uiconfig/theme_definitions/definition.xml43
3 files changed, 79 insertions, 2 deletions
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">