本文整理汇总了C++中GetMenuItemCount函数的典型用法代码示例。如果您正苦于以下问题:C++ GetMenuItemCount函数的具体用法?C++ GetMenuItemCount怎么用?C++ GetMenuItemCount使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetMenuItemCount函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: wxCHECK_MSG
wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item)
{
if (m_menuWidget)
{
// this is a dynamic Append
#ifndef XmNpositionIndex
wxCHECK_MSG( pos == GetMenuItemCount(), -1, wxT("insert not implemented"));
#endif
item->CreateItem(m_menuWidget, GetMenuBar(), m_topLevelMenu, pos);
}
if ( item->IsSubMenu() )
{
item->GetSubMenu()->m_topLevelMenu = m_topLevelMenu;
}
return pos == GetMenuItemCount() ? wxMenuBase::DoAppend(item) :
wxMenuBase::DoInsert(pos, item);
}
开发者ID:LuaDist,项目名称:wxwidgets,代码行数:19,代码来源:menu.cpp
示例2: RecursiveDeleteMenu
int RecursiveDeleteMenu(HMENU hMenu)
{
int cnt = GetMenuItemCount(hMenu);
for (int i = 0; i < cnt; i++) {
HMENU submenu = GetSubMenu(hMenu, 0);
if (submenu) DestroyMenu(submenu);
DeleteMenu(hMenu, 0, MF_BYPOSITION);
}
return 0;
}
开发者ID:martok,项目名称:miranda-ng,代码行数:10,代码来源:clistmenus.cpp
示例3: GetSubMenuByChildID
HMENU GetSubMenuByChildID(HMENU menu, UINT id) {
int i, j, items, subitems, cur_id;
HMENU m;
items = GetMenuItemCount(menu);
for (i=0; i<items; i++) {
if (m = GetSubMenu(menu, i)) {
subitems = GetMenuItemCount(m);
for (j=0; j<subitems; j++) {
cur_id = GetMenuItemID(m, j);
if (cur_id == id) {
return m;
}
}
}
}
return NULL;
}
开发者ID:pakls,项目名称:teraterm-ttssh2,代码行数:19,代码来源:TTXAlwaysOnTop.c
示例4: wxASSERT_MSG
// function appends a new item or submenu to the menu
// append a new item or submenu to the menu
bool wxMenu::DoInsertOrAppend(wxMenuItem *item, size_t pos)
{
wxASSERT_MSG( item != NULL, wxT("can't append NULL item to the menu") );
GetPeer()->InsertOrAppend( item, pos );
wxMenu *pSubMenu = item->GetSubMenu() ;
if ( pSubMenu != NULL )
{
wxASSERT_MSG( pSubMenu->GetHMenu() != NULL , wxT("invalid submenu added"));
pSubMenu->m_menuParent = this ;
pSubMenu->DoRearrange();
}
else if ( item->GetId() == idMenuTitle )
{
item->GetMenu()->Enable( idMenuTitle, false );
}
if ( pos == (size_t)-1 )
{
pos = GetMenuItemCount() - 1;
}
// Update radio groups if we're inserting a new menu item.
// Inserting radio and non-radio item has a different impact
// on radio groups, so we have to handle each case separately.
// (Inserting a radio item in the middle of existing groups extends this group,
// but inserting a non-radio item breaks it into two subgroups.)
bool check = false;
if ( item->IsRadio() )
{
if ( !m_radioData )
m_radioData = new wxMenuRadioItemsData;
if ( m_radioData->UpdateOnInsertRadio(pos) )
check = true; // ensure that we have a checked item in the radio group
}
else if ( m_radioData )
{
if ( m_radioData->UpdateOnInsertNonRadio(pos) )
{
// One of the existing groups has been split into two subgroups.
wxFAIL_MSG(wxS("Inserting non-radio item inside a radio group?"));
}
}
// if we're already attached to the menubar, we must update it
if ( IsAttached() && GetMenuBar()->IsAttached() )
GetMenuBar()->Refresh();
if ( check )
item->Check(true);
return true ;
}
开发者ID:CodeSmithyIDE,项目名称:wxWidgets,代码行数:57,代码来源:menu_osx.cpp
示例5: add_user_menu_items
static void add_user_menu_items(HMENU menu)
{
MENUITEMINFO mii;
memset(&mii, 0, sizeof(MENUITEMINFO));
mii.type = MFT_SEPARATOR;
InsertMenuItem(menu, GetMenuItemCount(menu), TRUE, &mii);
#if 1
memset(&mii, 0, sizeof(MENUITEMINFO));
mii.type = MFT_STRING;
mii.hsubmenu = 0;
mii.id = IDM_POP_NEW_TAB;
mii.state = MFS_ENABLED;
mii.cch = strlen("New Tab");
mii.typedata = (DWORD)"New Tab";
InsertMenuItem(menu, GetMenuItemCount(menu), TRUE, &mii);
#endif
memset(&mii, 0, sizeof(MENUITEMINFO));
mii.type = MFT_STRING;
mii.hsubmenu = 0;
mii.id = IDM_POP_SAVE_AS;
mii.state = MFS_ENABLED;
mii.cch = strlen("Save As...");
mii.typedata = (DWORD)"Save As...";
InsertMenuItem(menu, GetMenuItemCount(menu), TRUE, &mii);
memset(&mii, 0, sizeof(MENUITEMINFO));
mii.type = MFT_STRING;
mii.hsubmenu = 0;
mii.id = IDM_POP_CLOSE_TAB;
int count = SendMessage(propsheet_hwnd, PSM_GETPAGECOUNT, 0, 0);
if (count >1) {
mii.state &= ~MFS_DISABLED;
mii.state |= MFS_ENABLED;
} else {
mii.state &= ~MFS_ENABLED;
mii.state |= MFS_DISABLED;
}
mii.cch = strlen("Close Tab");
mii.typedata = (DWORD)"Close Tab";
InsertMenuItem(menu, GetMenuItemCount(menu), TRUE, &mii);
}
开发者ID:bytewang,项目名称:vitas,代码行数:42,代码来源:mdolphin_popupmenu.cpp
示例6: GetBorderSize
//*********************************************************************************************************
void CBCGPBaseFilterPopupMenu::RecalcLayout(BOOL bNotify /* = TRUE */)
{
CBCGPPopupMenu::RecalcLayout(bNotify);
if (m_wndMenuBar.GetSafeHwnd() != NULL)
{
m_wndMenuBar.m_arColumns.RemoveAll();
m_wndMenuBar.AdjustLayout();
}
if (m_wndList.GetSafeHwnd() == NULL)
{
return;
}
const int nShadowSize = CBCGPToolBar::IsCustomizeMode () ? 0 : m_iShadowSize;
const int nBorderSize = GetBorderSize();
CRect rectClient;
GetClientRect(rectClient);
rectClient.DeflateRect (nBorderSize, nBorderSize);
if (GetExStyle() & WS_EX_LAYOUTRTL)
{
rectClient.left += nShadowSize;
}
else
{
rectClient.right -= nShadowSize;
}
rectClient.top += m_nMenuBarHeight;
rectClient.bottom -= nShadowSize;
#ifndef _BCGSUITE_
rectClient.left += m_wndMenuBar.GetGutterWidth();
#endif
if (!m_rectResize.IsRectEmpty())
{
if (m_bIsResizeBarOnTop)
{
rectClient.top += m_rectResize.Height();
}
else
{
rectClient.bottom -= m_rectResize.Height();
}
}
m_wndList.SetWindowPos(NULL, rectClient.left, rectClient.top, rectClient.Width(), rectClient.Height(), SWP_NOZORDER | SWP_NOACTIVATE);
m_wndList.m_bIsEmptyMenu = GetMenuItemCount() == 0;
}
开发者ID:iclosure,项目名称:jframework,代码行数:55,代码来源:BCGPGridFilterMenu.cpp
示例7: SWELL_Menu_AddMenuItem
void SWELL_Menu_AddMenuItem(HMENU hMenu, const char *name, int idx, int flags)
{
MENUITEMINFO mi={sizeof(mi),MIIM_ID|MIIM_STATE|MIIM_TYPE,MFT_STRING,
(flags)?MFS_GRAYED:0,idx,NULL,NULL,NULL,0,(char *)name};
if (!name)
{
mi.fType = MFT_SEPARATOR;
mi.fMask&=~(MIIM_STATE|MIIM_ID);
}
InsertMenuItem(hMenu,GetMenuItemCount(hMenu),TRUE,&mi);
}
开发者ID:aidush,项目名称:openmpt,代码行数:11,代码来源:swell-menu-generic.cpp
示例8: FillMarkerRegionMenu
// _flags: &1=marker, &2=region
void FillMarkerRegionMenu(ReaProject* _proj, HMENU _menu, int _msgStart, int _flags, UINT _uiState)
{
int x=0, lastx=0;
char desc[SNM_MAX_MARKER_NAME_LEN]="";
while ((x = EnumMarkerRegionDesc(_proj, x, desc, SNM_MAX_MARKER_NAME_LEN, _flags, true, true, true))) {
if (*desc) AddToMenu(_menu, desc, _msgStart+lastx, -1, false, _uiState);
lastx=x;
}
if (!GetMenuItemCount(_menu))
AddToMenu(_menu, __LOCALIZE("(No region!)","sws_menu"), 0, -1, false, MF_GRAYED);
}
开发者ID:AusRedNeck,项目名称:sws,代码行数:12,代码来源:SnM_Marker.cpp
示例9: winMouseOn
void MainWnd::OnContextMenu(CWnd* pWnd, CPoint point)
{
winMouseOn();
if(theApp.skin) {
if(theApp.popup == NULL) {
theApp.winAccelMgr.UpdateMenu(theApp.menu);
theApp.popup = CreatePopupMenu();
if(theApp.menu != NULL) {
int count = GetMenuItemCount(theApp.menu);
OSVERSIONINFO info;
info.dwOSVersionInfoSize = sizeof(info);
GetVersionEx(&info);
if(info.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
for(int i = 0; i < count; i++) {
char buffer[256];
MENUITEMINFO info;
ZeroMemory(&info, sizeof(info));
info.cbSize = sizeof(info) - sizeof(HBITMAP);
info.fMask = MIIM_STRING | MIIM_SUBMENU;
info.dwTypeData = buffer;
info.cch = 256;
if(!GetMenuItemInfo(theApp.menu, i, MF_BYPOSITION, &info)) {
}
if(!AppendMenu(theApp.popup, MF_POPUP|MF_STRING, (UINT)info.hSubMenu, buffer)) {
}
}
} else {
for(int i = 0; i < count; i++) {
wchar_t buffer[256];
MENUITEMINFOW info;
ZeroMemory(&info, sizeof(info));
info.cbSize = sizeof(info) - sizeof(HBITMAP);
info.fMask = MIIM_STRING | MIIM_SUBMENU;
info.dwTypeData = buffer;
info.cch = 256;
if(!GetMenuItemInfoW(theApp.menu, i, MF_BYPOSITION, &info)) {
}
if(!AppendMenuW(theApp.popup, MF_POPUP|MF_STRING, (UINT)info.hSubMenu, buffer)) {
}
}
}
}
}
int x = point.x;
int y = point.y;
if(x == -1 && y == -1) {
x = (theApp.dest.left + theApp.dest.right) / 2;
y = (theApp.dest.top + theApp.dest.bottom) / 2;
}
if(!TrackPopupMenu(theApp.popup, 0, x, y, 0, m_hWnd, NULL)) {
}
}
}
开发者ID:BackupTheBerlios,项目名称:vbastep-svn,代码行数:54,代码来源:MainWnd.cpp
示例10: get_menu_position
/* find index in menu bar; returns -1 if not installed */
static int get_menu_position(HMENU addr)
{
int n, i;
if (addr == NULL) return -1;
n = GetMenuItemCount(hMainMenu);
for (i = 0; i < n; i++)
if (addr == GetSubMenu(hMainMenu, i))
return(i);
return(-1);
}
开发者ID:jhbadger,项目名称:xlispstat,代码行数:12,代码来源:mswmenus.c
示例11: mh_additem
static int mh_additem (lua_State* l) {
menu* m = lua_touserdata(l,1);
if (!m->sub) return 0;
int k = 2, pos = 0;
if (lua_isnumber(l,k)) pos = lua_tointeger(l,k++);
if (pos==0) pos = -1;
else if (pos>0) pos--;
else if (pos<-1) pos += GetMenuItemCount(m->menu);
const char* str = luaL_checkstring(l,k++);
const char* sShortcut = NULL;
if (lua_isstring(l,k)) sShortcut = lua_tostring(l,k++);
else if (lua_isnoneornil(l,k)) k++;
if (!lua_isfunction(l,k)) luaL_typerror(l, k, "function");
void* p = lua_topointer(l,k++);
if (!p) return 0;
const wchar_t* wstr = strcvt(str, CP_UTF8, CP_UTF16, NULL);
int command = addCustomCommand(p) + IDM_CUSTOMCOMMAND;
int kFlags = 0, key=0;
if (parseKeyName(sShortcut, &kFlags, &key)) {
addAccelerator(kFlags, key, command);
const wchar_t* z = mh_buildLabel(wstr, kFlags, key);
if (z!=wstr) {
free(wstr);
wstr = z;
}}
menu it;
it.sub = FALSE;
it.parent = m->menu;
it.origin = m->origin;
it.position = (pos==-1? GetMenuItemCount(m->menu) -1 : pos);
it.command = command;
InsertMenu(m->menu, pos, MF_STRING | MF_BYPOSITION, command, wstr);
DrawMenuBar(win);
free(wstr);
lua_pushlightuserdata(l, command);
lua_pushluafunction(l, p);
lua_rawset(l, LUA_REGISTRYINDEX);
lua_settop(l,0);
lua_pushfulluserdata(l, &it, sizeof(it), "menuhandle");
return 1;
}
开发者ID:qtnc,项目名称:6pad,代码行数:41,代码来源:luamenuhandle.c
示例12: while
unsigned int Win32Popup::findInsertionPoint( unsigned int pos ) const
{
// For this simple algorithm, we rely on the fact that in the final state
// of the menu, the ID of each item is equal to its position in the menu
int i = 0;
while( i < GetMenuItemCount( m_hMenu ) &&
GetMenuItemID( m_hMenu, i ) < pos )
{
i++;
}
return i;
}
开发者ID:mstorsjo,项目名称:vlc,代码行数:12,代码来源:win32_popup.cpp
示例13: SWSGetMenuPosFromID
int SWSGetMenuPosFromID(HMENU hMenu, UINT id)
{ // Replacement for deprecated windows func GetMenuPosFromID
MENUITEMINFO mi={sizeof(MENUITEMINFO),};
mi.fMask = MIIM_ID;
for (int i = 0; i < GetMenuItemCount(hMenu); i++)
{
GetMenuItemInfo(hMenu, i, true, &mi);
if (mi.wID == id)
return i;
}
return -1;
}
开发者ID:AusRedNeck,项目名称:sws,代码行数:12,代码来源:Menus.cpp
示例14: EventArea_DrawWorker
static int EventArea_DrawWorker(HWND hWnd, HDC hDC)
{
RECT rc;
HFONT hOldFont;
GetClientRect(hWnd, &rc);
if (g_CluiData.fDisableSkinEngine)
sttDrawEventAreaBackground(hWnd, hDC, &rc);
else
SkinDrawGlyph(hDC, &rc, &rc, "Main,ID=EventArea");
hOldFont = g_clcPainter.ChangeToFont(hDC, NULL, FONTID_EVENTAREA, NULL);
SetBkMode(hDC, TRANSPARENT);
int iCount = GetMenuItemCount(g_CluiData.hMenuNotify);
rc.left += 26;
if (g_CluiData.hUpdateContact != 0) {
TCHAR *szName = pcli->pfnGetContactDisplayName(g_CluiData.hUpdateContact, 0);
int iIcon = cli_GetContactIcon(g_CluiData.hUpdateContact);
ske_ImageList_DrawEx(g_himlCListClc, iIcon, hDC, rc.left, (rc.bottom + rc.top - GetSystemMetrics(SM_CYSMICON)) / 2, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), CLR_NONE, CLR_NONE, ILD_NORMAL);
rc.left += 18;
ske_DrawText(hDC, szName, -1, &rc, DT_VCENTER | DT_SINGLELINE);
ske_ImageList_DrawEx(g_himlCListClc, (int)g_CluiData.iIconNotify, hDC, 4, (rc.bottom + rc.top - 16) / 2, 16, 16, CLR_NONE, CLR_NONE, ILD_NORMAL);
}
else if (iCount > 0) {
MENUITEMINFO mii = { 0 };
struct NotifyMenuItemExData *nmi;
TCHAR *szName;
int iIcon;
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_DATA;
GetMenuItemInfo(g_CluiData.hMenuNotify, iCount - 1, TRUE, &mii);
nmi = (struct NotifyMenuItemExData *) mii.dwItemData;
szName = pcli->pfnGetContactDisplayName(nmi->hContact, 0);
iIcon = cli_GetContactIcon(nmi->hContact);
ske_ImageList_DrawEx(g_himlCListClc, iIcon, hDC, rc.left, (rc.bottom + rc.top - GetSystemMetrics(SM_CYSMICON)) / 2, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), CLR_NONE, CLR_NONE, ILD_NORMAL);
rc.left += 18;
ske_ImageList_DrawEx(g_himlCListClc, nmi->iIcon, hDC, 4, (rc.bottom + rc.top) / 2 - 8, 16, 16, CLR_NONE, CLR_NONE, ILD_NORMAL);
ske_DrawText(hDC, szName, -1, &rc, DT_VCENTER | DT_SINGLELINE);
}
else {
HICON hIcon = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, 16, 16, 0);
TCHAR *ptszEvents = TranslateT("No events");
ske_DrawText(hDC, ptszEvents, (int)mir_tstrlen(ptszEvents), &rc, DT_VCENTER | DT_SINGLELINE);
ske_DrawIconEx(hDC, 4, (rc.bottom + rc.top - 16) / 2, hIcon, 16, 16, 0, 0, DI_NORMAL | DI_COMPAT);
DestroyIcon(hIcon);
}
ske_ResetTextEffect(hDC);
SelectObject(hDC, hOldFont);
return 0;
}
开发者ID:martok,项目名称:miranda-ng,代码行数:53,代码来源:modern_clistevents.cpp
示例15:
OMenu::~OMenu() {
if (::IsMenu(m_hMenu)) {
for (int i = 0; i < GetMenuItemCount(); ++i)
CheckOwnerDrawn(i, TRUE);
} else {
// How can we end up here??? it sure happens sometimes..
for (OMenuItem::Iter i = items.begin(); i != items.end(); ++i) {
delete *i;
}
}
//pUnMap();
}
开发者ID:inetra,项目名称:peers1,代码行数:12,代码来源:OMenu.cpp
示例16: CreateVdmMenu
/*static*/ VOID
CreateVdmMenu(HANDLE ConOutHandle)
{
hConsoleMenu = ConsoleMenuControl(ConOutHandle,
ID_SHOWHIDE_MOUSE,
ID_VDM_QUIT);
if (hConsoleMenu == NULL) return;
VdmMenuPos = GetMenuItemCount(hConsoleMenu);
AppendMenuItems(hConsoleMenu, VdmMainMenuItems);
DrawMenuBar(GetConsoleWindow());
}
开发者ID:staring,项目名称:RosFE,代码行数:12,代码来源:ntvdm.c
示例17: GetMenuItemCount
int CCustomMenu::GetTopMenuWidth()
{
int Count = GetMenuItemCount();
int width = 0;
CRect rc;
for (int i=0; i<Count; i++)
{
::GetMenuItemRect(AfxGetMainWnd()->m_hWnd,m_hMenu,i,rc);
width += rc.Width();
}
return width;
}
开发者ID:wuzhipeng2014,项目名称:FiveChess,代码行数:12,代码来源:CustomMenu.cpp
示例18: while
OMenu::~OMenu() {
if (::IsMenu(m_hMenu)) {
while(GetMenuItemCount() != 0)
RemoveMenu(0, MF_BYPOSITION);
} else {
// How can we end up here??? it sure happens sometimes..
for (OMenuItem::Iter i = items.begin(); i != items.end(); ++i) {
delete *i;
}
}
//pUnMap();
}
开发者ID:strogo,项目名称:StrongDC,代码行数:12,代码来源:OMenu.cpp
示例19: DestroyTrayMenu
void DestroyTrayMenu(HMENU hMenu)
{
int i, cnt;
cnt = GetMenuItemCount(hMenu);
for (i = 0; i < cnt; ++i) {
HMENU hSubMenu = GetSubMenu(hMenu, i);
if (hSubMenu == hMainStatusMenu || hSubMenu == hMainMenu)
RemoveMenu(hMenu, i--, MF_BYPOSITION);
}
DestroyMenu(hMenu);
}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:12,代码来源:clistmenus.cpp
示例20: GetIndexOfItem
INT GetIndexOfItem(HMENU menu, UINT id)
{
for (int i = GetMenuItemCount(menu) - 1; i >= 0; i--)
{
int x = GetMenuItemID(menu, i);
if (id == x)
{
return i;
}
}
return -1;
}
开发者ID:Eun,项目名称:MoveToDesktop,代码行数:12,代码来源:hook.cpp
注:本文中的GetMenuItemCount函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论