From 30f1b5f3ef80156808e5a96b2abd63c62a1f5894 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Wed, 31 Mar 1999 17:53:27 +0000 Subject: [PATCH] added wxFrame::Command() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2017 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/gtk/install.txt | 2 +- include/wx/gtk/frame.h | 2 ++ include/wx/gtk1/frame.h | 2 ++ src/gtk/frame.cpp | 17 +++++++++++++++++ src/gtk1/frame.cpp | 17 +++++++++++++++++ 5 files changed, 39 insertions(+), 1 deletion(-) diff --git a/docs/gtk/install.txt b/docs/gtk/install.txt index 6aa0cd9fa1..e73c31dda6 100644 --- a/docs/gtk/install.txt +++ b/docs/gtk/install.txt @@ -164,7 +164,7 @@ toolkit. You must do this by running configure with either of: The following options handle the kind of library you want to build. - --with-threads Compile without thread support. + --with-threads Compile with thread support. --without-shared Do not create shared libraries. diff --git a/include/wx/gtk/frame.h b/include/wx/gtk/frame.h index fc73faa091..de86ad8e1a 100644 --- a/include/wx/gtk/frame.h +++ b/include/wx/gtk/frame.h @@ -92,6 +92,8 @@ public: virtual void Maximize(bool WXUNUSED(maximize)) {} virtual void Restore() {} + virtual void Command( int id ); + void OnCloseWindow( wxCloseEvent& event ); void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp void OnSize( wxSizeEvent &event ); diff --git a/include/wx/gtk1/frame.h b/include/wx/gtk1/frame.h index fc73faa091..de86ad8e1a 100644 --- a/include/wx/gtk1/frame.h +++ b/include/wx/gtk1/frame.h @@ -92,6 +92,8 @@ public: virtual void Maximize(bool WXUNUSED(maximize)) {} virtual void Restore() {} + virtual void Command( int id ); + void OnCloseWindow( wxCloseEvent& event ); void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp void OnSize( wxSizeEvent &event ); diff --git a/src/gtk/frame.cpp b/src/gtk/frame.cpp index b8198a3288..84899e1e48 100644 --- a/src/gtk/frame.cpp +++ b/src/gtk/frame.cpp @@ -640,6 +640,23 @@ wxStatusBar *wxFrame::OnCreateStatusBar( int number, long style, wxWindowID id, return statusBar; } +void wxFrame::Command( int id ) +{ + wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, id); + commandEvent.SetInt( id ); + commandEvent.SetEventObject( this ); + + wxMenuBar *bar = GetMenuBar(); + if (!bar) return; + + wxMenuItem *item = bar->FindItemForId(id) ; + if (item && item->IsCheckable()) + { + bar->Check(id,!bar->Checked(id)) ; + } + GetEventHandler()->ProcessEvent(commandEvent); +} + void wxFrame::SetStatusText(const wxString& text, int number) { wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); diff --git a/src/gtk1/frame.cpp b/src/gtk1/frame.cpp index b8198a3288..84899e1e48 100644 --- a/src/gtk1/frame.cpp +++ b/src/gtk1/frame.cpp @@ -640,6 +640,23 @@ wxStatusBar *wxFrame::OnCreateStatusBar( int number, long style, wxWindowID id, return statusBar; } +void wxFrame::Command( int id ) +{ + wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, id); + commandEvent.SetInt( id ); + commandEvent.SetEventObject( this ); + + wxMenuBar *bar = GetMenuBar(); + if (!bar) return; + + wxMenuItem *item = bar->FindItemForId(id) ; + if (item && item->IsCheckable()) + { + bar->Check(id,!bar->Checked(id)) ; + } + GetEventHandler()->ProcessEvent(commandEvent); +} + void wxFrame::SetStatusText(const wxString& text, int number) { wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); -- 2.47.2