123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- #include "copyright.h"
- #include <config.h>
- #include "XMenuInt.h"
- int
- XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, char *data, char *label, int active, char const *help)
-
-
-
-
-
-
- {
- register XMPane *pane;
- register XMSelect *sel;
- int label_length;
- int label_width;
-
- if (label == NULL) {
- _XMErrorCode = XME_ARG_BOUNDS;
- return(XM_FAILURE);
- }
-
- pane = _XMGetPanePtr(menu, p_num);
- if (pane == NULL) return(XM_FAILURE);
-
- sel = (XMSelect *)calloc(1, sizeof(XMSelect));
- if (sel == NULL) {
- _XMErrorCode = XME_CALLOC;
- return(XM_FAILURE);
- }
-
- label_length = strlen(label);
- label_width = XTextWidth(menu->s_fnt_info, label, label_length);
-
- if (!strcmp (label, "--") || !strcmp (label, "---"))
- {
- sel->type = SEPARATOR;
- sel->active = 0;
- }
- else
- {
- sel->type = SELECTION;
- sel->active = active;
- }
- sel->serial = -1;
- sel->label = label;
- sel->label_width = label_width;
- sel->label_length = label_length;
- sel->data = data;
- sel->parent_p = pane;
- sel->help_string = help;
-
- emacs_insque(sel, pane->s_list->prev);
-
- pane->s_count++;
-
- menu->recompute = 1;
-
- _XMErrorCode = XME_NO_ERROR;
- return((pane->s_count - 1));
- }
|