Some menu things.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4344 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -391,9 +391,10 @@ void MyFrame::OnAppendMenuItem(wxCommandEvent& WXUNUSED(event))
|
|||||||
void MyFrame::OnAppendSubMenu(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnAppendSubMenu(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxMenuBar *menubar = GetMenuBar();
|
wxMenuBar *menubar = GetMenuBar();
|
||||||
|
|
||||||
wxMenu *menu = menubar->GetMenu(menubar->GetMenuCount() - 1);
|
wxMenu *menu = menubar->GetMenu(menubar->GetMenuCount() - 1);
|
||||||
|
|
||||||
menu->Append(Menu_Dummy_Last, "Dummy sub menu\tCtrl-F12",
|
menu->Append(Menu_Dummy_Last, "Dummy sub menu\tCtrl-F2",
|
||||||
CreateDummyMenu());
|
CreateDummyMenu());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -51,7 +51,8 @@ WX_DEFINE_LIST(wxMenuItemList);
|
|||||||
|
|
||||||
wxMenuItemBase::~wxMenuItemBase()
|
wxMenuItemBase::~wxMenuItemBase()
|
||||||
{
|
{
|
||||||
delete m_subMenu;
|
if (m_subMenu)
|
||||||
|
delete m_subMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_ACCEL
|
#if wxUSE_ACCEL
|
||||||
@@ -128,7 +129,8 @@ void wxMenuBase::Init(long style)
|
|||||||
|
|
||||||
wxMenuBase::~wxMenuBase()
|
wxMenuBase::~wxMenuBase()
|
||||||
{
|
{
|
||||||
// nothing to do, wxMenuItemList dtor will delete the menu items
|
// nothing to do, wxMenuItemList dtor will delete the menu items.
|
||||||
|
// Actually, in GTK, the submenus have to get deleted first.
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -757,11 +757,11 @@ void wxMenu::Init()
|
|||||||
|
|
||||||
wxMenu::~wxMenu()
|
wxMenu::~wxMenu()
|
||||||
{
|
{
|
||||||
|
m_items.Clear();
|
||||||
|
|
||||||
gtk_widget_destroy( m_menu );
|
gtk_widget_destroy( m_menu );
|
||||||
|
|
||||||
gtk_object_unref( GTK_OBJECT(m_factory) );
|
gtk_object_unref( GTK_OBJECT(m_factory) );
|
||||||
|
|
||||||
// the menu items are deleted by the base class dtor
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxMenu::DoAppend(wxMenuItem *mitem)
|
bool wxMenu::DoAppend(wxMenuItem *mitem)
|
||||||
@@ -802,6 +802,7 @@ bool wxMenu::DoAppend(wxMenuItem *mitem)
|
|||||||
entry.callback = (GtkItemFactoryCallback) 0;
|
entry.callback = (GtkItemFactoryCallback) 0;
|
||||||
entry.callback_action = 0;
|
entry.callback_action = 0;
|
||||||
entry.item_type = "<Branch>";
|
entry.item_type = "<Branch>";
|
||||||
|
entry.accelerator = (gchar*) NULL;
|
||||||
|
|
||||||
gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */
|
gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */
|
||||||
|
|
||||||
@@ -832,6 +833,7 @@ bool wxMenu::DoAppend(wxMenuItem *mitem)
|
|||||||
entry.item_type = "<CheckItem>";
|
entry.item_type = "<CheckItem>";
|
||||||
else
|
else
|
||||||
entry.item_type = "<Item>";
|
entry.item_type = "<Item>";
|
||||||
|
entry.accelerator = (gchar*) NULL;
|
||||||
|
|
||||||
#if wxUSE_ACCEL
|
#if wxUSE_ACCEL
|
||||||
// due to an apparent bug in GTK+, we have to use a static buffer here -
|
// due to an apparent bug in GTK+, we have to use a static buffer here -
|
||||||
|
@@ -757,11 +757,11 @@ void wxMenu::Init()
|
|||||||
|
|
||||||
wxMenu::~wxMenu()
|
wxMenu::~wxMenu()
|
||||||
{
|
{
|
||||||
|
m_items.Clear();
|
||||||
|
|
||||||
gtk_widget_destroy( m_menu );
|
gtk_widget_destroy( m_menu );
|
||||||
|
|
||||||
gtk_object_unref( GTK_OBJECT(m_factory) );
|
gtk_object_unref( GTK_OBJECT(m_factory) );
|
||||||
|
|
||||||
// the menu items are deleted by the base class dtor
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxMenu::DoAppend(wxMenuItem *mitem)
|
bool wxMenu::DoAppend(wxMenuItem *mitem)
|
||||||
@@ -802,6 +802,7 @@ bool wxMenu::DoAppend(wxMenuItem *mitem)
|
|||||||
entry.callback = (GtkItemFactoryCallback) 0;
|
entry.callback = (GtkItemFactoryCallback) 0;
|
||||||
entry.callback_action = 0;
|
entry.callback_action = 0;
|
||||||
entry.item_type = "<Branch>";
|
entry.item_type = "<Branch>";
|
||||||
|
entry.accelerator = (gchar*) NULL;
|
||||||
|
|
||||||
gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */
|
gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */
|
||||||
|
|
||||||
@@ -832,6 +833,7 @@ bool wxMenu::DoAppend(wxMenuItem *mitem)
|
|||||||
entry.item_type = "<CheckItem>";
|
entry.item_type = "<CheckItem>";
|
||||||
else
|
else
|
||||||
entry.item_type = "<Item>";
|
entry.item_type = "<Item>";
|
||||||
|
entry.accelerator = (gchar*) NULL;
|
||||||
|
|
||||||
#if wxUSE_ACCEL
|
#if wxUSE_ACCEL
|
||||||
// due to an apparent bug in GTK+, we have to use a static buffer here -
|
// due to an apparent bug in GTK+, we have to use a static buffer here -
|
||||||
|
Reference in New Issue
Block a user