view oldXMenu/AddPane.c @ 68478:61b78b1445bf

(org-allow-space-in-links, org-closed-string, org-quote-string, org-calendar-to-agenda-key, org-agenda-sorting-strategy, org-agenda-use-time-grid, org-show-following-heading, org-tags-column, org-use-tag-inheritance, org, org-allow-space-in-links, org-usenet-links-prefer-google, org-file-apps-defaults-gnu, org-enable-table-editor, org-calc-default-modes, org-export-html-style, org-table-allow-automatic-line-recalculation, org-export-with-fixed-width, org-export-with-sub-superscripts, org-special-keyword, org-formula, org-time-grid, org-table-may-need-update, org-mode, org-goto-ret, org-goto-left, org-goto-right, org-goto-quit, org-get-indentation, org-end-of-item, org-move-item-down, org-move-item-up, org-renumber-ordered-list, org-todo, org-log-done, org-occur, org-remove-occur-highlights, org-read-date, org-goto-calendar, org-agenda, org-agenda-day-view, org-agenda-previous-date-line, org-agenda-log-mode, org-agenda-toggle-diary, org-agenda-toggle-time-grid, org-agenda-cleanup-fancy-diary, org-agenda-file-to-end, org-agenda-no-heading-message, org-agenda-get-closed, org-format-agenda-item, org-cmp-priority, org-cmp-category, org-cmp-time, org-agenda-change-all-lines, org-agenda-diary-entry, org-scan-tags, org-after-todo-state-change-hook, org-tags-view, org-link-search, org-camel-to-words, org-open-file, org-remember-handler, org-table-convert-region, org-table-move-row-down, org-table-move-row-up, org-table-copy-region, org-table-wrap-region, org-table-toggle-vline-visibility, org-table-get-vertical-vector, org-table-modify-formulas, org-table-get-specials, org-recalc-commands, org-table-rotate-recalc-marks, org-table-eval-formula, orgtbl-make-binding, org-in-invisibility-spec-p, org-cycle, org-level-color-stars-only, org-insert-heading): Fix typos in docstrings. (last-arg): Add defvar.
author Juanma Barranquero <lekktu@gmail.com>
date Mon, 30 Jan 2006 02:03:21 +0000
parents 3861ff8f4bf1
children e8a3fb527b77 532e0a9335a9 2d92f5c9d6ae
line wrap: on
line source

#include "copyright.h"

/* Copyright    Massachusetts Institute of Technology    1985	*/
/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.  */

/*
 * XMenu:	MIT Project Athena, X Window system menu package
 *
 * 	XMenuAddPane - Adds a pane to an XMenu object.
 *
 *	Author:		Tony Della Fera, DEC
 *			August, 1985
 *
 */

#include <config.h>
#include "XMenuInt.h"

int
XMenuAddPane(display, menu, label, active)
    Display *display;
    register XMenu *menu;	/* Menu object to be modified. */
    register char *label;	/* Selection label. */
    int active;			/* Make selection active? */
{
    register XMPane *pane;	/* Newly created pane. */
    register XMSelect *select;	/* Initial selection for the new pane. */

    int label_length;		/* Label length in characters. */
    int label_width;		/* Label width in pixels. */

    /*
     * Check for NULL pointers!
     */
    if (label == NULL) {
	_XMErrorCode = XME_ARG_BOUNDS;
	return(XM_FAILURE);
    }

    /*
     * Calloc the XMPane structure and the initial XMSelect.
     */
    pane = (XMPane *)calloc(1, sizeof(XMPane));
    if (pane == NULL) {
	_XMErrorCode = XME_CALLOC;
	return(XM_FAILURE);
    }
    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->p_fnt_info,
			     label,
			     label_length);

    /*
     * Set up the initial selection.
     * Values not explicitly set are zeroed by calloc.
     */
    select->next = select;
    select->prev = select;
    select->type = SL_HEADER;
    select->serial = -1;
    select->parent_p = pane;

    /*
     * Fill the XMPane structure.
     * X and Y position are set to 0 since a recompute will follow.
     */
    pane->type = PANE;
    pane->active = active;
    pane->serial = -1;
    pane->label = label;
    pane->label_width = label_width;
    pane->label_length = label_length;
    pane->s_list = select;

    /*
     * Insert the pane at the end of the pane list.
     */
    emacs_insque(pane, menu->p_list->prev);

    /*
     * Update the pane count.
     */
    menu->p_count++;

    /*
     * Schedule a recompute.
     */
    menu->recompute = 1;

    /*
     * Return the pane number just added.
     */
    _XMErrorCode = XME_NO_ERROR;
    return((menu->p_count - 1));
}

/* arch-tag: 62a26021-f29d-48ba-96ef-3b6c4ebd6547
   (do not change this comment) */