forked from pharo-project/pharo
/
SpToolBarButtonPresenter.class.st
94 lines (74 loc) · 1.68 KB
/
SpToolBarButtonPresenter.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
"
A button with an icon and label associated with an action and a badge
"
Class {
#name : #SpToolBarButtonPresenter,
#superclass : #SpToolBarItemPresenter,
#instVars : [
'#label => SpObservableSlot',
'#icon => SpObservableSlot',
'#action',
'#badge'
],
#category : #'Spec2-Core-Widgets-Toolbar'
}
{ #category : #specs }
SpToolBarButtonPresenter class >> adapterName [
^ #ToolBarButtonAdapter
]
{ #category : #accessing }
SpToolBarButtonPresenter >> action [
^ action
]
{ #category : #accessing }
SpToolBarButtonPresenter >> action: anObject [
action := anObject
]
{ #category : #accessing }
SpToolBarButtonPresenter >> badge [
^ badge
]
{ #category : #accessing }
SpToolBarButtonPresenter >> badge: aString [
badge := aString
]
{ #category : #simulating }
SpToolBarButtonPresenter >> click [
self execute
]
{ #category : #execution }
SpToolBarButtonPresenter >> execute [
self action cull: self
]
{ #category : #testing }
SpToolBarButtonPresenter >> hasBadge [
^ badge notNil
]
{ #category : #accessing }
SpToolBarButtonPresenter >> icon [
^ icon
]
{ #category : #accessing }
SpToolBarButtonPresenter >> icon: anObject [
icon := anObject
]
{ #category : #initialization }
SpToolBarButtonPresenter >> initialize [
super initialize.
]
{ #category : #accessing }
SpToolBarButtonPresenter >> label [
^ label
]
{ #category : #accessing }
SpToolBarButtonPresenter >> label: anObject [
label := anObject
]
{ #category : #'api-events' }
SpToolBarButtonPresenter >> whenIconChangedDo: aBlock [
self property: #icon whenChangedDo: aBlock
]
{ #category : #'api-events' }
SpToolBarButtonPresenter >> whenLabelChangedDo: aBlock [
self property: #label whenChangedDo: aBlock
]