📄 wmenuifi.c
字号:
/* CXL - Copyright (c) 1987-1989 by Mike Smedley - All Rights Reserved */
/* WMENUIFI.C - finds item record in a menu structure */
#include "cxlwin.h"
static struct _item_t *search_menu(struct _menu_t *menu,int tagid);
struct _item_t *wmenuifind(int tagid)
{
register struct _item_t *item;
/* check for existance of a menu */
if(_winfo.cmenu==NULL) {
_winfo.errno=W_NOMNUDEF;
return(NULL);
}
/* start search process at root of menu structure */
item=search_menu(_winfo.menu,tagid);
/* return to caller */
_winfo.errno=(item==NULL?W_NOTFOUND:W_NOERROR);
return(item);
}
static struct _item_t *search_menu(struct _menu_t *menu,int tagid)
{
register struct _item_t *witem,*item;
/* do while more items in this menu */
for(witem=menu->item;witem!=NULL;witem=witem->prev) {
/* if tagid of found item matches item we're */
/* searching for, then return that item's address */
if(witem->tagid==tagid) return(witem);
/* if current item has a child menu, search it */
if(witem->child!=NULL) {
item=search_menu(witem->child,tagid);
if(item!=NULL) return(item);
}
}
/* return address of item found */
return(witem);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -