Commit Graph

426 Commits

Author SHA1 Message Date
Jonathan Daugherty
01827e29c7 Remove stale import 2023-12-13 20:38:39 -08:00
Jonathan Daugherty
c1aef1106e Add Brick.Main.customMainWithDefaultVty (fixes #488) 2023-11-03 17:25:12 -07:00
Jonathan Daugherty
d442145c78 Merge branch 'master' into refactor/vty-crossplatform 2023-10-22 19:55:22 -07:00
Jonathan Daugherty
6b7195cf6e Split up ScrollbarRenderer type into vertical and horizontal versions
This change helps users avoid undesirable behavior by accidentally
using the wrong type of renderer to draw a scroll bar. This change:

* Splits up the ScrollbarRenderer type into two new types,
  VScrollbarRenderer and HScrollbarRenderer, with nearly identical
  fields except that each field now has some 'V' or 'H' in it.

* Renames 'scrollbarAllocation' to 'scrollbar(Height|Width)Allocation'
  depending on the renderer type.

* Updates the Core API to take values of the new renderer types as
  appropriate.

* Updates the types of the default renderers.

* Updates the demo program that uses the custom renderers.
2023-09-01 10:19:48 -07:00
Jonathan Daugherty
c1aa33098b ViewportScrollbarsDemo.hs: nit 2023-09-01 10:02:56 -07:00
Jonathan Daugherty
324b5adfbd Add scrollbar space allocation control
This change is motivated by a desire to be able to control how scroll
bars are rendered adjacent to viewport contents. It isn't always
desirable to render them right up against the contents; sometimes,
spacing would be nice between the bar and contents, for example. In
general, we want users to be able to control more aspects of how scroll
bars are drawn. This change is a step in that direction. This change
won't affect any users who are using the default scroll bar renderers.

This change:

* Adds a new field to ScrollbarRenderer, scrollbarAllocation :: Int,
  which specifies the height (for horizontal scroll bars) or width (for
  vertical ones) of the region in which the bar is rendered. This allows
  scroll bar element widgets to take up more than one row in height (for
  horizontal scroll bars) or more than one column in width (for vertical
  ones).

* Updates the scroll bar rendering logic to clamp scroll bar handles to
  one row in height (for vertical scroll bars) or one column in width
  (for horizontal ones) since we need to be able to assume the size
  of the handles when computing the size of the scroll bar and trough
  regions.

* Updates programs/ViewportScrollbarsDemo.hs to demonstrate the use of
  the new allocation feature to draw a vertical scroll bar that takes up
  more than one column in various ways.
2023-09-01 09:36:12 -07:00
Jonathan Daugherty
99e082720a Merge branch 'master' into refactor/vty-crossplatform 2023-08-20 08:39:58 -07:00
Jonathan Daugherty
dc046ca8ef Update core library and demo programs to use vty-crossplatform to initialize the terminal 2023-08-20 08:37:40 -07:00
Jonathan Daugherty
2776b3c87b ThemeDemo: typo 2023-08-15 14:47:52 -07:00
Jonathan Daugherty
f1e57e6b22 BorderDemo: nit 2023-08-15 14:45:54 -07:00
Jonathan Daugherty
417571b9a1 BorderDemo: nit 2023-08-15 14:43:36 -07:00
Jonathan Daugherty
339ce5243c BorderDemo: nit 2023-08-15 14:42:43 -07:00
Jonathan Daugherty
f4561dc662 TabularListDemo: update cursor location text 2022-12-27 15:56:11 -08:00
Jonathan Daugherty
16666f3891 TabularListDemo: nit 2022-12-27 15:54:26 -08:00
Jonathan Daugherty
1518f8f8b1 TabularListDemo: update help 2022-12-27 15:54:22 -08:00
Jonathan Daugherty
33ef96925c TabularListDemo: add selection attribute to whole cell, not just string content 2022-12-27 15:52:01 -08:00
Jonathan Daugherty
4f1ff08cd3 TabularListDemo: add column headings 2022-12-27 15:50:46 -08:00
Jonathan Daugherty
c95baf63e6 Add a tabular list demo for #417 discussion 2022-12-27 15:47:18 -08:00
Jonathan Daugherty
ff17667264 EditorLineNumbersDemo: add conditional import 2022-11-25 10:10:47 -08:00
Jonathan Daugherty
fda7e084b2 Add editor line number demo program 2022-11-25 09:57:20 -08:00
Jonathan Daugherty
43ab5d5c3a Dialog: take resource names for buttons to allow cursor placement and click event support 2022-11-22 15:48:55 -08:00
Jonathan Daugherty
6b73d78783 Brick.Widgets.Border: add hBorderAttr, vBorderAttr for hBorder/vBorder respectively (see also #404) 2022-10-22 19:56:22 -07:00
Jan Hrček
3bd2235c0c Fix some hlint warnings 2022-09-24 12:56:11 +02:00
Jonathan Daugherty
a117ff7790 Whitespace 2022-09-21 13:50:39 -07:00
Jonathan Daugherty
5ebe98eac6 brick-theme-demo: nit 2022-09-21 13:48:18 -07:00
Jonathan Daugherty
5fe19ab046 brick-fill-demo: improve UI 2022-09-21 13:46:40 -07:00
Jonathan Daugherty
9af37e9404 CustomKeybindingDemo: comment edit 2022-08-22 12:55:05 -07:00
Jonathan Daugherty
e74623c323 keyDispatcher: fail with collision info if collisions are detected
This fixes a critical problem in KeyDispatcher where it would previously
silently ignore all but one handler for a specified key if the key
configuration resulted in the same key being mapped to multiple handlers
(either by event or by statically specified key).
2022-08-18 18:49:43 -07:00
Jonathan Daugherty
9cc2d5eafb reverseKeyMappings -> keyEventMappings 2022-08-18 18:22:50 -07:00
Jonathan Daugherty
4c8fc07178 CustomKeybindingDemo: add extra details about keybinding collision checking 2022-08-18 16:21:43 -07:00
Jonathan Daugherty
4e6b90d928 KeyConfig: add reverseKeyMappings to allow applications to check for colliding bindings
This change also adjusts KeyConfig's internals so that collisions are
preserved since they may not actually be bad.
2022-08-18 14:59:00 -07:00
Jonathan Daugherty
f6727b114d CustomKeybindingDemo: better state field name 2022-08-08 14:21:19 -07:00
Jonathan Daugherty
8763de2df9 CustomKeybindingDemo: nit 2022-08-08 14:20:39 -07:00
Jonathan Daugherty
f4b06804da CustomKeybindingDemo: nit 2022-08-08 14:19:50 -07:00
Jonathan Daugherty
776f631f23 CustomKeybindingDemo: UI nit 2022-08-08 14:15:09 -07:00
Jonathan Daugherty
b5b1f9329e Keybindings.Pretty: add keybindingHelpBaseAttr, eventNameAttr, eventDescriptionAttr, and keybindingAttr and show off in demo program 2022-08-08 14:08:47 -07:00
Jonathan Daugherty
45a6d57717 CustomKeybindingDemo: add helpful tip 2022-08-04 19:23:34 -07:00
Jonathan Daugherty
3817b456e8 CustomKeybindingDemo: layout improvements 2022-08-04 19:21:38 -07:00
Jonathan Daugherty
b8735a16bc CustomKeybindingDemo: UI nit 2022-08-04 19:21:30 -07:00
Jonathan Daugherty
8f2716ab2a CustomKeybindingDemo: comment 2022-08-04 19:16:44 -07:00
Jonathan Daugherty
b0fbd7f638 CustomKeybindingDemo: improve comments 2022-08-04 19:16:15 -07:00
Jonathan Daugherty
1ba4c0974d Comment nit 2022-08-04 19:13:13 -07:00
Jonathan Daugherty
ad91a0b727 CustomKeybindingDemo: add a working example INI file to load 2022-08-04 19:10:31 -07:00
Jonathan Daugherty
d10e6cd374 CustomKeybindingDemo: demonstrate loading custom bindings 2022-08-04 19:07:47 -07:00
Jonathan Daugherty
6f1b62ae53 AttrName: remove IsString instance
This change is motivated by the API wart that results from the
overloading of both "<>" and string literals that resulted in code like
this:

  a :: AttrName
  a = "blah" <> "things"

While this worked to create an AttrName with two segments, it is far too
easy to read this as two strings concatenated. The overloading hides
what is really going on with the segments of the attribute name. The way
to write the above example after this change is:

  a :: AttrName
  a = attrName "blah" <> attrName "things"
2022-08-04 18:44:57 -07:00
Jonathan Daugherty
bf58926132 Whitespace 2022-08-03 08:19:43 -07:00
Jonathan Daugherty
6c0fb8da24 CustomKeybindingDemo: nit 2022-08-02 20:13:22 -07:00
Jonathan Daugherty
4225f813a2 CustomKeybindingDemo: add another fixed key handler 2022-08-02 20:13:01 -07:00
Jonathan Daugherty
a768c6600d CustomKeybindingDemo: nit 2022-08-02 20:10:33 -07:00
Jonathan Daugherty
6bc22b87d7 Binding: ignore modifier order and duplication 2022-08-02 20:09:13 -07:00