1 /*
2  * src/help.h, part of wmslib library
3  * Copyright (C) 1995 William Shubert.
4  * See "configure.h.in" for more copyright information.
5  */
6 
7 #ifndef  _ABUT_MSG_H_
8 #define  _ABUT_MSG_H_  1
9 
10 #ifndef  _WMS_H_
11 #include <wms.h>
12 #endif
13 #ifndef  _BUT_BUT_H_
14 #include <but/but.h>
15 #endif
16 #ifndef  _BUT_BOX_H_
17 #include <but/box.h>
18 #endif
19 #ifndef  _ABUT_ABUT_H_
20 #include <abut/abut.h>
21 #endif
22 
23 
24 /**********************************************************************
25  * Types
26  **********************************************************************/
27 
28 /* Public. */
29 typedef struct AbutMsgOpt_struct  {
30   const char  *name;
31   ButOut  (*callback)(But *but);
32   void  *packet;
33   const ButKey  *keyEq;
34 } AbutMsgOpt;
35 
36 
37 typedef struct AbutMsgTin_struct  {
38   const char  *name;
39   const char  *def;
40   ButOut  (*callback)(But *but, const char *value);
41   uint  flags;
42 } AbutMsgTin;
43 
44 #define  abutMsgTinFlags_secret  0x1
45 
46 
47 /* Private. */
48 typedef struct AbutMsg_struct  {
49   Abut  *abut;
50   ButWin  *win;
51   int  numButs, numTins;
52   But  **buts, **tins, **tinTitles;
53   const AbutMsgOpt  *butDesc;
54   ButOut  (*destroy)(void *packet);
55   void  *packet;
56   int  layer;
57   int  w, h, textH;
58   But  *box, *text;
59   MAGIC_STRUCT
60 } AbutMsg;
61 
62 
63 /**********************************************************************
64  * Functions available
65  **********************************************************************/
66 extern AbutMsg  *abutMsg_inCreate(Abut *a, ButWin *win, int layer,
67 				  const char *text,
68 				  void *packet, int numTins,
69 				  const AbutMsgTin *tinList);
70 extern AbutMsg  *abutMsg_optInCreate(Abut *a, ButWin *win, int layer,
71 				     const char *text,
72 				     ButOut (*destroy)(void *packet),
73 				     void *packet, int numButs,
74 				     const AbutMsgOpt *optList,
75 				     int numTins,
76 				     const AbutMsgTin *tinList);
77 extern AbutMsg  *abutMsg_winInCreate(Abut *a, const char *title,
78 				     const char *text,
79 				     void *packet, int numTins,
80 				     const AbutMsgTin *tinList);
81 extern AbutMsg  *abutMsg_winOptInCreate(Abut *a, const char *title,
82 					const char *text,
83 					ButOut (*destroy)(void *packet),
84 					void *packet, int numButs,
85 					const AbutMsgOpt *optList,
86 					int numTins,
87 					const AbutMsgTin *tinList);
88 #define  abutMsg_create(a, w, l, t)  abutMsg_inCreate(a, w, l, t, NULL,0,NULL)
89 #define  abutMsg_optCreate(a, w, l, t, d, p, nb, b)  \
90   abutMsg_optInCreate(a, w, l, t, d, p, nb, b, 0,NULL)
91 #define  abutMsg_winCreate(a, ti, t)  \
92   abutMsg_winInCreate(a, ti, t, NULL,0,NULL)
93 #define  abutMsg_winOptCreate(a, ti, t, d, p, nb, b)  \
94   abutMsg_winOptInCreate(a, ti, t, d, p, nb, b, 0,NULL)
95 extern void  abutMsg_destroy(AbutMsg *msg, bool propagate);
96 
97 #define  abutMsg_setColors(m, ul, lr, f)  \
98            butBoxFilled_setColors((m)->box, (ul), (lr), (f))
99 #define  abutMsg_setPixmaps(m, ul, lr, f)  \
100            butBoxFilled_setPixmaps((m)->box, (ul), (lr), (f))
101 #define  abutMsg_tin(m, t)  ((m)->tins[t])
102 
103 #endif  /* _ABUT_MSG_H_ */
104