Annotation of researchv9/X11/src/X.V11R1/clients/xmh/button.c, revision 1.1

1.1     ! root        1: #ifndef lint
        !             2: static char rcs_id[] = "$Header: button.c,v 1.10 87/09/11 08:17:57 toddb Exp $";
        !             3: #endif lint
        !             4: /*
        !             5:  *                       COPYRIGHT 1987
        !             6:  *                DIGITAL EQUIPMENT CORPORATION
        !             7:  *                    MAYNARD, MASSACHUSETTS
        !             8:  *                     ALL RIGHTS RESERVED.
        !             9:  *
        !            10:  * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND
        !            11:  * SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION.
        !            12:  * DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR
        !            13:  * ANY PURPOSE.  IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
        !            14:  *
        !            15:  * IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT RIGHTS,
        !            16:  * APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN ADDITION TO THAT
        !            17:  * SET FORTH ABOVE.
        !            18:  *
        !            19:  *
        !            20:  * Permission to use, copy, modify, and distribute this software and its
        !            21:  * documentation for any purpose and without fee is hereby granted, provided
        !            22:  * that the above copyright notice appear in all copies and that both that
        !            23:  * copyright notice and this permission notice appear in supporting documentation,
        !            24:  * and that the name of Digital Equipment Corporation not be used in advertising
        !            25:  * or publicity pertaining to distribution of the software without specific,
        !            26:  * written prior permission.
        !            27:  */
        !            28: 
        !            29: /* button.c -- Handle a button being pressed */
        !            30: 
        !            31: #include "xmh.h"
        !            32: #include "bboxint.h"
        !            33: 
        !            34: 
        !            35: /* Highlight or unhighlight the given button. */
        !            36: 
        !            37: FlipColors(button)
        !            38: Button button;
        !            39: {
        !            40:     static Arg arglist[] = {
        !            41:        {XtNforeground, NULL},
        !            42:        {XtNbackground, NULL},
        !            43:     };
        !            44:     XtArgVal temp;
        !            45:     XtCommandGetValues(DISPLAY button->window, arglist, XtNumber(arglist));
        !            46:     temp = arglist[0].value;
        !            47:     arglist[0].value = arglist[1].value;
        !            48:     arglist[1].value = temp;
        !            49:     XtCommandSetValues(DISPLAY button->window, arglist, XtNumber(arglist));
        !            50: }
        !            51: 
        !            52: 
        !            53: /* The given button has just been pressed.  (This routine is usually called
        !            54:    by the command button widget code.)  If it's a radio button, select it.
        !            55:    Then call the function registered for this button. */
        !            56: 
        !            57: void DoButtonPress(button)
        !            58: Button button;
        !            59: {
        !            60:     ButtonBox buttonbox = button->buttonbox;
        !            61:     Scrn scrn = buttonbox->scrn;
        !            62:     if (!button->enabled) return;
        !            63:     if (buttonbox->radio && *(buttonbox->radio) != button) {
        !            64:        FlipColors(*(buttonbox->radio));
        !            65:        FlipColors(button);
        !            66:        *(buttonbox->radio) = button;
        !            67:     }
        !            68:     LastButtonPressed = button;
        !            69:     (*(button->func))(scrn);
        !            70: }
        !            71: 
        !            72: 
        !            73: /* Act as if the last button pressed was pressed again. */
        !            74: 
        !            75: void RedoLastButton()
        !            76: {
        !            77:     if (LastButtonPressed)
        !            78:        DoButtonPress(LastButtonPressed);
        !            79: }
        !            80: 
        !            81: 
        !            82: /* Returns the screen in which the last button was pressed. */
        !            83: 
        !            84: Scrn LastButtonScreen()
        !            85: {
        !            86:     return LastButtonPressed->buttonbox->scrn;
        !            87: }
        !            88: 
        !            89: 
        !            90: #ifdef X10
        !            91: /* Handle X10 bug where we lose exit window events on the last button. */
        !            92: 
        !            93: ClearButtonTracks()
        !            94: {
        !            95:     XEvent event;
        !            96:     event.type = LeaveWindow;
        !            97:     event.window = LastButtonPressed->window;
        !            98:     XtDispatchEvent(DISPLAY &event);
        !            99: }
        !           100: #endif X10

unix.superglobalmegacorp.com

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