forked from pharo-project/pharo
/
SpMorphicSearchInputFieldAdapter.class.st
48 lines (41 loc) · 1.19 KB
/
SpMorphicSearchInputFieldAdapter.class.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Class {
#name : #SpMorphicSearchInputFieldAdapter,
#superclass : #SpMorphicTextInputFieldAdapter,
#category : #'Spec2-Adapters-Morphic-Base'
}
{ #category : #factory }
SpMorphicSearchInputFieldAdapter >> buildWidget [
| textMorph iconsContainer |
textMorph := super buildWidget.
iconsContainer := Morph new
extent: 12 @ 12;
color: Color transparent;
changeTableLayout;
listDirection: #topToBottom;
addMorph: (IconicButton new
target: self;
actionSelector: #clearText;
labelGraphic: (self iconNamed: #glamorousRemove);
color: Color transparent;
extent: 16 @ 8;
borderWidth: 0;
yourself);
yourself.
"With the layout frame I set next it, the arrows will be at the top right of the
text morph. We should be able to make it vertically centered but I don't know
how to do that with morphs. If someone knows, please do :)"
textMorph
changeProportionalLayout;
addMorph: iconsContainer
fullFrame: (LayoutFrame identity
bottomFraction: 0;
leftFraction: 1;
topOffset: 4;
leftOffset: -25;
yourself).
^ textMorph
]
{ #category : #'as yet unclassified' }
SpMorphicSearchInputFieldAdapter >> clearText [
self widgetDo: [ :w | w setTextWith: '' ]
]