Annotation of freem/src/mwapi_window.c, revision 1.1

1.1     ! snw         1: /*
        !             2:  *                            *
        !             3:  *                           * *
        !             4:  *                          *   *
        !             5:  *                     ***************
        !             6:  *                      * *       * *
        !             7:  *                       *  MUMPS  *
        !             8:  *                      * *       * *
        !             9:  *                     ***************
        !            10:  *                          *   *
        !            11:  *                           * *
        !            12:  *                            *
        !            13:  *
        !            14:  *   mwapi_window.c
        !            15:  *    mwapi window support
        !            16:  *
        !            17:  *  
        !            18:  *   Author: Serena Willis <jpw@coherent-logic.com>
        !            19:  *    Copyright (C) 1998 MUG Deutschland
        !            20:  *    Copyright (C) 2014, 2020, 2021 Coherent Logic Development LLC
        !            21:  *
        !            22:  *
        !            23:  *   This file is part of FreeM.
        !            24:  *
        !            25:  *   FreeM is free software: you can redistribute it and/or modify
        !            26:  *   it under the terms of the GNU Affero Public License as published by
        !            27:  *   the Free Software Foundation, either version 3 of the License, or
        !            28:  *   (at your option) any later version.
        !            29:  *
        !            30:  *   FreeM is distributed in the hope that it will be useful,
        !            31:  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
        !            32:  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        !            33:  *   GNU Affero Public License for more details.
        !            34:  *
        !            35:  *   You should have received a copy of the GNU Affero Public License
        !            36:  *   along with FreeM.  If not, see <https://www.gnu.org/licenses/>.
        !            37:  *
        !            38:  **/
        !            39: 
        !            40: #include "config.h"
        !            41: 
        !            42: #if defined(HAVE_MWAPI_MOTIF)
        !            43: 
        !            44: #include <stdlib.h>
        !            45: 
        !            46: #include "mpsdef0.h"
        !            47: #include "mwapi_window.h"
        !            48: #include "mwapi_event.h"
        !            49: 
        !            50: mwapi_window *mwapi_win_head;
        !            51: 
        !            52: void mwapi_foreach(void (*callback)(mwapi_window *))
        !            53: {
        !            54:     mwapi_window *t;
        !            55: 
        !            56:     for (t = mwapi_win_head; t != NULL; t = t->next) {
        !            57:         (*callback)(t);
        !            58:     }   
        !            59: }
        !            60: 
        !            61: int mwapi_win_count(void)
        !            62: {
        !            63:     mwapi_window *t;
        !            64:     int c = 0;
        !            65: 
        !            66:     for (t = mwapi_win_head; t != NULL; t = t->next) c++;
        !            67: 
        !            68:     return c;
        !            69: }
        !            70: 
        !            71: 
        !            72: void mwapi_win_show_all(void)
        !            73: {
        !            74:     mwapi_foreach (&mwapi_win_show);
        !            75: }
        !            76: 
        !            77: void mwapi_win_show(mwapi_window *win)
        !            78: {
        !            79:     
        !            80:     if (!win->win_visible) {
        !            81: 
        !            82:         mwapi_event *destroy_ev = mwapi_event_new ("CLOSE", win->window_name, win->window);       
        !            83:         mwapi_wire_event (destroy_ev, "CLOSE^%MWAPI.EVENT.DEFAULT");
        !            84:         
        !            85:         //gtk_widget_show_all (win->window);
        !            86:         
        !            87:         win->win_visible = TRUE;
        !            88:         
        !            89:     }
        !            90: 
        !            91:     return;
        !            92: }
        !            93: 
        !            94: mwapi_window *mwapi_win_get(char *window_name)
        !            95: {
        !            96:     
        !            97:     mwapi_window *t;
        !            98: 
        !            99:     for (t = mwapi_win_head; t != NULL; t = t->next) {
        !           100: 
        !           101:         if (stcmp (t->window_name, window_name) == 0) {
        !           102:             return t;
        !           103:         }   
        !           104:         
        !           105:     }
        !           106: 
        !           107:     /* this window does not yet exist. create it. */
        !           108:     t = (mwapi_window *) malloc (sizeof (mwapi_window));
        !           109:     NULLPTRCHK(t,"win_get");
        !           110: 
        !           111:     stcpy (t->window_name, window_name);
        !           112: 
        !           113:     //t->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
        !           114:     t->win_visible = FALSE;
        !           115:     
        !           116:     t->next = mwapi_win_head;
        !           117:     mwapi_win_head = t;
        !           118: 
        !           119:     return t;
        !           120:     
        !           121: }
        !           122: #endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>