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.
Files changed (242) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -1
  3. data/README.md +315 -43
  4. data/Rakefile +8 -18
  5. data/lib/whirled_peas/graphics.rb +14 -0
  6. data/lib/whirled_peas/graphics/box_painter.rb +39 -46
  7. data/lib/whirled_peas/graphics/canvas.rb +22 -11
  8. data/lib/whirled_peas/graphics/container_coords.rb +6 -5
  9. data/lib/whirled_peas/graphics/container_dimensions.rb +26 -8
  10. data/lib/whirled_peas/graphics/container_painter.rb +42 -4
  11. data/lib/whirled_peas/graphics/grid_painter.rb +11 -10
  12. data/lib/whirled_peas/graphics/painter.rb +5 -1
  13. data/lib/whirled_peas/graphics/renderer.rb +6 -1
  14. data/lib/whirled_peas/graphics/text_painter.rb +2 -2
  15. data/lib/whirled_peas/settings/alignment.rb +24 -0
  16. data/lib/whirled_peas/settings/bg_color.rb +2 -0
  17. data/lib/whirled_peas/settings/border.rb +16 -16
  18. data/lib/whirled_peas/settings/color.rb +13 -14
  19. data/lib/whirled_peas/settings/container_settings.rb +126 -42
  20. data/lib/whirled_peas/settings/display_flow.rb +13 -11
  21. data/lib/whirled_peas/settings/element_settings.rb +3 -3
  22. data/lib/whirled_peas/settings/grid_settings.rb +5 -1
  23. data/lib/whirled_peas/settings/sizing.rb +19 -0
  24. data/lib/whirled_peas/settings/spacing.rb +34 -0
  25. data/lib/whirled_peas/settings/text_color.rb +2 -0
  26. data/lib/whirled_peas/settings/vert_alignment.rb +24 -0
  27. data/lib/whirled_peas/utils/title_font.rb +1 -1
  28. data/lib/whirled_peas/version.rb +1 -1
  29. data/screen_test/{rendered/elements → elements}/box.frame +1 -1
  30. data/screen_test/{rendered/elements → elements}/box.rb +0 -0
  31. data/screen_test/elements/grid.frame +1 -0
  32. data/screen_test/{rendered/elements → elements}/grid.rb +0 -0
  33. data/screen_test/elements/screen_overflow_x.frame +1 -0
  34. data/screen_test/{rendered/elements/screen_overflow.rb → elements/screen_overflow_x.rb} +0 -0
  35. data/screen_test/elements/screen_overflow_y.frame +1 -0
  36. data/screen_test/elements/screen_overflow_y.rb +9 -0
  37. data/screen_test/elements/text.frame +1 -0
  38. data/screen_test/{rendered/elements → elements}/text.rb +0 -0
  39. data/screen_test/elements/text_multiline.frame +1 -0
  40. data/screen_test/{rendered/elements → elements}/text_multiline.rb +0 -0
  41. data/screen_test/settings/align/box_around.frame +1 -0
  42. data/screen_test/settings/align/box_around.rb +16 -0
  43. data/screen_test/settings/align/box_between.frame +1 -0
  44. data/screen_test/settings/align/box_between.rb +16 -0
  45. data/screen_test/settings/align/box_center.frame +1 -0
  46. data/screen_test/{rendered/settings/align/grid.rb → settings/align/box_center.rb} +7 -6
  47. data/screen_test/settings/align/box_default.frame +1 -0
  48. data/screen_test/settings/align/box_default.rb +20 -0
  49. data/screen_test/settings/align/box_evenly.frame +1 -0
  50. data/screen_test/settings/align/box_evenly.rb +16 -0
  51. data/screen_test/settings/align/box_left.frame +1 -0
  52. data/screen_test/settings/align/box_left.rb +21 -0
  53. data/screen_test/settings/align/box_right.frame +1 -0
  54. data/screen_test/settings/align/box_right.rb +21 -0
  55. data/screen_test/settings/align/children_center.frame +1 -0
  56. data/screen_test/settings/align/children_center.rb +15 -0
  57. data/screen_test/settings/align/children_left.frame +1 -0
  58. data/screen_test/settings/align/children_left.rb +15 -0
  59. data/screen_test/settings/align/children_right.frame +1 -0
  60. data/screen_test/settings/align/children_right.rb +15 -0
  61. data/screen_test/settings/align/grid_center.frame +1 -0
  62. data/screen_test/settings/align/grid_center.rb +18 -0
  63. data/screen_test/settings/align/grid_default.frame +1 -0
  64. data/screen_test/settings/align/grid_default.rb +17 -0
  65. data/screen_test/settings/align/grid_left.frame +1 -0
  66. data/screen_test/settings/align/grid_left.rb +18 -0
  67. data/screen_test/settings/align/grid_right.frame +1 -0
  68. data/screen_test/settings/align/grid_right.rb +18 -0
  69. data/screen_test/settings/ansi/bold.frame +1 -0
  70. data/screen_test/{rendered/settings/height/overflow_box_t2b.rb → settings/ansi/bold.rb} +4 -4
  71. data/screen_test/{rendered/settings → settings}/ansi/color.frame +1 -1
  72. data/screen_test/{rendered/settings → settings}/ansi/color.rb +0 -0
  73. data/screen_test/settings/ansi/underline.frame +1 -0
  74. data/screen_test/{rendered/settings → settings}/ansi/underline.rb +4 -5
  75. data/screen_test/{rendered/settings → settings}/border.frame +1 -1
  76. data/screen_test/{rendered/settings → settings}/border.rb +1 -1
  77. data/screen_test/settings/flow/box_b2t.frame +1 -0
  78. data/screen_test/settings/flow/box_b2t.rb +26 -0
  79. data/screen_test/settings/flow/box_l2r.frame +1 -0
  80. data/screen_test/settings/flow/box_l2r.rb +26 -0
  81. data/screen_test/settings/flow/box_r2l.frame +1 -0
  82. data/screen_test/settings/flow/box_r2l.rb +26 -0
  83. data/screen_test/settings/flow/box_t2b.frame +1 -0
  84. data/screen_test/settings/flow/box_t2b.rb +26 -0
  85. data/screen_test/settings/flow/grid_b2t.frame +1 -0
  86. data/screen_test/{rendered/settings → settings}/flow/grid_b2t.rb +0 -0
  87. data/screen_test/settings/flow/grid_l2r.frame +1 -0
  88. data/screen_test/{rendered/settings → settings}/flow/grid_l2r.rb +0 -0
  89. data/screen_test/settings/flow/grid_r2l.frame +1 -0
  90. data/screen_test/{rendered/settings → settings}/flow/grid_r2l.rb +0 -0
  91. data/screen_test/settings/flow/grid_t2b.frame +1 -0
  92. data/screen_test/{rendered/settings → settings}/flow/grid_t2b.rb +0 -0
  93. data/screen_test/settings/height/box.frame +1 -0
  94. data/screen_test/{rendered/settings → settings}/height/box.rb +0 -0
  95. data/screen_test/settings/height/box_border_sizing.frame +1 -0
  96. data/screen_test/settings/height/box_border_sizing.rb +15 -0
  97. data/screen_test/settings/height/grid.frame +1 -0
  98. data/screen_test/{rendered/settings → settings}/height/grid.rb +0 -0
  99. data/screen_test/settings/height/overflow_box.frame +1 -0
  100. data/screen_test/settings/height/overflow_box.rb +13 -0
  101. data/screen_test/settings/height/overflow_box_l2r.frame +1 -0
  102. data/screen_test/settings/height/overflow_box_l2r.rb +17 -0
  103. data/screen_test/settings/height/overflow_box_t2b.frame +1 -0
  104. data/screen_test/settings/height/overflow_box_t2b.rb +16 -0
  105. data/screen_test/settings/height/overflow_grid.frame +1 -0
  106. data/screen_test/{rendered/settings → settings}/height/overflow_grid.rb +0 -0
  107. data/screen_test/settings/margin.frame +1 -0
  108. data/screen_test/settings/margin.rb +16 -0
  109. data/screen_test/settings/padding.frame +1 -0
  110. data/screen_test/settings/padding.rb +13 -0
  111. data/screen_test/settings/position/box_left.frame +1 -0
  112. data/screen_test/{rendered/settings → settings}/position/box_left.rb +2 -2
  113. data/screen_test/settings/position/box_left_negative.frame +1 -0
  114. data/screen_test/{rendered/settings → settings}/position/box_left_negative.rb +2 -2
  115. data/screen_test/settings/position/box_top.frame +1 -0
  116. data/screen_test/{rendered/settings → settings}/position/box_top.rb +1 -1
  117. data/screen_test/settings/position/box_top_negative.frame +1 -0
  118. data/screen_test/{rendered/settings → settings}/position/box_top_negative.rb +2 -2
  119. data/screen_test/settings/position/grid_left.frame +1 -0
  120. data/screen_test/{rendered/settings → settings}/position/grid_left.rb +1 -1
  121. data/screen_test/settings/position/grid_left_negative.frame +1 -0
  122. data/screen_test/{rendered/settings → settings}/position/grid_left_negative.rb +1 -1
  123. data/screen_test/settings/position/grid_top.frame +1 -0
  124. data/screen_test/{rendered/settings → settings}/position/grid_top.rb +1 -1
  125. data/screen_test/settings/position/grid_top_negative.frame +1 -0
  126. data/screen_test/{rendered/settings → settings}/position/grid_top_negative.rb +1 -1
  127. data/screen_test/settings/scroll/horiz_box.frame +1 -0
  128. data/screen_test/settings/scroll/horiz_box.rb +17 -0
  129. data/screen_test/settings/scroll/horiz_box_align_center.rb +18 -0
  130. data/screen_test/settings/scroll/horiz_box_align_right.rb +18 -0
  131. data/screen_test/settings/scroll/vert_box.frame +1 -0
  132. data/screen_test/settings/scroll/vert_box.rb +20 -0
  133. data/screen_test/settings/title_font.frame +1 -0
  134. data/screen_test/{rendered/settings → settings}/title_font.rb +1 -1
  135. data/screen_test/settings/valign/box_around.frame +1 -0
  136. data/screen_test/settings/valign/box_around.rb +17 -0
  137. data/screen_test/settings/valign/box_between.frame +1 -0
  138. data/screen_test/settings/valign/box_between.rb +17 -0
  139. data/screen_test/settings/valign/box_bottom.frame +1 -0
  140. data/screen_test/settings/valign/box_bottom.rb +17 -0
  141. data/screen_test/settings/valign/box_default.frame +1 -0
  142. data/screen_test/settings/valign/box_default.rb +16 -0
  143. data/screen_test/settings/valign/box_evenly.frame +1 -0
  144. data/screen_test/settings/valign/box_evenly.rb +17 -0
  145. data/screen_test/settings/valign/box_middle.frame +1 -0
  146. data/screen_test/settings/valign/box_middle.rb +17 -0
  147. data/screen_test/settings/valign/box_top.frame +1 -0
  148. data/screen_test/settings/valign/box_top.rb +17 -0
  149. data/screen_test/settings/valign/grid_bottom.frame +1 -0
  150. data/screen_test/settings/valign/grid_bottom.rb +15 -0
  151. data/screen_test/settings/valign/grid_default.frame +1 -0
  152. data/screen_test/settings/valign/grid_default.rb +14 -0
  153. data/screen_test/settings/valign/grid_middle.frame +1 -0
  154. data/screen_test/settings/valign/grid_middle.rb +15 -0
  155. data/screen_test/settings/valign/grid_top.frame +1 -0
  156. data/screen_test/settings/valign/grid_top.rb +15 -0
  157. data/screen_test/settings/width/box_border_sizing.frame +1 -0
  158. data/screen_test/settings/width/box_border_sizing.rb +15 -0
  159. data/screen_test/settings/width/box_content.frame +1 -0
  160. data/screen_test/settings/width/box_content.rb +15 -0
  161. data/screen_test/settings/width/box_default.frame +1 -0
  162. data/screen_test/{rendered/settings/width/box.rb → settings/width/box_default.rb} +3 -2
  163. data/screen_test/settings/width/grid.frame +1 -0
  164. data/screen_test/{rendered/settings → settings}/width/grid.rb +2 -2
  165. data/screen_test/settings/width/overflow_align_center.frame +1 -0
  166. data/screen_test/settings/width/overflow_align_center.rb +14 -0
  167. data/screen_test/settings/width/overflow_align_right.frame +1 -0
  168. data/screen_test/settings/width/overflow_align_right.rb +14 -0
  169. data/screen_test/settings/width/overflow_box.frame +1 -0
  170. data/screen_test/settings/width/overflow_box.rb +13 -0
  171. data/screen_test/settings/width/overflow_box_l2r.frame +1 -0
  172. data/screen_test/settings/width/overflow_box_l2r.rb +16 -0
  173. data/screen_test/settings/width/overflow_box_t2b.frame +1 -0
  174. data/screen_test/settings/width/overflow_box_t2b.rb +17 -0
  175. data/screen_test/settings/width/overflow_grid.frame +1 -0
  176. data/screen_test/{rendered/settings → settings}/width/overflow_grid.rb +0 -0
  177. data/tools/whirled_peas/tools/screen_tester.rb +233 -0
  178. metadata +154 -98
  179. data/lib/whirled_peas/settings/text_align.rb +0 -19
  180. data/screen_test/rendered/elements/grid.frame +0 -1
  181. data/screen_test/rendered/elements/screen_overflow.frame +0 -1
  182. data/screen_test/rendered/elements/text.frame +0 -1
  183. data/screen_test/rendered/elements/text_multiline.frame +0 -1
  184. data/screen_test/rendered/settings/align/box.frame +0 -1
  185. data/screen_test/rendered/settings/align/box.rb +0 -24
  186. data/screen_test/rendered/settings/align/children_center.frame +0 -1
  187. data/screen_test/rendered/settings/align/children_center.rb +0 -13
  188. data/screen_test/rendered/settings/align/children_left.frame +0 -1
  189. data/screen_test/rendered/settings/align/children_left.rb +0 -13
  190. data/screen_test/rendered/settings/align/children_right.frame +0 -1
  191. data/screen_test/rendered/settings/align/children_right.rb +0 -13
  192. data/screen_test/rendered/settings/align/grid.frame +0 -1
  193. data/screen_test/rendered/settings/ansi/bold.frame +0 -1
  194. data/screen_test/rendered/settings/ansi/bold.rb +0 -15
  195. data/screen_test/rendered/settings/ansi/underline.frame +0 -1
  196. data/screen_test/rendered/settings/flow/box_b2t.frame +0 -1
  197. data/screen_test/rendered/settings/flow/box_b2t.rb +0 -24
  198. data/screen_test/rendered/settings/flow/box_l2r.frame +0 -1
  199. data/screen_test/rendered/settings/flow/box_l2r.rb +0 -24
  200. data/screen_test/rendered/settings/flow/box_r2l.frame +0 -1
  201. data/screen_test/rendered/settings/flow/box_r2l.rb +0 -24
  202. data/screen_test/rendered/settings/flow/box_t2b.frame +0 -1
  203. data/screen_test/rendered/settings/flow/box_t2b.rb +0 -24
  204. data/screen_test/rendered/settings/flow/grid_b2t.frame +0 -1
  205. data/screen_test/rendered/settings/flow/grid_l2r.frame +0 -1
  206. data/screen_test/rendered/settings/flow/grid_r2l.frame +0 -1
  207. data/screen_test/rendered/settings/flow/grid_t2b.frame +0 -1
  208. data/screen_test/rendered/settings/height/box.frame +0 -1
  209. data/screen_test/rendered/settings/height/grid.frame +0 -1
  210. data/screen_test/rendered/settings/height/overflow_box.frame +0 -1
  211. data/screen_test/rendered/settings/height/overflow_box.rb +0 -13
  212. data/screen_test/rendered/settings/height/overflow_box_l2r.frame +0 -1
  213. data/screen_test/rendered/settings/height/overflow_box_l2r.rb +0 -15
  214. data/screen_test/rendered/settings/height/overflow_box_t2b.frame +0 -1
  215. data/screen_test/rendered/settings/height/overflow_grid.frame +0 -1
  216. data/screen_test/rendered/settings/margin.frame +0 -1
  217. data/screen_test/rendered/settings/margin.rb +0 -14
  218. data/screen_test/rendered/settings/padding.frame +0 -1
  219. data/screen_test/rendered/settings/padding.rb +0 -11
  220. data/screen_test/rendered/settings/position/box_left.frame +0 -1
  221. data/screen_test/rendered/settings/position/box_left_negative.frame +0 -1
  222. data/screen_test/rendered/settings/position/box_top.frame +0 -1
  223. data/screen_test/rendered/settings/position/box_top_negative.frame +0 -1
  224. data/screen_test/rendered/settings/position/grid_left.frame +0 -1
  225. data/screen_test/rendered/settings/position/grid_left_negative.frame +0 -1
  226. data/screen_test/rendered/settings/position/grid_top.frame +0 -1
  227. data/screen_test/rendered/settings/position/grid_top_negative.frame +0 -1
  228. data/screen_test/rendered/settings/scroll/horiz_box.frame +0 -1
  229. data/screen_test/rendered/settings/scroll/horiz_box.rb +0 -15
  230. data/screen_test/rendered/settings/scroll/vert_box.frame +0 -1
  231. data/screen_test/rendered/settings/scroll/vert_box.rb +0 -18
  232. data/screen_test/rendered/settings/title_font.frame +0 -1
  233. data/screen_test/rendered/settings/width/box.frame +0 -1
  234. data/screen_test/rendered/settings/width/grid.frame +0 -1
  235. data/screen_test/rendered/settings/width/overflow_box.frame +0 -1
  236. data/screen_test/rendered/settings/width/overflow_box.rb +0 -11
  237. data/screen_test/rendered/settings/width/overflow_box_l2r.frame +0 -1
  238. data/screen_test/rendered/settings/width/overflow_box_l2r.rb +0 -14
  239. data/screen_test/rendered/settings/width/overflow_box_t2b.frame +0 -1
  240. data/screen_test/rendered/settings/width/overflow_box_t2b.rb +0 -15
  241. data/screen_test/rendered/settings/width/overflow_grid.frame +0 -1
  242. data/screen_test/screen_tester.rb +0 -201
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4a2a839ef0ed84dd94f346be47c38d65c0d23b6faa399abdf8f56023138788a4
4
- data.tar.gz: 04a43d7c60d2e3896adea98036012bdba20448ecdf530947b72ca535ee5c3464
3
+ metadata.gz: 46a66b5e575d80b9e99cd263d8158ece7f500aebfc853df72bd340b7b67a0787
4
+ data.tar.gz: 6a097ab19829f97957eff088dab8aed0241b0d68a79a43681883a07e2a897790
5
5
  SHA512:
6
- metadata.gz: dfff87fa6a87ed784b35b400ad9ac737508b4ded1e791840a3a3194a0ef22eae1ad517c9f8db9459b929e37ce132cfa97662f85762b0b02df691f58ececa7d19
7
- data.tar.gz: 504e279d386d56d3b476220c4f8a015134c446b7a0cdcebc5c65db50ee750f48ce2b8b5e6a72ce0d3844bdca916f832230b7974dfdd5d982140b8bc15db003c6
6
+ metadata.gz: '093f92c928d2dda04cabe54d4bcc627f3083fcc1e1b68ceb413dc2ffcfa3e1f73427a91f9e5d1fee8992fcc1e88f601984e5e04f8b0a58183c5b44ac5e4d2c27'
7
+ data.tar.gz: '0300822358c0ceaeba6c998cbff96ac1c2d94198cc639062e77cfe041132630f94f8dd4ef56a6de45838b068480f0a8ebcc40c23c2b1a5e315ce990ead06ca93'
@@ -1,6 +1,14 @@
1
1
  # Changelog
2
2
 
3
- ## v0.5.0 - 2021-01-25
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 | Default | Availability | Inherited |
243
- | ------------ | ------------------------------------------------------------------------------- | ------- | --------------------- | -------------------- |
244
- | `align` | Justifies the content (allowed values: `:left`, `:center`, `:right`) | `:left` | `Box`, `Grid` | Yes |
245
- | `bg_color` | Background color (see [Colors](#colors)) | | `Box`, `Grid`, `Text` | Yes |
246
- | `bold` | `true` makes the font bold | `false` | `Box`, `Grid`, `Text` | Yes |
247
- | `border` | Set the border for the lements | none | `Box`, `Grid`, | Only style and color |
248
- | `color` | Foreground text color (see [Colors](#colors)) | | `Box`, `Grid`, `Text` | Yes |
249
- | `flow` | Flow to display child elements (see [Display Flow](#display-flow)) | `:l2r` | `Box`, `Grid` | Yes |
250
- | `height` | Override the calculated height of an element's content area | | `Box`, `Grid` | No |
251
- | `margin` | Set the (left, top, right, bottom) margin of the element | `0` | `Box`, `Grid` | No |
252
- | `num_cols` | Number of columns in the grid (must be set!) | | `Grid` | No |
253
- | `padding` | Set the (left, top, right, bottom) padding of the element | `0` | `Box`, `Grid` | No |
254
- | `position` | Set the (left, top) position of the element relative to parent content area | `0` | `Box`, `Grid` | No |
255
- | `scrollbar` | Display a scroll bar for vertical or horizontal scrolling | | `Box` | No |
256
- | `title_font` | Font used for "large" text (see [Large Text](#large-text), ignores `underline`) | | `Text` | No |
257
- | `underline` | `true` underlines the font | `false` | `Box`, `Grid`, `Text` | Yes |
258
- | `width` | Override the calculated width of an element's content area | | `Box`, `Grid` | No |
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
- - `set_padding(horiz:, vert:)`
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
- [child 1] [child 2] ... [child N]
589
+ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
590
+ ┃[child 1] [child 2] ... [child N]┃
591
+ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
336
592
 
337
593
  # In a Grid
338
- [child 1] [child 2] [child 3]
339
- [chiid 4] [child 5]
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
- [child N] [child N - 1] ... [child 1]
605
+ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
606
+ ┃[child N] [child N - 1] ... [child 1]┃
607
+ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
347
608
 
348
609
  # In a Grid
349
- [child 3] [child 2] [child 1]
350
- [chiid 5] [child 4]
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
- [child 1]
358
- [child 2]
359
- ...
360
- [child N]
621
+ ┏━━━━━━━━━┓
622
+ [child 1]
623
+ ┃[child 2]┃
624
+ ... ┃
625
+ ┃[child N]┃
626
+ ┗━━━━━━━━━┛
361
627
 
362
628
  # In a Grid
363
- [child 1] [child 4]
364
- [child 2] [child 5]
365
- [child 3]
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
- [child N]
373
- [child N - 1]
374
- ...
375
- [child 1]
640
+ ┏━━━━━━━━━━━━━┓
641
+ [child N]
642
+ ┃[child N - 1]┃
643
+ ... ┃
644
+ ┃[child 1] ┃
645
+ ┗━━━━━━━━━━━━━┛
376
646
 
377
647
  # In a Grid
378
- [child 3]
379
- [child 2] [child 5]
380
- [child 1] [child 4]
648
+ ┏━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┓
649
+ [child 2][child 4]┃ ┃
650
+ ┣━━━━━━━━━╋━━━━━━━━━╋━━━━━━━━━┫
651
+ ┃[child 1]┃[child 3]┃[child 5]┃
652
+ ┗━━━━━━━━━┻━━━━━━━━━┻━━━━━━━━━┛
381
653
  ```
382
654
 
383
655
  ##### Colors