-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathPyramidBlocLayoutPlugin.class.st
More file actions
333 lines (291 loc) · 10.8 KB
/
PyramidBlocLayoutPlugin.class.st
File metadata and controls
333 lines (291 loc) · 10.8 KB
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
Class {
#name : #PyramidBlocLayoutPlugin,
#superclass : #Object,
#traits : 'TPyramidPlugin',
#classTraits : 'TPyramidPlugin classTrait',
#instVars : [
'propertiesManager'
],
#category : #'Pyramid-Bloc-plugin-bloc-layout'
}
{ #category : #accessing }
PyramidBlocLayoutPlugin class >> constraintsBasicH [
| property |
property := PyramidProperty new
name: 'Constraints - horizontal';
command:
PyramidBasicHorizontalConstraintsBlocCommand new;
inputPresenterClass:
PyramidBasicConstraintsInputPresenter;
yourself.
^ property
]
{ #category : #accessing }
PyramidBlocLayoutPlugin class >> constraintsBasicHExact [
| property |
property := PyramidProperty new
name: 'Constraints - width';
command:
PyramidBasicExactHorizontalConstraintsBlocCommand new;
inputPresenterClass: PyramidNumberInputPresenter;
yourself.
property inputPresenterModel help:
'Change the width of the object'.
^ property
]
{ #category : #accessing }
PyramidBlocLayoutPlugin class >> constraintsBasicV [
| property |
property := PyramidProperty new
name: 'Constraints - vertical';
command:
PyramidBasicVerticalConstraintsBlocCommand new;
inputPresenterClass:
PyramidBasicConstraintsInputPresenter;
yourself.
^ property
]
{ #category : #accessing }
PyramidBlocLayoutPlugin class >> constraintsBasicVExact [
| property |
property := PyramidProperty new
name: 'Constraints - height';
command:
PyramidBasicExactVerticalConstraintsBlocCommand new;
inputPresenterClass: PyramidNumberInputPresenter;
yourself.
property inputPresenterModel help:
'Change the height of the object'.
^ property
]
{ #category : #accessing }
PyramidBlocLayoutPlugin class >> constraintsFrameH [
| property |
property := PyramidProperty new
name: 'Constraints - Frame - horizontal';
command: PyramidFrameHorizontalConstraintsCommand new;
inputPresenterClass:
PyramidHorizontalFrameConstraintsInputPresenter;
yourself.
^ property
]
{ #category : #accessing }
PyramidBlocLayoutPlugin class >> constraintsFrameV [
| property |
property := PyramidProperty new
name: 'Constraints - Frame - vertical';
command: PyramidFrameVerticalConstraintsCommand new;
inputPresenterClass:
PyramidVerticalFrameConstraintsInputPresenter;
yourself.
^ property
]
{ #category : #accessing }
PyramidBlocLayoutPlugin class >> constraintsPropH [
| property |
property := PyramidProperty new
name: 'Constraints - horizontal';
command:
PyramidProportionalHorizontalConstraintsCommand new;
inputPresenterClass: PyramidPointInputPresenter;
yourself.
property inputPresenterModel
help: 'Define the proportion of the horizontal component.';
labelX: 'Left';
labelY: 'Right'.
^ property
]
{ #category : #accessing }
PyramidBlocLayoutPlugin class >> constraintsPropV [
| property |
property := PyramidProperty new
name: 'Constraints - vertical';
command:
PyramidProportionalVerticalConstraintsCommand new;
inputPresenterClass: PyramidPointInputPresenter;
yourself.
property inputPresenterModel
help: 'Define the proportion of the vertical component.';
labelX: 'Top';
labelY: 'Bottom'.
^ property
]
{ #category : #accessing }
PyramidBlocLayoutPlugin class >> constraintsWeight [
| property |
property := PyramidProperty new
name: 'Constraints - weight';
command: PyramidWeightConstraintsCommand new;
inputPresenterClass: PyramidNumberInputPresenter;
yourself.
property inputPresenterModel help:
'Define the weight of the element to compute its size. The constraints must be "matchParent" to have an effect.'.
^ property
]
{ #category : #accessing }
PyramidBlocLayoutPlugin class >> flowLayoutOrientation [
| property |
property := PyramidProperty new
name: 'Flow - Orientation';
command:
PyramidLayoutChangeOrientationForFlowCommand new;
inputPresenterClass:
PyramidFlowLayoutOrientationPresenter;
yourself.
property inputPresenterModel help:
'Change the orientation of the flow layout.'.
property inputPresenterModel onLabel: 'Vertical'.
property inputPresenterModel offLabel: 'Horizontal'.
property inputPresenterModel uncertainLabel: 'Uncertain'.
^ property
]
{ #category : #accessing }
PyramidBlocLayoutPlugin class >> layout [
| property |
property := PyramidProperty new
name: 'Layout Type';
command: PyramidLayoutBlocCommand new;
inputPresenterClass: PyramidMagicButtonsInputPresenter;
yourself.
property inputPresenterModel
addButtonModel: (PyramidMagicButtonModel new
icon: (Smalltalk ui icons iconNamed: #radioButtonUnselected);
helpSelected: 'The element have no layout.';
helpNotSelected: 'No layout.';
label: 'Basic';
inputValue: BlBasicLayout new;
inputValidation: [ :value | value class = BlBasicLayout ];
yourself);
addButtonModel: (PyramidMagicButtonModel new
icon: (Smalltalk ui icons iconNamed: #smallLeftFlush);
helpSelected: 'The layout is linear.';
helpNotSelected: 'Set the layout to linear.';
label: 'Linear';
inputValue: [ BlLinearLayout vertical ];
inputValidation: [ :value | value class = BlLinearLayout ];
yourself);
addButtonModel: (PyramidMagicButtonModel new
icon: (Smalltalk ui icons iconNamed: #smallJustified);
helpSelected: 'The layout is flow.';
helpNotSelected: 'Set the layout to flow.';
label: 'Flow';
inputValue: [ BlFlowLayout vertical ];
inputValidation: [ :value | value class = BlFlowLayout ];
yourself);
addButtonModel: (PyramidMagicButtonModel new
icon: (Smalltalk ui icons iconNamed: #windowMaximize);
helpSelected: 'The layout is frame.';
helpNotSelected: 'Set the layout to frame.';
label: 'Frame';
inputValue: [ BlFrameLayout new ];
inputValidation: [ :value | value class = BlFrameLayout ];
yourself);
addButtonModel: (PyramidMagicButtonModel new
icon: (Smalltalk ui icons iconNamed: #haloScale);
helpSelected: 'The layout is proportional.';
helpNotSelected: 'Set the layout to proportional.';
label: 'Prop';
inputValue: [ BlProportionalLayout new ];
inputValidation: [ :value | value class = BlProportionalLayout ];
yourself).
^ property
]
{ #category : #accessing }
PyramidBlocLayoutPlugin class >> linearLayoutOrientation [
| property |
property := PyramidProperty new
name: 'Linear - Orientation';
command:
PyramidLayoutChangeOrientationForLinearCommand new;
inputPresenterClass:
PyramidLinearLayoutOrientationPresenter;
yourself.
property inputPresenterModel help:
'Change the orientation of the linear layout.'.
property inputPresenterModel onLabel: 'Vertical'.
property inputPresenterModel offLabel: 'Horizontal'.
property inputPresenterModel uncertainLabel: 'Uncertain'.
^ property
]
{ #category : #accessing }
PyramidBlocLayoutPlugin class >> margin [
| property |
property := PyramidProperty new
name: 'Margin';
command: PyramidMarginCommand new;
inputPresenterClass: PyramidInsetsInputPresenter;
yourself.
property inputPresenterModel help: 'Change the margin. The margin will affect the space between the border and the elements outside. For example:
- "10" to set a margin of 10 px on each size.
- "10 20" to set a margin of 10 px on the top and bottom and 20 px on the right and left.
- "10 20 30 40" to set a margin of 10 px on top, 20 px on left, 30 px on bottom and 40 px on right.'..
^ property
]
{ #category : #accessing }
PyramidBlocLayoutPlugin class >> padding [
| property |
property := PyramidProperty new
name: 'Padding';
command: PyramidPaddingCommand new;
inputPresenterClass: PyramidInsetsInputPresenter;
yourself.
property inputPresenterModel help:
'Change the padding. The padding will affect the space between the border and the elements inside. For example:
- "10" to set a padding of 10 px on each size.
- "10 20" to set a padding of 10 px on the top and bottom and 20 px on the right and left.
- "10 20 30 40" to set a padding of 10 px on top, 20 px on left, 30 px on bottom and 40 px on right.'.
^ property
]
{ #category : #accessing }
PyramidBlocLayoutPlugin class >> position [
| property |
property := PyramidProperty new
name: 'Position';
command: PyramidPositionCommand new;
inputPresenterClass: PyramidPointInputPresenter;
yourself.
property inputPresenterModel help:
'Set the position x and y of the element inside his parent.'.
^ property
]
{ #category : #adding }
PyramidBlocLayoutPlugin >> addPanelsOn: aPyramidSimpleWindow [
aPyramidSimpleWindow at: #tabRight addItem: [ :builder |
builder
makeTab: self propertiesManager mainPresenter
label: 'Layout'
icon: (Smalltalk ui icons iconNamed: #box)
order: 3 ]
]
{ #category : #connecting }
PyramidBlocLayoutPlugin >> connectOn: aPyramidEditor [
propertiesManager projectModel: aPyramidEditor projectModel.
propertiesManager commandExecutor:
aPyramidEditor commandExecutor
]
{ #category : #initialization }
PyramidBlocLayoutPlugin >> initialize [
propertiesManager := PyramidPropertiesManagerForSelection new.
"Position | Margin | Padding"
propertiesManager addProperty: self class position.
propertiesManager addProperty: self class padding.
propertiesManager addProperty: self class margin.
propertiesManager addProperty: self class layout.
propertiesManager addProperty: self class flowLayoutOrientation.
propertiesManager addProperty: self class linearLayoutOrientation.
propertiesManager addProperty: self class constraintsWeight.
"Constraints - horizontal"
propertiesManager addProperty: self class constraintsFrameH.
propertiesManager addProperty: self class constraintsPropH.
propertiesManager addProperty: self class constraintsBasicH.
propertiesManager addProperty: self class constraintsBasicHExact.
"Constraints - vertical"
propertiesManager addProperty: self class constraintsFrameV.
propertiesManager addProperty: self class constraintsPropV.
propertiesManager addProperty: self class constraintsBasicV.
propertiesManager addProperty: self class constraintsBasicVExact
]
{ #category : #adding }
PyramidBlocLayoutPlugin >> propertiesManager [
^ propertiesManager
]