File:  [Coherent Logic Development] / freem / src / mwapi_window.c
Revision 1.4: download - view: text, annotated - select for diffs
Thu Apr 10 01:24:38 2025 UTC (3 months, 3 weeks ago) by snw
Branches: MAIN
CVS tags: HEAD
Remove C++ style comments

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

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