本文整理汇总了C++中GetMenuItems函数的典型用法代码示例。如果您正苦于以下问题:C++ GetMenuItems函数的具体用法?C++ GetMenuItems怎么用?C++ GetMenuItems使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetMenuItems函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetMenuItems
wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
{
// Update indices of radio groups.
if ( m_radioData )
{
int pos = GetMenuItems().IndexOf(item);
if ( m_radioData->UpdateOnRemoveItem(pos) )
{
wxASSERT_MSG( item->IsRadio(), wxS("Removing non radio button from radio group?") );
}
//else: item being removed is not in a radio group
}
/*
// we need to find the items position in the child list
size_t pos;
wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
for ( pos = 0; node; pos++ )
{
if ( node->GetData() == item )
break;
node = node->GetNext();
}
// DoRemove() (unlike Remove) can only be called for existing item!
wxCHECK_MSG( node, NULL, wxT("bug in wxMenu::Remove logic") );
wxOSXMenuRemoveItem(m_hMenu , pos );
*/
GetPeer()->Remove( item );
// and from internal data structures
return wxMenuBase::DoRemove(item);
}
示例2: GetMenuItems
wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
{
if ( m_startRadioGroup != -1 )
{
// Check if we're removing the item starting the radio group
if ( GetMenuItems().Item(m_startRadioGroup)->GetData() == item )
{
// Yes, we do, so reset its index as the next item added shouldn't
// count as part of the same radio group anyhow.
m_startRadioGroup = -1;
}
}
/*
// we need to find the items position in the child list
size_t pos;
wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
for ( pos = 0; node; pos++ )
{
if ( node->GetData() == item )
break;
node = node->GetNext();
}
// DoRemove() (unlike Remove) can only be called for existing item!
wxCHECK_MSG( node, NULL, wxT("bug in wxMenu::Remove logic") );
wxOSXMenuRemoveItem(m_hMenu , pos );
*/
GetPeer()->Remove( item );
// and from internal data structures
return wxMenuBase::DoRemove(item);
}
示例3: GetMenuItems
wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
{
// we need to find the items position in the child list
size_t pos;
wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
for ( pos = 0; node; pos++ )
{
if ( node->GetData() == item )
break;
node = node->GetNext();
}
// DoRemove() (unlike Remove) can only be called for existing item!
wxCHECK_MSG( node, NULL, wxT("bug in wxMenu::Remove logic") );
::DeleteMenuItem(MAC_WXHMENU(m_hMenu) , pos + 1);
if ( IsAttached() && GetMenuBar()->IsAttached() )
// otherwise, the change won't be visible
GetMenuBar()->Refresh();
// and from internal data structures
return wxMenuBase::DoRemove(item);
}
示例4: wxDoChangeForegroundColour
void wxMenu::SetForegroundColour(const wxColour& col)
{
m_foregroundColour = col;
if (!col.IsOk())
return;
if (m_menuWidget)
wxDoChangeForegroundColour(m_menuWidget, (wxColour&) col);
if (m_buttonWidget)
wxDoChangeForegroundColour(m_buttonWidget, (wxColour&) col);
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
# pragma ivdep
# pragma swp
# pragma unroll
# pragma prefetch
# if 0
# pragma simd noassert
# endif
#endif /* VDM auto patch */
for ( wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
node;
node = node->GetNext() )
{
wxMenuItem* item = node->GetData();
if (item->GetButtonWidget())
{
// This crashes because it uses gadgets
// wxDoChangeForegroundColour(item->GetButtonWidget(), (wxColour&) col);
}
if (item->GetSubMenu())
item->GetSubMenu()->SetForegroundColour((wxColour&) col);
}
}
示例5: GetMenuItems
// non recursive search
wxMenuItem *wxMenuBase::FindChildItem(int id, size_t *ppos) const
{
wxMenuItem *item = (wxMenuItem *)NULL;
wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
size_t pos;
for ( pos = 0; node; pos++ )
{
if ( node->GetData()->GetId() == id )
{
item = node->GetData();
break;
}
node = node->GetNext();
}
if ( ppos )
{
*ppos = item ? pos : (size_t)wxNOT_FOUND;
}
return item;
}
示例6: GetMenuItems
wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
{
// we need to find the items position in the child list
size_t pos;
wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
for ( pos = 0; node; pos++ )
{
if ( node->GetData() == item )
break;
node = node->GetNext();
}
// DoRemove() (unlike Remove) can only be called for existing item!
wxCHECK_MSG( node, NULL, wxT("bug in wxMenu::Remove logic") );
// remove the item from the menu
wxMenuItem *ret=wxMenuBase::DoRemove(item);
if ( IsAttached() && GetMenuBar()->IsAttached() )
{
// Regenerate the menu resource
GetMenuBar()->Refresh();
}
return ret;
}
示例7: DestroyMenu
// Destroys the Motif implementation of the menu,
// but maintains the wxWidgets data structures so we can
// do a CreateMenu again.
void wxMenu::DestroyMenu (bool full)
{
for ( wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
node;
node = node->GetNext() )
{
wxMenuItem *item = node->GetData();
item->SetMenuBar(NULL);
item->DestroyItem(full);
}
if (m_buttonWidget)
{
if (full)
{
XtVaSetValues((Widget) m_buttonWidget, XmNsubMenuId, NULL, NULL);
XtDestroyWidget ((Widget) m_buttonWidget);
m_buttonWidget = (WXWidget) 0;
}
}
if (m_menuWidget && full)
{
XtDestroyWidget((Widget) m_menuWidget);
m_menuWidget = (WXWidget) NULL;
}
}
示例8: FindMenuItem
WXWidget wxMenu::FindMenuItem (int id, wxMenuItem ** it) const
{
if (id == m_menuId)
{
if (it)
*it = NULL;
return m_buttonWidget;
}
for ( wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
node;
node = node->GetNext() )
{
wxMenuItem *item = node->GetData ();
if (item->GetId() == id)
{
if (it)
*it = item;
return item->GetButtonWidget();
}
if (item->GetSubMenu())
{
WXWidget w = item->GetSubMenu()->FindMenuItem (id, it);
if (w)
{
return w;
}
}
}
if (it)
*it = NULL;
return (WXWidget) NULL;
}
示例9: GetMenuItems
/*virtual*/ void CWndToolBar::ChangeFocus(ui8 oldFocus)
{
const CWndToolBar::CBarItem* pItems = GetMenuItems();
SendMessage( GetParent(), ToWord('L', 'D'), (NATIVEPTR)pItems[oldFocus].m_pWndMenu );
SendMessage( GetParent(), ToWord('L', 'E'), (NATIVEPTR)pItems[m_nFocus].m_pWndMenu );
SendMessage( GetParent(), ToWord('L', 'R'), 0 );
Settings.Runtime.m_nMenuItem = m_nFocus;
}
示例10: GetMenuItems
wxMenuItem* wxMenu::DoRemove(
wxMenuItem* pItem
)
{
//
// We need to find the items position in the child list
//
size_t nPos;
wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
for (nPos = 0; node; nPos++)
{
if (node->GetData() == pItem)
break;
node = node->GetNext();
}
//
// DoRemove() (unlike Remove) can only be called for existing item!
//
wxCHECK_MSG(node, NULL, wxT("bug in wxMenu::Remove logic"));
#if wxUSE_ACCEL
//
// Remove the corresponding accel from the accel table
//
int n = FindAccel(pItem->GetId());
if (n != wxNOT_FOUND)
{
delete m_vAccels[n];
m_vAccels.RemoveAt(n);
}
#endif // wxUSE_ACCEL
//
// Remove the item from the menu
//
::WinSendMsg( GetHmenu()
,MM_REMOVEITEM
,MPFROM2SHORT(pItem->GetId(), TRUE)
,(MPARAM)0
);
if (IsAttached() && GetMenuBar()->IsAttached())
{
//
// Otherwise, the chane won't be visible
//
GetMenuBar()->Refresh();
}
//
// And from internal data structures
//
return wxMenuBase::DoRemove(pItem);
} // end of wxMenu::DoRemove
示例11: ClearSuggestionsMenu
void SuggestionsSidebarBlock::ClearSuggestionsMenu()
{
auto m = m_suggestionsMenu;
auto menuItems = m->GetMenuItems();
for (auto i: menuItems)
{
if (std::find(m_suggestionMenuItems.begin(), m_suggestionMenuItems.end(), i) != m_suggestionMenuItems.end())
m->Remove(i);
}
}
示例12: GetMenuItems
wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
{
if ( item->IsRadio() )
{
// Check if we're removing the item starting the radio group
if ( item->IsRadioGroupStart() )
{
// Yes, we do, update the next radio group item, if any, to be the
// start one now.
const int endGroup = item->GetRadioGroupEnd();
wxMenuItemList::compatibility_iterator
node = GetMenuItems().Item(endGroup);
wxASSERT_MSG( node, wxS("Should have valid radio group end") );
while ( node->GetData() != item )
{
const wxMenuItemList::compatibility_iterator
prevNode = node->GetPrevious();
wxMenuItem* const prevItem = prevNode->GetData();
if ( prevItem == item )
{
prevItem->SetAsRadioGroupStart();
prevItem->SetRadioGroupEnd(endGroup);
break;
}
node = prevNode;
}
}
}
/*
// we need to find the items position in the child list
size_t pos;
wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
for ( pos = 0; node; pos++ )
{
if ( node->GetData() == item )
break;
node = node->GetNext();
}
// DoRemove() (unlike Remove) can only be called for existing item!
wxCHECK_MSG( node, NULL, wxT("bug in wxMenu::Remove logic") );
wxOSXMenuRemoveItem(m_hMenu , pos );
*/
GetPeer()->Remove( item );
// and from internal data structures
return wxMenuBase::DoRemove(item);
}
示例13: GetMenuItems
wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
{
// we need to find the item's position in the child list
size_t pos;
wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
for ( pos = 0; node; pos++ )
{
if ( node->GetData() == item )
break;
node = node->GetNext();
}
#if wxUSE_ACCEL
// remove the corresponding accel from the accel table
int n = FindAccel(item->GetId());
if ( n != wxNOT_FOUND )
{
delete m_accels[n];
m_accels.RemoveAt(n);
#if wxUSE_OWNER_DRAWN
ResetMaxAccelWidth();
#endif
}
//else: this item doesn't have an accel, nothing to do
#endif // wxUSE_ACCEL
// Update indices of radio groups.
if ( m_radioData )
{
bool inExistingGroup = m_radioData->UpdateOnRemoveItem(pos);
wxASSERT_MSG( !inExistingGroup || item->GetKind() == wxITEM_RADIO,
wxT("Removing non radio button from radio group?") );
}
// remove the item from the menu
if ( !::RemoveMenu(GetHmenu(), (UINT)pos, MF_BYPOSITION) )
{
wxLogLastError(wxT("RemoveMenu"));
}
if ( IsAttached() && GetMenuBar()->IsAttached() )
{
// otherwise, the change won't be visible
GetMenuBar()->Refresh();
}
// and from internal data structures
return wxMenuBase::DoRemove(item);
}
示例14: wxCHECK_MSG
wxMenuItem* wxMenu::DoAppend(wxMenuItem *item)
{
wxCHECK_MSG( item, NULL, wxT("NULL item in wxMenu::DoAppend") );
bool check = false;
if ( item->GetKind() == wxITEM_RADIO )
{
int count = GetMenuItemCount();
if ( m_startRadioGroup == -1 )
{
// start a new radio group
m_startRadioGroup = count;
// for now it has just one element
item->SetAsRadioGroupStart();
item->SetRadioGroupEnd(m_startRadioGroup);
// ensure that we have a checked item in the radio group
check = true;
}
else // extend the current radio group
{
// we need to update its end item
item->SetRadioGroupStart(m_startRadioGroup);
wxMenuItemList::compatibility_iterator node = GetMenuItems().Item(m_startRadioGroup);
if ( node )
{
node->GetData()->SetRadioGroupEnd(count);
}
else
{
wxFAIL_MSG( wxT("where is the radio group start item?") );
}
}
}
else // not a radio item
{
EndRadioGroup();
}
if ( !wxMenuBase::DoAppend(item) || !DoInsertOrAppend(item) )
return NULL;
if ( check )
// check the item initially
item->Check(true);
return item;
}
示例15: wxGetTopLevelParent
// Update a menu and all submenus recursively. source is the object that has
// the update event handlers defined for it. If NULL, the menu or associated
// window will be used.
void wxMenuBase::UpdateUI(wxEvtHandler* source)
{
if (GetInvokingWindow())
{
// Don't update menus if the parent
// frame is about to get deleted
wxWindow *tlw = wxGetTopLevelParent( GetInvokingWindow() );
if (tlw && wxPendingDelete.Member(tlw))
return;
}
if ( !source && GetInvokingWindow() )
source = GetInvokingWindow()->GetEventHandler();
if ( !source )
source = GetEventHandler();
if ( !source )
source = this;
wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
while ( node )
{
wxMenuItem* item = node->GetData();
if ( !item->IsSeparator() )
{
wxWindowID id = item->GetId();
wxUpdateUIEvent event(id);
event.SetEventObject( source );
if ( source->ProcessEvent(event) )
{
// if anything changed, update the changed attribute
if (event.GetSetText())
SetLabel(id, event.GetText());
if (event.GetSetChecked())
Check(id, event.GetChecked());
if (event.GetSetEnabled())
Enable(id, event.GetEnabled());
}
// recurse to the submenus
if ( item->GetSubMenu() )
item->GetSubMenu()->UpdateUI(source);
}
//else: item is a separator (which doesn't process update UI events)
node = node->GetNext();
}
}