Annotation of 43BSD/contrib/X/XMenu/XMenuChgPane.c, revision 1.1.1.1

1.1       root        1: #include <X/mit-copyright.h>
                      2: 
                      3: /* $Header: XMenuChgPane.c,v 10.8 86/02/01 16:14:29 tony Rel $ */
                      4: /* Copyright    Massachusetts Institute of Technology    1985  */
                      5: 
                      6: /*
                      7:  * XMenu:      MIT Project Athena, X Window system menu package
                      8:  *
                      9:  *     XMenuChangePane - Change the label of a  menu pane.
                     10:  *
                     11:  *     Author:         Tony Della Fera, DEC
                     12:  *                     December 19, 1985
                     13:  *
                     14:  */
                     15: 
                     16: #include "XMenuInternal.h"
                     17: 
                     18: int
                     19: XMenuChangePane(menu, p_num, label)
                     20:     register XMenu *menu;      /* Menu object to be modified. */
                     21:     register int p_num;                /* Pane number to be modified. */
                     22:     char *label;               /* Selection label. */
                     23: {
                     24:     register int i;            /* Loop counter. */
                     25:     register XMPane *p_ptr;    /* XMPane pointer. */
                     26: 
                     27:     int label_length;          /* Label lenght in characters. */
                     28:     int label_width;           /* Label width in pixels. */
                     29: 
                     30:     /*
                     31:      * Check for NULL pointers!
                     32:      */
                     33:     if (label == NULL) {
                     34:        _XMErrorCode = XME_ARG_BOUNDS;
                     35:        return(XM_FAILURE);
                     36:     }
                     37: 
                     38:     /*
                     39:      * Find the right pane.
                     40:      */
                     41:     p_ptr = _XMGetPanePtr(menu, p_num);
                     42:     if (p_ptr == NULL) return(XM_FAILURE);
                     43: 
                     44:     /*
                     45:      * Determine label size.
                     46:      */
                     47:     label_width = XQueryWidth(label, menu->p_fnt_info->id);
                     48:     label_length = strlen(label);
                     49: 
                     50:     /*
                     51:      * Change the pane data.
                     52:      */
                     53:     p_ptr->label = label;
                     54:     p_ptr->label_width = label_width;
                     55:     p_ptr->label_length = label_length;
                     56: 
                     57:     /*
                     58:      * Schedule a recompute.
                     59:      */
                     60:     menu->recompute = 1;
                     61: 
                     62:     /*
                     63:      * Return the pane number just changed.
                     64:      */
                     65:     _XMErrorCode = XME_NO_ERROR;
                     66:     return(p_num);
                     67: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.