Skip to content

Commit

Permalink
Merge fix from 2.3 branch
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Jul 25, 2017
2 parents 42161d3 + 7525734 commit 6080763
Showing 1 changed file with 13 additions and 24 deletions.
37 changes: 13 additions & 24 deletions plugins/uimanager/GroupDialog.cpp
Expand Up @@ -299,30 +299,8 @@ wxWindow* GroupDialog::addPage(const PagePtr& page)
}
}

// greebo: Workaround to resolve #4551 in wxGTK:
// In Window Layouts with the GroupDialog in its own Window
// the attempt to Reparent() the page widget to the wxNotebook fails
// and the page gets cramped into the upper left corner.
// I can't figure the heck out why this happens, but it works when
// inserting a wxPanel and reparenting the page to that instead.
#if false
// non-working code, stuff gets cramped into the upper left corner as if wrongly parented
page->page->Reparent(_notebook.get());
_notebook->InsertPage(insertPosition, page->page, page->tabLabel, false, imageId);
#else
// Instantiate an intermediate wxPanel with the wxNotebook as parent
wxPanel* temp = new wxPanel(_notebook.get(), wxID_ANY);
temp->SetSizer(new wxBoxSizer(wxVERTICAL));

// Reparent the page widget to the panel
page->page->Reparent(temp);
temp->GetSizer()->Add(page->page, 1, wxEXPAND);

// We need to store the panel as page widget for switching functionality
page->page = temp;

_notebook->InsertPage(insertPosition, temp, page->tabLabel, false, imageId);
#endif

// Add this page by copy to the local list
_pages.insert(std::make_pair(page->position, Page(*page)));
Expand Down Expand Up @@ -361,9 +339,20 @@ void GroupDialog::removePage(const std::string& name)

void GroupDialog::updatePageTitle(int pageNumber)
{
if (pageNumber >= 0 && pageNumber < static_cast<int>(_pages.size()))
if (pageNumber < 0) return;

// Look up the page in the _pages dictionary by the page widget
wxWindow* win = _notebook->GetPage(static_cast<size_t>(pageNumber));

if (win == nullptr) return;

for (const Pages::value_type& page : _pages)
{
SetTitle(_pages[pageNumber].windowLabel);
if (page.second.page == win)
{
SetTitle(page.second.windowLabel);
break;
}
}
}

Expand Down

0 comments on commit 6080763

Please sign in to comment.