/
SpecDialogWindow.class.st
103 lines (77 loc) · 2.11 KB
/
SpecDialogWindow.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
95
96
97
98
99
100
101
102
103
"
A SpecDialogWindow is a window made for embedding Spec models into dialog windows
"
Class {
#name : #SpecDialogWindow,
#superclass : #DialogWindow,
#instVars : [
'toolbar'
],
#category : #'Spec-MorphicAdapters-Support'
}
{ #category : #actions }
SpecDialogWindow >> addInitialPanel [
"Do nothing here because Spec will take care of adding the content"
]
{ #category : #protocol }
SpecDialogWindow >> cancelAction: aBlock [
self toolbar cancelAction: aBlock
]
{ #category : #protocol }
SpecDialogWindow >> cancelled [
^ self toolbar cancelled
]
{ #category : #actions }
SpecDialogWindow >> escapePressed [
self model triggerCancelAction
]
{ #category : #focus }
SpecDialogWindow >> giveFocusToNextFrom: aModel [
^ self model giveFocusToNextFrom: aModel
]
{ #category : #focus }
SpecDialogWindow >> giveFocusToPreviousFrom: aModel [
^ self model giveFocusToPreviousFrom: aModel
]
{ #category : #'open/close' }
SpecDialogWindow >> initialExtent [
^ self model
ifNil: [ super initialExtent ]
ifNotNil: [:m | m initialExtent
ifNil: [ super initialExtent ]]
]
{ #category : #initialization }
SpecDialogWindow >> initialize [
super initialize.
self beResizeable
]
{ #category : #accessing }
SpecDialogWindow >> newButtonRow [
^ self toolbar ifNotNil: [ : t | t buildWithSpec ]
]
{ #category : #protocol }
SpecDialogWindow >> okAction: aBlock [
self toolbar okAction: aBlock
]
{ #category : #protocol }
SpecDialogWindow >> setToolbarFrom: aBlock [
| newToolbar |
newToolbar := aBlock value.
newToolbar owner: self.
self toolbar: newToolbar.
self model presenter focusOrder addLast: toolbar.
toolbar focusOrder addLast: self model
]
{ #category : #accessing }
SpecDialogWindow >> toolbar [
"Lazy initialization because this method is called efore the initialize method"
^ toolbar
]
{ #category : #accessing }
SpecDialogWindow >> toolbar: anObject [
| content |
toolbar := anObject.
anObject owner: self.
self removeMorph: (content := self submorphs last).
self addMorph: (self newDialogPanel addMorphBack: content; addMorphBack: self newButtonRow; yourself) frame: (0 @ 0 corner: 1 @ 1)
]