Exemplo n.º 1
0
void RebrandingHelper::ApplyBranding(wxMenu & menu, wxString scope)
{
    size_t separatorIndex = 0;

	wxMenuItemList & itemsList = menu.GetMenuItems();
	for(auto itemIt = itemsList.begin(); itemIt != itemsList.end();++itemIt)
	{
	    wxMenuItem * item = *itemIt;
	    if (!item) continue;

        wxString name = menu.GetLabelText(item->GetId());
        if (item->GetId() == wxID_SEPARATOR)
        {
            name = "Separator_";
            name << separatorIndex;
            separatorIndex++;
        }

	    wxString itemScope = scope + "." + name;

	    if (ShouldDelete(itemScope)) menu.Destroy(item);
	    else if (ShouldRename(itemScope)) item->SetItemLabel(GetNewName(itemScope));
	}
}