-
Notifications
You must be signed in to change notification settings - Fork 3
/
SpeedBarObject.e
608 lines (515 loc) · 18.4 KB
/
SpeedBarObject.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
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
OPT MODULE, OSVERSION=37
MODULE 'reaction/reaction_macros',
'window','classes/window',
'gadgets/layout','layout',
'reaction/reaction_lib',
'button','gadgets/button',
'images/bevel',
'bitmap','images/bitmap',
'string',
'gadgets/chooser','chooser',
'gadgets/checkbox','checkbox',
'listbrowser','gadgets/listbrowser',
'speedbar','gadgets/speedbar',
'images/label','label',
'amigalib/boopsi',
'exec/lists',
'exec/nodes',
'amigalib/lists',
'exec/memory',
'libraries/gadtools',
'intuition/intuition',
'intuition/screens',
'intuition/imageclass',
'intuition/gadgetclass'
MODULE '*reactionObject','*reactionForm','*colourPicker','*sourcegen','*stringlist','*validator'
EXPORT ENUM SBARGAD_IDENT,SBARGAD_LABEL, SBARGAD_HINT, SBARGAD_BTNLIST, SBARGAD_BUTTON_TEXT, SBARGAD_BUTTON_TYPE, SBARGAD_BUTTON_ADD, SBARGAD_BUTTON_DEL, SBARGAD_ORIENTATION, SBARGAD_BGPEN,
SBARGAD_STRUMBAR, SBARGAD_BEVELSTYLE,
SBARGAD_OK, SBARGAD_CHILD, SBARGAD_CANCEL
CONST TYPE_TEXT="0"
CONST TYPE_IMAGE="1"
CONST NUM_SBAR_GADS=SBARGAD_CANCEL+1
EXPORT OBJECT speedBarObject OF reactionObject
orientation:CHAR
bgPen:INT
strumBar:CHAR
bevelStyle:CHAR
buttonList:PTR TO stringlist
PRIVATE
buttonLabels:PTR TO stdlist
buttons:LONG
ENDOBJECT
OBJECT speedBarSettingsForm OF reactionForm
PRIVATE
speedBarObject:PTR TO speedBarObject
rootLayout:LONG
columninfo[3]:ARRAY OF columninfo
tempItems:PTR TO stringlist
selectedItem:INT
tempBgPen:INT
labels1:LONG
labels2:LONG
browserlist:PTR TO mlh
ENDOBJECT
PROC selectItem(nself,gadget,id,code) OF speedBarSettingsForm
DEF win
self:=nself
win:=Gets(self.windowObj,WINDOW_WINDOW)
self.selectedItem:=code
SetGadgetAttrsA(self.gadgetList[SBARGAD_BUTTON_DEL],win,0,[GA_DISABLED, IF code=-1 THEN TRUE ELSE FALSE, TAG_END])
DoMethod(self.windowObj, WM_RETHINK)
ENDPROC
PROC addItem(nself,gadget,id,code) OF speedBarSettingsForm
DEF strval
DEF n,win
DEF type
DEF newval
DEF typeStr[10]:STRING
self:=nself
strval:=Gets(self.gadgetList[ SBARGAD_BUTTON_TEXT ],STRINGA_TEXTVAL)
IF StrLen(strval)
newval:=String(StrLen(strval)+1)
type:=Gets(self.gadgetList[ SBARGAD_BUTTON_TYPE ],CHOOSER_ACTIVE)
StringF(newval,'\d\s',type,strval)
self.tempItems.add(newval)
win:=Gets(self.windowObj,WINDOW_WINDOW)
SetGadgetAttrsA(self.gadgetList[SBARGAD_BTNLIST],win,0,[LISTBROWSER_LABELS, Not(0), TAG_END])
IF type=1
StrCopy(typeStr,'Image')
ELSE
StrCopy(typeStr,'Text')
ENDIF
IF (n:=AllocListBrowserNodeA(2, [LBNA_FLAGS,0, LBNA_COLUMN,0, LBNCA_COPYTEXT, TRUE, LBNCA_TEXT, strval, LBNA_COLUMN,1, LBNCA_COPYTEXT, TRUE, LBNCA_TEXT, typeStr, TAG_END]))
AddTail(self.browserlist, n)
ELSE
Raise("MEM")
ENDIF
SetGadgetAttrsA(self.gadgetList[SBARGAD_BUTTON_TEXT],win,0,[STRINGA_TEXTVAL, '', TAG_END])
SetGadgetAttrsA(self.gadgetList[SBARGAD_BUTTON_TYPE],win,0,[CHOOSER_ACTIVE, 0, TAG_END])
SetGadgetAttrsA(self.gadgetList[SBARGAD_BTNLIST],win,0,[LISTBROWSER_LABELS, self.browserlist, TAG_END])
SetGadgetAttrsA(self.gadgetList[SBARGAD_BTNLIST],win,0,[LISTBROWSER_SELECTEDNODE, 0,0])
self.selectItem(self,0,0,-1)
IF gadget=self.gadgetList[SBARGAD_BUTTON_TEXT] THEN ActivateLayoutGadget(self.rootLayout, win, 0, gadget)
ENDIF
ENDPROC
PROC deleteItem(nself,gadget,id,code) OF speedBarSettingsForm
DEF win,node
self:=nself
win:=Gets(self.windowObj,WINDOW_WINDOW)
IF self.selectedItem>=0
self.tempItems.remove(self.selectedItem)
node:=Gets(self.gadgetList[SBARGAD_BTNLIST],LISTBROWSER_SELECTEDNODE)
remNode(self.gadgetList[SBARGAD_BTNLIST],win,0,node)
self.selectItem(self,0,0,-1)
DoMethod(self.windowObj, WM_RETHINK)
ENDIF
ENDPROC
PROC create() OF speedBarSettingsForm
DEF gads:PTR TO LONG
DEF tmpItems:PTR TO stringlist
NEW gads[NUM_SBAR_GADS]
self.gadgetList:=gads
NEW gads[NUM_SBAR_GADS]
self.gadgetActions:=gads
NEW tmpItems.stringlist(10)
self.tempItems:=tmpItems
self.columninfo[0].width:=3
self.columninfo[0].title:='Menu Buttons'
self.columninfo[0].flags:=CIF_WEIGHTED
self.columninfo[1].width:=1
self.columninfo[1].title:='Type'
self.columninfo[1].flags:=CIF_WEIGHTED
self.columninfo[2].width:=-1
self.columninfo[2].title:=-1
self.columninfo[2].flags:=-1
self.browserlist:=browserNodesA([0])
self.windowObj:=WindowObject,
WA_TITLE, 'SpeedBar Attribute Setting',
WA_LEFT, 0,
WA_TOP, 0,
WA_HEIGHT, 80,
WA_WIDTH, 450,
WA_MINWIDTH, 150,
WA_MAXWIDTH, 8192,
WA_MINHEIGHT, 80,
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, self.rootLayout:=VLayoutObject,
LAYOUT_SPACEOUTER, TRUE,
LAYOUT_DEFERLAYOUT, TRUE,
LAYOUT_ADDCHILD, LayoutObject,
LAYOUT_ORIENTATION, LAYOUT_ORIENT_HORIZ,
LAYOUT_ADDCHILD, self.gadgetList[ SBARGAD_IDENT ]:=StringObject,
GA_ID, SBARGAD_IDENT,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
STRINGA_MAXCHARS, 80,
StringEnd,
CHILD_LABEL, LabelObject,
LABEL_TEXT, 'Identifier',
LabelEnd,
LAYOUT_ADDCHILD, self.gadgetList[ SBARGAD_LABEL ]:=StringObject,
GA_ID, SBARGAD_LABEL,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
STRINGA_MAXCHARS, 80,
StringEnd,
CHILD_LABEL, LabelObject,
LABEL_TEXT, '_Label',
LabelEnd,
LAYOUT_ADDCHILD, self.gadgetList[ SBARGAD_HINT ]:=ButtonObject,
GA_ID, SBARGAD_HINT,
GA_TEXT, 'Hint',
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
ButtonEnd,
CHILD_WEIGHTEDWIDTH,50,
LAYOUT_ADDCHILD, self.gadgetList[ SBARGAD_BGPEN ]:=ButtonObject,
GA_ID, SBARGAD_BGPEN,
GA_TEXT, 'Back_groundPen',
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
ButtonEnd,
CHILD_WEIGHTEDWIDTH,0,
LAYOUT_ADDCHILD, self.gadgetList[ SBARGAD_STRUMBAR ]:=CheckBoxObject,
GA_ID, SBARGAD_STRUMBAR,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
GA_TEXT, 'StrumBar',
CHECKBOX_TEXTPLACE, PLACETEXT_LEFT,
CheckBoxEnd,
CHILD_WEIGHTEDWIDTH,0,
LayoutEnd,
CHILD_WEIGHTEDHEIGHT,0,
LAYOUT_ADDCHILD, LayoutObject,
LAYOUT_ORIENTATION, LAYOUT_ORIENT_HORIZ,
LAYOUT_ADDCHILD, self.gadgetList[ SBARGAD_ORIENTATION ]:=ChooserObject,
GA_ID, SBARGAD_ORIENTATION,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
CHOOSER_POPUP, TRUE,
CHOOSER_MAXLABELS, 12,
CHOOSER_ACTIVE, 0,
CHOOSER_WIDTH, -1,
CHOOSER_LABELS, self.labels1:=chooserLabelsA(['SBORIENT_HORIZ','SBORIENT_VERT',0]),
ChooserEnd,
CHILD_LABEL, LabelObject,
LABEL_TEXT, 'Orientation',
LabelEnd,
LAYOUT_ADDCHILD, self.gadgetList[ SBARGAD_BEVELSTYLE ]:=ChooserObject,
GA_ID, SBARGAD_BEVELSTYLE,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
CHOOSER_POPUP, TRUE,
CHOOSER_MAXLABELS, 12,
CHOOSER_ACTIVE, 0,
CHOOSER_WIDTH, -1,
CHOOSER_LABELS, self.labels2:=chooserLabelsA(['BVS_NONE', 'BVS_THIN', 'BVS_BUTTON', 'BVS_GROUP','BVS_FIELD','BVS_DROPBOX','BVS_SBAR_HORIZ','BVS_SBAR_VERT','BVS_BOX','BVS_RADIOBUTTON','BVS_STANDARD',0]),
ChooserEnd,
CHILD_LABEL, LabelObject,
LABEL_TEXT, 'BevelStyle',
LabelEnd,
LayoutEnd,
LAYOUT_ADDCHILD,self.gadgetList[SBARGAD_BTNLIST]:=ListBrowserObject,
GA_ID, SBARGAD_BTNLIST,
GA_RELVERIFY, TRUE,
LISTBROWSER_POSITION, 0,
LISTBROWSER_SHOWSELECTED, TRUE,
LISTBROWSER_COLUMNTITLES, TRUE,
LISTBROWSER_HIERARCHICAL, FALSE,
LISTBROWSER_COLUMNINFO, self.columninfo,
LISTBROWSER_LABELS, self.browserlist,
ListBrowserEnd,
LAYOUT_ADDCHILD, LayoutObject,
LAYOUT_ORIENTATION, LAYOUT_ORIENT_HORIZ,
LAYOUT_ADDCHILD, self.gadgetList[ SBARGAD_BUTTON_TEXT ]:=StringObject,
GA_ID, SBARGAD_BUTTON_TEXT,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
STRINGA_MAXCHARS, 80,
StringEnd,
LAYOUT_ORIENTATION, LAYOUT_ORIENT_HORIZ,
LAYOUT_ADDCHILD, self.gadgetList[ SBARGAD_BUTTON_TYPE ]:=ChooserObject,
GA_ID, SBARGAD_BUTTON_TYPE,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
CHOOSER_POPUP, TRUE,
CHOOSER_MAXLABELS, 12,
CHOOSER_ACTIVE, 0,
CHOOSER_WIDTH, -1,
CHOOSER_LABELS, self.labels1:=chooserLabelsA(['Text','Image',0]),
ChooserEnd,
CHILD_WEIGHTEDWIDTH,0,
LAYOUT_ADDCHILD, self.gadgetList[ SBARGAD_BUTTON_ADD ]:=ButtonObject,
GA_ID, SBARGAD_BUTTON_ADD,
GA_TEXT, 'Add',
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
ButtonEnd,
CHILD_WEIGHTEDWIDTH,0,
LAYOUT_ADDCHILD, self.gadgetList[ SBARGAD_BUTTON_DEL ]:=ButtonObject,
GA_ID, SBARGAD_BUTTON_DEL,
GA_TEXT, 'Remove',
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
ButtonEnd,
CHILD_WEIGHTEDWIDTH,0,
LayoutEnd,
LAYOUT_ADDCHILD, LayoutObject,
LAYOUT_ORIENTATION, LAYOUT_ORIENT_HORIZ,
LAYOUT_ADDCHILD, self.gadgetList[ SBARGAD_OK ]:=ButtonObject,
GA_ID, SBARGAD_OK,
GA_TEXT, '_OK',
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
ButtonEnd,
LAYOUT_ADDCHILD, self.gadgetList[ SBARGAD_CHILD ]:=ButtonObject,
GA_ID, SBARGAD_CHILD,
GA_TEXT, 'C_hild',
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
ButtonEnd,
LAYOUT_ADDCHILD, self.gadgetList[ SBARGAD_CANCEL ]:=ButtonObject,
GA_ID, SBARGAD_CANCEL,
GA_TEXT, '_Cancel',
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
ButtonEnd,
LayoutEnd,
CHILD_WEIGHTEDHEIGHT,0,
LayoutEnd,
WindowEnd
self.gadgetActions[SBARGAD_BTNLIST]:={selectItem}
self.gadgetActions[SBARGAD_BGPEN]:={selectPen}
self.gadgetActions[SBARGAD_CHILD]:={editChildSettings}
self.gadgetActions[SBARGAD_HINT]:={editHint}
self.gadgetActions[SBARGAD_CANCEL]:=MR_CANCEL
self.gadgetActions[SBARGAD_BUTTON_ADD]:={addItem}
self.gadgetActions[SBARGAD_BUTTON_DEL]:={deleteItem}
self.gadgetActions[SBARGAD_BUTTON_TEXT]:={addItem}
self.gadgetActions[SBARGAD_OK]:=MR_OK
ENDPROC
PROC editChildSettings(nself,gadget,id,code) OF speedBarSettingsForm
self:=nself
self.setBusy()
self.speedBarObject.editChildSettings()
self.clearBusy()
ENDPROC
PROC selectPen(nself,gadget,id,code) OF speedBarSettingsForm
DEF frmColourPicker:PTR TO colourPickerForm
DEF selColour
DEF colourProp:PTR TO INT
self:=nself
self.setBusy()
SELECT id
CASE SBARGAD_BGPEN
colourProp:={self.tempBgPen}
ENDSELECT
NEW frmColourPicker.create()
IF (selColour:=frmColourPicker.selectColour(colourProp[]))<>-1
colourProp[]:=selColour
ENDIF
END frmColourPicker
self.clearBusy()
ENDPROC
PROC end() OF speedBarSettingsForm
freeChooserLabels( self.labels1 )
freeChooserLabels( self.labels2 )
freeBrowserNodes(self.browserlist)
END self.tempItems
END self.gadgetList[NUM_SBAR_GADS]
END self.gadgetActions[NUM_SBAR_GADS]
DisposeObject(self.windowObj)
ENDPROC
EXPORT PROC canClose(modalRes) OF speedBarSettingsForm
DEF res
IF modalRes=MR_CANCEL THEN RETURN TRUE
IF checkIdent(self,self.speedBarObject,SBARGAD_IDENT)=FALSE
RETURN FALSE
ENDIF
ENDPROC TRUE
PROC editHint(nself,gadget,id,code) OF speedBarSettingsForm
self:=nself
self.setBusy()
self.speedBarObject.editHint()
self.clearBusy()
self.updateHint(SBARGAD_HINT, self.speedBarObject.hintText)
ENDPROC
PROC editSettings(comp:PTR TO speedBarObject) OF speedBarSettingsForm
DEF res,i,n
DEF typeStr[10]:STRING
DEF str:PTR TO CHAR
self.speedBarObject:=comp
self.tempBgPen:=comp.bgPen
self.updateHint(SBARGAD_HINT, comp.hintText)
SetGadgetAttrsA(self.gadgetList[SBARGAD_BTNLIST],0,0,[LISTBROWSER_LABELS, Not(0), TAG_END])
FOR i:=0 TO comp.buttonList.count()-1
self.tempItems.add(comp.buttonList.item(i))
str:=comp.buttonList.item(i)
IF str[0]=TYPE_IMAGE
StrCopy(typeStr,'Image')
ELSE
StrCopy(typeStr,'Text')
ENDIF
IF (n:=AllocListBrowserNodeA(2, [LBNA_FLAGS,0, LBNA_COLUMN,0, LBNCA_COPYTEXT, TRUE, LBNCA_TEXT, comp.buttonList.item(i)+1, LBNA_COLUMN,1, LBNCA_COPYTEXT, TRUE, LBNCA_TEXT, typeStr, TAG_END]))
AddTail(self.browserlist, n)
ELSE
Raise("MEM")
ENDIF
ENDFOR
SetGadgetAttrsA(self.gadgetList[SBARGAD_BTNLIST],0,0,[LISTBROWSER_LABELS, self.browserlist, TAG_END])
self.selectItem(self,0,0,-1)
SetGadgetAttrsA(self.gadgetList[ SBARGAD_IDENT ],0,0,[STRINGA_TEXTVAL,comp.ident,0])
SetGadgetAttrsA(self.gadgetList[ SBARGAD_LABEL ],0,0,[STRINGA_TEXTVAL,comp.label,0])
SetGadgetAttrsA(self.gadgetList[ SBARGAD_STRUMBAR ],0,0,[CHECKBOX_CHECKED,comp.strumBar,0])
SetGadgetAttrsA(self.gadgetList[ SBARGAD_ORIENTATION ],0,0,[CHOOSER_SELECTED,comp.orientation,0])
SetGadgetAttrsA(self.gadgetList[ SBARGAD_BEVELSTYLE ],0,0,[CHOOSER_SELECTED,comp.bevelStyle,0])
res:=self.showModal()
IF res=MR_OK
AstrCopy(comp.ident,Gets(self.gadgetList[ SBARGAD_IDENT ],STRINGA_TEXTVAL))
AstrCopy(comp.label,Gets(self.gadgetList[ SBARGAD_LABEL ],STRINGA_TEXTVAL))
comp.bgPen:=self.tempBgPen
comp.strumBar:=Gets(self.gadgetList[ SBARGAD_STRUMBAR ],CHECKBOX_CHECKED)
comp.orientation:=Gets(self.gadgetList[ SBARGAD_ORIENTATION ],CHOOSER_SELECTED)
comp.bevelStyle:=Gets(self.gadgetList[ SBARGAD_BEVELSTYLE ],CHOOSER_SELECTED)
comp.buttonList.clear()
FOR i:=0 TO self.tempItems.count()-1 DO comp.buttonList.add(self.tempItems.item(i))
ENDIF
ENDPROC res=MR_OK
PROC freeButtons(list:PTR TO lh) OF speedBarObject
DEF node:PTR TO ln
DEF nextnode:PTR TO ln
DEF i
FOR i:=0 TO self.buttonLabels.count()-1
DisposeObject(self.buttonLabels.item(i))
ENDFOR
self.buttonLabels.clear()
IF list
node:= list.head
WHILE (nextnode := node.succ)
FreeSpeedButtonNode(node)
node := nextnode
ENDWHILE
FreeMem(list,SIZEOF lh)
ENDIF
ENDPROC
PROC makeButtons(scr) OF speedBarObject
DEF list:PTR TO lh
DEF node:PTR TO ln
DEF label
DEF i,n=0
DEF str:PTR TO CHAR
self.freeButtons(self.buttons)
IF (list:=AllocMem( SIZEOF lh, MEMF_PUBLIC ))
newList(list)
FOR i:=0 TO self.buttonList.count()-1
str:=self.buttonList.item(i)
IF str[0]=TYPE_IMAGE
label:=BitMapObject,
BITMAP_SOURCEFILE, self.buttonList.item(i)+1,
BITMAP_SCREEN,scr,
BitMapEnd
ELSE
label:=LabelObject,
LABEL_TEXT, self.buttonList.item(i)+1,
LabelEnd
ENDIF
self.buttonLabels.add(label)
IF (node:=AllocSpeedButtonNodeA(
i,[SBNA_IMAGE, label,
SBNA_ENABLED, TRUE,
SBNA_SPACING, 2,
SBNA_HIGHLIGHT, SBH_RECESS,
TAG_DONE]))=FALSE
self.freeButtons(self.buttons)
RETURN NIL
ENDIF
AddTail(list,node)
ENDFOR
ENDIF
ENDPROC list
EXPORT PROC createPreviewObject(scr) OF speedBarObject
self.previewObject:=0
IF (speedbarbase)
self.previewObject:=SpeedBarObject,
GA_ID, self.id,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
SPEEDBAR_ORIENTATION, ListItem([SBORIENT_HORIZ,SBORIENT_VERT],self.orientation),
SPEEDBAR_BACKGROUND, self.bgPen,
SPEEDBAR_STRUMBAR, self.strumBar,
SPEEDBAR_BEVELSTYLE, ListItem([BVS_NONE, BVS_THIN, BVS_BUTTON, BVS_GROUP,BVS_FIELD,BVS_DROPBOX,BVS_SBAR_HORIZ,BVS_SBAR_VERT,BVS_BOX,BVS_RADIOBUTTON,BVS_STANDARD],self.bevelStyle),
SPEEDBAR_BUTTONS, self.buttons:=self.makeButtons(scr),
SpeedBarEnd
ENDIF
IF self.previewObject=0 THEN self.previewObject:=self.createErrorObject(scr)
self.makePreviewChildAttrs(self.label)
ENDPROC
EXPORT PROC create(parent) OF speedBarObject
DEF buttons:PTR TO stringlist
DEF buttonLabels:PTR TO stdlist
self.type:=TYPE_SPEEDBAR
SUPER self.create(parent)
self.orientation:=0
self.bgPen:=0
self.strumBar:=FALSE
self.bevelStyle:=2
NEW buttons.stringlist(10)
self.buttonList:=buttons
NEW buttonLabels.stdlist(10)
self.buttonLabels:=buttonLabels
self.libsused:=[TYPE_SPEEDBAR,TYPE_LABEL, TYPE_BITMAP]
ENDPROC
PROC end() OF speedBarObject
END self.buttonList
self.freeButtons(self.buttons)
END self.buttonLabels
SUPER self.end()
ENDPROC
EXPORT PROC editSettings() OF speedBarObject
DEF editForm:PTR TO speedBarSettingsForm
DEF res
NEW editForm.create()
res:=editForm.editSettings(self)
END editForm
ENDPROC res
EXPORT PROC getTypeName() OF speedBarObject
RETURN 'SpeedBar'
ENDPROC
#define makeProp(a,b) 'a',{self.a},b
EXPORT PROC serialiseData() OF speedBarObject IS
[
makeProp(orientation,FIELDTYPE_CHAR),
makeProp(bgPen,FIELDTYPE_INT),
makeProp(strumBar,FIELDTYPE_CHAR),
makeProp(bevelStyle,FIELDTYPE_CHAR),
makeProp(buttonList,FIELDTYPE_STRLIST)
]
EXPORT PROC genCodeProperties(srcGen:PTR TO srcGen) OF speedBarObject
DEF tempStr[200]:STRING
srcGen.componentProperty('GA_RelVerify','TRUE',FALSE)
srcGen.componentProperty('GA_TabCycle','TRUE',FALSE)
IF self.bgPen<>0 THEN srcGen.componentPropertyInt('SPEEDBAR_Background',self.bgPen)
IF self.orientation<>0 THEN srcGen.componentProperty('SPEEDBAR_Orientation',ListItem(['SBORIENT_HORIZ','SBORIENT_VERT'],self.orientation),FALSE)
IF self.strumBar THEN srcGen.componentProperty('SPEEDBAR_StrumBar','TRUE',FALSE)
IF self.bevelStyle<>2 THEN srcGen.componentProperty('SPEEDBAR_BevelStyle',ListItem(['BVS_NONE', 'BVS_THIN', 'BVS_BUTTON', 'BVS_GROUP','BVS_FIELD','BVS_DROPBOX','BVS_SBAR_HORIZ','BVS_SBAR_VERT','BVS_BOX','BVS_RADIOBUTTON','BVS_STANDARD'],self.bevelStyle),FALSE)
StringF(tempStr,'buttons\d',self.id)
srcGen.componentProperty('SPEEDBAR_Buttons',tempStr,FALSE)
ENDPROC
EXPORT PROC genCodeChildProperties(srcGen:PTR TO srcGen) OF speedBarObject
srcGen.componentAddChildLabel(self.label)
SUPER self.genCodeChildProperties(srcGen)
ENDPROC
EXPORT PROC createSpeedBarObject(parent)
DEF speedbar:PTR TO speedBarObject
NEW speedbar.create(parent)
ENDPROC speedbar