fixes to X11 primitives
[k8lst.git] / modules / x11 / x11groups.st
blob92113b6f995e83f591db451013dffcca5147e816
1 Package [
2   X11
6 X11BaseWindow subclass: X11RestrictedGroup [
7   | widgetlist |
9   includes: aWC [
10     widgetlist ifNotNil: [ ^widgetlist includes: aWC ].
11     ^false
12   ]
14   findWidgetById: aWid [
15     widgetlist ifNotNil: [ widgetlist do: [:w | (X11Singleton sameWids: aWid and: w wid) ifTrue: [ ^w ]]].
16     ^nil
17   ]
19   passEvent: aWid event: evt [
20     "returns true if event handler found"
21     | w |
22     (super passEvent: aWid event: evt) ifTrue: [ ^true ].
23     (w := self findWidgetById: aWid) ifNotNil: [ w onEvent: evt. ^true ].
24     "widgetlist ifNotNil: [ widgetlist do: [:w | (w passEvent: aWid event: evt) ifTrue: [ ^true ]]]."
25     ^false
26   ]
30 X11RestrictedGroup subclass: X11Group [
31   add: aWC [
32     widgetlist ifNil: [ widgetlist := List new ].
33     widgetlist << aWC.
34   ]
36   remove: aWC [
37     widgetlist ifNotNil: [ widgetlist remove: aWC ifAbsent: [ nil ]]
38   ]
40   removeAll [
41     widgetlist ifNotNil: [
42       [ widgetlist size > 0 ] whileTrue: [ self remove: widgetlist first ].
43     ]
44   ]