ExecutableFunction.st
changeset 16270 2b544a163c71
parent 16263 881e5090c287
child 18120 e3a375d5f6a8
child 18944 c8a1f76e1c16
--- a/ExecutableFunction.st	Thu Mar 20 13:26:40 2014 +0100
+++ b/ExecutableFunction.st	Thu Mar 20 18:04:25 2014 +0100
@@ -202,6 +202,15 @@
     "Created: 16.4.1996 / 16:31:15 / cg"
 !
 
+hasCanvasResource
+    "Return true, if this method is an canvas-resource method, false otherwise.
+     This is done by looking for a #canvas key in the method's resources."
+
+    ^ self hasResource:#canvas
+
+    "Modified (comment): / 20-03-2014 / 16:58:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 hasCode
     "return true, if this codeObject has machinecode to execute."
 %{
@@ -214,12 +223,40 @@
     "Created: / 13.11.1998 / 23:13:29 / cg"
 !
 
+hasImageResource
+    "return true, if this method is an image-resource method.
+     This is done by looking for a #image key in the method's resources."
+
+    ^ self hasResource:#image
+!
+
+hasMenuResource
+    "return true, if this method is a menu-resource method.
+     This is done by looking for a #image key in the method's resources."
+
+    ^ self hasResource:#menu
+!
+
 hasResource
     "return true, if this codeObject has a resource (false here - only real methods have)."
 
     ^ false
 !
 
+hasResource:aSymbol
+    "return true if the method has a <resource> definition for aSymbol."
+
+    ^ self hasResource and:[ (self resources ? #()) includesKey:aSymbol ]
+
+    "
+     Method allInstancesDo:[:m |
+        (m hasResource:#image) ifTrue:[self halt]
+     ].
+    "
+
+    "Modified: / 01-12-2010 / 13:59:58 / cg"
+!
+
 isBreakpointed
     "return true, if this is a wrapper method for a breakpoint.
      False is returned here - this method is redefined in WrappedMethod"
@@ -416,10 +453,10 @@
 !ExecutableFunction class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ExecutableFunction.st,v 1.58 2014-03-17 21:20:38 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ExecutableFunction.st,v 1.59 2014-03-20 17:04:25 vrany Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/ExecutableFunction.st,v 1.58 2014-03-17 21:20:38 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ExecutableFunction.st,v 1.59 2014-03-20 17:04:25 vrany Exp $'
 ! !