[Libreoffice-commits] core.git: vcl/source
Maxim Monastirsky
momonasmon at gmail.com
Sat Jan 20 19:03:44 UTC 2018
vcl/source/control/button.cxx | 8 ++++++++
vcl/source/window/builder.cxx | 28 ----------------------------
2 files changed, 8 insertions(+), 28 deletions(-)
New commits:
commit 18ada80e3f98318d94b3be8109cd86eda1d095c8
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Fri Jan 19 03:19:37 2018 +0200
WB_NOPOINTERFOCUS can be added after the button is created
Change-Id: I3f06aa8ea4edb981d201210b783c4624ffd68d16
Reviewed-on: https://gerrit.libreoffice.org/48175
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Maxim Monastirsky <momonasmon at gmail.com>
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index ea0e7fd8e846..949cc65d5a9b 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -594,6 +594,14 @@ bool Button::set_property(const OString &rKey, const OUString &rValue)
eAlign = ImageAlign::Bottom;
SetImageAlign(eAlign);
}
+ else if (rKey == "focus-on-click")
+ {
+ WinBits nBits = GetStyle();
+ nBits &= ~WB_NOPOINTERFOCUS;
+ if (!toBool(rValue))
+ nBits |= WB_NOPOINTERFOCUS;
+ SetStyle(nBits);
+ }
else
return Control::set_property(rKey, rValue);
return true;
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index bde5585c26da..0a10d7a4ded6 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -669,18 +669,6 @@ namespace
return bIsStock;
}
- bool extractFocusOnClick(VclBuilder::stringmap &rMap)
- {
- bool bFocusOnClick = true;
- VclBuilder::stringmap::iterator aFind = rMap.find(OString("focus-on-click"));
- if (aFind != rMap.end())
- {
- bFocusOnClick = toBool(aFind->second);
- rMap.erase(aFind);
- }
- return bFocusOnClick;
- }
-
WinBits extractRelief(VclBuilder::stringmap &rMap)
{
WinBits nBits = WB_3DLOOK;
@@ -792,8 +780,6 @@ namespace
WinBits nBits = WB_CLIPCHILDREN|WB_CENTER|WB_VCENTER;
nBits |= extractRelief(rMap);
- if (!extractFocusOnClick(rMap))
- nBits |= WB_NOPOINTERFOCUS;
VclPtr<Button> xWindow;
@@ -825,8 +811,6 @@ namespace
WinBits nBits = WB_CLIPCHILDREN|WB_CENTER|WB_VCENTER|WB_3DLOOK;
nBits |= extractRelief(rMap);
- if (!extractFocusOnClick(rMap))
- nBits |= WB_NOPOINTERFOCUS;
VclPtr<Button> xWindow = VclPtr<MenuButton>::Create(pParent, nBits);
@@ -843,8 +827,6 @@ namespace
WinBits nBits = WB_CLIPCHILDREN|WB_CENTER|WB_VCENTER|WB_3DLOOK;
nBits |= extractRelief(rMap);
- if (!extractFocusOnClick(rMap))
- nBits |= WB_NOPOINTERFOCUS;
VclPtr<Button> xWindow = VclPtr<MenuToggleButton>::Create(pParent, nBits);
@@ -1276,8 +1258,6 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
OUString sWrap = BuilderUtils::extractCustomProperty(rMap);
if (!sWrap.isEmpty())
nBits |= WB_WORDBREAK;
- if (!extractFocusOnClick(rMap))
- nBits |= WB_NOPOINTERFOCUS;
VclPtr<RadioButton> xButton = VclPtr<RadioButton>::Create(pParent, nBits);
xButton->SetImageAlign(ImageAlign::Left); //default to left
xWindow = xButton;
@@ -1293,8 +1273,6 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
OUString sWrap = BuilderUtils::extractCustomProperty(rMap);
if (!sWrap.isEmpty())
nBits |= WB_WORDBREAK;
- if (!extractFocusOnClick(rMap))
- nBits |= WB_NOPOINTERFOCUS;
//maybe always import as TriStateBox and enable/disable tristate
bool bIsTriState = extractInconsistent(rMap);
VclPtr<CheckBox> xCheckBox;
@@ -1676,18 +1654,12 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
VclPtr<vcl::Window> xParent(pParent);
pFunction(xWindow, xParent, rMap);
if (xWindow->GetType() == WindowType::PUSHBUTTON)
- {
- if (!extractFocusOnClick(rMap))
- xWindow->SetStyle(xWindow->GetStyle() | WB_NOPOINTERFOCUS);
setupFromActionName(static_cast<Button*>(xWindow.get()), rMap, m_xFrame);
- }
else if (xWindow->GetType() == WindowType::MENUBUTTON)
{
OUString sMenu = BuilderUtils::extractCustomProperty(rMap);
if (!sMenu.isEmpty())
m_pParserState->m_aButtonMenuMaps.emplace_back(id, sMenu);
- if (!extractFocusOnClick(rMap))
- xWindow->SetStyle(xWindow->GetStyle() | WB_NOPOINTERFOCUS);
setupFromActionName(static_cast<Button*>(xWindow.get()), rMap, m_xFrame);
}
}
More information about the Libreoffice-commits
mailing list