1, handle right click on either toolbar(red rectangle) or the space next to toolbar(green rectangle). See image shot below:
2, disconnect the event handler of toolbar correctly.
Index: main.cpp
===================================================================
--- main.cpp	(revision 8991)
+++ main.cpp	(working copy)
@@ -529,6 +529,8 @@
     EVT_MENU(idShiftTab,   MainFrame::OnShiftTab)
     EVT_MENU(idCtrlAltTab, MainFrame::OnCtrlAltTab)
 
+    EVT_RIGHT_UP(MainFrame::OnMouseRightUp)
+
 END_EVENT_TABLE()
 
 MainFrame::MainFrame(wxWindow* parent)
@@ -1057,9 +1059,13 @@
     Manager::Get()->AddonToolBar(m_pToolbar, xrcToolbarName);
 
     m_pToolbar->Realize();
+    m_pToolbar->Connect(wxID_ANY, wxEVT_COMMAND_TOOL_RCLICKED, wxCommandEventHandler(MainFrame::OnToolBarRightClick) );
 
+
     m_pToolbar->SetInitialSize();
+    m_debuggerToolbarHandler->GetToolbar()->Connect(wxID_ANY, wxEVT_COMMAND_TOOL_RCLICKED, wxCommandEventHandler(MainFrame::OnToolBarRightClick) );
 
+
     std::vector<ToolbarInfo> toolbars;
 
     toolbars.push_back(ToolbarInfo(m_pToolbar, wxAuiPaneInfo().Name(wxT("MainToolbar")).Caption(_("Main Toolbar")), 0));
@@ -1076,7 +1082,11 @@
         {
             ToolbarInfo info = DoAddPluginToolbar(plug);
             if (info.toolbar)
+            {
                 toolbars.push_back(info);
+                info.toolbar->Connect(wxID_ANY, wxEVT_COMMAND_TOOL_RCLICKED, wxCommandEventHandler(MainFrame::OnToolBarRightClick) );
+            }
+
         }
     }
 
@@ -1710,6 +1720,8 @@
                 }
                 wxAuiPaneInfo paneInfo(toolbarInfo.paneInfo);
                 m_LayoutManager.AddPane(toolbarInfo.toolbar, paneInfo. ToolbarPane().Top().Row(row).Position(position));
+                // add the event handler for mouse right click
+                toolbarInfo.toolbar->Connect(wxID_ANY, wxEVT_COMMAND_TOOL_RCLICKED, wxCommandEventHandler(MainFrame::OnToolBarRightClick));
 
                 DoUpdateLayout();
             }
@@ -2752,6 +2764,17 @@
         m_pInfoPane = 0L;
     }
 
+    // Disconnect the event handler for toolbar's mouse right click event before the plugin is
+    // unloaded in Manager::Shutdown().
+    PluginToolbarsMap::iterator it;
+    for( it = m_PluginsTools.begin(); it != m_PluginsTools.end(); ++it )
+    {
+        wxToolBar* toolbar = it->second;
+        if (toolbar)//Disconnect the mouse right click event handler before the toolbar is destroyed
+            toolbar->Disconnect(wxID_ANY, wxEVT_COMMAND_TOOL_RCLICKED, wxCommandEventHandler(MainFrame::OnToolBarRightClick));
+
+    }
+
     Manager::Shutdown(); // Shutdown() is not Free(), Manager is automatically destroyed at exit
 
     Destroy();
@@ -4456,6 +4479,8 @@
     // remove toolbar, if any
     if (m_PluginsTools[plugin])
     {
+        //Disconnect the mouse right click event handler before the toolbar is destroyed
+        m_PluginsTools[plugin]->Disconnect(wxID_ANY, wxEVT_COMMAND_TOOL_RCLICKED, wxCommandEventHandler(MainFrame::OnToolBarRightClick));
         m_LayoutManager.DetachPane(m_PluginsTools[plugin]);
         m_PluginsTools[plugin]->Destroy();
         m_PluginsTools.erase(plugin);
@@ -4829,3 +4854,33 @@
 
     return sb;
 }
+// Let the user toggle the toolbar and logs from the context menu
+void MainFrame::OnMouseRightUp(wxMouseEvent& event)
+{
+    PopupToggleToolbarMenu();
+    event.Skip();
+}
+
+void MainFrame::OnToolBarRightClick(wxCommandEvent& event)
+{
+    PopupToggleToolbarMenu();
+    event.Skip();
+}
+
+void MainFrame::PopupToggleToolbarMenu()
+{
+    wxMenuBar* menuBar = Manager::Get()->GetAppFrame()->GetMenuBar();
+    int idx = menuBar->FindMenu(_("&View"));
+    if (idx != wxNOT_FOUND)
+    {
+        wxMenu* viewMenu = menuBar->GetMenu(idx);
+        idx = viewMenu->FindItem(_("Toolbars"));
+        if (idx != wxNOT_FOUND)
+        {
+            wxMenu* toolbarMenu = viewMenu->FindItem(idx)->GetSubMenu();
+            PopupMenu(toolbarMenu);
+        }
+    }
+}
+
+
Index: main.h
===================================================================
--- main.h	(revision 8991)
+++ main.h	(working copy)
@@ -95,6 +95,14 @@
         void OnApplicationClose(wxCloseEvent& event);
         void OnStartHereLink(wxCommandEvent& event);
 
+        // the two functions below are used to show context menu to toggle toolbar view status
+        // OnMouseRightUp is handler for right click on MainFrame client space not covered by
+        // any other panels, OnToolBarRightClick is used to response the mouse right click command
+        // on the toolbar.
+        void OnMouseRightUp(wxMouseEvent& event);
+        void OnToolBarRightClick(wxCommandEvent& event);
+        void PopupToggleToolbarMenu();
+
         // File->New submenu entries handler
         void OnFileNewWhat(wxCommandEvent& event);
 
@@ -348,14 +356,14 @@
         LogManager*     m_pLogMan;
         InfoPane*       m_pInfoPane;
 
-        wxToolBar* m_pToolbar;
-        PluginToolbarsMap m_PluginsTools;
+        wxToolBar* m_pToolbar;   // main toolbar
+        PluginToolbarsMap m_PluginsTools; // plugin -> toolbar map
 
         PluginIDsMap m_PluginIDsMap;
         wxMenu* m_ToolsMenu;
         wxMenu* m_PluginsMenu;
         wxMenu* m_HelpPluginsMenu;
-        bool    m_ScanningForPlugins;
+        bool    m_ScanningForPlugins; // this variable is used to delay the UI construction
 
         bool m_SmallToolBar;
         bool m_StartupDone;