Mercurial > emacs
view oldXMenu/AddSel.c @ 110909:cc035ccb9275
Declare and define in one step various mode maps.
* lisp/shell.el (shell-mode-map):
* lisp/progmodes/modula2.el (m2-mode-map):
* lisp/progmodes/inf-lisp.el (inferior-lisp-mode-map):
* lisp/play/mpuz.el (mpuz-mode-map):
* lisp/play/landmark.el (lm-mode-map):
* lisp/play/decipher.el (decipher-mode-map):
* lisp/play/5x5.el (5x5-mode-map):
* lisp/net/telnet.el (telnet-mode-map):
* lisp/net/quickurl.el (quickurl-list-mode-map):
* lisp/net/mairix.el (mairix-searches-mode-map):
* lisp/net/eudc-hotlist.el (eudc-hotlist-mode-map):
* lisp/net/dig.el (dig-mode-map):
* lisp/mail/mspools.el (mspools-mode-map):
* lisp/hexl.el (hexl-mode-map):
* lisp/emulation/ws-mode.el (wordstar-C-k-map, wordstar-mode-map)
(wordstar-C-o-map, wordstar-C-q-map):
* lisp/emacs-lisp/edebug.el (edebug-eval-mode-map):
* lisp/emacs-lisp/chart.el (chart-map):
* lisp/edmacro.el (edmacro-mode-map):
* lisp/array.el (array-mode-map): Declare and define in one step.
* lisp/erc/erc-list.el (erc-list-menu-mode-map): Declare and define in one step.
author | Dan Nicolaescu <dann@ics.uci.edu> |
---|---|
date | Sun, 10 Oct 2010 16:12:30 -0700 |
parents | 5cc91198ffb2 |
children | ef719132ddfa |
line wrap: on
line source
/* Copyright Massachusetts Institute of Technology 1985 */ #include "copyright.h" /* * XMenu: MIT Project Athena, X Window system menu package * * XMenuAddSelection - Adds a selection to an XMenu object. * * Author: Tony Della Fera, DEC * August, 1985 * */ #include <config.h> #include "XMenuInt.h" int XMenuAddSelection(Display *display, register XMenu *menu, register int p_num, char *data, char *label, int active, char *help) /* Menu object to be modified. */ /* Pane number to be modified. */ /* Data value. */ /* Selection label. */ /* Make selection active? */ /* Help string */ { register XMPane *pane; /* Pane containing the new selection. */ register XMSelect *select; /* Newly created selection. */ int label_length; /* Label lenght in characters. */ int label_width; /* Label width in pixels. */ /* * Check for NULL pointers! */ if (label == NULL) { _XMErrorCode = XME_ARG_BOUNDS; return(XM_FAILURE); } /* * Find the right pane. */ pane = _XMGetPanePtr(menu, p_num); if (pane == NULL) return(XM_FAILURE); /* * Calloc the XMSelect structure. */ select = (XMSelect *)calloc(1, sizeof(XMSelect)); if (select == NULL) { _XMErrorCode = XME_CALLOC; return(XM_FAILURE); } /* * Determine label size. */ label_length = strlen(label); label_width = XTextWidth(menu->s_fnt_info, label, label_length); /* * Fill the XMSelect structure. */ if (!strcmp (label, "--") || !strcmp (label, "---")) { select->type = SEPARATOR; select->active = 0; } else { select->type = SELECTION; select->active = active; } select->serial = -1; select->label = label; select->label_width = label_width; select->label_length = label_length; select->data = data; select->parent_p = pane; select->help_string = help; /* * Insert the selection at the end of the selection list. */ emacs_insque(select, pane->s_list->prev); /* * Update the selection count. */ pane->s_count++; /* * Schedule a recompute. */ menu->recompute = 1; /* * Return the selection number just added. */ _XMErrorCode = XME_NO_ERROR; return((pane->s_count - 1)); } /* arch-tag: 0161f024-c739-440d-9498-050280c6c355 (do not change this comment) */