Merge branches 'aui-close-on-all-fix', 'aui-current-after-drag', 'aui-hint', 'aui-tbar-realize' and 'aui-book-rm-current'

Merge miscellaneous AUI fixes and improvements.

See #24159, #24160, #24161, #24164, #24184.
This commit is contained in:
Vadim Zeitlin 2024-01-10 18:39:41 +01:00
8 changed files with 155 additions and 148 deletions

View file

@ -25,6 +25,7 @@
#include "wx/dataobj.h"
#include "wx/dcclient.h"
#include "wx/bmpbuttn.h"
#include "wx/log.h"
#include "wx/menu.h"
#include "wx/toolbar.h"
#include "wx/statusbr.h"
@ -100,6 +101,8 @@ class MyFrame : public wxFrame
ID_NotebookArtSimple,
ID_NotebookAlignTop,
ID_NotebookAlignBottom,
ID_NotebookNewTab,
ID_NotebookDeleteTab,
ID_SampleItem,
@ -160,6 +163,9 @@ private:
void OnNotebookFlag(wxCommandEvent& evt);
void OnUpdateUI(wxUpdateUIEvent& evt);
void OnNotebookNewTab(wxCommandEvent& evt);
void OnNotebookDeleteTab(wxCommandEvent& evt);
void OnPaneClose(wxAuiManagerEvent& evt);
private:
@ -607,6 +613,8 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(ID_NotebookArtSimple, MyFrame::OnNotebookFlag)
EVT_MENU(ID_NotebookAlignTop, MyFrame::OnTabAlignment)
EVT_MENU(ID_NotebookAlignBottom, MyFrame::OnTabAlignment)
EVT_MENU(ID_NotebookNewTab, MyFrame::OnNotebookNewTab)
EVT_MENU(ID_NotebookDeleteTab, MyFrame::OnNotebookDeleteTab)
EVT_MENU(ID_NoGradient, MyFrame::OnGradient)
EVT_MENU(ID_VerticalGradient, MyFrame::OnGradient)
EVT_MENU(ID_HorizontalGradient, MyFrame::OnGradient)
@ -735,6 +743,9 @@ MyFrame::MyFrame(wxWindow* parent,
notebook_menu->AppendCheckItem(ID_NotebookScrollButtons, _("Scroll Buttons Visible"));
notebook_menu->AppendCheckItem(ID_NotebookWindowList, _("Window List Button Visible"));
notebook_menu->AppendCheckItem(ID_NotebookTabFixedWidth, _("Fixed-width Tabs"));
notebook_menu->AppendSeparator();
notebook_menu->Append(ID_NotebookNewTab, _("Add a &New Tab"));
notebook_menu->Append(ID_NotebookDeleteTab, _("&Delete Last Tab"));
m_perspectives_menu = new wxMenu;
m_perspectives_menu->Append(ID_CreatePerspective, _("Create Perspective"));
@ -1302,6 +1313,36 @@ void MyFrame::OnUpdateUI(wxUpdateUIEvent& event)
}
}
void MyFrame::OnNotebookNewTab(wxCommandEvent& WXUNUSED(evt))
{
auto* const book =
wxCheckCast<wxAuiNotebook>(m_mgr.GetPane("notebook_content").window);
book->AddPage(new wxTextCtrl(book, wxID_ANY, "New Tab",
wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE | wxNO_BORDER),
wxString::Format("Tab %zu", book->GetPageCount() + 1),
true /* select */);
}
void MyFrame::OnNotebookDeleteTab(wxCommandEvent& WXUNUSED(evt))
{
auto* const book =
wxCheckCast<wxAuiNotebook>(m_mgr.GetPane("notebook_content").window);
auto numPages = book->GetPageCount();
if ( !numPages )
{
wxLogWarning("No pages to delete.");
return;
}
book->DeletePage(numPages - 1);
}
void MyFrame::OnPaneClose(wxAuiManagerEvent& evt)
{
if (evt.pane->name == "test10")