// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
-#pragma implementation "menu.h"
-#pragma implementation "menuitem.h"
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
+ #pragma implementation "menu.h"
+ #pragma implementation "menuitem.h"
#endif
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
#include "wx/log.h"
#include "wx/intl.h"
#include "wx/app.h"
{
if (g_isIdle) wxapp_install_idle_handler();
- wxMenuEvent event( wxEVT_MENU_OPEN, -1 );
+ wxMenuEvent event( wxEVT_MENU_OPEN, -1, menu );
event.SetEventObject( menu );
wxEvtHandler* handler = menu->GetEventHandler();
return;
}
- m_menus.DeleteContents( TRUE );
-
/* GTK 1.2.0 doesn't have gtk_item_factory_get_item(), but GTK 1.2.1 has. */
#if GTK_CHECK_VERSION(1, 2, 1)
m_accel = gtk_accel_group_new();
return;
}
- m_menus.DeleteContents( TRUE );
-
/* GTK 1.2.0 doesn't have gtk_item_factory_get_item(), but GTK 1.2.1 has. */
#if GTK_CHECK_VERSION(1, 2, 1)
m_accel = gtk_accel_group_new();
/* support for native hot keys */
gtk_accel_group_detach( menu->m_accel, ACCEL_OBJ_CAST(top_frame->m_widget) );
- wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
+ wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
while (node)
{
wxMenuItem *menuitem = node->GetData();
gtk_accel_group_attach( menu->m_accel, obj );
#endif // GTK+ 1.2.1+
- wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
+ wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
while (node)
{
wxMenuItem *menuitem = node->GetData();
gtk_accel_group_attach( m_accel, obj );
#endif // GTK+ 1.2.1+
- wxMenuList::Node *node = m_menus.GetFirst();
+ wxMenuList::compatibility_iterator node = m_menus.GetFirst();
while (node)
{
wxMenu *menu = node->GetData();
gtk_accel_group_detach( m_accel, ACCEL_OBJ_CAST(top_frame->m_widget) );
#endif // GTK+ 1.2.1+
- wxMenuList::Node *node = m_menus.GetFirst();
+ wxMenuList::compatibility_iterator node = m_menus.GetFirst();
while (node)
{
wxMenu *menu = node->GetData();
static wxMenu *CopyMenu (wxMenu *menu)
{
wxMenu *menucopy = new wxMenu ();
- wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
+ wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
while (node)
{
wxMenuItem *item = node->GetData();
return res;
}
- wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
+ wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
while (node)
{
wxMenuItem *item = node->GetData();
int wxMenuBar::FindMenuItem( const wxString &menuString, const wxString &itemString ) const
{
- wxMenuList::Node *node = m_menus.GetFirst();
+ wxMenuList::compatibility_iterator node = m_menus.GetFirst();
while (node)
{
wxMenu *menu = node->GetData();
{
wxMenuItem* result = menu->FindChildItem(id);
- wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
+ wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
while ( node && result == NULL )
{
wxMenuItem *item = node->GetData();
wxMenuItem* wxMenuBar::FindItem( int id, wxMenu **menuForItem ) const
{
wxMenuItem* result = 0;
- wxMenuList::Node *node = m_menus.GetFirst();
+ wxMenuList::compatibility_iterator node = m_menus.GetFirst();
while (node && result == 0)
{
wxMenu *menu = node->GetData();
void wxMenuBar::EnableTop( size_t pos, bool flag )
{
- wxMenuList::Node *node = m_menus.Item( pos );
+ wxMenuList::compatibility_iterator node = m_menus.Item( pos );
wxCHECK_RET( node, wxT("menu not found") );
wxString wxMenuBar::GetLabelTop( size_t pos ) const
{
- wxMenuList::Node *node = m_menus.Item( pos );
+ wxMenuList::compatibility_iterator node = m_menus.Item( pos );
wxCHECK_MSG( node, wxT("invalid"), wxT("menu not found") );
void wxMenuBar::SetLabelTop( size_t pos, const wxString& label )
{
- wxMenuList::Node *node = m_menus.Item( pos );
+ wxMenuList::compatibility_iterator node = m_menus.Item( pos );
wxCHECK_RET( node, wxT("menu not found") );
pm = pm->GetParent();
}
+ // FIXME: why do we have to call wxFrame::GetEventHandler() directly here?
+ // normally wxMenu::SendEvent() should be enough, if it doesn't work
+ // in wxGTK then we have a bug in wxMenu::GetInvokingWindow() which
+ // should be fixed instead of working around it here...
if (frame)
{
// If it is attached then let the frame send the event.
commandEvent.SetEventObject(frame);
if (item->IsCheckable())
commandEvent.SetInt(item->IsChecked());
+ commandEvent.SetEventObject(menu);
frame->GetEventHandler()->ProcessEvent(commandEvent);
}
wxMenu::~wxMenu()
{
- m_items.Clear();
+ WX_CLEAR_LIST(wxMenuItemList, m_items);
if ( GTK_IS_WIDGET( m_menu ))
gtk_widget_destroy( m_menu );
int wxMenu::FindMenuIdByMenuItem( GtkWidget *menuItem ) const
{
- wxMenuItemList::Node *node = m_items.GetFirst();
+ wxMenuItemList::compatibility_iterator node = m_items.GetFirst();
while (node)
{
wxMenuItem *item = node->GetData();