Add -fpermissive to allow compilation of old C++ on modern GCC
[oweals/cde.git] / cde / programs / dtudcfonted / util.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* util.h 1.5 - Fujitsu source for CDEnext    96/09/18 13:59:22      */
24 /* $XConsortium: util.h /main/5 1996/09/19 19:42:11 cde-fuj $ */
25 /*
26  *  (c) Copyright 1995 FUJITSU LIMITED
27  *  This is source code modified by FUJITSU LIMITED under the Joint
28  *  Development Agreement for the CDEnext PST.
29  *  This is unpublished proprietary source code of FUJITSU LIMITED
30  */
31
32
33
34 extern Widget GetMenuWidget();
35 extern Widget CreateFrame();
36 extern Widget CreateControlArea();
37 extern Widget CreateScrollBar();
38 extern Widget CreateDrawingArea();
39 extern Widget CreateExclusive();
40 extern Widget CreateLabel();
41 extern Widget CreateDialogAndButtons();
42 extern
43 #ifdef _HPUX_SOURCE
44 String
45 #else
46 XtPointer
47 #endif
48 GetTextFieldValue();
49 extern Widget CreateTemplateDialog();
50 extern Widget CreateScrollBase();
51 extern Widget CreateForm();
52
53 #include <Xm/Xm.h>
54 #include <Xm/XmStrDefs.h>
55
56 Widget  CreateCaptionFrame();
57 #ifdef _HPUX_SOURCE
58 String
59 #else
60 XtPointer
61 #endif
62 GetTextFieldValue();
63 void    CreateTextField();
64 void    CreateButtons();
65 void    CreateMenuButtons();
66 void    LayoutButtonsEH();
67 Widget  CreateLayoutButtons();
68 Widget  CreateDialogAndButtons();
69 Widget  GuiInitialize();
70 Widget  CreateDrawingArea();
71 void    AddTopWidget();
72 void    AddLeftAttachWidget();
73 void    AddLeftAttachForm();
74 void    AddTopAttachWidget();
75 void    AddTopAttachForm();
76 void    AddRightAttachWidget();
77 void    AddRightAttachForm();
78 void    AddBottomAttachForm();
79 void    PopupDialog();
80 void    PopdownDialog();
81 void    ForcePopdownDialog();
82 void    SetLabelString();
83 void    SetFooterString();
84 void    PopupNotice();
85 void    AddDeleteProc();
86 Widget  CreateMenuBarAndFooterMessageForm();
87 Widget  GetMenuWidget();
88 Widget  CreateForm();
89 Widget  CreateLabel();
90 Widget  CreateFrame();
91 Widget  CreateRowColumn();
92 Widget  CreateScrollBar();
93
94
95 #define MarginWidth 4
96 #define RowMarginWidth 11 
97 #define MarginHeight 11
98 #define HeightSpace 4
99 #define MinimumSpace 4
100
101 /*****  Exclusive Set  *****/
102
103 typedef struct _ToggleButt {
104     Widget      w;
105     char *      label;
106     XtPointer   clientdata;
107     String      name;
108     XtArgVal    sensitive;
109     XtCallbackProc      cb;
110     XtArgVal    set;
111 } ToggleButt;
112
113 #define EXARGS( clientdata, name, sensitive, cb, set ){ \
114                 NULL, \
115     (char *)    "", \
116     (XtPointer) clientdata, \
117                 name, \
118     (XtArgVal)  sensitive, \
119     (XtCallbackProc)    cb, \
120     (XtArgVal)  set \
121 }
122
123 typedef struct _RadioButt {
124     String      label;
125     ToggleButt  *items;
126     int         items_cnt;
127     String      name;
128     Widget      w;
129     XtPointer   udata;
130 } RadioButt;
131
132
133 #define EXCLUSIVE(a) { 0, a, XtNumber(a), 0, 0, 0 }
134
135 #define ExclusiveItems          ToggleButt
136 #define Exclusive               RadioButt
137
138 #define SetItemLabel(b,n,l) (b)->items[(n)].label = (l)
139
140 /*****  PushButton Set  *****/
141
142 typedef struct _ButtonItems {
143         char *  label;
144         XtCallbackProc  cb;
145         XtPointer clientdata;
146         XtArgVal  mnemonic;
147         XtArgVal  sensitive;
148         XtArgVal  deflt;
149 } ButtonItems;
150
151 #define BTNARGS( cb, clientdata, mnumonic, sensitive, deflt ) { \
152         (char *) "", \
153         (XtCallbackProc) cb, \
154         (XtPointer) clientdata, \
155         (XtArgVal) mnumonic, \
156         (XtArgVal) sensitive, \
157         (XtArgVal) deflt \
158 }
159
160 typedef struct _Button {
161         Widget          *w;
162         ButtonItems     *items;
163         int             itemcnt;
164 } Button;
165
166 #define BUTTONS( items ) { 0, items, XtNumber(items) }
167
168 /*****  MenuButton Set  *****/
169
170 typedef struct _menuButtonItems {
171         char    *label;
172         char    mnemonic;
173         Widget  menu;
174 } menuButtonItems;
175
176 #define MENUBTNARGS( mnumonic ) { \
177         "",    \
178         mnumonic, \
179         NULL, \
180 }
181
182 typedef struct _MButton {
183         menuButtonItems *items;
184         int             itemcnt;
185 } MButton;
186
187 #define MBUTTONS(items) {items,XtNumber((items))}
188
189
190 /*****  NoticeButton Set  *****/
191
192 typedef struct _NoticeButton {
193         char    *label;
194         void    (*cb)();
195 } NoticeButton;
196
197 #define NBTNARGS( cb, clientdata, mnumonic, sensitive, deflt) { \
198         "",    \
199         cb,    \
200 }
201
202 typedef struct _NButton {
203         NoticeButton    *items;
204         int             itemcnt;
205 } NButton;
206
207 #define NBUTTONS(items) {items,XtNumber((items))}
208
209
210 /*****  TextField Set  *****/
211
212 typedef struct _TextField {
213         Widget  w1;
214         Widget  w2;
215         String  label;
216 } TextField;
217
218
219 /*****  Function Type  *****/
220
221 #define D_WARNING       XmDIALOG_WARNING
222 #define D_QUESTION      XmDIALOG_QUESTION
223 #define D_ERROR         XmDIALOG_ERROR
224 #define D_TEMPLATE      XmDIALOG_TEMPLATE
225 #define L_VERTICAL      XmVERTICAL
226 #define L_HORIZONTAL    XmHORIZONTAL
227
228
229 #ifdef  USE_MACRO
230 #define AddLeftAttachWidget( w, ref, offset ) XtVaSetValues( w, \
231         XmNleftAttachment, XmATTACH_WIDGET, \
232         XmNleftWidget, ref, \
233         XmNleftOffset, offset, \
234         0)
235
236 #define AddLeftAttachForm( w, offset ) XtVaSetValues( w, \
237         XmNleftAttachment, XmATTACH_FORM, \
238         XmNleftOffset, offset, \
239         0)
240
241 #define AddTopAttachWidget( w, ref, offset ) XtVaSetValues( w, \
242         XmNtopAttachment, XmATTACH_WIDGET, \
243         XmNtopWidget, ref, \
244         XmNtopOffset, offset, \
245         0)
246
247 #define AddTopAttachForm( w, offset ) XtVaSetValues( w, \
248         XmNtopAttachment, XmATTACH_FORM, \
249         XmNtopOffset, offset, \
250         0)
251
252 #define AddRightAttachWidget( w, ref, offset ) XtVaSetValues( w, \
253         XmNrightAttachment, XmATTACH_WIDGET, \
254         XmNrightWidget, ref, \
255         XmNrightOffset, offset, \
256         0)
257
258 #define AddRightAttachForm( w, offset ) XtVaSetValues( w, \
259         XmNrightAttachment, XmATTACH_FORM, \
260         XmNrightOffset, offset, \
261         0)
262
263 #define AddBottomAttachForm( w, offset ) XtVaSetValues( w, \
264         XmNbottomAttachment, XmATTACH_FORM, \
265         XmNbottomOffset, offset, \
266         0)
267 #endif  /* USE_MACRO */