/
Object.extension.st
142 lines (101 loc) · 3.03 KB
/
Object.extension.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
Extension { #name : #Object }
{ #category : #'*Morphic-Base' }
Object >> addModelYellowButtonMenuItemsTo: aCustomMenu forMorph: aMorph hand: aHandMorph [
"The receiver serves as the model for aMorph; a menu is being constructed for the morph, and here the receiver is able to add its own items"
Morph cmdGesturesEnabled ifTrue: [
aCustomMenu add: 'inspect model' target: self selector: #inspect.
].
^aCustomMenu
]
{ #category : #'*Morphic-Base' }
Object >> asAlphaImageMorph [
^ self asMorph
]
{ #category : #'*Morphic-Base' }
Object >> asDraggableMorph [
^ self asStringMorph
]
{ #category : #'*Morphic-Base' }
Object >> asMorph [
"Open a morph, as best one can, on the receiver"
^ self asStringMorph
"
234 asMorph.
(MenuIcons tinyMenuIcon) asMorph.
'fred' asMorph.
"
]
{ #category : #'*Morphic-Base' }
Object >> asStringMorph [
"Open a StringMorph, as best one can, on the receiver"
^ self asString asStringMorph
]
{ #category : #'*Morphic-Base' }
Object >> asTextMorph [
"Open a TextMorph, as best one can, on the receiver"
^ TextMorph new contentsAsIs: self asStringOrText
]
{ #category : #'*Morphic-Base' }
Object >> currentEvent [
"Answer the current Morphic event. This method never returns nil."
^ActiveEvent ifNil:[self currentHand lastEvent]
]
{ #category : #'*Morphic-Base' }
Object >> currentHand [
"Return a usable HandMorph -- the one associated with the object's current environment. This method will always return a hand, even if it has to conjure one up as a last resort. If a particular hand is actually handling events at the moment (such as a remote hand or a ghost hand), it will be returned."
^ self currentWorld primaryHand
]
{ #category : #'*Morphic-Base' }
Object >> defaultLabel [
"Answer the default label to be used in morphs."
^ self class name
]
{ #category : #'*Morphic-Base' }
Object >> dragPassengersFor: item inMorph: dragSource [
^ { item }
]
{ #category : #'*Morphic-Base' }
Object >> hasModelYellowButtonMenuItems [
^Morph cmdGesturesEnabled
]
{ #category : #'*Morphic-Base' }
Object >> iconOrThumbnailOfSize: aNumberOrPoint [
"Answer an appropiate form to represent the receiver"
^ nil
]
{ #category : #'*Morphic-Base' }
Object >> isTransferable [
^ false
]
{ #category : #'*Morphic-Base' }
Object >> taskbarIcon [
"Answer the icon for the receiver in a task bar
or nil for the default."
^self class taskbarIcon
]
{ #category : #'*Morphic-Base' }
Object class >> taskbarIcon [
"Answer the icon for an instance of the receiver in a task bar"
^self iconNamed: self taskbarIconName
]
{ #category : #'*Morphic-Base' }
Object class >> taskbarIconName [
"Answer the icon for an instance of the receiver in a task bar"
^#smallWindowIcon
]
{ #category : #'*Morphic-Base' }
Object >> transferFor: passenger from: aMorph [
^ TransferMorph withPassenger: passenger from: aMorph
]
{ #category : #'*Morphic-Base' }
Object >> treeNodeHead [
^ self
]
{ #category : #'*Morphic-Base' }
Object >> treeNodeTail [
^ nil
]
{ #category : #'*Morphic-Base' }
Object >> wantsVisualFeedback [
^ true
]