chiark / gitweb /
Initial revision
[ssr] / StraySrc / Glass / !Glass / h / intMsgs
1 /*
2  * intMsgs.h
3  *
4  * Definitions of Glass internal broadcasts
5  *
6  * © 1994-1998 Straylight
7  */
8
9 /*----- Licensing note ----------------------------------------------------*
10  *
11  * This file is part of Straylight's Glass.
12  *
13  * Glass is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 2, or (at your option)
16  * any later version.
17  *
18  * Glass 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 General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with Glass.  If not, write to the Free Software Foundation,
25  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26  */
27
28 /*----- Background information --------------------------------------------*
29  *
30  * Various operations require that many separate parts of the Glass
31  * program are informed of changes made to the state of the application
32  * (i.e. when windows are deleted, all Edit windows associated with the
33  * window must be removed).  The easiest way of doing this was deemed to be
34  * to use the new Steel broadcast system.  A new message has been
35  * created, called Message_StraylightInternal (message number &427FF, defined
36  * as wimp_MINTERNAL in wimp.h).  Messages should be passed to intMsgs_send,
37  * which constructs a message block, and then sends out the message via
38  * win_broadcast.  In raw event handlers, interested windows should scan for
39  * message wimp_MINTERNAL, and use intMsgs_receive to extract the
40  * information from the event block.  For speed, this has been implemented as
41  * a macro.  This may not always be the case.
42  */
43
44 #ifndef __intMsgs_h
45 #define __intMsgs_h
46
47 /*----- Required header files ---------------------------------------------*/
48
49 #ifndef __gStruct_h
50   #include "gStruct.h"
51 #endif
52
53 /*----- Message codes and meanings ----------------------------------------*/
54
55 typedef enum
56 {
57   glass_DELETEWINDOW,         /* Deleting a window                      */
58   glass_DELETEFILE,           /* Deleting a whole file                  */
59   glass_KILLFILES,            /* Close all open files, on PREQUIT       */
60   glass_CLOSEDOWN,            /* Closing down the application           */
61   glass_RENAME,               /* Renaming a window                      */
62   glass_SAVEFILE,             /* A file has been saved                  */
63   glass_REDRAW,               /* Request to redraw windows              */
64   glass_AUTOSAVE,             /* Autosave timings have changed          */
65   glass_SPRITECHANGE,         /* A template file's sprite area changed  */
66   glass_MODECHANGE            /* The screen mode has changed            */
67 }
68 glass_intMessage;
69
70 /*----- Structure definitions ---------------------------------------------*/
71
72 typedef union
73 {
74   struct {
75     glass_windPointer *w;     /* The window being deleted               */
76   } dw;                          /* glass_DELETEWINDOW                  */
77
78   struct {
79     glass_tfile *t;           /* The file being deleted                 */
80   } df;                          /* glass_DELETEFILE                    */
81
82     struct {
83     glass_windPointer *w;     /* The window being renamed               */
84   } rn;                          /* glass_RENAME                        */
85
86   struct {
87     glass_tfile *t;           /* The file that was saved                */
88   } sf;                          /* glass_SAVEFILE                      */
89
90   struct {
91     glass_tfile *t;           /* The file to redraw, or 0 for all       */
92   } rdr;                         /* glass_REDRAW                        */
93
94   struct {
95       int newTime;               /* The new autosave time in centiseconds  */
96   } as;                          /* glass_AUTOSAVE                      */
97
98   struct {
99     glass_tfile *t;           /* The template file whose area changed   */
100   } sc;                          /* glass_SPRITECHANGE                  */
101 }
102 glass_intMsgstr;
103
104 /*----- External routines -------------------------------------------------*/
105
106 /*
107  * void intMsgs_send(glass_intMessage type,...)
108  *
109  * Use
110  *  Sends out an internal broadcast message.  The routine constructs a
111  *  Message_StraylightInternal block and sends it out via win_broadcast.
112  *  The parameters should be as for the entries in the appropriate
113  *  structure, in order (i.e one for glass_DELETEWINDOW, two for
114  *  glass_DELETEICON).
115  *
116  * Parameters
117  *  glass_intMessage type == the message type.  This is used to decide
118  *    how many and what type of parameters to accept.
119  */
120
121 void intMsgs_send(glass_intMessage type,...);
122
123 /*
124  * glass_intMsgstr *intMsgs_receive(wimp_eventstr *e)
125  *
126  * Use
127  *  Returns a pointer to an internal message structure type.  No checking is
128  *  done to ensure that the event is correct.  This routine is implemented
129  *  as a macro.  There is no guarantee that this will continue to be the
130  *  case.
131  *
132  * Parameters
133  *  wimp_eventstr *e == the event to use
134  */
135
136 #define intMsgs_receive(e) \
137   ((glass_intMsgstr *)(&(e)->data.msg.data.words[1]))
138
139 #endif