Menu-destroy
From TrillWiki
When a menu is no longer needed, this will be sent to every item in the menu. Here is a good place to do any final memory removal, such as the data.
Compatibility: 1.0 and higher
Contents |
Syntax
callback(0, NULL, "menu-destroy", struct menu_entry_t *, void *userData);
Note that all Trillian functions and notifications begin with a lower-case letter, despite the Wiki requirement that all pages start with a capital letter.
Parameters
Menu-destroy utilitizes the menu_entry_t structure.
struct menu_entry_t {
unsigned int struct_size;
int menu_id;
int sub_menu_id;
int type;
int timeout;
int disabled;
int num_copies;
char *icon;
char *text;
char *shortcut;
void *data;
HWND hwnd;
struct menu_entry_t *sub_menu;
struct menu_entry_t *next_menu;
ttkCallback callback;
};
- menu_id
- The menu ID which is returned to you.
- sub_menu_id
- Must be -1.
- type
- Specifies the type of menu it will be. There are four types that are currently supported: MENU_TEXT, MENU_POPUP, MENU_SEPARATOR or MENU_CALLBACK. A MENU_TEXT type is just a normal menu entry. A MENU_POPUP is one that provides sub menus. A MENU_SEPARATOR is a horizontal separator that can separate a menu into sections to make it easier on the eyes to read. Lastly, the MENU_CALLBACK is a place holder that can be replaced when a menu is shown, this is good for dynamic menu areas that may change often and the plugin can be able to show the most current state of the menu at the time it is drawn.
- timeout
- Can either be a number for the number of times it is shown before it is hidden, or can be infinite (right now infinite is the only one that works).
- disabled
- If you want it unclickable or not.
- num_copies
- Must be 0.
- icon
- A name of the icon to use from the skin for the menu.
- text
- The text to write within the menu.
- shortcut
- If there is a shortcut key, add it here, such as 'ctrl-t'.
- data
- Data returned through the callback.
- sub_menu
- If there are sub_menu's to this entry, add the top of the chain here.
- next_menu
- If there are menu's below this entry, add the next one down here.
- callback
- The callback where menu notifications are sent.
NOTE: The menu_entry_t will be a copy of one that was passed in, so do not remove this memory. The userData will be the data passed into the original menu_entry and can be destroyed.
Return Value
Must return 0.
Remarks
Be sure to always remove your data if it was dynamically created.
See also: menu-select
