Commit Graph

221 Commits

Author SHA1 Message Date
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
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
Jonathan Daugherty
d1f8cd9a67 PaddingDemo: use explicit imports 2015-07-10 13:30:34 -07:00
Jonathan Daugherty
9fce0120b0 MarkupDemo: use explicit imports 2015-07-10 13:28:23 -07:00
Jonathan Daugherty
ad9cffc2b7 Remove Vty rogue demo 2015-07-10 13:26:06 -07:00
Jonathan Daugherty
75cab4340c ListDemo: use explicit imports 2015-07-10 13:25:44 -07:00
Jonathan Daugherty
191b37f417 LayerDemo: use explicit imports 2015-07-10 13:20:05 -07:00