-
Notifications
You must be signed in to change notification settings - Fork 3
/
requesterItemObject.e
527 lines (451 loc) · 17 KB
/
requesterItemObject.e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
OPT MODULE, OSVERSION=37
MODULE 'reaction/reaction_macros',
'window','classes/window',
'gadgets/layout','layout',
'reaction/reaction_lib',
'button','gadgets/button',
'images/bevel',
'string','gadgets/string',
'integer','gadgets/integer',
'texteditor','gadgets/texteditor',
'*textfield',
'chooser','gadgets/chooser',
'gadgets/checkbox','checkbox',
'gadgets/listbrowser','listbrowser',
'images/label','label',
'amigalib/boopsi',
'libraries/gadtools',
'intuition/intuition',
'intuition/screens',
'intuition/imageclass',
'intuition/gadgetclass',
'exec/lists','exec/nodes',
'requester','classes/requester'
MODULE '*reactionObject','*reactionForm','*stringlist','*baseStreamer','*validator'
CONST TEXTFIELD_TEXT=$84000001
CONST TEXTFIELD_BORDER_BEVEL=1
CONST TEXTFIELD_BORDER=$8400000C
CONST TEXTFIELD_SIZE=$84000007
CONST TEXTFIELD_READONLY=$8400001F
EXPORT DEF texteditorbase
EXPORT ENUM REQITEMGAD_TYPE, REQITEMGAD_IDENT, REQITEMGAD_TITLEPARAM, REQITEMGAD_TITLE,REQITEMGAD_GADTEXTPARAM, REQITEMGAD_GADTEXT,
REQITEMGAD_INVISIBLE, REQITEMGAD_MAXCHARS, REQITEMGAD_IMAGE,REQITEMGAD_BODYPARAM, REQITEMGAD_BODY,
REQITEMGAD_OK, REQITEMGAD_TEST, REQITEMGAD_CANCEL
CONST NUM_REQITEM_GADS=REQITEMGAD_CANCEL+1
EXPORT OBJECT requesterItemObject OF reactionObject
reqType:CHAR
titleParam:CHAR
gadgetsParam:CHAR
bodyParam:CHAR
titleText[80]:ARRAY OF CHAR
gadgetsText[80]:ARRAY OF CHAR
image:CHAR
bodyText:PTR TO stringlist
invisible:CHAR
maxChars:CHAR
ENDOBJECT
EXPORT OBJECT requesterItemSettingsForm OF reactionForm
PRIVATE
typeLabels
imageLabels
requesterItem:PTR TO requesterItemObject
ENDOBJECT
PROC create(parent) OF requesterItemObject
DEF strlist:PTR TO stringlist
self.type:=TYPE_REQUESTER_ITEM
SUPER self.create(parent)
self.reqType:=0
self.image:=0
AstrCopy(self.titleText,'')
AstrCopy(self.gadgetsText,'')
self.titleParam:=0
self.gadgetsParam:=0
self.bodyParam:=0
self.invisible:=FALSE
self.maxChars:=10
NEW strlist.stringlist(10)
self.bodyText:=strlist
ENDPROC
PROC end() OF requesterItemObject
END self.bodyText
ENDPROC
PROC create() OF requesterItemSettingsForm
DEF gads:PTR TO LONG
DEF tempbase=0
NEW gads[NUM_REQITEM_GADS]
self.gadgetList:=gads
NEW gads[NUM_REQITEM_GADS]
self.gadgetActions:=gads
IF texteditorbase
tempbase:=textfieldbase
textfieldbase:=texteditorbase
self.gadgetList[ REQITEMGAD_BODY ]:=NewObjectA( TextEditor_GetClass(), NIL,[
GA_ID, REQITEMGAD_BODY,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
GA_READONLY, FALSE,
TAG_END])
ELSE
self.gadgetList[ REQITEMGAD_BODY ]:=NewObjectA( TextField_GetClass(), NIL,[
GA_ID, REQITEMGAD_BODY,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
TEXTFIELD_READONLY, FALSE,
TEXTFIELD_BORDER, TEXTFIELD_BORDER_BEVEL,
TAG_END])
ENDIF
self.typeLabels:=chooserLabelsA(['Info','Integer','String',0])
self.imageLabels:=chooserLabelsA(['Default','Info','Warning','Error','Question','Insert Disk',0])
self.windowObj:=WindowObject,
WA_TITLE, 'Requester Attribute Setting',
WA_LEFT, 0,
WA_TOP, 0,
WA_HEIGHT, 220,
WA_WIDTH, 260,
WA_MINWIDTH, 150,
WA_MAXWIDTH, 8192,
WA_MINHEIGHT, 60,
WA_MAXHEIGHT, 8192,
WA_ACTIVATE, TRUE,
WINDOW_POSITION, WPOS_CENTERSCREEN,
WA_PUBSCREEN, 0,
->WA_CustomScreen, gScreen,
->WINDOW_AppPort, gApp_port,
WA_CLOSEGADGET, TRUE,
WA_DEPTHGADGET, TRUE,
WA_SIZEGADGET, TRUE,
WA_DRAGBAR, TRUE,
WA_IDCMP,IDCMP_GADGETDOWN OR IDCMP_GADGETUP OR IDCMP_CLOSEWINDOW OR 0,
WINDOW_PARENTGROUP, VLayoutObject,
LAYOUT_SPACEOUTER, TRUE,
LAYOUT_DEFERLAYOUT, TRUE,
LAYOUT_ADDCHILD, LayoutObject,
LAYOUT_ORIENTATION, LAYOUT_ORIENT_HORIZ,
LAYOUT_ADDCHILD, self.gadgetList[REQITEMGAD_TYPE]:=ChooserObject,
GA_ID, REQITEMGAD_TYPE,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
CHOOSER_POPUP, TRUE,
CHOOSER_SELECTED, 0,
CHOOSER_LABELS, self.typeLabels,
ChooserEnd,
CHILD_LABEL, LabelObject,
LABEL_TEXT, 'Type',
LabelEnd,
LAYOUT_ADDCHILD, self.gadgetList[ REQITEMGAD_IDENT ]:=StringObject,
GA_ID, REQITEMGAD_IDENT,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
STRINGA_MAXCHARS, 80,
StringEnd,
CHILD_LABEL, LabelObject,
LABEL_TEXT, 'Identifier',
LabelEnd,
LayoutEnd,
CHILD_WEIGHTEDHEIGHT,0,
LAYOUT_ADDCHILD, LayoutObject,
LAYOUT_ORIENTATION, LAYOUT_ORIENT_HORIZ,
LAYOUT_FIXEDHORIZ, FALSE,
LAYOUT_ADDCHILD, self.gadgetList[ REQITEMGAD_INVISIBLE ]:=CheckBoxObject,
GA_ID, REQITEMGAD_INVISIBLE,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
GA_TEXT, 'Invisible',
CHECKBOX_TEXTPLACE, PLACETEXT_LEFT,
CheckBoxEnd,
LAYOUT_ADDCHILD, self.gadgetList[ REQITEMGAD_MAXCHARS ]:=IntegerObject,
GA_ID, REQITEMGAD_MAXCHARS,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
INTEGER_MAXCHARS, 10,
INTEGER_MINIMUM, 0,
INTEGER_MAXIMUM, 999,
IntegerEnd,
CHILD_LABEL, LabelObject,
LABEL_TEXT, 'MaxCha_rs',
LabelEnd,
LAYOUT_ADDCHILD, self.gadgetList[REQITEMGAD_IMAGE]:=ChooserObject,
GA_ID, REQITEMGAD_IMAGE,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
CHOOSER_POPUP, TRUE,
CHOOSER_SELECTED, 0,
CHOOSER_LABELS, self.imageLabels,
ChooserEnd,
CHILD_LABEL, LabelObject,
LABEL_TEXT, 'Image',
LabelEnd,
LayoutEnd,
CHILD_WEIGHTEDHEIGHT,0,
LAYOUT_ADDCHILD, LayoutObject,
LAYOUT_ORIENTATION, LAYOUT_ORIENT_HORIZ,
LAYOUT_FIXEDHORIZ, FALSE,
LAYOUT_ADDCHILD, self.gadgetList[ REQITEMGAD_TITLEPARAM ]:=CheckBoxObject,
GA_ID, REQITEMGAD_TITLEPARAM,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
GA_TEXT, 'Parameterised title',
CHECKBOX_TEXTPLACE, PLACETEXT_LEFT,
CheckBoxEnd,
LAYOUT_ADDCHILD, self.gadgetList[ REQITEMGAD_GADTEXTPARAM ]:=CheckBoxObject,
GA_ID, REQITEMGAD_GADTEXTPARAM,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
GA_TEXT, 'Parameterised gadgets',
CHECKBOX_TEXTPLACE, PLACETEXT_LEFT,
CheckBoxEnd,
LAYOUT_ADDCHILD, self.gadgetList[ REQITEMGAD_BODYPARAM ]:=CheckBoxObject,
GA_ID, REQITEMGAD_BODYPARAM,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
GA_TEXT, 'Parameterised body',
CHECKBOX_TEXTPLACE, PLACETEXT_LEFT,
CheckBoxEnd,
LayoutEnd,
CHILD_WEIGHTEDHEIGHT,0,
LAYOUT_ADDCHILD, LayoutObject,
LAYOUT_ORIENTATION, LAYOUT_ORIENT_HORIZ,
LAYOUT_ADDCHILD, self.gadgetList[REQITEMGAD_TITLE]:=StringObject,
GA_ID, REQITEMGAD_TITLE,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
STRINGA_MAXCHARS, 80,
StringEnd,
CHILD_LABEL, LabelObject,
LABEL_TEXT, 'Title Text',
LabelEnd,
LAYOUT_ADDCHILD, self.gadgetList[REQITEMGAD_GADTEXT]:=StringObject,
GA_ID, REQITEMGAD_GADTEXT,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
STRINGA_MAXCHARS, 80,
StringEnd,
CHILD_LABEL, LabelObject,
LABEL_TEXT, 'Gadget Text',
LabelEnd,
LayoutEnd,
CHILD_WEIGHTEDHEIGHT,0,
LAYOUT_ADDCHILD, self.gadgetList[REQITEMGAD_BODY],
CHILD_LABEL, LabelObject,
LABEL_TEXT, 'Body Text',
LabelEnd,
LAYOUT_ADDCHILD, LayoutObject,
LAYOUT_ORIENTATION, LAYOUT_ORIENT_HORIZ,
LAYOUT_ADDCHILD, self.gadgetList[REQITEMGAD_OK]:=ButtonObject,
GA_ID, REQITEMGAD_OK,
GA_TEXT, 'Ok',
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
ButtonEnd,
LAYOUT_ADDCHILD, self.gadgetList[REQITEMGAD_TEST]:=ButtonObject,
GA_ID, REQITEMGAD_TEST,
GA_TEXT, 'Test',
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
ButtonEnd,
LAYOUT_ADDCHILD, self.gadgetList[REQITEMGAD_CANCEL]:=ButtonObject,
GA_ID, REQITEMGAD_CANCEL,
GA_TEXT, 'Cancel',
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
ButtonEnd,
LayoutEnd,
CHILD_WEIGHTEDHEIGHT,0,
LayoutEnd,
WindowEnd
self.gadgetActions[REQITEMGAD_TITLEPARAM]:={updateTitleParam}
self.gadgetActions[REQITEMGAD_GADTEXTPARAM]:={updateGadgetsParam}
self.gadgetActions[REQITEMGAD_BODYPARAM]:={updateBodyParam}
self.gadgetActions[REQITEMGAD_TEST]:={testRequester}
self.gadgetActions[REQITEMGAD_CANCEL]:=MR_CANCEL
self.gadgetActions[REQITEMGAD_OK]:=MR_OK
IF tempbase THEN textfieldbase:=tempbase
ENDPROC
PROC updateTitleParam(nself,gadget,id,code) OF requesterItemSettingsForm
DEF win
self:=nself
win:=Gets(self.windowObj,WINDOW_WINDOW)
SetGadgetAttrsA(self.gadgetList[REQITEMGAD_TITLE],win,0,[GA_DISABLED, code<>0, TAG_END])
ENDPROC
PROC updateGadgetsParam(nself,gadget,id,code) OF requesterItemSettingsForm
DEF win
self:=nself
win:=Gets(self.windowObj,WINDOW_WINDOW)
SetGadgetAttrsA(self.gadgetList[REQITEMGAD_GADTEXT],win,0,[GA_DISABLED, code<>0, TAG_END])
ENDPROC
PROC updateBodyParam(nself,gadget,id,code) OF requesterItemSettingsForm
DEF win
self:=nself
win:=Gets(self.windowObj,WINDOW_WINDOW)
SetGadgetAttrsA(self.gadgetList[REQITEMGAD_BODY],win,0,[GA_DISABLED, code<>0, TAG_END])
ENDPROC
PROC testRequester(nself,gadget,id,code) OF requesterItemSettingsForm
DEF reqmsg:PTR TO orrequest
DEF reqobj,win
DEF res=0,strval,vallen
DEF type,titleText,gadText,bodyText,image
DEF invtag,maxcharstag,buftag
DEF buffer,maxchars
SUBA.L #$100,A7
self:=nself
win:=Gets(self.windowObj,WINDOW_WINDOW)
buffer:=New(100)
type:=Gets(self.gadgetList[ REQITEMGAD_TYPE ],CHOOSER_SELECTED)
titleText:=Gets(self.gadgetList[ REQITEMGAD_TITLE ],STRINGA_TEXTVAL)
gadText:=Gets(self.gadgetList[ REQITEMGAD_GADTEXT ],STRINGA_TEXTVAL)
invtag:=TAG_IGNORE
buftag:=TAG_IGNORE
maxcharstag:=TAG_IGNORE
IF type=2 THEN buftag:=REQS_BUFFER
IF Gets(self.gadgetList[ REQITEMGAD_INVISIBLE ],CHECKBOX_CHECKED)
SELECT type
CASE 1
invtag:=REQI_INVISIBLE
CASE 2
invtag:=REQS_INVISIBLE
ENDSELECT
ENDIF
maxchars:=Gets(self.gadgetList[ REQITEMGAD_MAXCHARS ],INTEGER_NUMBER)
SELECT type
CASE 1
maxcharstag:=REQI_MAXCHARS
IF maxchars>10 THEN maxchars:=10
CASE 2
maxcharstag:=REQS_MAXCHARS
ENDSELECT
IF texteditorbase
bodyText:=DoMethod(self.gadgetList[ REQITEMGAD_BODY ], GM_TEXTEDITOR_EXPORTTEXT)
ELSE
SetGadgetAttrsA(self.gadgetList[ REQITEMGAD_BODY ],0,0,[TEXTFIELD_READONLY,TRUE,0])
vallen:=Gets(self.gadgetList[ REQITEMGAD_BODY ], TEXTFIELD_SIZE)
strval:=Gets(self.gadgetList[ REQITEMGAD_BODY ], TEXTFIELD_TEXT)
bodyText:=AllocVec(vallen+1,0)
IF (vallen<>0) AND (strval<>0)
CopyMem(strval,bodyText,vallen)
ENDIF
bodyText[vallen]:=0
SetGadgetAttrsA(self.gadgetList[ REQITEMGAD_BODY ],0,0,[TEXTFIELD_READONLY,FALSE,0])
ENDIF
image:=Gets(self.gadgetList[ REQITEMGAD_IMAGE ],CHOOSER_SELECTED)
IF Gets(self.gadgetList[ REQITEMGAD_TITLEPARAM ],CHECKBOX_CHECKED)
titleText:='titleParam'
ENDIF
IF Gets(self.gadgetList[ REQITEMGAD_GADTEXTPARAM ],CHECKBOX_CHECKED)
gadText:='gadgetsParam'
ENDIF
IF Gets(self.gadgetList[ REQITEMGAD_BODYPARAM ],CHECKBOX_CHECKED)
bodyText:='bodyParam'
ENDIF
type:=ListItem([REQTYPE_INFO, REQTYPE_INTEGER, REQTYPE_STRING],type)
image:=ListItem([REQIMAGE_DEFAULT, REQIMAGE_INFO, REQIMAGE_WARNING, REQIMAGE_ERROR, REQIMAGE_QUESTION, REQIMAGE_INSERTDISK],image)
NEW reqmsg
reqmsg.methodid:=RM_OPENREQ
reqmsg.window:=win
reqmsg.attrs:=[REQ_TYPE, type, REQ_IMAGE, image, REQ_TITLETEXT,titleText,REQ_BODYTEXT,bodyText,REQ_GADGETTEXT,gadText,invtag,TRUE,
maxcharstag,maxchars,buftag,buffer,TAG_END]
reqobj:=NewObjectA(Requester_GetClass(),0,[TAG_END])
IF reqobj
res:=DoMethodA(reqobj, reqmsg)
DisposeObject(reqobj)
ENDIF
END reqmsg
IF Gets(self.gadgetList[ REQITEMGAD_BODYPARAM ],CHECKBOX_CHECKED)=FALSE
FreeVec(bodyText)
ENDIF
Dispose(buffer)
ADD.L #$100,A7
ENDPROC
PROC end() OF requesterItemSettingsForm
IF self.typeLabels THEN freeChooserLabels(self.typeLabels)
IF self.imageLabels THEN freeChooserLabels(self.imageLabels)
END self.gadgetList[NUM_REQITEM_GADS]
END self.gadgetActions[NUM_REQITEM_GADS]
DisposeObject(self.windowObj)
ENDPROC
EXPORT PROC canClose(modalRes) OF requesterItemSettingsForm
DEF res
IF modalRes=MR_CANCEL THEN RETURN TRUE
IF checkIdent(self,self.requesterItem,REQITEMGAD_IDENT)=FALSE
RETURN FALSE
ENDIF
ENDPROC TRUE
PROC editSettings(reqItem:PTR TO requesterItemObject) OF requesterItemSettingsForm
DEF res,bodyText,strval,vallen
self.requesterItem:=reqItem
SetGadgetAttrsA(self.gadgetList[REQITEMGAD_TITLE],0,0,[GA_DISABLED, reqItem.titleParam<>0, TAG_END])
SetGadgetAttrsA(self.gadgetList[REQITEMGAD_GADTEXT],0,0,[GA_DISABLED, reqItem.gadgetsParam<>0, TAG_END])
SetGadgetAttrsA(self.gadgetList[REQITEMGAD_BODY],0,0,[GA_DISABLED, reqItem.bodyParam<>0, TAG_END])
SetGadgetAttrsA(self.gadgetList[ REQITEMGAD_IDENT ],0,0,[STRINGA_TEXTVAL,reqItem.ident,0])
SetGadgetAttrsA(self.gadgetList[ REQITEMGAD_TYPE ],0,0,[CHOOSER_SELECTED,reqItem.reqType,0])
SetGadgetAttrsA(self.gadgetList[ REQITEMGAD_TITLE ],0,0,[STRINGA_TEXTVAL,reqItem.titleText,0])
SetGadgetAttrsA(self.gadgetList[ REQITEMGAD_GADTEXT ],0,0,[STRINGA_TEXTVAL,reqItem.gadgetsText,0])
SetGadgetAttrsA(self.gadgetList[ REQITEMGAD_TITLEPARAM ],0,0,[CHECKBOX_CHECKED,reqItem.titleParam,0])
SetGadgetAttrsA(self.gadgetList[ REQITEMGAD_GADTEXTPARAM ],0,0,[CHECKBOX_CHECKED,reqItem.gadgetsParam,0])
SetGadgetAttrsA(self.gadgetList[ REQITEMGAD_BODYPARAM ],0,0,[CHECKBOX_CHECKED,reqItem.bodyParam,0])
SetGadgetAttrsA(self.gadgetList[ REQITEMGAD_INVISIBLE ],0,0,[CHECKBOX_CHECKED,reqItem.invisible,0])
SetGadgetAttrsA(self.gadgetList[ REQITEMGAD_MAXCHARS ],0,0,[INTEGER_NUMBER,reqItem.maxChars,0])
bodyText:=reqItem.bodyText.makeTextString()
IF texteditorbase
SetGadgetAttrsA(self.gadgetList[ REQITEMGAD_BODY ],0,0,[GA_TEXTEDITOR_CONTENTS, bodyText,0])
ELSE
SetGadgetAttrsA(self.gadgetList[ REQITEMGAD_BODY ],0,0,[TEXTFIELD_TEXT,bodyText,0])
ENDIF
DisposeLink(bodyText)
SetGadgetAttrsA(self.gadgetList[ REQITEMGAD_IMAGE ],0,0,[CHOOSER_SELECTED,reqItem.image,0])
res:=self.showModal()
IF res=MR_OK
AstrCopy(reqItem.ident,Gets(self.gadgetList[ REQITEMGAD_IDENT ],STRINGA_TEXTVAL),80)
reqItem.reqType:=Gets(self.gadgetList[ REQITEMGAD_TYPE ],CHOOSER_SELECTED)
AstrCopy(reqItem.titleText,Gets(self.gadgetList[ REQITEMGAD_TITLE ],STRINGA_TEXTVAL),80)
AstrCopy(reqItem.gadgetsText,Gets(self.gadgetList[ REQITEMGAD_GADTEXT ],STRINGA_TEXTVAL),80)
reqItem.titleParam:=Gets(self.gadgetList[ REQITEMGAD_TITLEPARAM ],CHECKBOX_CHECKED)
reqItem.gadgetsParam:=Gets(self.gadgetList[ REQITEMGAD_GADTEXTPARAM ],CHECKBOX_CHECKED)
reqItem.bodyParam:=Gets(self.gadgetList[ REQITEMGAD_BODYPARAM ],CHECKBOX_CHECKED)
reqItem.invisible:=Gets(self.gadgetList[ REQITEMGAD_INVISIBLE ],CHECKBOX_CHECKED)
reqItem.maxChars:=Gets(self.gadgetList[ REQITEMGAD_MAXCHARS ],INTEGER_NUMBER)
IF texteditorbase
bodyText:=DoMethod(self.gadgetList[ REQITEMGAD_BODY ], GM_TEXTEDITOR_EXPORTTEXT)
ELSE
SetGadgetAttrsA(self.gadgetList[ REQITEMGAD_BODY ],0,0,[TEXTFIELD_READONLY,TRUE,0])
vallen:=Gets(self.gadgetList[ REQITEMGAD_BODY ], TEXTFIELD_SIZE)
strval:=Gets(self.gadgetList[ REQITEMGAD_BODY ], TEXTFIELD_TEXT)
bodyText:=AllocVec(vallen+1,0)
IF (vallen<>0) AND (strval<>0)
CopyMem(strval,bodyText,vallen)
ENDIF
bodyText[vallen]:=0
SetGadgetAttrsA(self.gadgetList[ REQITEMGAD_BODY ],0,0,[TEXTFIELD_READONLY,FALSE,0])
ENDIF
reqItem.bodyText.setFromTextString(bodyText)
FreeVec(bodyText)
reqItem.image:=Gets(self.gadgetList[ REQITEMGAD_IMAGE ],CHOOSER_SELECTED)
ENDIF
ENDPROC res=MR_OK
#define makeProp(a,b) 'a',{self.a},b
EXPORT PROC getTypeName() OF requesterItemObject
RETURN 'Requester'
ENDPROC
EXPORT PROC serialiseData() OF requesterItemObject IS
[
makeProp(reqType,FIELDTYPE_CHAR),
makeProp(titleParam,FIELDTYPE_CHAR),
makeProp(gadgetsParam,FIELDTYPE_CHAR),
makeProp(bodyParam,FIELDTYPE_CHAR),
makeProp(titleText,FIELDTYPE_STR),
makeProp(gadgetsText,FIELDTYPE_STR),
makeProp(image,FIELDTYPE_CHAR),
makeProp(bodyText,FIELDTYPE_STRLIST),
makeProp(invisible,FIELDTYPE_CHAR),
makeProp(maxChars,FIELDTYPE_CHAR)
]
EXPORT PROC editSettings() OF requesterItemObject
DEF editForm:PTR TO requesterItemSettingsForm
DEF res
NEW editForm.create()
res:=editForm.editSettings(self)
END editForm
ENDPROC res
EXPORT PROC createRequesterItemObject(parent)
DEF requesterItem:PTR TO requesterItemObject
NEW requesterItem.create(parent)
ENDPROC requesterItem