Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Latest commit

 

History

History
118 lines (88 loc) · 4.3 KB

README.md

File metadata and controls

118 lines (88 loc) · 4.3 KB

Spec-Brick

License Tests

Brick backend for Spec.

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

Supported Features

⚠️ This backend still covers a very small part of Spec: partial coverage of a few widgets. To see the current state, you can check the Example subsection below, the SUnit tests, and the hierarchy of 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

Example

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:

Installation

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.

CI status including dependencies

Project Badge
Sparta Sparta CI
Alexandrie Tests
Bloc Bloc CI
BlocPac BlocPac CI
Brick Brick CI
Spec-Brick Spec-Brick CI

License

This code is licensed under the MIT license.