diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-07-08 13:08:01 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-07-08 13:10:04 +0100 |
commit | a024849cf7bd2869ff18e111577454751278e7f6 (patch) | |
tree | e8887661d1b78fb63c8de8dc09c38a5150992102 /vcl | |
parent | 28d6687131db2dd471fd0dfae04b05d03105ef49 (diff) |
map gtk image-position to vcl imagealign
and set default alignment of builder-created buttons
to the default gtk left alignment, instead of the default
vcl top alignment
Change-Id: Ie6069ed7b0359c6d76e00fe1bcd3618625923cc1
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/control/button.cxx | 13 | ||||
-rw-r--r-- | vcl/source/window/builder.cxx | 15 |
2 files changed, 22 insertions, 6 deletions
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index a79088d208d8..515db35527ef 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -1720,6 +1720,19 @@ bool PushButton::set_property(const OString &rKey, const OString &rValue) nBits |= WB_DEFBUTTON; SetStyle(nBits); } + else if (rKey == "image-position") + { + ImageAlign eAlign = IMAGEALIGN_LEFT; + if (rValue == "left") + eAlign = IMAGEALIGN_LEFT; + else if (rValue == "right") + eAlign = IMAGEALIGN_RIGHT; + else if (rValue == "top") + eAlign = IMAGEALIGN_TOP; + else if (rValue == "bottom") + eAlign = IMAGEALIGN_BOTTOM; + SetImageAlign(eAlign); + } else return Control::set_property(rKey, rValue); return true; diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 7018789c8171..9a3ebd544d4c 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -689,7 +689,7 @@ namespace return sTooltipText; } - Window * extractStockAndBuildPushButton(Window *pParent, VclBuilder::stringmap &rMap) + Button* extractStockAndBuildPushButton(Window *pParent, VclBuilder::stringmap &rMap) { WinBits nBits = WB_CENTER|WB_VCENTER; @@ -697,7 +697,7 @@ namespace bool bIsStock = extractStock(rMap); - Window *pWindow = NULL; + Button *pWindow = NULL; if (bIsStock) { @@ -722,11 +722,11 @@ namespace return pWindow; } - Window * extractStockAndBuildMenuButton(Window *pParent, VclBuilder::stringmap &rMap) + Button * extractStockAndBuildMenuButton(Window *pParent, VclBuilder::stringmap &rMap) { WinBits nBits = WB_CENTER|WB_VCENTER|WB_3DLOOK; - Window *pWindow = new MenuButton(pParent, nBits); + Button *pWindow = new MenuButton(pParent, nBits); if (extractStock(rMap)) { @@ -1090,14 +1090,17 @@ Window *VclBuilder::makeObject(Window *pParent, const OString &name, const OStri pWindow = new VclAlignment(pParent); else if (name == "GtkButton") { + Button *pButton; OString sMenu = extractCustomProperty(rMap); if (sMenu.isEmpty()) - pWindow = extractStockAndBuildPushButton(pParent, rMap); + pButton = extractStockAndBuildPushButton(pParent, rMap); else { - pWindow = extractStockAndBuildMenuButton(pParent, rMap); + pButton = extractStockAndBuildMenuButton(pParent, rMap); m_pParserState->m_aButtonMenuMaps.push_back(ButtonMenuMap(id, sMenu)); } + pButton->SetImageAlign(IMAGEALIGN_LEFT); //default to left + pWindow = pButton; } else if (name == "GtkRadioButton") { |