Kaydet (Commit) 5a226c97 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Tomaž Vajngerl

Draw basic slider from the theme definition

Change-Id: I5ccd6c2e743324cee2a030e55425df4791e12e2f
Reviewed-on: https://gerrit.libreoffice.org/68719
Tested-by: Jenkins
Reviewed-by: 's avatarTomaž Vajngerl <quikee@gmail.com>
üst 4b6e00f0
...@@ -76,7 +76,9 @@ bool FileDefinitionWidgetDraw::isNativeControlSupported(ControlType eType, Contr ...@@ -76,7 +76,9 @@ bool FileDefinitionWidgetDraw::isNativeControlSupported(ControlType eType, Contr
case ControlType::TabHeader: case ControlType::TabHeader:
case ControlType::TabBody: case ControlType::TabBody:
case ControlType::Scrollbar: case ControlType::Scrollbar:
return false;
case ControlType::Slider: case ControlType::Slider:
return true;
case ControlType::Fixedline: case ControlType::Fixedline:
case ControlType::Toolbar: case ControlType::Toolbar:
case ControlType::Menubar: case ControlType::Menubar:
...@@ -375,7 +377,51 @@ bool FileDefinitionWidgetDraw::drawNativeControl(ControlType eType, ControlPart ...@@ -375,7 +377,51 @@ bool FileDefinitionWidgetDraw::drawNativeControl(ControlType eType, ControlPart
case ControlType::TabPane: case ControlType::TabPane:
case ControlType::TabBody: case ControlType::TabBody:
case ControlType::Scrollbar: case ControlType::Scrollbar:
break;
case ControlType::Slider: case ControlType::Slider:
{
{
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;
}
}
}
}
if (bOK)
{
const SliderValue* pSliderValue = static_cast<const SliderValue*>(&rValue);
std::shared_ptr<WidgetDefinitionPart> pPart
= m_aWidgetDefinition.getDefinition(eType, ControlPart::Button);
if (pPart)
{
auto aStates = pPart->getStates(eState | pSliderValue->mnThumbState, rValue);
if (!aStates.empty())
{
std::shared_ptr<WidgetDefinitionState> pState = aStates.back();
{
munchDrawCommands(pState->mpDrawCommands, m_rGraphics,
pSliderValue->maThumbRect.Left(),
pSliderValue->maThumbRect.Top(),
pSliderValue->maThumbRect.GetWidth() - 1,
pSliderValue->maThumbRect.GetHeight() - 1);
bOK = true;
}
}
}
}
}
break;
case ControlType::Fixedline: case ControlType::Fixedline:
case ControlType::Toolbar: case ControlType::Toolbar:
case ControlType::Menubar: case ControlType::Menubar:
......
...@@ -132,12 +132,11 @@ ControlPart xmlStringToControlPart(OString const& sPart) ...@@ -132,12 +132,11 @@ ControlPart xmlStringToControlPart(OString const& sPart)
bool getControlTypeForXmlString(OString const& rString, ControlType& reType) bool getControlTypeForXmlString(OString const& rString, ControlType& reType)
{ {
static std::unordered_map<OString, ControlType> aPartMap = { static std::unordered_map<OString, ControlType> aPartMap
{ "pushbutton", ControlType::Pushbutton }, { "radiobutton", ControlType::Radiobutton }, = { { "pushbutton", ControlType::Pushbutton }, { "radiobutton", ControlType::Radiobutton },
{ "checkbox", ControlType::Checkbox }, { "combobox", ControlType::Combobox }, { "checkbox", ControlType::Checkbox }, { "combobox", ControlType::Combobox },
{ "editbox", ControlType::Editbox }, { "scrollbar", ControlType::Scrollbar }, { "editbox", ControlType::Editbox }, { "scrollbar", ControlType::Scrollbar },
{ "spinbox", ControlType::Spinbox }, { "spinbox", ControlType::Spinbox }, { "slider", ControlType::Slider } };
};
auto const& rIterator = aPartMap.find(rString); auto const& rIterator = aPartMap.find(rString);
if (rIterator != aPartMap.end()) if (rIterator != aPartMap.end())
......
...@@ -140,4 +140,22 @@ ...@@ -140,4 +140,22 @@
</part> </part>
</editbox> </editbox>
<slider>
<part value="Button">
<state enabled="any" focused="any" pressed="any" rollover="any" default="any" selected="any" button-value="any">
<circ stroke="#AAAAAA" fill="#FFFFFF" stroke-width="1" rx="7" ry="7"/>
</state>
</part>
<part value="TrackHorzArea">
<state enabled="any" focused="any" pressed="any" rollover="any" default="any" selected="any" button-value="any">
<line stroke="#007AFF" fill="#007AFF" stroke-width="10" x1="0.0" y1="0.5" x2="1.0" y2="0.5"/>
</state>
</part>
<part value="TrackVertArea">
<state enabled="any" focused="any" pressed="any" rollover="any" default="any" selected="any" button-value="any">
<line stroke="#007AFF" fill="#007AFF" stroke-width="10" x1="0.5" y1="0.0" x2="0.5" y2="1.0"/>
</state>
</part>
</slider>
</widgets> </widgets>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment