diff options
author | Jan Holesovsky <kendy@suse.cz> | 2013-05-30 18:25:09 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2013-06-02 04:54:54 +0200 |
commit | 6fe1ff54c667a4f669feee6954dd9b859fd442b2 (patch) | |
tree | 25076e5502ad6cbf44ffff9406887e9dfc4485cf /vcl/source/window/builder.cxx | |
parent | 4f14ed6d346a488976262e69fdbc2fd21881b659 (diff) |
sidebar: Allow creation of toolboxes using Widget layout / .ui.
Change-Id: Idc07614005a00401a51007b1a0aef00e17507daa
Diffstat (limited to 'vcl/source/window/builder.cxx')
-rw-r--r-- | vcl/source/window/builder.cxx | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 3a584084652e..380c5e663357 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -26,11 +26,14 @@ #include <vcl/svapp.hxx> #include <vcl/tabctrl.hxx> #include <vcl/tabpage.hxx> +#include <vcl/toolbox.hxx> #include <vcl/vclmedit.hxx> #include <svdata.hxx> #include <svids.hrc> #include <window.h> +using namespace com::sun::star; + #ifdef DISABLE_DYNLOADING #include <dlfcn.h> // For RTLD_DEFAULT #endif @@ -135,13 +138,14 @@ namespace } #endif -VclBuilder::VclBuilder(Window *pParent, OUString sUIDir, OUString sUIFile, OString sID) +VclBuilder::VclBuilder(Window *pParent, OUString sUIDir, OUString sUIFile, OString sID, const uno::Reference<frame::XFrame>& rFrame) : m_sID(sID) , m_sHelpRoot(OUStringToOString(sUIFile, RTL_TEXTENCODING_UTF8)) , m_pStringReplace(ResMgr::GetReadStringHook()) , m_pParent(pParent) , m_bToplevelParentFound(false) , m_pParserState(new ParserState) + , m_xFrame(rFrame) { m_bToplevelHasDeferredInit = (pParent && pParent->IsDialog()) ? ((Dialog*)pParent)->isDeferredInit() : false; m_bToplevelHasDeferredProperties = m_bToplevelHasDeferredInit; @@ -617,6 +621,18 @@ namespace return sType; } + OString extractActionName(VclBuilder::stringmap &rMap) + { + OString sActionName; + VclBuilder::stringmap::iterator aFind = rMap.find(OString("action-name")); + if (aFind != rMap.end()) + { + sActionName = aFind->second; + rMap.erase(aFind); + } + return sActionName; + } + Window * extractStockAndBuildPushButton(Window *pParent, VclBuilder::stringmap &rMap) { WinBits nBits = WB_CENTER|WB_VCENTER|WB_3DLOOK; @@ -1209,6 +1225,22 @@ Window *VclBuilder::makeObject(Window *pParent, const OString &name, const OStri if (pRealParent != pParent) cleanupWidgetOwnScrolling(pParent, pWindow, rMap); } + else if (name == "GtkToolbar") + { + pWindow = new ToolBox(pParent, WB_3DLOOK | WB_TABSTOP); + } + else if (name == "GtkToolButton") + { + ToolBox *pToolBox = dynamic_cast<ToolBox*>(pParent); + if (pToolBox) + { + OUString aCommand(OStringToOUString(extractActionName(rMap), RTL_TEXTENCODING_UTF8)); + if (!aCommand.isEmpty()) + pToolBox->InsertItem(aCommand, m_xFrame); + + return NULL; // no widget to be created + } + } else { sal_Int32 nDelim = name.indexOf('-'); |