Added menu_highlight behaviour as in wxMSW (statusbar)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1606 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1999-02-05 13:25:40 +00:00
parent 341c92a8b4
commit 342b6a2fe4
10 changed files with 115 additions and 45 deletions

View File

@@ -105,6 +105,7 @@ static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventC
BEGIN_EVENT_TABLE(wxFrame, wxWindow)
EVT_SIZE(wxFrame::OnSize)
EVT_CLOSE(wxFrame::OnCloseWindow)
EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(wxFrame,wxWindow)
@@ -564,6 +565,29 @@ wxMenuBar *wxFrame::GetMenuBar() const
return m_frameMenuBar;
}
void wxFrame::OnMenuHighlight(wxMenuEvent& event)
{
if (GetStatusBar())
{
if (event.GetMenuId() == -1)
{
SetStatusText("");
}
else
{
wxMenuBar *menuBar = GetMenuBar();
if (menuBar)
{
int menuId = event.GetMenuId();
wxString helpString;
helpString = menuBar->GetHelpString(menuId);
if (helpString != "")
SetStatusText(helpString);
}
}
}
}
wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
{
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );

View File

@@ -152,6 +152,7 @@ bool wxMenuBar::Enabled( int id ) const
{
wxMenuItem* item = FindMenuItemById( id );
if (item) return item->IsEnabled();
return FALSE;
}
@@ -161,7 +162,7 @@ wxString wxMenuBar::GetLabel( int id ) const
if (item) return item->GetText();
return "";
return wxString("");
}
void wxMenuBar::SetLabel( int id, const wxString &label )
@@ -204,6 +205,23 @@ void wxMenuBar::SetLabelTop( int pos, const wxString& label )
menu->SetTitle( label );
}
void wxMenuBar::SetHelpString( int id, const wxString& helpString )
{
wxMenuItem* item = FindMenuItemById( id );
if (item) item->SetHelp( helpString );
}
wxString wxMenuBar::GetHelpString( int id ) const
{
wxMenuItem* item = FindMenuItemById( id );
if (item)
return item->GetHelp();
else
return wxString("");
}
//-----------------------------------------------------------------------------
// "activate"
//-----------------------------------------------------------------------------
@@ -262,9 +280,8 @@ static void gtk_menu_hilight_callback( GtkWidget *widget, wxMenu *menu )
if (!menu->IsEnabled(id)) return;
wxCommandEvent event( wxEVT_MENU_HIGHLIGHT, id );
wxMenuEvent event( wxEVT_MENU_HIGHLIGHT, id );
event.SetEventObject( menu );
event.SetInt(id );
/* wxMSW doesn't call callback here either