summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-12-07 12:56:10 +0000
committerCaolán McNamara <caolanm@redhat.com>2022-12-07 22:57:57 +0000
commit62ae7be5aa20499c45e6f1b3f1dd2729483625b0 (patch)
treeb811a06fda99b0231da7c5232c6f387e599e63b4 /cui
parent5d77fe6e7a386efda32a19d3bca587b1ad12715d (diff)
Related: tdf#152301 cache color widget width
Change-Id: I0030980e2259715aa1fa624eb0ee82d5dfc51810 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143778 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/options/optcolor.cxx15
1 files changed, 9 insertions, 6 deletions
diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx
index 4b5e4b306fed..42c299de3f0b 100644
--- a/cui/source/options/optcolor.cxx
+++ b/cui/source/options/optcolor.cxx
@@ -212,7 +212,7 @@ private:
{
public:
Entry(weld::Window* pTopLevel, weld::Builder& rBuilder, const char* pTextWidget, const char* pColorWidget,
- const Color& rColor, int nCheckBoxLabelOffset, bool bCheckBox, bool bShow);
+ const Color& rColor, int nCheckBoxLabelOffset, int* pColorWidthRequest, bool bCheckBox, bool bShow);
public:
void SetText(const OUString& rLabel) { dynamic_cast<weld::Label&>(*m_xText).set_label(rLabel); }
int get_height_request() const
@@ -284,9 +284,10 @@ ColorConfigWindow_Impl::Chapter::Chapter(weld::Builder& rBuilder, const char* pL
// ColorConfigWindow_Impl::Entry
ColorConfigWindow_Impl::Entry::Entry(weld::Window* pTopLevel, weld::Builder& rBuilder,
const char* pTextWidget, const char* pColorWidget,
- const Color& rColor,
- int nCheckBoxLabelOffset, bool bCheckBox, bool bShow)
- : m_xColorList(new ColorListBox(rBuilder.weld_menu_button(pColorWidget), [pTopLevel]{ return pTopLevel; }))
+ const Color& rColor, int nCheckBoxLabelOffset,
+ int* pColorWidthRequestCache, bool bCheckBox, bool bShow)
+ : m_xColorList(new ColorListBox(rBuilder.weld_menu_button(pColorWidget),
+ [pTopLevel]{ return pTopLevel; }, pColorWidthRequestCache))
, m_aDefaultColor(rColor)
{
if (bCheckBox)
@@ -404,6 +405,8 @@ void ColorConfigWindow_Impl::CreateEntries()
m_nCheckBoxLabelOffset = aCheckSize.Width() - aFixedSize.Width();
}
+ int nColorWidthRequestCache = -1;
+
// creating entries
vEntries.reserve(ColorConfigEntryCount);
for (size_t i = 0; i < std::size(vEntryInfo); ++i)
@@ -411,7 +414,7 @@ void ColorConfigWindow_Impl::CreateEntries()
vEntries.push_back(std::make_shared<Entry>(m_pTopLevel, *m_xBuilder,
vEntryInfo[i].pText, vEntryInfo[i].pColor,
ColorConfig::GetDefaultColor(static_cast<ColorConfigEntry>(i)),
- m_nCheckBoxLabelOffset,
+ m_nCheckBoxLabelOffset, &nColorWidthRequestCache,
vEntryInfo[i].bCheckBox,
aModulesInstalled[vEntryInfo[i].eGroup]));
}
@@ -445,7 +448,7 @@ void ColorConfigWindow_Impl::CreateEntries()
aExtConfig.GetComponentColorConfigValue(sComponentName, i);
vEntries.push_back(std::make_shared<Entry>(m_pTopLevel, *vExtBuilders.back(),
"label", "button", aColorEntry.getDefaultColor(),
- m_nCheckBoxLabelOffset, false, true));
+ m_nCheckBoxLabelOffset, &nColorWidthRequestCache, false, true));
vEntries.back()->SetText(aColorEntry.getDisplayName());
}
}