GDBEventSubscription.st
changeset 41 fb48207b6104
child 78 c24e7d8bc881
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/GDBEventSubscription.st	Thu Sep 18 09:32:30 2014 +0100
@@ -0,0 +1,33 @@
+"{ Package: 'jv:libgdbs' }"
+
+StrongSubscription subclass:#GDBEventSubscription
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'GDB-Private'
+!
+
+!GDBEventSubscription class methodsFor:'private'!
+
+blockFor: anObject withSelector: aSelector
+
+    | args |
+    args := aSelector numArgs.      
+
+    anObject isView ifTrue:[ 
+        args = 0 ifTrue: [ ^[ anObject sensor pushUserEvent: aSelector for: anObject ] ].
+        args = 1 ifTrue: [ ^[ :anAnnouncement | anObject sensor pushUserEvent: aSelector for: anObject withArgument: anAnnouncement ] ].
+        args = 2 ifTrue: [ ^[ :anAnnouncement :anAnnouncer | anObject sensor pushUserEvent: aSelector for: anObject withArguments: (Array with: anAnnouncement with: anAnnouncer) ] ].
+        self error: 'Couldn''t create block'.        
+    ].
+    (anObject isKindOf: ApplicationModel) ifTrue:[ 
+        args = 0 ifTrue: [ ^[ anObject window sensor pushUserEvent: aSelector for: anObject ] ].
+        args = 1 ifTrue: [ ^[ :anAnnouncement | anObject window sensor pushUserEvent: aSelector for: anObject withArgument: anAnnouncement ] ].
+        args = 2 ifTrue: [ ^[ :anAnnouncement :anAnnouncer | anObject window sensor pushUserEvent: aSelector for: anObject withArguments: (Array with: anAnnouncement with: anAnnouncer) ] ].
+        self error: 'Couldn''t create block'.        
+    ].
+    ^ super blockFor: anObject withSelector: aSelector
+
+    "Created: / 18-09-2014 / 00:10:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+