diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-01-11 16:51:07 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-01-13 10:08:48 +0100 |
commit | 9b2d46e41a463232e80154f5bb023bf14072d59e (patch) | |
tree | 062cf2b191799965ec3aa45bd9576b706fc0d68d /vcl/source/window/builder.cxx | |
parent | 10620cf97702f6fceb9334df50c255e08925919b (diff) |
move FixedImage icon-name property setting to the builder
Change-Id: Ic7250fbc7887a652b340d0dae346210d9e743e30
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109196
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source/window/builder.cxx')
-rw-r--r-- | vcl/source/window/builder.cxx | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index a250fd89b214..9ea07cdb5ee3 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -1071,11 +1071,22 @@ namespace OUString extractIconName(VclBuilder::stringmap &rMap) { OUString sIconName; - VclBuilder::stringmap::iterator aFind = rMap.find(OString("icon-name")); - if (aFind != rMap.end()) + // allow pixbuf, but prefer icon-name { - sIconName = aFind->second; - rMap.erase(aFind); + VclBuilder::stringmap::iterator aFind = rMap.find(OString("pixbuf")); + if (aFind != rMap.end()) + { + sIconName = aFind->second; + rMap.erase(aFind); + } + } + { + VclBuilder::stringmap::iterator aFind = rMap.find(OString("icon-name")); + if (aFind != rMap.end()) + { + sIconName = aFind->second; + rMap.erase(aFind); + } } return sIconName; } @@ -2126,8 +2137,13 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString & } else if (name == "GtkImage") { - extractStock(id, rMap); - xWindow = VclPtr<FixedImage>::Create(pParent, WB_CENTER|WB_VCENTER|WB_3DLOOK|WB_SCALE); + VclPtr<FixedImage> xFixedImage = VclPtr<FixedImage>::Create(pParent, WB_CENTER|WB_VCENTER|WB_3DLOOK|WB_SCALE); + OUString sIconName = extractIconName(rMap); + if (!sIconName.isEmpty()) + xFixedImage->SetImage(FixedImage::loadThemeImage(sIconName)); + else + extractStock(id, rMap); + xWindow = xFixedImage; //such parentless GtkImages are temps used to set icons on buttons //default them to hidden to stop e.g. insert->index entry flicking temp //full screen windows |