// declarations
// ============================================================================
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "menu.h"
#endif
}
// function appends a new item or submenu to the menu
-bool wxMenu::DoAppend(wxMenuItem *pItem)
+wxMenuItem* wxMenu::DoAppend(wxMenuItem *pItem)
{
if (m_menuWidget)
{
return wxMenuBase::DoRemove(item);
}
-bool wxMenu::DoInsert(size_t pos, wxMenuItem *item)
+wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item)
{
if ( wxMenuBase::DoInsert(pos, item) )
- return TRUE;
+ return item;
wxFAIL_MSG(wxT("DoInsert not implemented; or error in wxMenuBase::DoInsert"));
- return FALSE;
+ return NULL;
}
void wxMenu::SetTitle(const wxString& label)
{
m_title = label;
- wxMenuItemList::Node *node = GetMenuItems().GetFirst();
+ wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
if ( !node )
return;
m_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
}
+wxMenuBar::wxMenuBar(int n, wxMenu *menus[], const wxArrayString& titles)
+{
+ wxASSERT( size_t(n) == titles.GetCount() );
+
+ Init();
+
+ m_titles = titles;
+ for ( int i = 0; i < n; i++ )
+ m_menus.Append(menus[i]);
+}
+
wxMenuBar::wxMenuBar(int n, wxMenu *menus[], const wxString titles[])
{
Init();
menu->SetMenuBar(NULL);
- m_titles.Remove(pos);
+ m_titles.RemoveAt(pos);
return menu;
}
{
wxStripMenuCodes (wxConstCast(m_titles[i].c_str(), char), buf2);
if (strcmp (buf1, buf2) == 0)
- return m_menus[i]->FindItem (itemString);
+ return m_menus.Item(i)->GetData()->FindItem (itemString);
}
return -1;
}
wxMenuItem *item = NULL;
size_t menuCount = GetMenuCount();
for (size_t i = 0; i < menuCount; i++)
- if ((item = m_menus[i]->FindItem(id, itemMenu)))
+ if ((item = m_menus.Item(i)->GetData()->FindItem(id, itemMenu)))
return item;
return NULL;
}
wxMenu *menuParent = GetParent();
if ( menuParent )
{
- wxMenuItemList::Node *node = menuParent->GetMenuItems().GetFirst();
+ wxMenuItemList::compatibility_iterator node = menuParent->GetMenuItems().GetFirst();
while ( node )
{
if ( node->GetData()->GetSubMenu() == this )
{
- menuParent->GetMenuItems().DeleteNode(node);
+ delete node->GetData();
+ menuParent->GetMenuItems().Erase(node);
break;
}
m_menuBar = menuBar;
m_topLevelMenu = topMenu;
- for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst();
+ for ( wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
node;
node = node->GetNext() )
{
// do a CreateMenu again.
void wxMenu::DestroyMenu (bool full)
{
- for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst();
+ for ( wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
node;
node = node->GetNext() )
{
return m_buttonWidget;
}
- for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst();
+ for ( wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
node;
node = node->GetNext() )
{
if (m_buttonWidget)
wxDoChangeBackgroundColour(m_buttonWidget, (wxColour&) col, TRUE);
- for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst();
+ for ( wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
node;
node = node->GetNext() )
{
if (m_buttonWidget)
wxDoChangeForegroundColour(m_buttonWidget, (wxColour&) col);
- for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst();
+ for ( wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
node;
node = node->GetNext() )
{
NULL);
}
- for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst();
+ for ( wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
node;
node = node->GetNext() )
{
size_t menuCount = GetMenuCount();
for (size_t i = 0; i < menuCount; i++)
- m_menus[i]->SetBackgroundColour((wxColour&) col);
+ m_menus.Item(i)->GetData()->SetBackgroundColour((wxColour&) col);
return TRUE;
}
size_t menuCount = GetMenuCount();
for (size_t i = 0; i < menuCount; i++)
- m_menus[i]->SetForegroundColour((wxColour&) col);
+ m_menus.Item(i)->GetData()->SetForegroundColour((wxColour&) col);
return TRUE;
}
size_t menuCount = GetMenuCount();
for (size_t i = 0; i < menuCount; i++)
- m_menus[i]->SetFont(font);
+ m_menus.Item(i)->GetData()->SetFont(font);
return TRUE;
}