-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathPyramidLibraryDefault.class.st
More file actions
105 lines (93 loc) · 3.4 KB
/
PyramidLibraryDefault.class.st
File metadata and controls
105 lines (93 loc) · 3.4 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
Class {
#name : #PyramidLibraryDefault,
#superclass : #Object,
#category : #'Pyramid-Bloc-plugin-navigation'
}
{ #category : #accessing }
PyramidLibraryDefault >> defaultCategory [
<pyramidLibraryCategory: 0>
^ { (PyramidLibraryCategory new
icon: (Smalltalk ui icons iconNamed: #box);
name: 'Default';
elements: {
(PyramidLibraryElement new
name: 'Simple element';
icon: (Smalltalk ui icons iconNamed: #blank);
block: [ {BlElement new background: Color random} ];
yourself).
(PyramidLibraryElement new
name: 'Text element';
icon: (Smalltalk ui icons iconNamed: #smallFonts);
block: [ {'Change me' asRopedText asElement} ];
yourself) };
yourself) }
]
{ #category : #accessing }
PyramidLibraryDefault >> pragmaCategory: aSymbol withIcon: anIcon [
| pragmas methods packages categories |
pragmas := Pragma allNamed: aSymbol.
methods := (pragmas collect: #method) asSet.
packages := (methods collect: #package) asSet.
categories := OrderedCollection new.
^ (packages collect: [ :package |
| elements |
elements := methods
select: [ :method | method package = package ]
thenCollect: [ :method |
PyramidLibraryElement new
icon: (Smalltalk ui icons iconNamed:
method methodClass systemIconName);
name: ('<1s> (<2s>)'
expandMacrosWith: method selector
with: method methodClass name);
block: [
(method methodClass soleInstance perform:
method selector) materializeAsBlElement ];
yourself ].
PyramidLibraryCategory new
name: (package ifNil: [ '(nil)' ] ifNotNil: [ :p | p name ]);
icon: anIcon;
elements: (elements sorted: [ :a :b | a name < b name ]);
yourself ]) sorted: [ :a :b | a name < b name ]
]
{ #category : #accessing }
PyramidLibraryDefault >> pystashCategory [
<pyramidLibraryCategory: 100>
^ PyramidLibraryDefault new
pragmaCategory: #pyStash
withIcon: (Smalltalk ui icons iconNamed: #smallSave)
]
{ #category : #accessing }
PyramidLibraryDefault >> pystonCategory [
<pyramidLibraryCategory: 101>
^ PyramidLibraryDefault new
pragmaCategory: #pySTON
withIcon: (Smalltalk ui icons iconNamed: #smallSave)
]
{ #category : #accessing }
PyramidLibraryDefault >> smalltalkIconsCategory [
<pyramidLibraryCategory: 10>
| elements |
elements := OrderedCollection new.
elements := Smalltalk ui icons icons associations collect: [ :each |
PyramidLibraryElement new
icon: each value;
name: each key;
block: [
{ (BlElement new
extent: each value extent;
background:
(BlImageBackground image:
(PyramidExternalRessourceProxy fromSource:
(PyramidExternalRessourceSource
target: Object
selector: #iconNamed:
arguments: { each key })));
yourself) } ];
yourself ].
^ { (PyramidLibraryCategory new
name: 'Smalltalk Icons';
icon: (Smalltalk ui icons iconNamed: #image);
elements: (elements sorted: [ :a :b | a name < b name ]);
yourself) }
]