SmallSense__CompletionView.st
changeset 108 71471dc81e77
child 178 f98d96568600
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmallSense__CompletionView.st	Fri Sep 27 22:39:18 2013 +0100
@@ -0,0 +1,85 @@
+"{ Package: 'jv:smallsense' }"
+
+"{ NameSpace: SmallSense }"
+
+SimpleView subclass:#CompletionView
+	instanceVariableNames:'list listHolder listView selectionHolder'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'SmallSense-Core-Interface'
+!
+
+!CompletionView methodsFor:'accessing'!
+
+font: aFont
+    super font: aFont.
+    listView font: aFont.
+
+    "Created: / 27-09-2013 / 14:03:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+list
+    ^ list
+!
+
+list: aCollection
+    list :=  aCollection.
+    listHolder value: aCollection.
+
+    "Created: / 27-09-2013 / 14:02:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+selection
+    ^ (listView value at: selectionHolder value).
+
+    "Created: / 27-09-2013 / 15:41:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+selection: po
+    selectionHolder value: (listHolder value identityIndexOf: po)
+
+    "Created: / 27-09-2013 / 16:09:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!CompletionView methodsFor:'event handling'!
+
+keyPress:key x:x y:y
+    ^ listView keyPress:key x:x y:y
+
+    "Created: / 27-09-2013 / 14:05:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!CompletionView methodsFor:'initialization & release'!
+
+initialize
+    | listViewScroller |
+
+    super initialize.
+    listHolder := ValueHolder new.
+    selectionHolder := ValueHolder new.
+    listViewScroller := ScrollableView for: SelectionInListModelView.
+    self addSubView: listViewScroller.
+    listViewScroller origin: 0.0 @ 0.0 corner: 1.0 @ 1.0.
+    listView := listViewScroller scrolledView.
+    listView listHolder: listHolder.
+    listView model: selectionHolder.
+    listView highlightMode: #line.
+    self extent: 400 @ 250
+
+    "Created: / 27-09-2013 / 13:56:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!CompletionView methodsFor:'queries'!
+
+hasSelection
+    ^listView hasSelection
+
+    "Created: / 27-09-2013 / 14:10:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+isPopUpView
+    ^ true
+
+    "Created: / 27-09-2013 / 13:56:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+