2 /* This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * Fichier contenant les fonctions attachees aux objets graphiques
25 extern void InitPushButton(struct XObj
*xobj
);
26 extern void DestroyPushButton(struct XObj
*xobj
);
27 extern void DrawPushButton(struct XObj
*xobj
, XEvent
*evp
);
28 extern void EvtMousePushButton(struct XObj
*xobj
,XButtonEvent
*EvtButton
);
29 extern void EvtKeyPushButton(struct XObj
*xobj
,XKeyEvent
*EvtKey
);
30 extern void ProcessMsgPushButton(
31 struct XObj
*xobj
,unsigned long type
,unsigned long *body
);
33 extern void InitRadioButton(struct XObj
*xobj
);
34 extern void DestroyRadioButton(struct XObj
*xobj
);
35 extern void DrawRadioButton(struct XObj
*xobj
, XEvent
*evp
);
36 extern void EvtMouseRadioButton(struct XObj
*xobj
,XButtonEvent
*EvtButton
);
37 extern void EvtKeyRadioButton(struct XObj
*xobj
,XKeyEvent
*EvtKey
);
38 extern void ProcessMsgRadioButton(
39 struct XObj
*xobj
,unsigned long type
,unsigned long *body
);
41 extern void InitItemDraw(struct XObj
*xobj
);
42 extern void DestroyItemDraw(struct XObj
*xobj
);
43 extern void DrawItemDraw(struct XObj
*xobj
, XEvent
*evp
);
44 extern void EvtMouseItemDraw(struct XObj
*xobj
,XButtonEvent
*EvtButton
);
45 extern void EvtKeyItemDraw(struct XObj
*xobj
,XKeyEvent
*EvtKey
);
46 extern void ProcessMsgItemDraw(
47 struct XObj
*xobj
,unsigned long type
,unsigned long *body
);
49 extern void InitCheckBox(struct XObj
*xobj
);
50 extern void DestroyCheckBox(struct XObj
*xobj
);
51 extern void DrawCheckBox(struct XObj
*xobj
, XEvent
*evp
);
52 extern void EvtMouseCheckBox(struct XObj
*xobj
,XButtonEvent
*EvtButton
);
53 extern void EvtKeyCheckBox(struct XObj
*xobj
,XKeyEvent
*EvtKey
);
54 extern void ProcessMsgCheckBox(
55 struct XObj
*xobj
,unsigned long type
,unsigned long *body
);
57 extern void InitTextField(struct XObj
*xobj
);
58 extern void DestroyTextField(struct XObj
*xobj
);
59 extern void DrawTextField(struct XObj
*xobj
, XEvent
*evp
);
60 extern void EvtMouseTextField(struct XObj
*xobj
,XButtonEvent
*EvtButton
);
61 extern void EvtKeyTextField(struct XObj
*xobj
,XKeyEvent
*EvtKey
);
62 extern void ProcessMsgTextField(
63 struct XObj
*xobj
,unsigned long type
,unsigned long *body
);
65 extern void InitHScrollBar(struct XObj
*xobj
);
66 extern void DestroyHScrollBar(struct XObj
*xobj
);
67 extern void DrawHScrollBar(struct XObj
*xobj
, XEvent
*evp
);
68 extern void EvtMouseHScrollBar(struct XObj
*xobj
,XButtonEvent
*EvtButton
);
69 extern void EvtKeyHScrollBar(struct XObj
*xobj
,XKeyEvent
*EvtKey
);
70 extern void ProcessMsgHScrollBar(
71 struct XObj
*xobj
,unsigned long type
,unsigned long *body
);
73 extern void InitVScrollBar(struct XObj
*xobj
);
74 extern void DestroyVScrollBar(struct XObj
*xobj
);
75 extern void DrawVScrollBar(struct XObj
*xobj
, XEvent
*evp
);
76 extern void EvtMouseVScrollBar(struct XObj
*xobj
,XButtonEvent
*EvtButton
);
77 extern void EvtKeyVScrollBar(struct XObj
*xobj
,XKeyEvent
*EvtKey
);
78 extern void ProcessMsgVScrollBar(
79 struct XObj
*xobj
,unsigned long type
,unsigned long *body
);
81 extern void InitPopupMenu(struct XObj
*xobj
);
82 extern void DestroyPopupMenu(struct XObj
*xobj
);
83 extern void DrawPopupMenu(struct XObj
*xobj
, XEvent
*evp
);
84 extern void EvtMousePopupMenu(struct XObj
*xobj
,XButtonEvent
*EvtButton
);
85 extern void EvtKeyPopupMenu(struct XObj
*xobj
,XKeyEvent
*EvtKey
);
86 extern void ProcessMsgPopupMenu(
87 struct XObj
*xobj
,unsigned long type
,unsigned long *body
);
89 extern void InitRectangle(struct XObj
*xobj
);
90 extern void DestroyRectangle(struct XObj
*xobj
);
91 extern void DrawRectangle(struct XObj
*xobj
, XEvent
*evp
);
92 extern void EvtMouseRectangle(struct XObj
*xobj
,XButtonEvent
*EvtButton
);
93 extern void EvtKeyRectangle(struct XObj
*xobj
,XKeyEvent
*EvtKey
);
94 extern void ProcessMsgRectangle(
95 struct XObj
*xobj
,unsigned long type
,unsigned long *body
);
97 extern void InitMiniScroll(struct XObj
*xobj
);
98 extern void DestroyMiniScroll(struct XObj
*xobj
);
99 extern void DrawMiniScroll(struct XObj
*xobj
, XEvent
*evp
);
100 extern void EvtMouseMiniScroll(struct XObj
*xobj
,XButtonEvent
*EvtButton
);
101 extern void EvtKeyMiniScroll(struct XObj
*xobj
,XKeyEvent
*EvtKey
);
102 extern void ProcessMsgMiniScroll(
103 struct XObj
*xobj
,unsigned long type
,unsigned long *body
);
105 extern void InitSwallow(struct XObj
*xobj
);
106 extern void DestroySwallow(struct XObj
*xobj
);
107 extern void DrawSwallow(struct XObj
*xobj
, XEvent
*evp
);
108 extern void EvtMouseSwallow(struct XObj
*xobj
,XButtonEvent
*EvtButton
);
109 extern void EvtKeySwallow(struct XObj
*xobj
,XKeyEvent
*EvtKey
);
110 extern void ProcessMsgSwallow(
111 struct XObj
*xobj
,unsigned long type
,unsigned long *body
);
113 extern void InitHDipstick(struct XObj
*xobj
);
114 extern void DestroyHDipstick(struct XObj
*xobj
);
115 extern void DrawHDipstick(struct XObj
*xobj
, XEvent
*evp
);
116 extern void EvtMouseHDipstick(struct XObj
*xobj
,XButtonEvent
*EvtButton
);
117 extern void EvtKeyHDipstick(struct XObj
*xobj
,XKeyEvent
*EvtKey
);
118 extern void ProcessMsgHDipstick(
119 struct XObj
*xobj
,unsigned long type
,unsigned long *body
);
121 extern void InitVDipstick(struct XObj
*xobj
);
122 extern void DestroyVDipstick(struct XObj
*xobj
);
123 extern void DrawVDipstick(struct XObj
*xobj
, XEvent
*evp
);
124 extern void EvtMouseVDipstick(struct XObj
*xobj
,XButtonEvent
*EvtButton
);
125 extern void EvtKeyVDipstick(struct XObj
*xobj
,XKeyEvent
*EvtKey
);
126 extern void ProcessMsgVDipstick(
127 struct XObj
*xobj
,unsigned long type
,unsigned long *body
);
129 extern void InitList(struct XObj
*xobj
);
130 extern void DestroyList(struct XObj
*xobj
);
131 extern void DrawList(struct XObj
*xobj
, XEvent
*evp
);
132 extern void EvtMouseList(struct XObj
*xobj
,XButtonEvent
*EvtButton
);
133 extern void EvtKeyList(struct XObj
*xobj
,XKeyEvent
*EvtKey
);
134 extern void ProcessMsgList(
135 struct XObj
*xobj
,unsigned long type
,unsigned long *body
);
137 extern void InitMenu(struct XObj
*xobj
);
138 extern void DestroyMenu(struct XObj
*xobj
);
139 extern void DrawMenu(struct XObj
*xobj
, XEvent
*evp
);
140 extern void EvtMouseMenu(struct XObj
*xobj
,XButtonEvent
*EvtButton
);
141 extern void EvtKeyMenu(struct XObj
*xobj
,XKeyEvent
*EvtKey
);
142 extern void ProcessMsgMenu(
143 struct XObj
*xobj
,unsigned long type
,unsigned long *body
);
146 * Choix des fonctions suivant le type de bouton
149 void ChooseFunction(struct XObj
*xobj
,char *type
)
151 if (strcmp(type
,"PushButton")==0)
153 xobj
->TypeWidget
=PushButton
;
154 xobj
->InitObj
=InitPushButton
;
155 xobj
->DestroyObj
=DestroyPushButton
;
156 xobj
->DrawObj
=DrawPushButton
;
157 xobj
->EvtMouse
=EvtMousePushButton
;
158 xobj
->EvtKey
=EvtKeyPushButton
;
159 xobj
->ProcessMsg
=ProcessMsgPushButton
;
161 else if (strcmp(type
,"RadioButton")==0)
163 xobj
->TypeWidget
=RadioButton
;
164 xobj
->InitObj
=InitRadioButton
;
165 xobj
->DestroyObj
=DestroyRadioButton
;
166 xobj
->DrawObj
=DrawRadioButton
;
167 xobj
->EvtMouse
=EvtMouseRadioButton
;
168 xobj
->EvtKey
=EvtKeyRadioButton
;
169 xobj
->ProcessMsg
=ProcessMsgRadioButton
;
171 else if (strcmp(type
,"ItemDraw")==0)
173 xobj
->TypeWidget
=ItemDraw
;
174 xobj
->InitObj
=InitItemDraw
;
175 xobj
->DestroyObj
=DestroyItemDraw
;
176 xobj
->DrawObj
=DrawItemDraw
;
177 xobj
->EvtMouse
=EvtMouseItemDraw
;
178 xobj
->EvtKey
=EvtKeyItemDraw
;
179 xobj
->ProcessMsg
=ProcessMsgItemDraw
;
181 else if (strcmp(type
,"CheckBox")==0)
183 xobj
->TypeWidget
=CheckBox
;
184 xobj
->InitObj
=InitCheckBox
;
185 xobj
->DestroyObj
=DestroyCheckBox
;
186 xobj
->DrawObj
=DrawCheckBox
;
187 xobj
->EvtMouse
=EvtMouseCheckBox
;
188 xobj
->EvtKey
=EvtKeyCheckBox
;
189 xobj
->ProcessMsg
=ProcessMsgCheckBox
;
191 else if (strcmp(type
,"TextField")==0)
193 xobj
->TypeWidget
=TextField
;
194 xobj
->InitObj
=InitTextField
;
195 xobj
->DestroyObj
=DestroyTextField
;
196 xobj
->DrawObj
=DrawTextField
;
197 xobj
->EvtMouse
=EvtMouseTextField
;
198 xobj
->EvtKey
=EvtKeyTextField
;
199 xobj
->ProcessMsg
=ProcessMsgTextField
;
201 else if (strcmp(type
,"HScrollBar")==0)
203 xobj
->TypeWidget
=HScrollBar
;
204 xobj
->InitObj
=InitHScrollBar
;
205 xobj
->DestroyObj
=DestroyHScrollBar
;
206 xobj
->DrawObj
=DrawHScrollBar
;
207 xobj
->EvtMouse
=EvtMouseHScrollBar
;
208 xobj
->EvtKey
=EvtKeyHScrollBar
;
209 xobj
->ProcessMsg
=ProcessMsgHScrollBar
;
211 else if (strcmp(type
,"VScrollBar")==0)
213 xobj
->TypeWidget
=VScrollBar
;
214 xobj
->InitObj
=InitVScrollBar
;
215 xobj
->DestroyObj
=DestroyVScrollBar
;
216 xobj
->DrawObj
=DrawVScrollBar
;
217 xobj
->EvtMouse
=EvtMouseVScrollBar
;
218 xobj
->EvtKey
=EvtKeyVScrollBar
;
219 xobj
->ProcessMsg
=ProcessMsgVScrollBar
;
221 else if (strcmp(type
,"PopupMenu")==0)
223 xobj
->TypeWidget
=PopupMenu
;
224 xobj
->InitObj
=InitPopupMenu
;
225 xobj
->DestroyObj
=DestroyPopupMenu
;
226 xobj
->DrawObj
=DrawPopupMenu
;
227 xobj
->EvtMouse
=EvtMousePopupMenu
;
228 xobj
->EvtKey
=EvtKeyPopupMenu
;
229 xobj
->ProcessMsg
=ProcessMsgPopupMenu
;
231 else if (strcmp(type
,"Rectangle")==0)
233 xobj
->TypeWidget
=Rectangle
;
234 xobj
->InitObj
=InitRectangle
;
235 xobj
->DestroyObj
=DestroyRectangle
;
236 xobj
->DrawObj
=DrawRectangle
;
237 xobj
->EvtMouse
=EvtMouseRectangle
;
238 xobj
->EvtKey
=EvtKeyRectangle
;
239 xobj
->ProcessMsg
=ProcessMsgRectangle
;
241 else if (strcmp(type
,"MiniScroll")==0)
243 xobj
->TypeWidget
=MiniScroll
;
244 xobj
->InitObj
=InitMiniScroll
;
245 xobj
->DestroyObj
=DestroyMiniScroll
;
246 xobj
->DrawObj
=DrawMiniScroll
;
247 xobj
->EvtMouse
=EvtMouseMiniScroll
;
248 xobj
->EvtKey
=EvtKeyMiniScroll
;
249 xobj
->ProcessMsg
=ProcessMsgMiniScroll
;
251 else if (strcmp(type
,"SwallowExec")==0)
253 xobj
->TypeWidget
=SwallowExec
;
254 xobj
->InitObj
=InitSwallow
;
255 xobj
->DestroyObj
=DestroySwallow
;
256 xobj
->DrawObj
=DrawSwallow
;
257 xobj
->EvtMouse
=EvtMouseSwallow
;
258 xobj
->EvtKey
=EvtKeySwallow
;
259 xobj
->ProcessMsg
=ProcessMsgSwallow
;
261 else if (strcmp(type
,"HDipstick")==0)
263 xobj
->TypeWidget
=HDipstick
;
264 xobj
->InitObj
=InitHDipstick
;
265 xobj
->DestroyObj
=DestroyHDipstick
;
266 xobj
->DrawObj
=DrawHDipstick
;
267 xobj
->EvtMouse
=EvtMouseHDipstick
;
268 xobj
->EvtKey
=EvtKeyHDipstick
;
269 xobj
->ProcessMsg
=ProcessMsgHDipstick
;
271 else if (strcmp(type
,"VDipstick")==0)
273 xobj
->TypeWidget
=VDipstick
;
274 xobj
->InitObj
=InitVDipstick
;
275 xobj
->DestroyObj
=DestroyVDipstick
;
276 xobj
->DrawObj
=DrawVDipstick
;
277 xobj
->EvtMouse
=EvtMouseVDipstick
;
278 xobj
->EvtKey
=EvtKeyVDipstick
;
279 xobj
->ProcessMsg
=ProcessMsgVDipstick
;
281 else if (strcmp(type
,"List")==0)
283 xobj
->TypeWidget
=List
;
284 xobj
->InitObj
=InitList
;
285 xobj
->DestroyObj
=DestroyList
;
286 xobj
->DrawObj
=DrawList
;
287 xobj
->EvtMouse
=EvtMouseList
;
288 xobj
->EvtKey
=EvtKeyList
;
289 xobj
->ProcessMsg
=ProcessMsgList
;
291 else if (strcmp(type
,"Menu")==0)
293 xobj
->TypeWidget
=Menu
;
294 xobj
->InitObj
=InitMenu
;
295 xobj
->DestroyObj
=DestroyMenu
;
296 xobj
->DrawObj
=DrawMenu
;
297 xobj
->EvtMouse
=EvtMouseMenu
;
298 xobj
->EvtKey
=EvtKeyMenu
;
299 xobj
->ProcessMsg
=ProcessMsgMenu
;
303 fprintf(stderr
,"Item %s unknow\n",type
);