📄 cpw_menus.h
字号:
/* callbacks. Note that the callback function handler receives */
/* three parameters, the 'windowid', the 'menuid' and the 'entryid'. */
/* The window id is the id of the window the menu was selected in. */
/* (You can assign a single menu to multiple windows.) The menuid */
/* is the menu identifier of the top level menu containing all */
/* entries and sub menus. Sub menu identifiers are not sent to the */
/* callback, only top level menu identifiers. When creating sub */
/* menus, make sure your entry identifiers are unique across all */
/* entries in the top level menu the sub menu is contained within. */
/* */
/* To seamlessly replace an entire menu, assign the new menu to */
/* the window while the old menu is still in place. */
/* */
CPW_API bool
cpwAssignMenuToWindow( pCpw cpw,
uint_32 menuid,
uint_32 winid );
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Function> */
/* cpwUnassignMenu */
/* */
/* <Description> */
/* Removes a titlebar menu from a window. Does not destroy the */
/* resources associated with the menu and it's sub menus. */
/* */
CPW_API bool
cpwUnassignMenu( pCpw cpw,
uint_32 winid );
/* */
/*************************************************************************/
/* attaching menus to buttons */
/*************************************************************************/
/* */
/* <Function> */
/* cpwAttachMenuToButton */
/* */
/* <Description> */
/* Assigns a popup menu to a particular mouse click for the */
/* specified window. Use the standard cpw mouse button constants */
/* for 'button'. 'winid' must be a valid window identifier. You */
/* can attach a single menu to more than one window, and to more */
/* than one mouse click. */
/* */
CPW_API bool
cpwAttachMenuToButton( pCpw cpw,
uint_32 menuid,
uint_32 button,
uint_32 winid );
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Function> */
/* cpwDetachMenu */
/* */
/* <Description> */
/* Removes a popup menu button assignment for a particular window. */
/* */
CPW_API bool
cpwDetachMenu( pCpw cpw,
uint_32 button,
uint_32 winid );
/* */
/*************************************************************************/
/* item check marks */
/*************************************************************************/
/* */
/* <Function> */
/* cpwCheckMenuEntry */
/* */
/* <Description> */
/* If the menu entry is not checked, adds a check mark to */
/* the entry. 'menuid' can only be a top level menu identifier. */
/* sub menu identifiers will not work. */
/* */
/* For platforms which do not support checkmarked menus, the */
/* checkmark will not be displayed. The checkmark's state is */
/* tracked internally by Cpw and is valid regardless. */
/* */
CPW_API bool
cpwCheckMenuEntry( pCpw cpw,
uint_32 menuid,
uint_32 entryid );
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Function> */
/* cpwUncheckMenuEntry */
/* */
/* <Description> */
/* If the menu entry is checked, removes a check mark from */
/* the entry. 'menuid' can only be a top level menu identifier. */
/* sub menu identifiers will not work. */
/* */
CPW_API bool
cpwUncheckMenuEntry( pCpw cpw,
uint_32 menuid,
uint_32 entryid );
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Function> */
/* cpwMenuEntryChecked */
/* */
/* <Description> */
/* Returns a flag indicating whether or not the entry has a */
/* checkmark. 'menuid' can only be a top level menu identifier. */
/* sub menu identifiers will not work. */
/* */
CPW_API bool
cpwMenuEntryChecked( pCpw cpw,
uint_32 menuid,
uint_32 entryid );
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* internal functions */
/* */
/*************************************************************************/
#ifdef CPW_INTERN
/*************************************************************************/
/* */
/* <Struct> */
/* CpwMenuEntry */
/* */
/* <Description> */
/* A structure used in storing a single menu entry. */
/* */
struct _CpwMenuEntry
{
uint_32 id;
pStr title;
bool f_seperator;
bool f_checked;
bool f_submenu;
pVoid submenu;
};
typedef struct _CpwMenuEntry CpwMenuEntry;
typedef struct _CpwMenuEntry* pCpwMenuEntry;
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Struct> */
/* CpwMenu */
/* */
/* <Description> */
/* A structure used in storing a menu and it's entries. */
/* */
struct _CpwMenu
{
uint_32 id;
uint_32 ecount;
pCpwMenuEntry entries[CPW_MENUS_MAXENTRIES];
CpwMenuCallback callback;
};
typedef struct _CpwMenu CpwMenu;
typedef struct _CpwMenu* pCpwMenu;
/* */
/*************************************************************************/
/* init and exit */
bool cpw_menus_init( pCpw cpw );
void cpw_menus_exit( pCpw cpw );
/* called by cpw_event when a popup menu should be displayed */
void cpw_menus_popupselected( pCpw cpw, pCpwWin window, uint_32 menuid, uint_32 x, uint_32 y );
/* called by cpw_event when a popup menu entry is selected */
void cpw_menus_popupcallback( pCpw cpw, uint_32 id, uint_32 menuid, uint_32 entryid );
#endif /* CPW_INTERN */
CPW_END_HEADER
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -