-void wxMenu::Append(wxMenuItem *pItem)
-{
- wxCHECK_RET( pItem != NULL, "can't append NULL item to the menu" );
-
- m_menuItems.Append(pItem);
-
- if (m_menuWidget)
- pItem->CreateItem (m_menuWidget, m_menuBar, m_topLevelMenu); // this is a dynamic Append
-
- m_noItems++;
-}
-
-void wxMenu::AppendSeparator()
-{
- Append(new wxMenuItem(this, ID_SEPARATOR));
-}
-
-// Pullright item
-// N.B.: difference between old and new code.
-// Old code stores subMenu in 'children' for later deletion,
-// as well as in m_menuItems, whereas we only store it in
-// m_menuItems here. What implications does this have?
-
-void wxMenu::Append(int id, const wxString& label, wxMenu *subMenu,
- const wxString& helpString)
-{
- Append(new wxMenuItem(this, id, label, helpString, FALSE, subMenu));
-
- subMenu->m_topLevelMenu = m_topLevelMenu;
-}
-
-// Ordinary menu item
-void wxMenu::Append(int id, const wxString& label,
- const wxString& helpString, bool checkable)
-{
- // 'checkable' parameter is useless for Windows.
- Append(new wxMenuItem(this, id, label, helpString, checkable));
-}
-
-void wxMenu::Delete(int id)
-{
- wxNode *node;
- wxMenuItem *item;
- int pos;
-
- for (pos = 0, node = m_menuItems.First(); node; node = node->Next(), pos++)
- {
- item = (wxMenuItem *)node->Data();
- if (item->GetId() == id)
- break;
- }
-
- if (!node)
- return;
-
- item->DestroyItem(TRUE);
-
- // See also old code - don't know if this is needed (seems redundant).
- /*
- if (item->GetSubMenu()) {
- item->subMenu->top_level_menu = item->GetSubMenu();
- item->subMenu->window_parent = NULL;
- children->DeleteObject(item->GetSubMenu());
- }
- */
-
- m_menuItems.DeleteNode(node);
- delete item;
-}
-
-void wxMenu::Enable(int id, bool flag)
-{
- wxMenuItem *item = FindItemForId(id);
- wxCHECK_RET( item != NULL, "can't enable non-existing menu item" );
-
- item->Enable(flag);
-}
-
-bool wxMenu::Enabled(int Id) const
-{
- wxMenuItem *item = FindItemForId(Id);
- wxCHECK( item != NULL, FALSE );
-
- return item->IsEnabled();
-}
-
-void wxMenu::Check(int Id, bool Flag)
-{
- wxMenuItem *item = FindItemForId(Id);
- wxCHECK_RET( item != NULL, "can't get status of non-existing menu item" );
-
- item->Check(Flag);
-}
-
-bool wxMenu::Checked(int id) const
-{
- wxMenuItem *item = FindItemForId(id);
- wxCHECK( item != NULL, FALSE );
-
- return item->IsChecked();
-}
-
-void wxMenu::SetTitle(const wxString& label)
-{
- m_title = label ;
-
- wxNode *node = m_menuItems.First ();
- if (!node)
- return;
-
- wxMenuItem *item = (wxMenuItem *) node->Data ();
- Widget widget = (Widget) item->GetButtonWidget();
- if (!widget)
- return;
-
- XmString title_str = XmStringCreateSimple ((char*) (const char*) label);
- XtVaSetValues (widget,
- XmNlabelString, title_str,
- NULL);
- // TODO: should we delete title_str now?
-}
-
-const wxString wxMenu::GetTitle() const