Kaydet (Commit) 5a83b31a authored tarafından Caolán McNamara's avatar Caolán McNamara

expose a way to drop ownership of a window from builder tree

Change-Id: I6f6bff32271ed1d6c328ba211a6b1249fda039dd
üst 5983675e
...@@ -297,6 +297,9 @@ public: ...@@ -297,6 +297,9 @@ public:
OString get_by_window(const ::Window *pWindow) const; OString get_by_window(const ::Window *pWindow) const;
void delete_by_window(const ::Window *pWindow); void delete_by_window(const ::Window *pWindow);
//release ownership of pWindow, i.e. don't delete it
void drop_ownership(const ::Window *pWindow);
//apply the properties of rProps to pWindow //apply the properties of rProps to pWindow
static void set_properties(::Window *pWindow, const stringmap &rProps); static void set_properties(::Window *pWindow, const stringmap &rProps);
......
...@@ -2997,13 +2997,18 @@ void VclBuilder::delete_by_name(const OString& sID) ...@@ -2997,13 +2997,18 @@ void VclBuilder::delete_by_name(const OString& sID)
} }
void VclBuilder::delete_by_window(const Window *pWindow) void VclBuilder::delete_by_window(const Window *pWindow)
{
drop_ownership(pWindow);
delete pWindow;
}
void VclBuilder::drop_ownership(const Window *pWindow)
{ {
for (std::vector<WinAndId>::iterator aI = m_aChildren.begin(), for (std::vector<WinAndId>::iterator aI = m_aChildren.begin(),
aEnd = m_aChildren.end(); aI != aEnd; ++aI) aEnd = m_aChildren.end(); aI != aEnd; ++aI)
{ {
if (aI->m_pWindow == pWindow) if (aI->m_pWindow == pWindow)
{ {
delete aI->m_pWindow;
m_aChildren.erase(aI); m_aChildren.erase(aI);
break; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment