inserted abstract ComboView class
authorClaus Gittinger <cg@exept.de>
Wed, 28 Feb 1996 15:25:23 +0100
changeset 130 5cad43b11fb5
parent 129 a680f0b7508f
child 131 ee1b6e7cdf75
inserted abstract ComboView class
ComboBoxV.st
ComboBoxView.st
--- a/ComboBoxV.st	Wed Feb 28 15:24:49 1996 +0100
+++ b/ComboBoxV.st	Wed Feb 28 15:25:23 1996 +0100
@@ -1,5 +1,5 @@
-View subclass:#ComboBoxView
-	instanceVariableNames:'enterField pullDownButton list'
+ComboView subclass:#ComboBoxView
+	instanceVariableNames:''
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Views-Interactors'
@@ -9,12 +9,12 @@
 
 documentation
 "
-    A comboBoxView combines an inputField with a list of default inputs;
+    A ComboBoxView combines an inputField with a drop down list of default inputs;
     choosing any from the pulled list presets the string in the field.
-    In contrast to a popUpList, the string can still be edited -
+
+    In contrast to a PopUpList or ComboListView, the string can still be edited -
     the list is actually only a set of values for the convenience of the user.
 
-    This is a first attempt in a comboBox implementation.
     Not yet finished.
 "
 !
@@ -83,101 +83,50 @@
 "
 ! !
 
-!ComboBoxView class methodsFor:'defaults'!
-
-buttonForm
-    |form|
-
-    form  := Form fromFile:'ComboDn_win.xbm'.
-    ^ form on:Display
-! !
-
 !ComboBoxView methodsFor:'accessing-components'!
 
 editor
     "return the inputField component"
 
-    ^ enterField
+    ^ field
 
     "Created: 9.2.1996 / 20:18:03 / cg"
-!
-
-menuButton
-    "return the menuButton component"
-
-    ^ pullDownButton
-
-    "Created: 9.2.1996 / 20:18:18 / cg"
-! !
-
-!ComboBoxView methodsFor:'accessing-contents'!
-
-list:aList
-    list := aList.
-    (list notNil and:[list notEmpty]) ifTrue:[
-        pullDownButton controller enable
-    ] ifFalse:[
-        pullDownButton controller disable
-    ].
-
-    "Created: 9.2.1996 / 00:51:25 / cg"
-    "Modified: 9.2.1996 / 00:51:56 / cg"
+    "Modified: 28.2.1996 / 15:10:50 / cg"
 ! !
 
 !ComboBoxView methodsFor:'accessing-mvc'!
 
 action:aBlock 
-    enterField action:aBlock
+    field action:aBlock
 
     "Created: 9.2.1996 / 01:44:20 / cg"
+    "Modified: 28.2.1996 / 15:10:55 / cg"
 !
 
 model
-    ^ enterField model
+    ^ field model
 
     "Created: 9.2.1996 / 00:50:18 / cg"
+    "Modified: 28.2.1996 / 15:10:59 / cg"
 !
 
 model:aModel
-    enterField model:aModel.
+    field model:aModel.
 
     "Created: 9.2.1996 / 00:50:12 / cg"
+    "Modified: 28.2.1996 / 15:11:03 / cg"
 ! !
 
 !ComboBoxView methodsFor:'initialization'!
 
-initialize
-    |ext|
-
-    super initialize.
-
-    enterField := EditField in:self.
-    enterField origin:0.0@0.0 corner:1.0@1.0.
-
-    enterField model:('' asValue).
-
-    pullDownButton := Toggle in:self.
-    pullDownButton label:(self class buttonForm).
-    pullDownButton showLamp:false.
-    pullDownButton activeLevel == pullDownButton passiveLevel ifTrue:[
-        pullDownButton activeLevel:0.
-    ].
-    ext := pullDownButton preferredExtent.
-    pullDownButton origin:1.0@0.0 corner:1.0@1.0.
-    pullDownButton leftInset:(ext x "+ (ViewSpacing//2)") negated.
-"/    pullDownButton rightInset:(ViewSpacing//2).
-
-    enterField rightInset:(ext x + (ViewSpacing//2)).
-
-    pullDownButton disable.
-    pullDownButton pressAction:[self pullMenu].
-
-    self height:enterField preferredExtent y + ViewSpacing.
+initializeField
+    field := EditField in:self.
+    field model:('' asValue).
 
     "
      all of my input goes to the enterfield
     "
-    self delegate:(KeyboardForwarder toView:enterField).
+    self delegate:(KeyboardForwarder toView:field).
 
     "
      |b|
@@ -187,82 +136,23 @@
      b open
     "
 
-    "Created: 9.2.1996 / 00:05:24 / cg"
     "Modified: 9.2.1996 / 20:06:08 / cg"
-! !
-
-!ComboBoxView methodsFor:'message delegation'!
-
-doesNotUnderstand:aMessage
-    (enterField respondsTo:aMessage selector) ifTrue:[
-        ^ aMessage sendTo:enterField
-    ].
-    ^ super doesNotUnderstand:aMessage
-
-    "Created: 9.2.1996 / 19:22:51 / cg"
-! !
-
-!ComboBoxView methodsFor:'queries'!
-
-preferredExtent
-    |pref1 pref2 m mPrefX|
-
-    list isNil ifTrue:[
-        mPrefX := 0
-    ] ifFalse:[
-        m := MenuView labels:list.
-        mPrefX := m preferredExtent x.
-    ].
-
-    pref1 := enterField preferredExtent.
-    pref2 := pullDownButton preferredExtent.
-    ^ ((pref1 x + pref2 x) max:mPrefX) @ (pref1 y max:pref2 y)
-
-    "Created: 9.2.1996 / 01:08:47 / cg"
-    "Modified: 9.2.1996 / 19:29:58 / cg"
+    "Created: 28.2.1996 / 15:07:51 / cg"
 ! !
 
 !ComboBoxView methodsFor:'user interaction'!
 
 entryChanged:what
-    enterField contents:what.
-    enterField accept.
+    field contents:what.
+    field accept.
     pullDownButton turnOff.
 
     "Created: 9.2.1996 / 01:06:01 / cg"
-    "Modified: 9.2.1996 / 01:42:38 / cg"
-!
-
-pullMenu
-    |m org|
-
-    (list notNil and:[list notEmpty]) ifTrue:[
-        m := PopUpMenu
-                    labels:list
-                    selectors:#entryChanged:
-                    args:list
-                    receiver:self.
-
-        m menuView resize.
-        m menuView width:(self width).
-        m menuView sizeFixed:true.
-        m hideOnRelease:false.
-
-        org := device translatePoint:(0 @ self height) 
-                                from:(self id)
-                                  to:(device rootView id).
-
-        m showAt:org.
-    ].
-
-    pullDownButton turnOff.
-
-    "Created: 9.2.1996 / 00:36:49 / cg"
-    "Modified: 9.2.1996 / 19:23:19 / cg"
+    "Modified: 28.2.1996 / 15:08:14 / cg"
 ! !
 
 !ComboBoxView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/Attic/ComboBoxV.st,v 1.4 1996-02-09 21:50:11 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/Attic/ComboBoxV.st,v 1.5 1996-02-28 14:25:23 cg Exp $'
 ! !
--- a/ComboBoxView.st	Wed Feb 28 15:24:49 1996 +0100
+++ b/ComboBoxView.st	Wed Feb 28 15:25:23 1996 +0100
@@ -1,5 +1,5 @@
-View subclass:#ComboBoxView
-	instanceVariableNames:'enterField pullDownButton list'
+ComboView subclass:#ComboBoxView
+	instanceVariableNames:''
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Views-Interactors'
@@ -9,12 +9,12 @@
 
 documentation
 "
-    A comboBoxView combines an inputField with a list of default inputs;
+    A ComboBoxView combines an inputField with a drop down list of default inputs;
     choosing any from the pulled list presets the string in the field.
-    In contrast to a popUpList, the string can still be edited -
+
+    In contrast to a PopUpList or ComboListView, the string can still be edited -
     the list is actually only a set of values for the convenience of the user.
 
-    This is a first attempt in a comboBox implementation.
     Not yet finished.
 "
 !
@@ -83,101 +83,50 @@
 "
 ! !
 
-!ComboBoxView class methodsFor:'defaults'!
-
-buttonForm
-    |form|
-
-    form  := Form fromFile:'ComboDn_win.xbm'.
-    ^ form on:Display
-! !
-
 !ComboBoxView methodsFor:'accessing-components'!
 
 editor
     "return the inputField component"
 
-    ^ enterField
+    ^ field
 
     "Created: 9.2.1996 / 20:18:03 / cg"
-!
-
-menuButton
-    "return the menuButton component"
-
-    ^ pullDownButton
-
-    "Created: 9.2.1996 / 20:18:18 / cg"
-! !
-
-!ComboBoxView methodsFor:'accessing-contents'!
-
-list:aList
-    list := aList.
-    (list notNil and:[list notEmpty]) ifTrue:[
-        pullDownButton controller enable
-    ] ifFalse:[
-        pullDownButton controller disable
-    ].
-
-    "Created: 9.2.1996 / 00:51:25 / cg"
-    "Modified: 9.2.1996 / 00:51:56 / cg"
+    "Modified: 28.2.1996 / 15:10:50 / cg"
 ! !
 
 !ComboBoxView methodsFor:'accessing-mvc'!
 
 action:aBlock 
-    enterField action:aBlock
+    field action:aBlock
 
     "Created: 9.2.1996 / 01:44:20 / cg"
+    "Modified: 28.2.1996 / 15:10:55 / cg"
 !
 
 model
-    ^ enterField model
+    ^ field model
 
     "Created: 9.2.1996 / 00:50:18 / cg"
+    "Modified: 28.2.1996 / 15:10:59 / cg"
 !
 
 model:aModel
-    enterField model:aModel.
+    field model:aModel.
 
     "Created: 9.2.1996 / 00:50:12 / cg"
+    "Modified: 28.2.1996 / 15:11:03 / cg"
 ! !
 
 !ComboBoxView methodsFor:'initialization'!
 
-initialize
-    |ext|
-
-    super initialize.
-
-    enterField := EditField in:self.
-    enterField origin:0.0@0.0 corner:1.0@1.0.
-
-    enterField model:('' asValue).
-
-    pullDownButton := Toggle in:self.
-    pullDownButton label:(self class buttonForm).
-    pullDownButton showLamp:false.
-    pullDownButton activeLevel == pullDownButton passiveLevel ifTrue:[
-        pullDownButton activeLevel:0.
-    ].
-    ext := pullDownButton preferredExtent.
-    pullDownButton origin:1.0@0.0 corner:1.0@1.0.
-    pullDownButton leftInset:(ext x "+ (ViewSpacing//2)") negated.
-"/    pullDownButton rightInset:(ViewSpacing//2).
-
-    enterField rightInset:(ext x + (ViewSpacing//2)).
-
-    pullDownButton disable.
-    pullDownButton pressAction:[self pullMenu].
-
-    self height:enterField preferredExtent y + ViewSpacing.
+initializeField
+    field := EditField in:self.
+    field model:('' asValue).
 
     "
      all of my input goes to the enterfield
     "
-    self delegate:(KeyboardForwarder toView:enterField).
+    self delegate:(KeyboardForwarder toView:field).
 
     "
      |b|
@@ -187,82 +136,23 @@
      b open
     "
 
-    "Created: 9.2.1996 / 00:05:24 / cg"
     "Modified: 9.2.1996 / 20:06:08 / cg"
-! !
-
-!ComboBoxView methodsFor:'message delegation'!
-
-doesNotUnderstand:aMessage
-    (enterField respondsTo:aMessage selector) ifTrue:[
-        ^ aMessage sendTo:enterField
-    ].
-    ^ super doesNotUnderstand:aMessage
-
-    "Created: 9.2.1996 / 19:22:51 / cg"
-! !
-
-!ComboBoxView methodsFor:'queries'!
-
-preferredExtent
-    |pref1 pref2 m mPrefX|
-
-    list isNil ifTrue:[
-        mPrefX := 0
-    ] ifFalse:[
-        m := MenuView labels:list.
-        mPrefX := m preferredExtent x.
-    ].
-
-    pref1 := enterField preferredExtent.
-    pref2 := pullDownButton preferredExtent.
-    ^ ((pref1 x + pref2 x) max:mPrefX) @ (pref1 y max:pref2 y)
-
-    "Created: 9.2.1996 / 01:08:47 / cg"
-    "Modified: 9.2.1996 / 19:29:58 / cg"
+    "Created: 28.2.1996 / 15:07:51 / cg"
 ! !
 
 !ComboBoxView methodsFor:'user interaction'!
 
 entryChanged:what
-    enterField contents:what.
-    enterField accept.
+    field contents:what.
+    field accept.
     pullDownButton turnOff.
 
     "Created: 9.2.1996 / 01:06:01 / cg"
-    "Modified: 9.2.1996 / 01:42:38 / cg"
-!
-
-pullMenu
-    |m org|
-
-    (list notNil and:[list notEmpty]) ifTrue:[
-        m := PopUpMenu
-                    labels:list
-                    selectors:#entryChanged:
-                    args:list
-                    receiver:self.
-
-        m menuView resize.
-        m menuView width:(self width).
-        m menuView sizeFixed:true.
-        m hideOnRelease:false.
-
-        org := device translatePoint:(0 @ self height) 
-                                from:(self id)
-                                  to:(device rootView id).
-
-        m showAt:org.
-    ].
-
-    pullDownButton turnOff.
-
-    "Created: 9.2.1996 / 00:36:49 / cg"
-    "Modified: 9.2.1996 / 19:23:19 / cg"
+    "Modified: 28.2.1996 / 15:08:14 / cg"
 ! !
 
 !ComboBoxView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/ComboBoxView.st,v 1.4 1996-02-09 21:50:11 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/ComboBoxView.st,v 1.5 1996-02-28 14:25:23 cg Exp $'
 ! !