Commit Graph

426 Commits

Author SHA1 Message Date
Jonathan Daugherty
92bd9f0266 Improve table demo 2021-01-31 19:09:59 -08:00
Jonathan Daugherty
0d9085706c Table: add column alignment support 2021-01-31 19:04:56 -08:00
Jonathan Daugherty
477fe4d716 Add basic support for tables with fixed-size cell contents 2021-01-31 18:56:26 -08:00
Jonathan Daugherty
d106dc1e72 TailDemo: add missing imports for some GHC versions 2020-11-09 19:55:43 -08:00
Jonathan Daugherty
d01e51b9f2 TailDemo: improve approach to counting lines in thread 2020-08-24 14:19:58 -07:00
Jonathan Daugherty
660eb3b131 Add demo program for tail-style UI 2020-08-22 16:06:40 -07:00
Jonathan Daugherty
4947938e57 Re-enable unused do binding warning, lower -O3 to -O2, and add -Wcompat for all libs and executables 2020-02-28 15:05:48 -08:00
Jonathan Daugherty
7534f4d7be Clean up compilation warnings on newer GHCs 2020-02-07 16:43:36 -08:00
Jonathan Daugherty
581964442d customMain: allow caller to pass initial Vty handle, and add customMainWithVty 2019-03-19 08:27:43 -07:00
Jonathan Daugherty
557521a2e1 FileBrowser: support multiple entry selection (fixes #204)
This change adds fileBrowserSelectedAttr to indicate selected entries
and changes the API of fileBrowserSelection to return a list of selected
entries rather than a Maybe. It also adds Space as an input event to
toggle entry selection.
2018-12-06 11:55:24 -08:00
Jonathan Daugherty
796feff75d FileBrowser: update API to let caller control what constitutes a selectable entry 2018-12-03 10:57:10 -08:00
Jonathan Daugherty
0172756039 FileBrowser: haddock updates, API nits, and demo improvements 2018-12-03 10:33:47 -08:00
Jonathan Daugherty
fbc02529e1 FileBrowser: Socket -> UnixSocket 2018-11-30 20:20:22 -08:00
Jonathan Daugherty
800b8add22 FileBrowser: expose search state, update demo dispatch 2018-11-30 15:16:35 -08:00
Jonathan Daugherty
7075e3e63e FileBrowserDemo: add help text 2018-11-30 15:13:16 -08:00
Jonathan Daugherty
df4a70da1f FileBrowser: show current file info in footer 2018-11-30 11:49:08 -08:00
Jonathan Daugherty
6c72d89d46 FileBrowserDemo: nit 2018-11-30 11:23:11 -08:00
Jonathan Daugherty
1adaddce7f FileBrowser: add attribute for header 2018-11-30 11:14:12 -08:00
Jonathan Daugherty
6ab5c4dbae More file browser updates 2018-11-30 10:04:22 -08:00
Jonathan Daugherty
3188588c23 Initial working draft of file browser widget 2018-11-29 16:21:15 -08:00
Jonathan Daugherty
47bc0a3911 MouseDemo: improve text 2018-11-18 08:50:32 -08:00
Jonathan Daugherty
5ec13bfe92 Core: add hLimitPercent, vLimitPercent 2018-08-04 20:19:16 -07:00
Daniel Wagner
5dd5bc4100 add a way to join neighboring borders 2018-03-25 18:04:15 -04:00
Jonathan Daugherty
bd89f787d2 Support GHC 8.4 (fixes #162)
This change splits up Monoid instances into Monoid and Semigroup. It
also conditionally imports Data.Monoid on GHCs prior to 8.4.
2018-03-17 09:03:59 -07:00
Jonathan Daugherty
dac37858dd FormDemo: minor cleanup, set validation state initially 2018-01-09 16:27:08 -08:00
Jonathan Daugherty
23b8f291e2 Forms: add support for external validation, update FormDemo 2018-01-08 13:09:13 -08:00
Jonathan Daugherty
c1aad4bd5e Borders: simplify attribute API for borders by providing only one attribute name
This change removes attribute names that I think were inadvisable to
begin with.
2018-01-07 16:14:26 -08:00
Jonathan Daugherty
a7c611900c FormDemo: comment 2017-12-27 18:34:58 -08:00
Jonathan Daugherty
bee73d1167 FormDemo: extra @@= usage 2017-12-27 17:57:49 -08:00
Jonathan Daugherty
e844505619 FormDemo: use even more explicit imports 2017-12-27 16:33:03 -08:00
Jonathan Daugherty
8ddbcf94dd FormDemo: use explicit imports 2017-12-27 16:32:13 -08:00
Jonathan Daugherty
ac03482672 FormDemo: fix search-and-replace typo 2017-12-27 16:26:04 -08:00
Jonathan Daugherty
05ef4ac330 FormDemo: rename state type 2017-12-27 15:37:51 -08:00
Jonathan Daugherty
45c9bc48eb FormDemo: demo multi-line editor field 2017-12-27 11:37:26 -08:00
Jonathan Daugherty
d20c84daf4 Forms: make checkbox labels strings to be consistent with other functions 2017-12-26 23:21:15 -08:00
Jonathan Daugherty
58a531e4cb FormDemo: UI nits 2017-12-26 23:03:03 -08:00
Jonathan Daugherty
fa84704110 FormDemo: enable mouse events 2017-12-26 22:32:01 -08:00
Jonathan Daugherty
18c6ad9559 Reinstate checkbox labels as widgets 2017-12-26 22:07:41 -08:00
Jonathan Daugherty
80075e05f0 Forms: add functions to test form field validity 2017-12-26 22:04:51 -08:00
Jonathan Daugherty
0d3ed336d6 FormDemo: show initial and final form states 2017-12-26 21:58:07 -08:00
Jonathan Daugherty
58179a248a Whitespace 2017-12-26 21:56:32 -08:00
Jonathan Daugherty
ecb0748012 FormDemo: add help text 2017-12-26 21:56:10 -08:00
Jonathan Daugherty
fb4e801620 FormDemo: improve form build 2017-12-26 21:52:26 -08:00
Jonathan Daugherty
a0c387e9a3 FormDemo: improve labeling 2017-12-26 21:39:20 -08:00
Jonathan Daugherty
d86177a75a Forms: unify focused attributes 2017-12-26 21:35:14 -08:00
Jonathan Daugherty
0d6cfaa289 Forms: simplify checkbox API 2017-12-26 21:35:06 -08:00
Jonathan Daugherty
668a534a1e FormDemo: improve demo form 2017-12-26 21:31:18 -08:00
Jonathan Daugherty
af60c49bb3 Forms, FormDemo: add checkbox fields 2017-12-26 21:11:26 -08:00
Jonathan Daugherty
4d027c7a43 FormDemo: whitespace 2017-12-26 20:22:42 -08:00
Jonathan Daugherty
6d8cbe1e6c Forms: add infix operator alternative to withHelper 2017-12-26 20:11:18 -08:00
Jonathan Daugherty
03b91c5503 FormDemo: nits 2017-12-26 20:07:59 -08:00
Jonathan Daugherty
eca0b2abbf FormDemo: UI nit 2017-12-26 20:05:20 -08:00
Jonathan Daugherty
81727f46ce FormDemo: add radio button example 2017-12-26 19:58:20 -08:00
Jonathan Daugherty
6b2be1885d Forms: refactor API to decouple form input elements from state fields 2017-12-26 19:44:49 -08:00
Jonathan Daugherty
5b1112fc1f FormDemo: UI tweak 2017-12-26 16:43:37 -08:00
Jonathan Daugherty
7d59fd9213 Whitespace 2017-12-26 16:42:02 -08:00
Jonathan Daugherty
d4a8706072 FormDemo: clean up imports 2017-12-26 16:40:55 -08:00
Jonathan Daugherty
eaa14ed144 Forms: move TODO to forms module 2017-12-26 16:40:30 -08:00
Jonathan Daugherty
ba78ce92f8 Forms: improve naming convention of field constructors 2017-12-26 16:38:28 -08:00
Jonathan Daugherty
8bea691093 Add an experimental, incomplete forms API and demo program 2017-12-26 16:29:05 -08:00
Jonathan Daugherty
ae4d331dae MouseDemo: nit 2017-12-09 16:18:35 -08:00
Jonathan Daugherty
00428e78be Add a simple theme demo program 2017-11-05 11:19:42 -08:00
Jonathan Daugherty
eef78a0a67 Support attribute modification with modifyDefAttr, rename setDefault to setDefaultAttr 2017-10-09 13:02:21 -07:00
Jonathan Daugherty
dbebb512e9 Add hyperlink combinator, update attribute demo 2017-10-06 13:27:41 -07:00
Jonathan Daugherty
d4cb0fa63b AttrDemo: typo 2017-10-06 13:26:36 -07:00
Jonathan Daugherty
54380351a3 Add hyperlink test to attribute demo 2017-10-06 13:05:24 -07:00
Richard Alex Hofer
a002bf5001 Unalign imports. 2017-10-03 07:54:07 -04:00
Richard Alex Hofer
97f5457f9d Rename ListDemoVi to ListViDemo to better fit exisiting demos. 2017-10-03 07:42:52 -04:00
Richard Alex Hofer
017c0c1bf8 Add a list event handler with vi keybindings and a demo. 2017-10-01 16:25:55 -04:00
Jonathan Daugherty
6de72ae6b7 Add txtWrapWith, strWrapWith to provide control over wrapping behavior 2017-08-05 09:20:07 -07:00
Jonathan Daugherty
c7182aa448 Add a basic fill demonstration program 2017-08-02 15:55:09 -07:00
Jonathan Daugherty
687fe20ca5 Core: add txtWrap, strWrap, and TextWrapDemo (fixes #128) 2017-07-06 21:47:41 -07:00
Jonathan Daugherty
c07e9c0503 Edit: move content draw function to render time, not construction
This change makes the renderEditor function take the content drawing
function that "editor" previously took. This does a better job of
separating presentation and representation concerns, and the content
drawing function never should have been part of the state to begin with.

This change removed the corresponding lens and Editor accessor for the
drawing function, removed the smart constructor parameter, and moved it
to be a parameter of the renderEditor function.
2017-06-26 11:52:46 -07:00
Jonathan Daugherty
14871549a1 README: add simple demo UI and corresponding program 2017-03-11 20:31:55 -08:00
Jonathan Daugherty
7d2fc92405 Resolve 0.16 merge conflict, bump to 0.17 2017-01-24 13:52:41 -08:00
Jonathan Daugherty
4a2b90eae7 Update for Vty 5.15 2017-01-24 13:48:45 -08:00
Joshua Chia
6dce47a94c Switched to using TBQueue (bounded) instead of Chan (unbounded) 2017-01-07 18:52:38 +08:00
Jonathan Daugherty
339054b17c MouseDemo: import fix 2016-12-03 20:39:51 -08:00
Jonathan Daugherty
104d762dd4 MouseDemo: add an editor and use mouse events to move the cursor 2016-12-03 20:26:19 -08:00
Kevin Quick
3e51e2e5c2 Enhance MouseDemo to show interaction between clickable and viewport. 2016-11-30 00:06:44 -07:00
Jonathan Daugherty
bcf6eededb Rename TerminalLocation row/column fields to avoid commonplace name clashes (fixes #96) 2016-11-20 18:22:52 -08:00
Jonathan Daugherty
346a969886 MouseDemo: remove stale imports 2016-11-12 12:45:54 -08:00
Jonathan Daugherty
e313cc6816 Make customMain take an optional channel; do not set mouse mode by default 2016-11-01 13:22:25 -07:00
Jonathan Daugherty
377cc6cb56 Send MouseDown/Up when matching regions instead of just Clicked 2016-10-30 13:44:51 -07:00
Jonathan Daugherty
3ffd35799a MouseDemo: add missing imports for older GHCs 2016-10-30 13:17:08 -07:00
Jonathan Daugherty
5af29b43f8 Mouse demo: remove dragging code, add demo buttons 2016-10-27 22:02:56 -07:00
Jonathan Daugherty
665e19ebfe Update progress bar demo for API changes 2016-10-27 21:49:35 -07:00
Jonathan Daugherty
27f91a56d3 Cleanup 2016-10-27 21:43:39 -07:00
Jonathan Daugherty
3d50122d5b Merge branch 'master' into feature/mouse-support 2016-10-27 21:43:17 -07:00
Kevin Quick
7fcf3e68e9 Added mapAttrname, mapAttrNames, and overrideAttr functions, with ProgressBarDemo to demonstrate their usage. 2016-10-26 22:49:59 -07:00
Jonathan Daugherty
a85238a115 Add extent-local coordinates to Clicked events 2016-10-25 22:32:36 -07:00
Jonathan Daugherty
940435ddcc Update mouse demo with Clicked event test 2016-10-25 20:44:22 -07:00
Jonathan Daugherty
fc8cfe3b4a Remove appLiftVtyEvent in favor of library event type BrickEvent
This change makes it possible for brick to extent the event space using
its own event notions in addition those provided by Vty and the
application itself. This means we no longer need the user to provide the
type and appLiftVtyEvent went away. This makes pattern-matching in event
handlers a little noisier with the benefit that we can now add events
like mouse clicks or drags to the event type.
2016-10-25 20:19:31 -07:00
Jonathan Daugherty
831092e1bd MouseDemo: clear clicked extent list on mouse-up 2016-10-23 22:52:12 -07:00
Jonathan Daugherty
af11c17612 MouseDemo: indentation fix 2016-10-23 22:49:23 -07:00
Jonathan Daugherty
5bfd9a5537 More exploration of a mouse demo program 2016-10-23 22:42:51 -07:00
Jonathan Daugherty
afe2e7eec5 MouseDemo: move clickedExtent into Brick.Main 2016-10-23 19:24:57 -07:00
Jonathan Daugherty
9154522509 Remove mouse event offset adjustment, depend on Vty with relevant fix 2016-10-23 19:19:16 -07:00
Jonathan Daugherty
12659aced0 Merge master 2016-10-23 18:51:47 -07:00
Jonathan Daugherty
a2badcbd9f CacheDemo: add missing Applicative import 2016-09-20 21:31:23 -07:00
Jonathan Daugherty
464fec9c1d Add CacheDemo (closes #82) 2016-09-20 21:15:25 -07:00
Jonathan Daugherty
ef06be53f2 LayerDemo: language tweak 2016-09-18 10:21:43 -07:00
Getty Ritter
4c528987c7 Strawman implementation of parametric Editor widget
This isn't a fully backwards-compatible change, but the only thing
that needs to be modified for programs involves adding a type parameter,
which will be either `String` or `Text`.
2016-09-07 21:18:24 -07:00
Jonathan Daugherty
f9fc16025b MouseDemo: describe the different drag event cases 2016-06-30 19:28:27 -07:00
Jonathan Daugherty
95b9084bdd MouseDemo: remove old layer functionality to focus on how mouse support works 2016-06-30 19:25:16 -07:00
Jonathan Daugherty
94e3217d5d Add MouseDemo 2016-06-30 19:10:44 -07:00
Jonathan Daugherty
d06004952e LayerDemo: demonstrate a centered top layer 2016-06-10 15:01:28 -07:00
Jonathan Daugherty
29ac664adc Use conditional imports to silence redundancy warnings on GHCs with base >= 4.8.0.0 2016-05-27 11:47:16 -07:00
Jonathan Daugherty
3b604fd5af EditDemo: remove list widget 2016-05-27 11:20:34 -07:00
Jonathan Daugherty
bd95299148 Resolve master merge conflicts 2016-05-19 20:29:12 -07:00
Alan Gilbert
e0f9195737 renaming Data.Vector to avoid ambiguity 2016-05-15 19:34:07 +03:00
Jonathan Daugherty
f3950cf96d API: migrate "lens" usage to "microlens" packages 2016-05-08 18:05:30 -07:00
Jonathan Daugherty
4f0f74b851 API: remove dialogName, dialogNameL, dialog name parameter 2016-03-07 08:52:53 -08:00
Jonathan Daugherty
d3d453737c Make editors focus-aware 2016-03-07 08:25:02 -08:00
Jonathan Daugherty
00eebed6f6 Add Named class, make List focus-aware, add experimental withFocusRing combinator 2016-03-04 15:50:10 -08:00
Jonathan Daugherty
01487b398e edit-demo: use a focus ring 2016-03-04 14:54:43 -08:00
Jonathan Daugherty
3081e7367d Replace "Name" type with custom name type variable everywhere
This experimental change makes it possible to:
* Avoid runtime errors due to name typos
* Achieve compile-time guarantees about name matching and usage
* Force widget functions to be name-agnostic by being polymorphic
  in their name type
* Clean up focus handling by making it possible to pattern-match
  on cursor location names

The change also made many types more heavyweight and in some cases
this is unpleasant when we don't want to have to care about names.
But in those cases we can just use 'n' or '()' depending on how
concrete we need to be.  I'm not yet sure how this is going to play
out in practice.
2016-03-04 14:42:49 -08:00
Jonathan Daugherty
d0cabf95fe edit-demo: support shift-tab to switch editors 2016-02-16 09:18:43 -08:00
Jonathan Daugherty
568df56630 Markup: make markup support multi-line strings (fixes #41) 2016-01-23 15:55:23 -08:00
Markus Hauck
e59559b0d1 Apply hlint hints
- programs/LayerDemo: combine imports
- programs/SuspendAndResumeDemo: redundant do
- programs/ViewportScrollDemo: unused pragma
- src/Brick/Main: redundant do
- src/Brick/Widgets/Center: use fromMaybe
- src/Brick/Widgets/Core: combine imports, redundant do, use >=>
- src/Brick/Widgets/Internals: redundant '$'
- src/Brick/Widgets/List: use fromMaybe
- src/Brick/Widgets/ProgressBar: use fromMaybe
2015-12-09 20:15:09 +01:00
Jøhannes Lippmann
be47eb2a2b Changed ListDemo list type from List Int to List Char, small bugfix.
This might improve the understanding of what is a list item and what
is a position. Also in when running the demo it was possible to create
identical items by removing an element form the middle and adding a
new one (wich got the number (length of list), not (smallest unused
element in list)).
2015-10-22 11:26:51 +02:00
Jonathan Daugherty
1950bc01de Core: remove multiline string and text functions in favor of catch-all versions 2015-08-20 08:36:39 -07:00
Jonathan Daugherty
dc9cee623d Add convenience Brick module and simplify basic demo program 2015-08-19 23:13:07 -07:00
Jonathan Daugherty
fb8dc330bc Types: implement handleEventLensed 2015-08-19 22:26:25 -07:00
Jonathan Daugherty
1671c3732c List: pass the item height to the constructor instead of the draw function to make it available to event handlers 2015-08-19 21:46:55 -07:00
Jonathan Daugherty
0f84d19cdf API: handleEvent now runs in EventM 2015-08-19 19:52:34 -07:00
Jonathan Daugherty
736a81de97 API: move EventM and Next to Brick.Types 2015-08-19 19:48:55 -07:00
Jonathan Daugherty
35aa2ad8a4 Monster patch: move most data types to Brick.Types, remove IsString
instance for Widget

- This makes the module layout more predictable since Brick.Widgets.Core
  now (mostly) only contains widgets and widget transformations
- Utility functions closely related to types are now in Brick.Types
- Brick.Types.Internal contains types used internal by the renderer,
  some are re-exported by Brick.Types
2015-08-19 19:40:06 -07:00
Jonathan Daugherty
32b2740409 Edit: use multilineStr to render editors (fixes #8) 2015-08-19 09:21:35 -07:00
Jonathan Daugherty
693abbb345 List: refactor rendering routine to only render the items in view (fixes #7)
- Changes renderList to expect an item height and all rendered items
  must match this height
- Uses vector slicing to efficiently get the sub-list of items to be
  rendered
- Renders 2 * H items at time instead of all N, where H is the height of
  the list's viewport
2015-08-18 13:06:36 -07:00
Jonathan Daugherty
74aa344564 ListDemo: missing uses of Vector API 2015-08-18 09:39:58 -07:00
Jonathan Daugherty
14d2147c85 List: use Vector instead of [] to manage elements to improve performance 2015-08-17 23:33:47 -07:00
Jonathan Daugherty
d7bf9e1c97 List: instead of passing the draw function to the constructor, we pass it at rendering time 2015-08-17 22:19:08 -07:00
Jonathan Daugherty
d33181ed0b Make str and txt single-line only and add slower multiline variants 2015-08-17 21:13:00 -07:00
Jonathan Daugherty
47ef979221 Increase vty bound to 5.3 and remove comment about now-fixed bug 2015-08-11 15:32:12 -07:00
Jonathan Daugherty
5f6df6dbc4 Remove stale demo 2015-08-06 19:26:22 -07:00
Jonathan Daugherty
2d48b9bbac Minor editor demo cleanup 2015-07-20 18:39:10 -07:00
Jonathan Daugherty
60a67fd7fe Add Brick.Main.showCursorNamed for making name-based cursor-matching easier 2015-07-20 18:36:24 -07:00
Jonathan Daugherty
935f05973a Update editor demo to show both limited and unlimited editors 2015-07-20 18:31:33 -07:00
Jonathan Daugherty
c35e20196b Add support for multi-line editors
- Changes the editor constructor to take a line limit
- Changes the editor drawing function to take [String] instead of String
- Changes the editor to use a viewport that scrolls both horizontally
  and vertically
- Uses the latest text-zipper release (so cabal update)
2015-07-20 18:10:50 -07:00
Jonathan Daugherty
f930210777 Move toward suffixing all lenses with L 2015-07-19 12:08:00 -07:00
Jonathan Daugherty
c8ed8df9e1 Dialog demo: remove stale import 2015-07-17 21:12:39 -07:00
Jonathan Daugherty
648abfcacc padAll, padTopBottom, and padLeftRight all now only take integer padding arguments 2015-07-17 21:09:56 -07:00
Jonathan Daugherty
4fde0b4f7d Add support for viewports that scroll both vertically and horizontally, add visibility demo 2015-07-17 19:30:42 -07:00
Jonathan Daugherty
a2bf4e241a Border demo: update intersection field names 2015-07-17 18:37:11 -07:00
Jonathan Daugherty
e2b71a51be ListDemo: stale import 2015-07-11 16:53:06 -07:00
Jonathan Daugherty
f79da4ea2b Remove benchmark suite and dependencies 2015-07-11 16:17:42 -07:00
Jonathan Daugherty
962e7c83df Rename appMakeVtyEvent to appLiftVtyEvent 2015-07-10 13:53:21 -07:00
Jonathan Daugherty
a460d2fd15 ViewportScrollDemo: use explicit imports 2015-07-10 13:38:05 -07:00
Jonathan Daugherty
d6f34261bc SuspendAndResumeDemo: use explicit imports 2015-07-10 13:34:21 -07:00