whirled_peas 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -1
- data/README.md +315 -43
- data/Rakefile +8 -18
- data/lib/whirled_peas/graphics.rb +14 -0
- data/lib/whirled_peas/graphics/box_painter.rb +39 -46
- data/lib/whirled_peas/graphics/canvas.rb +22 -11
- data/lib/whirled_peas/graphics/container_coords.rb +6 -5
- data/lib/whirled_peas/graphics/container_dimensions.rb +26 -8
- data/lib/whirled_peas/graphics/container_painter.rb +42 -4
- data/lib/whirled_peas/graphics/grid_painter.rb +11 -10
- data/lib/whirled_peas/graphics/painter.rb +5 -1
- data/lib/whirled_peas/graphics/renderer.rb +6 -1
- data/lib/whirled_peas/graphics/text_painter.rb +2 -2
- data/lib/whirled_peas/settings/alignment.rb +24 -0
- data/lib/whirled_peas/settings/bg_color.rb +2 -0
- data/lib/whirled_peas/settings/border.rb +16 -16
- data/lib/whirled_peas/settings/color.rb +13 -14
- data/lib/whirled_peas/settings/container_settings.rb +126 -42
- data/lib/whirled_peas/settings/display_flow.rb +13 -11
- data/lib/whirled_peas/settings/element_settings.rb +3 -3
- data/lib/whirled_peas/settings/grid_settings.rb +5 -1
- data/lib/whirled_peas/settings/sizing.rb +19 -0
- data/lib/whirled_peas/settings/spacing.rb +34 -0
- data/lib/whirled_peas/settings/text_color.rb +2 -0
- data/lib/whirled_peas/settings/vert_alignment.rb +24 -0
- data/lib/whirled_peas/utils/title_font.rb +1 -1
- data/lib/whirled_peas/version.rb +1 -1
- data/screen_test/{rendered/elements → elements}/box.frame +1 -1
- data/screen_test/{rendered/elements → elements}/box.rb +0 -0
- data/screen_test/elements/grid.frame +1 -0
- data/screen_test/{rendered/elements → elements}/grid.rb +0 -0
- data/screen_test/elements/screen_overflow_x.frame +1 -0
- data/screen_test/{rendered/elements/screen_overflow.rb → elements/screen_overflow_x.rb} +0 -0
- data/screen_test/elements/screen_overflow_y.frame +1 -0
- data/screen_test/elements/screen_overflow_y.rb +9 -0
- data/screen_test/elements/text.frame +1 -0
- data/screen_test/{rendered/elements → elements}/text.rb +0 -0
- data/screen_test/elements/text_multiline.frame +1 -0
- data/screen_test/{rendered/elements → elements}/text_multiline.rb +0 -0
- data/screen_test/settings/align/box_around.frame +1 -0
- data/screen_test/settings/align/box_around.rb +16 -0
- data/screen_test/settings/align/box_between.frame +1 -0
- data/screen_test/settings/align/box_between.rb +16 -0
- data/screen_test/settings/align/box_center.frame +1 -0
- data/screen_test/{rendered/settings/align/grid.rb → settings/align/box_center.rb} +7 -6
- data/screen_test/settings/align/box_default.frame +1 -0
- data/screen_test/settings/align/box_default.rb +20 -0
- data/screen_test/settings/align/box_evenly.frame +1 -0
- data/screen_test/settings/align/box_evenly.rb +16 -0
- data/screen_test/settings/align/box_left.frame +1 -0
- data/screen_test/settings/align/box_left.rb +21 -0
- data/screen_test/settings/align/box_right.frame +1 -0
- data/screen_test/settings/align/box_right.rb +21 -0
- data/screen_test/settings/align/children_center.frame +1 -0
- data/screen_test/settings/align/children_center.rb +15 -0
- data/screen_test/settings/align/children_left.frame +1 -0
- data/screen_test/settings/align/children_left.rb +15 -0
- data/screen_test/settings/align/children_right.frame +1 -0
- data/screen_test/settings/align/children_right.rb +15 -0
- data/screen_test/settings/align/grid_center.frame +1 -0
- data/screen_test/settings/align/grid_center.rb +18 -0
- data/screen_test/settings/align/grid_default.frame +1 -0
- data/screen_test/settings/align/grid_default.rb +17 -0
- data/screen_test/settings/align/grid_left.frame +1 -0
- data/screen_test/settings/align/grid_left.rb +18 -0
- data/screen_test/settings/align/grid_right.frame +1 -0
- data/screen_test/settings/align/grid_right.rb +18 -0
- data/screen_test/settings/ansi/bold.frame +1 -0
- data/screen_test/{rendered/settings/height/overflow_box_t2b.rb → settings/ansi/bold.rb} +4 -4
- data/screen_test/{rendered/settings → settings}/ansi/color.frame +1 -1
- data/screen_test/{rendered/settings → settings}/ansi/color.rb +0 -0
- data/screen_test/settings/ansi/underline.frame +1 -0
- data/screen_test/{rendered/settings → settings}/ansi/underline.rb +4 -5
- data/screen_test/{rendered/settings → settings}/border.frame +1 -1
- data/screen_test/{rendered/settings → settings}/border.rb +1 -1
- data/screen_test/settings/flow/box_b2t.frame +1 -0
- data/screen_test/settings/flow/box_b2t.rb +26 -0
- data/screen_test/settings/flow/box_l2r.frame +1 -0
- data/screen_test/settings/flow/box_l2r.rb +26 -0
- data/screen_test/settings/flow/box_r2l.frame +1 -0
- data/screen_test/settings/flow/box_r2l.rb +26 -0
- data/screen_test/settings/flow/box_t2b.frame +1 -0
- data/screen_test/settings/flow/box_t2b.rb +26 -0
- data/screen_test/settings/flow/grid_b2t.frame +1 -0
- data/screen_test/{rendered/settings → settings}/flow/grid_b2t.rb +0 -0
- data/screen_test/settings/flow/grid_l2r.frame +1 -0
- data/screen_test/{rendered/settings → settings}/flow/grid_l2r.rb +0 -0
- data/screen_test/settings/flow/grid_r2l.frame +1 -0
- data/screen_test/{rendered/settings → settings}/flow/grid_r2l.rb +0 -0
- data/screen_test/settings/flow/grid_t2b.frame +1 -0
- data/screen_test/{rendered/settings → settings}/flow/grid_t2b.rb +0 -0
- data/screen_test/settings/height/box.frame +1 -0
- data/screen_test/{rendered/settings → settings}/height/box.rb +0 -0
- data/screen_test/settings/height/box_border_sizing.frame +1 -0
- data/screen_test/settings/height/box_border_sizing.rb +15 -0
- data/screen_test/settings/height/grid.frame +1 -0
- data/screen_test/{rendered/settings → settings}/height/grid.rb +0 -0
- data/screen_test/settings/height/overflow_box.frame +1 -0
- data/screen_test/settings/height/overflow_box.rb +13 -0
- data/screen_test/settings/height/overflow_box_l2r.frame +1 -0
- data/screen_test/settings/height/overflow_box_l2r.rb +17 -0
- data/screen_test/settings/height/overflow_box_t2b.frame +1 -0
- data/screen_test/settings/height/overflow_box_t2b.rb +16 -0
- data/screen_test/settings/height/overflow_grid.frame +1 -0
- data/screen_test/{rendered/settings → settings}/height/overflow_grid.rb +0 -0
- data/screen_test/settings/margin.frame +1 -0
- data/screen_test/settings/margin.rb +16 -0
- data/screen_test/settings/padding.frame +1 -0
- data/screen_test/settings/padding.rb +13 -0
- data/screen_test/settings/position/box_left.frame +1 -0
- data/screen_test/{rendered/settings → settings}/position/box_left.rb +2 -2
- data/screen_test/settings/position/box_left_negative.frame +1 -0
- data/screen_test/{rendered/settings → settings}/position/box_left_negative.rb +2 -2
- data/screen_test/settings/position/box_top.frame +1 -0
- data/screen_test/{rendered/settings → settings}/position/box_top.rb +1 -1
- data/screen_test/settings/position/box_top_negative.frame +1 -0
- data/screen_test/{rendered/settings → settings}/position/box_top_negative.rb +2 -2
- data/screen_test/settings/position/grid_left.frame +1 -0
- data/screen_test/{rendered/settings → settings}/position/grid_left.rb +1 -1
- data/screen_test/settings/position/grid_left_negative.frame +1 -0
- data/screen_test/{rendered/settings → settings}/position/grid_left_negative.rb +1 -1
- data/screen_test/settings/position/grid_top.frame +1 -0
- data/screen_test/{rendered/settings → settings}/position/grid_top.rb +1 -1
- data/screen_test/settings/position/grid_top_negative.frame +1 -0
- data/screen_test/{rendered/settings → settings}/position/grid_top_negative.rb +1 -1
- data/screen_test/settings/scroll/horiz_box.frame +1 -0
- data/screen_test/settings/scroll/horiz_box.rb +17 -0
- data/screen_test/settings/scroll/horiz_box_align_center.rb +18 -0
- data/screen_test/settings/scroll/horiz_box_align_right.rb +18 -0
- data/screen_test/settings/scroll/vert_box.frame +1 -0
- data/screen_test/settings/scroll/vert_box.rb +20 -0
- data/screen_test/settings/title_font.frame +1 -0
- data/screen_test/{rendered/settings → settings}/title_font.rb +1 -1
- data/screen_test/settings/valign/box_around.frame +1 -0
- data/screen_test/settings/valign/box_around.rb +17 -0
- data/screen_test/settings/valign/box_between.frame +1 -0
- data/screen_test/settings/valign/box_between.rb +17 -0
- data/screen_test/settings/valign/box_bottom.frame +1 -0
- data/screen_test/settings/valign/box_bottom.rb +17 -0
- data/screen_test/settings/valign/box_default.frame +1 -0
- data/screen_test/settings/valign/box_default.rb +16 -0
- data/screen_test/settings/valign/box_evenly.frame +1 -0
- data/screen_test/settings/valign/box_evenly.rb +17 -0
- data/screen_test/settings/valign/box_middle.frame +1 -0
- data/screen_test/settings/valign/box_middle.rb +17 -0
- data/screen_test/settings/valign/box_top.frame +1 -0
- data/screen_test/settings/valign/box_top.rb +17 -0
- data/screen_test/settings/valign/grid_bottom.frame +1 -0
- data/screen_test/settings/valign/grid_bottom.rb +15 -0
- data/screen_test/settings/valign/grid_default.frame +1 -0
- data/screen_test/settings/valign/grid_default.rb +14 -0
- data/screen_test/settings/valign/grid_middle.frame +1 -0
- data/screen_test/settings/valign/grid_middle.rb +15 -0
- data/screen_test/settings/valign/grid_top.frame +1 -0
- data/screen_test/settings/valign/grid_top.rb +15 -0
- data/screen_test/settings/width/box_border_sizing.frame +1 -0
- data/screen_test/settings/width/box_border_sizing.rb +15 -0
- data/screen_test/settings/width/box_content.frame +1 -0
- data/screen_test/settings/width/box_content.rb +15 -0
- data/screen_test/settings/width/box_default.frame +1 -0
- data/screen_test/{rendered/settings/width/box.rb → settings/width/box_default.rb} +3 -2
- data/screen_test/settings/width/grid.frame +1 -0
- data/screen_test/{rendered/settings → settings}/width/grid.rb +2 -2
- data/screen_test/settings/width/overflow_align_center.frame +1 -0
- data/screen_test/settings/width/overflow_align_center.rb +14 -0
- data/screen_test/settings/width/overflow_align_right.frame +1 -0
- data/screen_test/settings/width/overflow_align_right.rb +14 -0
- data/screen_test/settings/width/overflow_box.frame +1 -0
- data/screen_test/settings/width/overflow_box.rb +13 -0
- data/screen_test/settings/width/overflow_box_l2r.frame +1 -0
- data/screen_test/settings/width/overflow_box_l2r.rb +16 -0
- data/screen_test/settings/width/overflow_box_t2b.frame +1 -0
- data/screen_test/settings/width/overflow_box_t2b.rb +17 -0
- data/screen_test/settings/width/overflow_grid.frame +1 -0
- data/screen_test/{rendered/settings → settings}/width/overflow_grid.rb +0 -0
- data/tools/whirled_peas/tools/screen_tester.rb +233 -0
- metadata +154 -98
- data/lib/whirled_peas/settings/text_align.rb +0 -19
- data/screen_test/rendered/elements/grid.frame +0 -1
- data/screen_test/rendered/elements/screen_overflow.frame +0 -1
- data/screen_test/rendered/elements/text.frame +0 -1
- data/screen_test/rendered/elements/text_multiline.frame +0 -1
- data/screen_test/rendered/settings/align/box.frame +0 -1
- data/screen_test/rendered/settings/align/box.rb +0 -24
- data/screen_test/rendered/settings/align/children_center.frame +0 -1
- data/screen_test/rendered/settings/align/children_center.rb +0 -13
- data/screen_test/rendered/settings/align/children_left.frame +0 -1
- data/screen_test/rendered/settings/align/children_left.rb +0 -13
- data/screen_test/rendered/settings/align/children_right.frame +0 -1
- data/screen_test/rendered/settings/align/children_right.rb +0 -13
- data/screen_test/rendered/settings/align/grid.frame +0 -1
- data/screen_test/rendered/settings/ansi/bold.frame +0 -1
- data/screen_test/rendered/settings/ansi/bold.rb +0 -15
- data/screen_test/rendered/settings/ansi/underline.frame +0 -1
- data/screen_test/rendered/settings/flow/box_b2t.frame +0 -1
- data/screen_test/rendered/settings/flow/box_b2t.rb +0 -24
- data/screen_test/rendered/settings/flow/box_l2r.frame +0 -1
- data/screen_test/rendered/settings/flow/box_l2r.rb +0 -24
- data/screen_test/rendered/settings/flow/box_r2l.frame +0 -1
- data/screen_test/rendered/settings/flow/box_r2l.rb +0 -24
- data/screen_test/rendered/settings/flow/box_t2b.frame +0 -1
- data/screen_test/rendered/settings/flow/box_t2b.rb +0 -24
- data/screen_test/rendered/settings/flow/grid_b2t.frame +0 -1
- data/screen_test/rendered/settings/flow/grid_l2r.frame +0 -1
- data/screen_test/rendered/settings/flow/grid_r2l.frame +0 -1
- data/screen_test/rendered/settings/flow/grid_t2b.frame +0 -1
- data/screen_test/rendered/settings/height/box.frame +0 -1
- data/screen_test/rendered/settings/height/grid.frame +0 -1
- data/screen_test/rendered/settings/height/overflow_box.frame +0 -1
- data/screen_test/rendered/settings/height/overflow_box.rb +0 -13
- data/screen_test/rendered/settings/height/overflow_box_l2r.frame +0 -1
- data/screen_test/rendered/settings/height/overflow_box_l2r.rb +0 -15
- data/screen_test/rendered/settings/height/overflow_box_t2b.frame +0 -1
- data/screen_test/rendered/settings/height/overflow_grid.frame +0 -1
- data/screen_test/rendered/settings/margin.frame +0 -1
- data/screen_test/rendered/settings/margin.rb +0 -14
- data/screen_test/rendered/settings/padding.frame +0 -1
- data/screen_test/rendered/settings/padding.rb +0 -11
- data/screen_test/rendered/settings/position/box_left.frame +0 -1
- data/screen_test/rendered/settings/position/box_left_negative.frame +0 -1
- data/screen_test/rendered/settings/position/box_top.frame +0 -1
- data/screen_test/rendered/settings/position/box_top_negative.frame +0 -1
- data/screen_test/rendered/settings/position/grid_left.frame +0 -1
- data/screen_test/rendered/settings/position/grid_left_negative.frame +0 -1
- data/screen_test/rendered/settings/position/grid_top.frame +0 -1
- data/screen_test/rendered/settings/position/grid_top_negative.frame +0 -1
- data/screen_test/rendered/settings/scroll/horiz_box.frame +0 -1
- data/screen_test/rendered/settings/scroll/horiz_box.rb +0 -15
- data/screen_test/rendered/settings/scroll/vert_box.frame +0 -1
- data/screen_test/rendered/settings/scroll/vert_box.rb +0 -18
- data/screen_test/rendered/settings/title_font.frame +0 -1
- data/screen_test/rendered/settings/width/box.frame +0 -1
- data/screen_test/rendered/settings/width/grid.frame +0 -1
- data/screen_test/rendered/settings/width/overflow_box.frame +0 -1
- data/screen_test/rendered/settings/width/overflow_box.rb +0 -11
- data/screen_test/rendered/settings/width/overflow_box_l2r.frame +0 -1
- data/screen_test/rendered/settings/width/overflow_box_l2r.rb +0 -14
- data/screen_test/rendered/settings/width/overflow_box_t2b.frame +0 -1
- data/screen_test/rendered/settings/width/overflow_box_t2b.rb +0 -15
- data/screen_test/rendered/settings/width/overflow_grid.frame +0 -1
- data/screen_test/screen_tester.rb +0 -201
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46a66b5e575d80b9e99cd263d8158ece7f500aebfc853df72bd340b7b67a0787
|
4
|
+
data.tar.gz: 6a097ab19829f97957eff088dab8aed0241b0d68a79a43681883a07e2a897790
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '093f92c928d2dda04cabe54d4bcc627f3083fcc1e1b68ceb413dc2ffcfa3e1f73427a91f9e5d1fee8992fcc1e88f601984e5e04f8b0a58183c5b44ac5e4d2c27'
|
7
|
+
data.tar.gz: '0300822358c0ceaeba6c998cbff96ac1c2d94198cc639062e77cfe041132630f94f8dd4ef56a6de45838b068480f0a8ebcc40c23c2b1a5e315ce990ead06ca93'
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
## v0.
|
3
|
+
## v0.7.0 - 2021-01-27
|
4
|
+
|
5
|
+
BREAKING: the settings for the template now fills the full screen and disallows margin.
|
6
|
+
|
7
|
+
- [b7c12c2](https://github.com/tcollier/whirled_peas/tree/b7c12c2c34d7077b9c2496d05ddd0c6d1eb90699): Update template to fill full screen with border sizing
|
8
|
+
- [963b819](https://github.com/tcollier/whirled_peas/tree/963b8196f0d046ba03c893f07e5578bf8c88b7a3): Implement vertical alignment
|
9
|
+
- [4bddd54](https://github.com/tcollier/whirled_peas/tree/4bddd54bec5c8f93d145c285379c1816f313f35e): Add `between`, `around`, and `evenly` alignments
|
10
|
+
|
11
|
+
## v0.6.0 - 2021-01-25
|
4
12
|
|
5
13
|
- [73df2af](https://github.com/tcollier/whirled_peas/tree/73df2af1f1eac37fe94f720dce16da1ed568dade): Add support for scroll bars along both axes
|
6
14
|
- [f4f44e1](https://github.com/tcollier/whirled_peas/tree/f4f44e1ff6c75ed03cd682e3fa9921401dcd2d00): Implement remaining 3 flow directions for grids
|
data/README.md
CHANGED
@@ -172,7 +172,12 @@ To render the frame events sent by the driver, the application requires a templa
|
|
172
172
|
|
173
173
|
#### Building Blocks
|
174
174
|
|
175
|
-
A template is created with `WhirledPeas.template`, which yields a `Composer` object for a `Box` and `BoxSettings`. The composer allows for attaching child elements and the settings for setting layout options.
|
175
|
+
A template is created with `WhirledPeas.template`, which yields a `Composer` object for a `Box` and `BoxSettings`. The composer allows for attaching child elements and the settings for setting layout options. The following attributes of the template's settings will be overridden before it is rendered to ensure that it fills the screen exactly
|
176
|
+
|
177
|
+
- `margin` - all margin will be set to 0
|
178
|
+
- `width` - will be set to the screen's width
|
179
|
+
- `height` - will be set to the screen's height
|
180
|
+
- `sizing` - will be set `:border` to ensure the entire box fits on the screen and fills it entirely.
|
176
181
|
|
177
182
|
A `Composer` provides the following methods to add child elements, each of these takes an optional string argument that is set as the name of the element (which can be useful when debugging).
|
178
183
|
|
@@ -239,23 +244,211 @@ end
|
|
239
244
|
Each element type has an associated settings type, which provide a custom set of options to format the output. Child settings will inherit from the parent, where applicable
|
240
245
|
The available settigs are
|
241
246
|
|
242
|
-
| Setting | Description
|
243
|
-
| ------------ |
|
244
|
-
| `align` | Justifies the content
|
245
|
-
| `bg_color` | Background color (see [Colors](#colors))
|
246
|
-
| `bold` | `true` makes the font bold
|
247
|
-
| `border` | Set the border for the lements
|
248
|
-
| `color` | Foreground text color (see [Colors](#colors))
|
249
|
-
| `flow` | Flow to display child elements (see [Display Flow](#display-flow))
|
250
|
-
| `height` | Override the calculated height of an element's content area
|
251
|
-
| `margin` | Set the (left, top, right, bottom) margin of the element
|
252
|
-
| `num_cols` | Number of columns in the grid (must be set!)
|
253
|
-
| `padding` | Set the (left, top, right, bottom) padding of the element
|
254
|
-
| `position` | Set the (left, top) position of the element relative to parent content area
|
255
|
-
| `scrollbar` | Display a scroll bar for vertical or horizontal scrolling
|
256
|
-
| `
|
257
|
-
| `
|
258
|
-
| `
|
247
|
+
| Setting | Description | Default | Availability | Inherited |
|
248
|
+
| ------------ | -------------------------------------------------------------------------------- | ---------- | --------------------- | -------------------- |
|
249
|
+
| `align` | Justifies the content in the horizontal direction | `:left` | `Box`, `Grid` | No |
|
250
|
+
| `bg_color` | Background color (see [Colors](#colors)) | | `Box`, `Grid`, `Text` | Yes |
|
251
|
+
| `bold` | `true` makes the font bold | `false` | `Box`, `Grid`, `Text` | Yes |
|
252
|
+
| `border` | Set the border for the lements | none | `Box`, `Grid`, | Only style and color |
|
253
|
+
| `color` | Foreground text color (see [Colors](#colors)) | | `Box`, `Grid`, `Text` | Yes |
|
254
|
+
| `flow` | Flow to display child elements (see [Display Flow](#display-flow)) | `:l2r` | `Box`, `Grid` | No |
|
255
|
+
| `height` | Override the calculated height of an element's content area | | `Box`, `Grid` | No |
|
256
|
+
| `margin` | Set the (left, top, right, bottom) margin of the element | `0` | `Box`, `Grid` | No |
|
257
|
+
| `num_cols` | Number of columns in the grid (must be set!) | | `Grid` | No |
|
258
|
+
| `padding` | Set the (left, top, right, bottom) padding of the element | `0` | `Box`, `Grid` | No |
|
259
|
+
| `position` | Set the (left, top) position of the element relative to parent content area | `0` | `Box`, `Grid` | No |
|
260
|
+
| `scrollbar` | Display a scroll bar for vertical or horizontal scrolling | | `Box` | No |
|
261
|
+
| `sizing` | Sizing model (`:content` or `:border`) used in conjunction with `width`/`hieght` | `:content` | `Box` | No |
|
262
|
+
| `title_font` | Font used for "large" text (see [Large Text](#large-text), ignores `underline`) | | `Text` | No |
|
263
|
+
| `underline` | `true` underlines the font | `false` | `Box`, `Grid`, `Text` | Yes |
|
264
|
+
| `width` | Override the calculated width of an element's content area | | `Box`, `Grid` | No |
|
265
|
+
| `valign` | Justifies the content in the vertical direction | `:top` | `Box`, `Grid` | No |
|
266
|
+
|
267
|
+
##### Alignment
|
268
|
+
|
269
|
+
The `align` setting takes one of several values
|
270
|
+
|
271
|
+
- `:left` - align content starting at the leftmost edge of the container's content area
|
272
|
+
|
273
|
+
```
|
274
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
275
|
+
┃[child 1][child 2][child 3] ┃
|
276
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
277
|
+
```
|
278
|
+
|
279
|
+
- `:right` - align content starting at the rightmost edge of the container's content area
|
280
|
+
|
281
|
+
```
|
282
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
283
|
+
┃ [child 1][child 2][child 3]┃
|
284
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
285
|
+
```
|
286
|
+
|
287
|
+
- `:center` - align content starting in the horizontal center of the container's content area
|
288
|
+
|
289
|
+
```
|
290
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
291
|
+
┃ [child 1][child 2][child 3] ┃
|
292
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
293
|
+
```
|
294
|
+
|
295
|
+
- `:between` - distribute children so there is equal space between children no space outside of the children
|
296
|
+
|
297
|
+
```
|
298
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
299
|
+
┃[child 1] [child 2] [child 3]┃
|
300
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
301
|
+
```
|
302
|
+
|
303
|
+
- `:around` - distribute children so that they have equal spacing around them, space between two children is twice the space between an edge and a child.
|
304
|
+
|
305
|
+
```
|
306
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
307
|
+
┃ [child 1] [child 2] [child 3] ┃
|
308
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
309
|
+
```
|
310
|
+
|
311
|
+
- `:evenly` - distribute children so there is even spacing between any two children (or space to the edge)
|
312
|
+
|
313
|
+
```
|
314
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
315
|
+
┃ [child 1] [child 2] [child 3] ┃
|
316
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
317
|
+
```
|
318
|
+
|
319
|
+
The `valign` setting takes one of several values
|
320
|
+
|
321
|
+
- `:top` - align content starting at the top of the container's content area
|
322
|
+
|
323
|
+
```
|
324
|
+
┏━━━━━━━━━┓
|
325
|
+
┃[child 1]┃
|
326
|
+
┃[child 2]┃
|
327
|
+
┃[child 3]┃
|
328
|
+
┃ ┃
|
329
|
+
┃ ┃
|
330
|
+
┃ ┃
|
331
|
+
┃ ┃
|
332
|
+
┃ ┃
|
333
|
+
┃ ┃
|
334
|
+
┃ ┃
|
335
|
+
┃ ┃
|
336
|
+
┃ ┃
|
337
|
+
┃ ┃
|
338
|
+
┃ ┃
|
339
|
+
┃ ┃
|
340
|
+
┗━━━━━━━━━┛
|
341
|
+
```
|
342
|
+
|
343
|
+
- `:bottom` - align content starting at the bottom of the container's content area
|
344
|
+
|
345
|
+
```
|
346
|
+
┏━━━━━━━━━┓
|
347
|
+
┃ ┃
|
348
|
+
┃ ┃
|
349
|
+
┃ ┃
|
350
|
+
┃ ┃
|
351
|
+
┃ ┃
|
352
|
+
┃ ┃
|
353
|
+
┃ ┃
|
354
|
+
┃ ┃
|
355
|
+
┃ ┃
|
356
|
+
┃ ┃
|
357
|
+
┃ ┃
|
358
|
+
┃ ┃
|
359
|
+
┃[child 1]┃
|
360
|
+
┃[child 2]┃
|
361
|
+
┃[child 3]┃
|
362
|
+
┗━━━━━━━━━┛
|
363
|
+
```
|
364
|
+
|
365
|
+
- `:middle` - align content starting in the vertical middle of the container's content area
|
366
|
+
|
367
|
+
```
|
368
|
+
┏━━━━━━━━━┓
|
369
|
+
┃ ┃
|
370
|
+
┃ ┃
|
371
|
+
┃ ┃
|
372
|
+
┃ ┃
|
373
|
+
┃ ┃
|
374
|
+
┃ ┃
|
375
|
+
┃[child 1]┃
|
376
|
+
┃[child 2]┃
|
377
|
+
┃[child 3]┃
|
378
|
+
┃ ┃
|
379
|
+
┃ ┃
|
380
|
+
┃ ┃
|
381
|
+
┃ ┃
|
382
|
+
┃ ┃
|
383
|
+
┃ ┃
|
384
|
+
┗━━━━━━━━━┛
|
385
|
+
```
|
386
|
+
|
387
|
+
- `:between` - distribute children so there is equal space between children no space outside of the children
|
388
|
+
|
389
|
+
```
|
390
|
+
┏━━━━━━━━━┓
|
391
|
+
┃[child 1]┃
|
392
|
+
┃ ┃
|
393
|
+
┃ ┃
|
394
|
+
┃ ┃
|
395
|
+
┃ ┃
|
396
|
+
┃ ┃
|
397
|
+
┃ ┃
|
398
|
+
┃[child 2]┃
|
399
|
+
┃ ┃
|
400
|
+
┃ ┃
|
401
|
+
┃ ┃
|
402
|
+
┃ ┃
|
403
|
+
┃ ┃
|
404
|
+
┃ ┃
|
405
|
+
┃[child 3]┃
|
406
|
+
┗━━━━━━━━━┛
|
407
|
+
```
|
408
|
+
|
409
|
+
- `:around` - distribute children so that they have equal spacing around them, space between two children is twice the space between an edge and a child.
|
410
|
+
|
411
|
+
```
|
412
|
+
┏━━━━━━━━━┓
|
413
|
+
┃ ┃
|
414
|
+
┃ ┃
|
415
|
+
┃[child 1]┃
|
416
|
+
┃ ┃
|
417
|
+
┃ ┃
|
418
|
+
┃ ┃
|
419
|
+
┃ ┃
|
420
|
+
┃[child 2]┃
|
421
|
+
┃ ┃
|
422
|
+
┃ ┃
|
423
|
+
┃ ┃
|
424
|
+
┃ ┃
|
425
|
+
┃[child 3]┃
|
426
|
+
┃ ┃
|
427
|
+
┃ ┃
|
428
|
+
┗━━━━━━━━━┛
|
429
|
+
```
|
430
|
+
|
431
|
+
- `:evenly` - distribute children so there is even spacing between any two children (or space to the edge)
|
432
|
+
|
433
|
+
```
|
434
|
+
┏━━━━━━━━━┓
|
435
|
+
┃ ┃
|
436
|
+
┃ ┃
|
437
|
+
┃ ┃
|
438
|
+
┃[child 1]┃
|
439
|
+
┃ ┃
|
440
|
+
┃ ┃
|
441
|
+
┃ ┃
|
442
|
+
┃[child 2]┃
|
443
|
+
┃ ┃
|
444
|
+
┃ ┃
|
445
|
+
┃ ┃
|
446
|
+
┃[child 3]┃
|
447
|
+
┃ ┃
|
448
|
+
┃ ┃
|
449
|
+
┃ ┃
|
450
|
+
┗━━━━━━━━━┛
|
451
|
+
```
|
259
452
|
|
260
453
|
##### Position
|
261
454
|
|
@@ -263,11 +456,56 @@ Position settings dictate the relative position from where the painter would hav
|
|
263
456
|
|
264
457
|
- `set_position(left:, top:)`
|
265
458
|
|
459
|
+
##### Sizing Model
|
460
|
+
|
461
|
+
The sizing model determines how to interpret the `width` and `height` settings. The default sizing model is `:content`, which sets the width and height of the cotent area, whereas `:border` sets the width and height of the element inlcuding the padding and border and scroll bars.
|
462
|
+
|
463
|
+
###### Examples
|
464
|
+
|
465
|
+
In the examples below, the `~` character represents padding and would not be displayed in the acutal rendered screen.
|
466
|
+
|
467
|
+
```ruby
|
468
|
+
settings.width = 10
|
469
|
+
settings.height = 3
|
470
|
+
settings.set_padding(left: 3, top: 1, right: 3, bottom: 1)
|
471
|
+
settings.full_border
|
472
|
+
|
473
|
+
## Content sizing
|
474
|
+
settings.sizing = :content
|
475
|
+
|
476
|
+
# Results in the box
|
477
|
+
#
|
478
|
+
# ┏━━━━━━━━━━━━━━━━┓
|
479
|
+
# ┃~~~~~~~~~~~~~~~~┃
|
480
|
+
# ┃~~~1234567890~~~┃
|
481
|
+
# ┃~~~1234567890~~~┃
|
482
|
+
# ┃~~~1234567890~~~┃
|
483
|
+
# ┃~~~~~~~~~~~~~~~~┃
|
484
|
+
# ┗━━━━━━━━━━━━━━━━┛
|
485
|
+
|
486
|
+
## Border sizing
|
487
|
+
settings.sizing = :border
|
488
|
+
|
489
|
+
# Results in the box
|
490
|
+
#
|
491
|
+
# ┏━━━━━━━━┓
|
492
|
+
# ┃~~~12~~~┃
|
493
|
+
# ┗━━━━━━━━┛
|
494
|
+
```
|
495
|
+
|
496
|
+
Notice that a box rendered with `:border` sizing would fit exactly in the content area of a box with the same `width` and `height` that is rendered with `:content` sizing. For containers with no padding and no border, the resulting size is the same for either sizing model.
|
497
|
+
|
266
498
|
##### Margin
|
267
499
|
|
268
500
|
Margin settings dictate the spacing on the outside (i.e. outside of the border) of each of the 4 sides of the container independently. To set these values, use
|
269
501
|
|
270
|
-
- `set_margin(left:, top:, right:, bottom:)`
|
502
|
+
- `set_margin(left:, top:, right:, bottom:, horiz:, vert:)` - set any combination of margin (note: setting `horiz` and `left`/`right` or setting `vert` and `top`/`bottom` is not allowed)
|
503
|
+
- `margin.left=(value)` - set left margin
|
504
|
+
- `margin.top=(value)` - set top margin
|
505
|
+
- `margin.right=(value)` - set right margin
|
506
|
+
- `margin.bottom=(value)` - set bottom margin
|
507
|
+
- `margin.horiz=(value)` - set left and right margin to the same value
|
508
|
+
- `margin.vert=(value)` - set top and bottom margin to the same value
|
271
509
|
|
272
510
|
Note: values cannot be negative
|
273
511
|
|
@@ -275,7 +513,13 @@ Note: values cannot be negative
|
|
275
513
|
|
276
514
|
Padding settings dictate the spacing on the inside (i.e. inside of the border) of each of the 4 sides of the container independently. To set these values, use
|
277
515
|
|
278
|
-
- `set_padding(left:, top:, right:, bottom:)`
|
516
|
+
- `set_padding(left:, top:, right:, bottom:, horiz:, vert:)` - set any combination of padding (note: setting `horiz` and `left`/`right` or setting `vert` and `top`/`bottom` is not allowed)
|
517
|
+
- `padding.left=(value)` - set left padding
|
518
|
+
- `padding.top=(value)` - set top padding
|
519
|
+
- `padding.right=(value)` - set right padding
|
520
|
+
- `padding.bottom=(value)` - set bottom padding
|
521
|
+
- `padding.horiz=(value)` - set left and right padding to the same value
|
522
|
+
- `padding.vert=(value)` - set top and bottom padding to the same value
|
279
523
|
|
280
524
|
Note: values cannot be negative
|
281
525
|
|
@@ -283,14 +527,24 @@ Note: values cannot be negative
|
|
283
527
|
|
284
528
|
Scroll settings dictate whether the scrollbar will be shown when child content is larger the the container's viewport. A scrollbar adds a unit to the dimensions of a container (as opposed to overwriting the leftmost/bottommost padding)
|
285
529
|
|
286
|
-
- `
|
530
|
+
- `set_scrollbar(horiz:, vert:)` - set both scrollbar settings
|
531
|
+
- `scrollbar.horiz=(flag)` - show/hide the horizontal scrollbar
|
532
|
+
- `scrollbar.vert=(flag)` - show/hide the vertical scrollbar
|
287
533
|
|
288
534
|
##### Border
|
289
535
|
|
290
536
|
The border settings consist of 6 boolean values (border are either width 1 or not shown), the 4 obvious values (`left`, `top`, `right`, and `bottom`) along with 2 other values for inner borders (`inner_horiz` and `inner_vert`) in a grid. A border also has a foreground color (defaults to `:white`) and a style. The background color is determined by the `bg_color` of the element. Border values can be set with
|
291
537
|
|
292
|
-
- `set_border(left:, top:, right:, bottom:, inner_horiz:, inner_vert:, color:, style:)`
|
293
|
-
- `full_border(style:, color:)`
|
538
|
+
- `set_border(left:, top:, right:, bottom:, inner_horiz:, inner_vert:, color:, style:)` - set any combination of border settings
|
539
|
+
- `full_border(style:, color:)` - set all borders to true and optionally set the style or color
|
540
|
+
- `border.left=(flag)` - show/hide left border
|
541
|
+
- `border.top=(flag)` - show/hide top border
|
542
|
+
- `border.right=(flag)` - show/hide right border
|
543
|
+
- `border.bottom=(flag)` - show/hide bottom border
|
544
|
+
- `border.inner_horiz=(flag)` - show/hide inner horizontal border (dividing grid rows)
|
545
|
+
- `border.inner_vert=(flag)` - show/hide inner vertical border (dividing grid columns)
|
546
|
+
- `border.color=(flag)` - set the border color
|
547
|
+
- `border.style=(flag)` - set the border style
|
294
548
|
|
295
549
|
Available border styles are
|
296
550
|
|
@@ -332,52 +586,70 @@ Child elements can flow in one of 4 directions
|
|
332
586
|
|
333
587
|
```
|
334
588
|
# In a Box
|
335
|
-
|
589
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
590
|
+
┃[child 1] [child 2] ... [child N]┃
|
591
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
336
592
|
|
337
593
|
# In a Grid
|
338
|
-
|
339
|
-
[
|
594
|
+
┏━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┓
|
595
|
+
┃[child 1]┃[child 2]┃[child 3]┃
|
596
|
+
┣━━━━━━━━━╋━━━━━━━━━╋━━━━━━━━━┫
|
597
|
+
┃[chiid 4]┃[child 5]┃ ┃
|
598
|
+
┗━━━━━━━━━┻━━━━━━━━━┻━━━━━━━━━┛
|
340
599
|
```
|
341
600
|
|
342
601
|
- `:r2l` right-to-left
|
343
602
|
|
344
603
|
```
|
345
604
|
# In a Box
|
346
|
-
|
605
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
606
|
+
┃[child N] [child N - 1] ... [child 1]┃
|
607
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
347
608
|
|
348
609
|
# In a Grid
|
349
|
-
|
350
|
-
|
610
|
+
┏━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┓
|
611
|
+
┃[child 3]┃[child 2]┃[child 1]┃
|
612
|
+
┣━━━━━━━━━╋━━━━━━━━━╋━━━━━━━━━┫
|
613
|
+
┃ ┃[chiid 5]┃[child 4]┃
|
614
|
+
┗━━━━━━━━━┻━━━━━━━━━┻━━━━━━━━━┛
|
351
615
|
```
|
352
616
|
|
353
617
|
- `:t2b` top-to-bottom
|
354
618
|
|
355
619
|
```
|
356
620
|
# In a Box
|
357
|
-
|
358
|
-
[child
|
359
|
-
|
360
|
-
|
621
|
+
┏━━━━━━━━━┓
|
622
|
+
┃[child 1]┃
|
623
|
+
┃[child 2]┃
|
624
|
+
┃ ... ┃
|
625
|
+
┃[child N]┃
|
626
|
+
┗━━━━━━━━━┛
|
361
627
|
|
362
628
|
# In a Grid
|
363
|
-
|
364
|
-
[child
|
365
|
-
|
629
|
+
┏━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┓
|
630
|
+
┃[child 1]┃[child 3]┃[child 5]┃
|
631
|
+
┣━━━━━━━━━╋━━━━━━━━━╋━━━━━━━━━┫
|
632
|
+
┃[child 2]┃[child 4]┃ ┃
|
633
|
+
┗━━━━━━━━━┻━━━━━━━━━┻━━━━━━━━━┛
|
366
634
|
```
|
367
635
|
|
368
636
|
- `:b2t` bottom-to-top
|
369
637
|
|
370
638
|
```
|
371
639
|
# In a Box
|
372
|
-
|
373
|
-
[child N
|
374
|
-
|
375
|
-
|
640
|
+
┏━━━━━━━━━━━━━┓
|
641
|
+
┃[child N] ┃
|
642
|
+
┃[child N - 1]┃
|
643
|
+
┃ ... ┃
|
644
|
+
┃[child 1] ┃
|
645
|
+
┗━━━━━━━━━━━━━┛
|
376
646
|
|
377
647
|
# In a Grid
|
378
|
-
|
379
|
-
[child 2]
|
380
|
-
|
648
|
+
┏━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┓
|
649
|
+
┃[child 2]┃[child 4]┃ ┃
|
650
|
+
┣━━━━━━━━━╋━━━━━━━━━╋━━━━━━━━━┫
|
651
|
+
┃[child 1]┃[child 3]┃[child 5]┃
|
652
|
+
┗━━━━━━━━━┻━━━━━━━━━┻━━━━━━━━━┛
|
381
653
|
```
|
382
654
|
|
383
655
|
##### Colors
|