UIObjectView.st
changeset 119 39acd704ad51
parent 113 1854c2e61c4e
child 123 421d412e797b
--- a/UIObjectView.st	Fri May 23 16:06:33 1997 +0200
+++ b/UIObjectView.st	Fri May 23 16:07:52 1997 +0200
@@ -1,5 +1,5 @@
 ObjectView subclass:#UIObjectView
-	instanceVariableNames:'inputView testMode undoHistory copiedExtent copiedLayout
+	instanceVariableNames:'inputView enableChannel undoHistory copiedExtent copiedLayout
 		actionData createClass clipChildren selectionHiddenLevel
 		setOfSuperViewsSizeChanged'
 	classVariableNames:''
@@ -155,12 +155,10 @@
 
 !UIObjectView methodsFor:'accessing'!
 
-canModify
-    ^ testMode not
-!
-
-canModify:aBool
-    self testMode:(aBool not)
+enableChannel
+    "returns the channel which keeps false if running test otherwise true
+    "
+  ^ enableChannel
 !
 
 gridAlign
@@ -222,12 +220,38 @@
     "show grid
     "
     self withSelectionHiddenDo:[super showGrid]
+! !
+
+!UIObjectView methodsFor:'accessing behavior'!
+
+enabled
+    ^ enableChannel value
+!
+
+enabled:aState
+    "set the modification / test mode
+    "
+    (aState == enableChannel value) ifFalse:[
+        enableChannel value:aState.
+
+        aState ifFalse:[
+            self unselect.
+            inputView unrealize
+        ] ifTrue:[
+            inputView raise.
+            inputView realize
+        ].
+        self changed:#enabled
+    ]
+
+
+
 !
 
 testMode
     "returns true if running test
     "
-    ^ testMode
+    ^ enableChannel value not
 
 
 !
@@ -235,20 +259,7 @@
 testMode:aBoolean
     "change test mode
     "
-    (aBoolean == testMode) ifFalse:[
-        testMode := aBoolean.
-
-        testMode ifTrue:[
-            self unselect.
-            inputView unrealize
-        ] ifFalse:[
-            inputView raise.
-            inputView realize
-        ].
-        self changed:#canModify
-    ]
-
-
+    self enabled:(aBoolean not)
 ! !
 
 !UIObjectView methodsFor:'blocked'!
@@ -359,9 +370,9 @@
 
     self setDefaultActions.
 
-    undoHistory  := UndoHistory new.
-    testMode     := false.
-    clipChildren := true.
+    undoHistory          := UndoHistory new.
+    enableChannel        := true asValue.
+    clipChildren         := true.
     selectionHiddenLevel := 0.
 
     (self class gridShown) ifTrue:[
@@ -683,7 +694,7 @@
 
     |anObject|
 
-    testMode ifTrue:[^ self].
+    self enabled ifFalse:[^ self].
 
     anObject := self findObjectAt:aPoint.
     anObject notNil ifTrue:[
@@ -700,7 +711,7 @@
     "
     |aView b|
 
-    testMode ifTrue:[^ self].
+    self enabled ifFalse:[^ self].
 
     aView := self singleSelection.
 
@@ -1402,9 +1413,9 @@
 !
 
 canSelect:something
-    "returns true if something can be selected and testMode is disabled
+    "returns true if something can be selected and enabled is true
     "
-    ^ (testMode not and:[something ~~ selection])
+    ^ (self enabled and:[something ~~ selection])
 
 !