11 class: GuiSingleton | widgetlist quitflag | [
13 <#IUPDispatcher 250 elid>.
17 ^message: msg title: title [
18 <#IUPDispatcher 1 title msg>
22 ^self message: msg title: 'LittleSmalltalk Message'
26 <#IUPDispatcher 2 0 action>.
30 ^button: label action: action [
31 <#IUPDispatcher 2 1 action label>.
35 ^toggle: label action: action [
36 <#IUPDispatcher 2 2 action label>.
41 <#IUPDispatcher 2 3 action>.
46 <#IUPDispatcher 2 4 action>.
51 <#IUPDispatcher 2 5 action>.
56 <#IUPDispatcher 2 6 label>.
76 <#IUPDispatcher 2 10 elid>.
81 <#IUPDispatcher 2 11 elid>.
101 <#IUPDispatcher 3 3>.
106 <#IUPDispatcher 3 4 elid>.
111 <#IUPDispatcher 3 5>.
116 <#IUPDispatcher 3 6>.
121 <#IUPDispatcher 3 7>.
125 ^split: elid0 and: elid1 [
126 <#IUPDispatcher 3 8 elid0 elid1>.
131 <#IUPDispatcher 3 8>.
135 ^attachTo: boxid element: elid [
136 <#IUPDispatcher 4 boxid elid>.
141 <#IUPDispatcher 5 elid>.
146 <#IUPDispatcher 6 elid>.
151 <#IUPDispatcher 7 elid>.
155 ^registerEvent: aName [
156 <#IUPDispatcher 8 aName>.
160 ^unregisterEvent: aName [
161 <#IUPDispatcher 8 aName false>.
165 ^registerListEvent: aName [
166 <#IUPDispatcher 9 aName>.
170 ^unregisterListEvent: aName [
171 <#IUPDispatcher 9 aName false>.
180 ^setAttribute: elid name: aName value: value [
181 <#IUPDispatcher 11 elid aName value>.
185 ^getAttribute: elid name: aName [
186 <#IUPDispatcher 12 elid aName>.
190 ^deleteAttribute: elid name: aName [
191 <#IUPDispatcher 13 elid aName>.
196 <#IUPDispatcher 14 elid>.
201 <#IUPDispatcher 15 elid>.
206 <#IUPDispatcher 15 elid true>.
211 widgetlist ifNil: [ widgetlist := List new ].
216 widgetlist ifNotNil: [ widgetlist remove: aWC ifAbsent: [ nil ]]
219 ^findWidgetById: aId [
220 widgetlist ifNotNil: [ widgetlist do: [:w | w idToString = aId ifTrue: [ ^w ]]].
229 widgetlist ifNotNil: [ widgetlist do: [:w | (w passEvent: aId) ifTrue: [ ^true ]]].
235 [ quitflag ] whileFalse: [
236 System eventWaitFor: 1100.
237 self passEvent: (self getEvent).
245 self error: 'GuiWidget instances must be created with special methods'.
250 obj := self basicNew.
251 self in: obj at: 1 put: aId.
256 ^GuiSingleton idToString: id
263 setAttribute: aName value: value [
264 GuiSingleton setAttribute: id name: aName value: value
268 ^GuiSingleton getAttribute: id name: aName
271 removeAttribute: aName [
272 GuiSingleton deleteAttribute: id name: aName
276 GuiSingleton popup: id
280 GuiSingleton show: id
284 "returns true if event handler found"
285 self idToString = aId ifTrue: [ self onEvent. ^true ].
290 GuiSingleton detach: id
294 GuiSingleton attachTo: aWid id element: id
299 GuiWidget subclass: GuiButton [
300 ^new: aText actionBlock: aBlock [
302 obj := self newWithId: (GuiSingleton button: aText action: true).
303 self in: obj var: #ablock put: aBlock.
308 ablock ifNotNil: [ ablock value ].
313 GuiWidget subclass: GuiRestrictedGroup [
316 containsWidget: aWC [
317 widgetlist ifNotNil: [ ^widgetlist includes: aWC ].
321 findWidgetById: aId [
322 widgetlist ifNotNil: [ widgetlist do: [:w | w idToString = aId ifTrue: [ ^w ]]].
327 "returns true if event handler found"
329 (super passEvent: aId) ifTrue: [ ^true ].
330 (w := self findWidgetById: aId) ifNotNil: [ w onEvent. ^true ].
331 widgetlist ifNotNil: [ widgetlist do: [:w | (w passEvent: aId) ifTrue: [ ^true ]]].
337 GuiRestrictedGroup subclass: GuiGroup [
339 widgetlist ifNil: [ widgetlist := List new ].
344 widgetlist ifNotNil: [ widgetlist remove: aWC ifAbsent: [ nil ]]
349 GuiGroup subclass: GuiBox [
351 aWid; detach; attachTo: self.
352 ^super addWidget: aWid
356 (self containsWidget: aWid) ifTrue: [
358 super removeWidget: aWid.
363 GuiBox subclass: GuiHBox [
365 ^self newWithId: (GuiSingleton hbox).
369 GuiBox subclass: GuiVBox [
371 ^self newWithId: (GuiSingleton vbox).
375 GuiBox subclass: GuiCBox [
377 ^self newWithId: (GuiSingleton cbox).
381 GuiBox subclass: GuiSBox [
383 ^self newWithId: (GuiSingleton sbox).
387 GuiBox subclass: GuiNormBox [
389 ^self newWithId: (GuiSingleton normalizer).
394 GuiRestrictedGroup subclass: GuiSplit [
395 ^new: aWid0 and: aWid1 [
397 obj := self newWithId: (GuiSingleton split: aWid0 and aWid1).
398 self in: obj var: #widgetlist put: (List with: aWid0 with: aWid1).
413 GuiRestrictedGroup subclass: GuiDialog [
414 ^new: aTitle widget: aWidget [
416 obj := self newWithId: (GuiSingleton dialog: aWidget id).
417 self in: obj var: #widgetlist put: (List with: aWidget).
418 obj setAttribute: 'TITLE' value: aTitle asString.