From ba40e243260b8931fc5681306b30375412024d21 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Sat, 19 May 2012 01:13:00 +0000 Subject: [PATCH] Attach toolbars to the frame before populating them Works around a wxOSX-Cocoa bug (http://trac.wxwidgets.org/ticket/13888) that resulted in items never being added to the toolbar. Originally committed to SVN as r6826. --- aegisub/src/toolbar.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/aegisub/src/toolbar.cpp b/aegisub/src/toolbar.cpp index db16f7b97..3959a39cc 100644 --- a/aegisub/src/toolbar.cpp +++ b/aegisub/src/toolbar.cpp @@ -183,12 +183,25 @@ namespace { Populate(); Bind(wxEVT_COMMAND_TOOL_CLICKED, &Toolbar::OnClick, this); } + + Toolbar(wxFrame *parent, std::string const& name, agi::Context *c, std::string const& ht_context) + : wxToolBar(parent, -1, wxDefaultPosition, wxDefaultSize, wxTB_FLAT | wxTB_HORIZONTAL) + , name(name) + , context(c) + , ht_context(ht_context) + , icon_size_slot(OPT_SUB("App/Toolbar Icon Size", &Toolbar::RegenerateToolbar, this)) + , hotkeys_changed_slot(hotkey::inst->AddHotkeyChangeListener(&Toolbar::RegenerateToolbar, this)) + { + parent->SetToolBar(this); + Populate(); + Bind(wxEVT_COMMAND_TOOL_CLICKED, &Toolbar::OnClick, this); + } }; } namespace toolbar { void AttachToolbar(wxFrame *frame, std::string const& name, agi::Context *c, std::string const& hotkey) { - frame->SetToolBar(new Toolbar(frame, name, c, hotkey, false)); + new Toolbar(frame, name, c, hotkey); } wxToolBar *GetToolbar(wxWindow *parent, std::string const& name, agi::Context *c, std::string const& hotkey, bool vertical) {