added an extra validateExpandability block,
authorClaus Gittinger <cg@exept.de>
Mon, 15 Feb 1999 20:24:17 +0100
changeset 1202 b9a3beb20ca7
parent 1201 a81cf27650bd
child 1203 ef8f7ce856d4
added an extra validateExpandability block, to allow double-click without expand.
SelTreeV.st
SelectionInTreeView.st
--- a/SelTreeV.st	Sun Feb 14 16:47:25 1999 +0100
+++ b/SelTreeV.st	Mon Feb 15 20:24:17 1999 +0100
@@ -19,7 +19,7 @@
 		showDirectoryIndicatorForRoot imageOpened imageClosed imageItem
 		discardMotionEvents registeredImages supportsExpandAll
 		buildInArray drawVLinesFromLevel highlightMode editorWidget
-		editorIndex editValueFgColor'
+		editorIndex editValueFgColor validateExpandabilityBlock'
 	classVariableNames:'DefaultHilightMode SelectionInset'
 	poolDictionaries:''
 	category:'Views-Text'
@@ -419,7 +419,7 @@
 !
 
 validateDoubleClickBlock
-    "set the conditionBlock; this block is evaluated before a doubleClick action
+    "return the conditionBlock; this block is evaluated before a doubleClick action
      on a node will be performed. In case of returning false, the doubleClick will
      not be handled.
    "
@@ -436,6 +436,26 @@
    validateDoubleClickBlock := aOneArgBlock
 
 
+!
+
+validateExpandabilityBlock
+    "return the expand conditionBlock; this block is evaluated before an expand due to
+     a doubleClick on a node will be performed. In case of returning false, 
+     the node will not be expanded.
+   "
+   ^ validateExpandabilityBlock
+
+
+!
+
+validateExpandabilityBlock:aOneArgBlock
+    "set the expand conditionBlock; this block is evaluated before an expand due to
+     a doubleClick on a node will be performed. In case of returning false, 
+     the node will not be expanded.
+   "
+   validateExpandabilityBlock := aOneArgBlock
+
+
 ! !
 
 !SelectionInTreeView methodsFor:'accessing-channels'!
@@ -1287,10 +1307,12 @@
     |node|
 
     (node := self selectedNode) notNil ifTrue:[
-        (     validateDoubleClickBlock isNil
-         or:[(validateDoubleClickBlock value:node) ~~ false]
-        ) ifTrue:[
-            self selectedNodeExpand:(node isExpandable).
+        (validateDoubleClickBlock isNil
+         or:[(validateDoubleClickBlock value:node) ~~ false]) ifTrue:[
+            (validateExpandabilityBlock isNil
+             or:[(validateExpandabilityBlock value:node) ~~ false]) ifTrue:[
+                self selectedNodeExpand:(node isExpandable).
+            ].
             super doubleClicked
         ]
     ]
@@ -2323,5 +2345,5 @@
 !SelectionInTreeView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/Attic/SelTreeV.st,v 1.73 1999-02-11 17:45:13 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/Attic/SelTreeV.st,v 1.74 1999-02-15 19:24:17 cg Exp $'
 ! !
--- a/SelectionInTreeView.st	Sun Feb 14 16:47:25 1999 +0100
+++ b/SelectionInTreeView.st	Mon Feb 15 20:24:17 1999 +0100
@@ -19,7 +19,7 @@
 		showDirectoryIndicatorForRoot imageOpened imageClosed imageItem
 		discardMotionEvents registeredImages supportsExpandAll
 		buildInArray drawVLinesFromLevel highlightMode editorWidget
-		editorIndex editValueFgColor'
+		editorIndex editValueFgColor validateExpandabilityBlock'
 	classVariableNames:'DefaultHilightMode SelectionInset'
 	poolDictionaries:''
 	category:'Views-Text'
@@ -419,7 +419,7 @@
 !
 
 validateDoubleClickBlock
-    "set the conditionBlock; this block is evaluated before a doubleClick action
+    "return the conditionBlock; this block is evaluated before a doubleClick action
      on a node will be performed. In case of returning false, the doubleClick will
      not be handled.
    "
@@ -436,6 +436,26 @@
    validateDoubleClickBlock := aOneArgBlock
 
 
+!
+
+validateExpandabilityBlock
+    "return the expand conditionBlock; this block is evaluated before an expand due to
+     a doubleClick on a node will be performed. In case of returning false, 
+     the node will not be expanded.
+   "
+   ^ validateExpandabilityBlock
+
+
+!
+
+validateExpandabilityBlock:aOneArgBlock
+    "set the expand conditionBlock; this block is evaluated before an expand due to
+     a doubleClick on a node will be performed. In case of returning false, 
+     the node will not be expanded.
+   "
+   validateExpandabilityBlock := aOneArgBlock
+
+
 ! !
 
 !SelectionInTreeView methodsFor:'accessing-channels'!
@@ -1287,10 +1307,12 @@
     |node|
 
     (node := self selectedNode) notNil ifTrue:[
-        (     validateDoubleClickBlock isNil
-         or:[(validateDoubleClickBlock value:node) ~~ false]
-        ) ifTrue:[
-            self selectedNodeExpand:(node isExpandable).
+        (validateDoubleClickBlock isNil
+         or:[(validateDoubleClickBlock value:node) ~~ false]) ifTrue:[
+            (validateExpandabilityBlock isNil
+             or:[(validateExpandabilityBlock value:node) ~~ false]) ifTrue:[
+                self selectedNodeExpand:(node isExpandable).
+            ].
             super doubleClicked
         ]
     ]
@@ -2323,5 +2345,5 @@
 !SelectionInTreeView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInTreeView.st,v 1.73 1999-02-11 17:45:13 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInTreeView.st,v 1.74 1999-02-15 19:24:17 cg Exp $'
 ! !