Wx: further cleanup to toolbar creation process

This commit is contained in:
archshift 2014-08-15 22:33:58 -07:00
parent b74a34795b
commit b7f3797689
2 changed files with 12 additions and 19 deletions

View File

@ -626,8 +626,6 @@ void CCodeWindow::PopulateToolbar(wxToolBar* toolBar)
WxUtils::AddToolbarButton(toolBar, IDM_SETPC, _("Set PC"), m_Bitmaps[Toolbar_SetPC], _("Set the current instruction")); WxUtils::AddToolbarButton(toolBar, IDM_SETPC, _("Set PC"), m_Bitmaps[Toolbar_SetPC], _("Set the current instruction"));
toolBar->AddSeparator(); toolBar->AddSeparator();
toolBar->AddControl(new wxTextCtrl(toolBar, IDM_ADDRBOX, "")); toolBar->AddControl(new wxTextCtrl(toolBar, IDM_ADDRBOX, ""));
toolBar->Realize();
} }
// Update GUI // Update GUI

View File

@ -522,28 +522,21 @@ void CFrame::PopulateToolbar(wxToolBar* ToolBar)
WxUtils::AddToolbarButton(ToolBar, IDM_CONFIG_DSP_EMULATOR, _("DSP"), m_Bitmaps[Toolbar_ConfigDSP], _("DSP settings")); WxUtils::AddToolbarButton(ToolBar, IDM_CONFIG_DSP_EMULATOR, _("DSP"), m_Bitmaps[Toolbar_ConfigDSP], _("DSP settings"));
WxUtils::AddToolbarButton(ToolBar, IDM_CONFIG_PAD_PLUGIN, _("GCPad"), m_Bitmaps[Toolbar_ConfigPAD], _("GameCube Pad settings")); WxUtils::AddToolbarButton(ToolBar, IDM_CONFIG_PAD_PLUGIN, _("GCPad"), m_Bitmaps[Toolbar_ConfigPAD], _("GameCube Pad settings"));
WxUtils::AddToolbarButton(ToolBar, IDM_CONFIG_WIIMOTE_PLUGIN, _("Wiimote"), m_Bitmaps[Toolbar_Wiimote], _("Wiimote settings")); WxUtils::AddToolbarButton(ToolBar, IDM_CONFIG_WIIMOTE_PLUGIN, _("Wiimote"), m_Bitmaps[Toolbar_Wiimote], _("Wiimote settings"));
// after adding the buttons to the toolbar, must call Realize() to reflect
// the changes
ToolBar->Realize();
} }
// Delete and recreate the toolbar // Delete and recreate the toolbar
void CFrame::RecreateToolbar() void CFrame::RecreateToolbar()
{ {
if (m_ToolBar) static const long TOOLBAR_STYLE = wxTB_DEFAULT_STYLE | wxTB_TEXT;
if (m_ToolBar != nullptr)
{ {
m_Mgr->DetachPane(m_ToolBar);
m_ToolBar->Destroy(); m_ToolBar->Destroy();
m_ToolBar = nullptr; m_ToolBar = nullptr;
} }
long TOOLBAR_STYLE = wxTB_DEFAULT_STYLE | wxTB_TEXT; m_ToolBar = CreateToolBar(TOOLBAR_STYLE, wxID_ANY);
if (!m_ToolBar)
{
m_ToolBar = CreateToolBar(TOOLBAR_STYLE, wxID_ANY, "TBMain");
if (g_pCodeWindow) if (g_pCodeWindow)
{ {
@ -552,7 +545,9 @@ void CFrame::RecreateToolbar()
} }
PopulateToolbar(m_ToolBar); PopulateToolbar(m_ToolBar);
} // after adding the buttons to the toolbar, must call Realize() to reflect
// the changes
m_ToolBar->Realize();
UpdateGUI(); UpdateGUI();
} }