forked from pharo-project/pharo
/
SpHelpTopics.class.st
87 lines (67 loc) · 2.76 KB
/
SpHelpTopics.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
"
A SpecHelpTopics is the main class which holds the documentation of Spec. This documentation can be accessed from the Help Browser.
See class side for selectors.
"
Class {
#name : #SpHelpTopics,
#superclass : #CustomHelp,
#category : #'Spec2-Help-Topics'
}
{ #category : #accessing }
SpHelpTopics class >> bookName [
^ 'Spec'
]
{ #category : #pages }
SpHelpTopics class >> hookingWithTheInspector [
^HelpTopic
title: 'Inspector'
contents: 'Pharo offers a Spec-based inspector. Inspecting an object opens an inspector that is built using Spec.
You can particularize the inspector in numerous way. For example, consider the following code:
```
OrderedCollection>>inspectorText
<inspectorPresentationOrder: 90 title: ''My description''>
^ SpTextPresenter new
text: ''OrderedCollection of size = '', self size asString;
yourself.
```
After having defined this method, inspecting the expression `#(1 2 3 5) asOrderedCollection` shows the inspector with a new textual pane.
A Roassal view can also be hooked, as follow:
```
OrderedCollection>>inspectorCanvas2
<inspectorPresentationOrder: 90 title: ''Visualization''>
| canvas shapes |
canvas := RSCanvas new.
shapes := (self collect: [ :obj | RSBox new model: obj; size: 20 ]) asGroup.
canvas addAll: shapes.
RSGridLayout on: shapes.
^ SpRoassal3InspectorPresenter new
canvas: canvas;
yourself
```
'
]
{ #category : #pages }
SpHelpTopics class >> introduction [
^HelpTopic
title: 'About Spec'
contents: 'Spec has been originally developed by B. Van Ryseghem based on an idea of S. Ducasse. It is now maintained by the community and the pharo core team.
Spec is an attempt to support UI logic reuse. Spec is influenced by VisualWorks and Dolphin MVP in the sense that it recognizes the need for a Presenter or Application-Model class, in Spec called SpPresenter that manages the logic and the link between widgets and domain objects. Spec, following the tradition, uses value holders, simple object raising announcements when their values, often domain objects, change.'
]
{ #category : #accessing }
SpHelpTopics class >> key [
^'Spec'
]
{ #category : #accessing }
SpHelpTopics class >> pages [
^#(introduction terminology #SpExamples #SpTheHeartOfSpec #SpLayouts #hookingWithTheInspector)
]
{ #category : #pages }
SpHelpTopics class >> terminology [
^HelpTopic
title: 'Terminology'
contents: 'To avoid possible misunderstandings due to confusion in terminology, we first define the following four terms, which will be used frequently:
UI Element: an interactive graphical element displayed as part of the graphical user interface.
UI Model: an object that contains the state and behavior of one or several UI elements.
Widget: the union of a UI Element and its UI model.
Basic Widgets: low level widgets like'
]