]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/cmdproc.cpp
Don't let wxSlider send events when programmatically changing
[wxWidgets.git] / src / common / cmdproc.cpp
index afdc6fff29acf7ef07a2e56433f60513c0b99888..79456425653bcf8b2d2c7302fabceebaa8df0c98 100644 (file)
@@ -220,6 +220,11 @@ void wxCommandProcessor::Initialize()
     SetMenuStrings();
 }
 
+static void wxSetMenuLabel(wxMenu* menu, int id, const wxString& label)
+{
+    menu->SetLabel(id, label);
+}
+
 void wxCommandProcessor::SetMenuStrings()
 {
 #if wxUSE_MENUS
@@ -237,7 +242,8 @@ void wxCommandProcessor::SetMenuStrings()
             else
                 buf = wxString(_("Can't &Undo ")) + commandName + m_undoAccelerator;
 
-            m_commandEditMenu->SetLabel(wxID_UNDO, buf);
+            wxSetMenuLabel(m_commandEditMenu, wxID_UNDO, buf);
+            
             m_commandEditMenu->Enable(wxID_UNDO, canUndo);
 
             // We can redo, if we're not at the end of the history.
@@ -247,23 +253,23 @@ void wxCommandProcessor::SetMenuStrings()
                 wxString redoCommandName(redoCommand->GetName());
                 if (redoCommandName == wxT("")) redoCommandName = _("Unnamed command");
                 buf = wxString(_("&Redo ")) + redoCommandName + m_redoAccelerator;
-                m_commandEditMenu->SetLabel(wxID_REDO, buf);
+                wxSetMenuLabel(m_commandEditMenu, wxID_REDO, buf);
                 m_commandEditMenu->Enable(wxID_REDO, TRUE);
             }
             else
             {
-                m_commandEditMenu->SetLabel(wxID_REDO, _("&Redo") + m_redoAccelerator);
+                wxSetMenuLabel(m_commandEditMenu, wxID_REDO, _("&Redo") + m_redoAccelerator);
                 m_commandEditMenu->Enable(wxID_REDO, FALSE);
             }
         }
         else
         {
-            m_commandEditMenu->SetLabel(wxID_UNDO, _("&Undo") + m_undoAccelerator);
+            wxSetMenuLabel(m_commandEditMenu, wxID_UNDO, _("&Undo") + m_undoAccelerator);
             m_commandEditMenu->Enable(wxID_UNDO, FALSE);
 
             if (m_commands.Number() == 0)
             {
-                m_commandEditMenu->SetLabel(wxID_REDO, _("&Redo") + m_redoAccelerator);
+                wxSetMenuLabel(m_commandEditMenu, wxID_REDO, _("&Redo") + m_redoAccelerator);
                 m_commandEditMenu->Enable(wxID_REDO, FALSE);
             }
             else
@@ -274,7 +280,7 @@ void wxCommandProcessor::SetMenuStrings()
                 wxString redoCommandName(redoCommand->GetName());
                 if (redoCommandName == wxT("")) redoCommandName = _("Unnamed command");
                 buf = wxString(_("&Redo ")) + redoCommandName + m_redoAccelerator;
-                m_commandEditMenu->SetLabel(wxID_REDO, buf);
+                wxSetMenuLabel(m_commandEditMenu, wxID_REDO, buf);
                 m_commandEditMenu->Enable(wxID_REDO, TRUE);
             }
         }