forked from pharo-project/pharo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SpStyleContainer.class.st
86 lines (65 loc) · 1.71 KB
/
SpStyleContainer.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
"
! Container properties (==SpStyleContainer==)
A container property can be applied to container elements (buttonbar, toolbar, actionbar), and define several properties:
- borderColor: The color of the border (in case borderWidth > 0).
- borderWidth: The width of the border.
- padding: The space between elements.
See *method:SpStyleContainer#borderColor*
!! Usage
The identifier of container in the stylesheet is ==Container==.
[[[
Container {
#borderColor: #blue,
#borderWidth: 2,
#padding: 5
}
]]]
"
Class {
#name : #SpStyleContainer,
#superclass : #SpStyleProperty,
#instVars : [
'borderWidth',
'padding',
'borderColor'
],
#category : #'Spec2-Adapters-Morphic-StyleSheet'
}
{ #category : #'ston-core' }
SpStyleContainer class >> stonName [
^ 'Container'
]
{ #category : #operations }
SpStyleContainer >> applyTo: aMorph [
self borderColor ifNotNil: [ :aColor | aMorph borderColor: aColor ].
self borderWidth ifNotNil: [ :aNumber | aMorph borderWidth: aNumber ].
self padding ifNotNil: [ :aNumber | aMorph cellInset: aNumber ]
]
{ #category : #accessing }
SpStyleContainer >> borderColor [
"This property can be expressed as
- a STON map: ==Color { #red : 1., #green : 0, #blue : 0, #alpha : 1 }==
- a named selector: ==#red==
- an hex string: =='FF0000'=="
^ borderColor
]
{ #category : #accessing }
SpStyleContainer >> borderColor: aColor [
borderColor := aColor
]
{ #category : #accessing }
SpStyleContainer >> borderWidth [
^ borderWidth
]
{ #category : #accessing }
SpStyleContainer >> borderWidth: aNumber [
borderWidth := aNumber
]
{ #category : #accessing }
SpStyleContainer >> padding [
^ padding
]
{ #category : #accessing }
SpStyleContainer >> padding: aNumber [
padding := aNumber
]