/* the parent window is known after wxFrame::SetMenu() */
m_needParent = FALSE;
m_style = style;
+ m_invokingWindow = (wxWindow*) NULL;
if (!PreCreation( (wxWindow*) NULL, wxDefaultPosition, wxDefaultSize ) ||
!CreateBase( (wxWindow*) NULL, -1, wxDefaultPosition, wxDefaultSize, style, wxDefaultValidator, _T("menubar") ))
/* the parent window is known after wxFrame::SetMenu() */
m_needParent = FALSE;
m_style = 0;
+ m_invokingWindow = (wxWindow*) NULL;
if (!PreCreation( (wxWindow*) NULL, wxDefaultPosition, wxDefaultSize ) ||
!CreateBase( (wxWindow*) NULL, -1, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("menubar") ))
void wxMenuBar::SetInvokingWindow( wxWindow *win )
{
+ m_invokingWindow = win;
#if (GTK_MINOR_VERSION > 0) && (GTK_MICRO_VERSION > 0)
wxWindow *top_frame = win;
while (top_frame->GetParent())
void wxMenuBar::UnsetInvokingWindow( wxWindow *win )
{
+ m_invokingWindow = (wxWindow*) NULL;
#if (GTK_MINOR_VERSION > 0) && (GTK_MICRO_VERSION > 0)
wxWindow *top_frame = win;
while (top_frame->GetParent())
wxString buf;
buf << _T('/') << str.c_str();
- char *cbuf = new char[buf.Length()];
+ char *cbuf = new char[buf.Length()+1];
strcpy(cbuf, buf.mbc_str());
GtkItemFactoryEntry entry;
gtk_menu_bar_append( GTK_MENU_BAR(m_menubar), menu->m_owner );
#endif
+
+ // m_invokingWindow is set after wxFrame::SetMenuBar(). This call enables
+ // adding menu later on.
+ if (m_invokingWindow)
+ wxMenubarSetInvokingWindow( menu, m_invokingWindow );
}
static int FindMenuItemRecursive( const wxMenu *menu, const wxString &menuString, const wxString &itemString )
m_items.Append( mitem );
}
+#if (GTK_MINOR_VERSION > 0)
static char* GetHotKey( const wxString &hotkey, char *hotbuf )
{
if (hotkey.IsEmpty()) return (char*) NULL;
}
return (char*) NULL;
}
+#endif
void wxMenu::Append( int id, const wxString &item, const wxString &helpStr, bool checkable )
{