Brick is a widget library on top of Bloc.
Spec is a Pharo library for describing user interfaces. You describe a UI by composing the "presenters" and by connecting them via block closures.
More concretely, a Spec UI is a tree of SpPresenter
, that is opened in the context of an application (SpApplication
) that, among others, indicates what is the backend.
Our backend (SpBrickBackend
) provides the adapters (hierarchy of SpBrickAdapter
) to make the Brick
widgets to act as the tree of presenters describe.
Other Spec backends are:
- Morphic (the default)
- GTK
SpBrickAdapter
.
:warning:
This is supported:
- Widgets:
- Label
- Button
- icon + text
- enabled/disabled
- Tool bar
- Menu bar
- Text and Text input
- enabled/disabled
- Drop list (ugly transition open/closed)
- List and Table
- icon + text
- enabled/disabled
- columns
- header
- selection action (single-click)
- strong-selection action (double-click and enter key)
- context menu (not recursive)
- Window and Dialog
- Layouts
- Box
- Horizontal or vertical
- Margin (borderWidth)
- spacing:
- borderWidth:
- For each child:
- padding
- expand
- Paned: similar to box
- Box
This repository has a demo Spec UI that you can open with the default backend (Morphic) using this snippet:
| aModel aPresenter |
aModel := SpToDoList exampleWithSomeTasks.
aPresenter := SpToDoListPresenter on: aModel.
aPresenter openWithSpec.
To open it using this Brick backend, specify the backend in an application:
| app aModel aPresenter |
app := SpApplication new
useBackend: #Brick;
yourself.
aModel := SpToDoList exampleWithSomeTasks.
aPresenter := SpToDoListPresenter newApplication: app model: aModel.
aPresenter openWithSpec.
Videos:
- https://youtu.be/nYZS3zqdCQM (June/2021 ~ commit 50dfb5f)
- https://youtu.be/DGqeRnspGas (June/2021 ~ commit 89b6cbe)
Evaluate the following script on Pharo 9 or 10:
Metacello new
baseline: 'SpecBrick';
repository: 'github://pharo-graphics/Spec-Brick/src';
onConflictUseIncoming;
load
Alternatively, you can do it by terminal (MacOS, linux... and should work as well in Windows with MINGW64).
Create a directory and execute <this_repo>/scripts/build.sh
, which first downloads the Pharo image and VM and then loads the project.
Project | Badge |
---|---|
Sparta | |
Alexandrie | |
Bloc | |
BlocPac | |
Brick | |
Spec-Brick |
This code is licensed under the MIT license.