Commit Graph

37 Commits

Author SHA1 Message Date
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
dee90efa8c Remove withLens and withFirst in lieu of a Zoom instance for EventM
This change makes it possible to use the "zoom" function from
microlens-mtl to zoom in on a state field in EventM. This change adds a
re-export of "zoom" to Brick.Types for convenience.
2022-07-26 19:49:29 -07:00
Jonathan Daugherty
bf2f6be870 Move Padding type from Brick.Types to Brick.Widgets.Core 2022-07-22 16:07:00 -07:00
Jonathan Daugherty
b0273b0109 MouseDemo: move Vty handle operations into appStartEvent 2022-07-21 14:22:11 -07:00
Jonathan Daugherty
2838263c22 MouseDemo: whitespace 2022-07-21 14:18:49 -07:00
Jonathan Daugherty
875c305ad4 handleEventLensed -> withLens (generalize API), add nestEventM 2022-07-17 16:50:54 -07:00
Jonathan Daugherty
4ea1f65d86 Update demo programs for changes to EventM 2022-07-16 23:10:03 -07:00
Jonathan Daugherty
8eb41ca8c3 handleEditorEvent: handle mouse click events to place the cursor (adds Eq constraint to handleEditorEvent) 2022-07-09 08:30:42 -07:00
Jonathan Daugherty
65645be3d2 Edit: handle BrickEvents, not Events
This is a breaking API change that changes handleEditorEvent to take
BrickEvents instead of Events. This paves the way for handling Brick's
mouse events in the editor.
2022-07-09 08:23:32 -07:00
Jonathan Daugherty
c5ee667f72 Mouse demo: improve click message slightly 2022-05-12 08:14:27 -07:00
Jonathan Daugherty
e2a1f32fb0 Mouse demo: remove redundant clickable 2022-05-12 08:00:13 -07:00
Simon Jakobi
5fbf3bc965 Remove some compat code for base < 4.8 / GHC < 7.10 2021-10-25 22:25:15 +02:00
Willem Van Onsem
d6d1245005
use record patterns for MouseDemo 2021-03-15 21:13:48 +01: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
47bc0a3911 MouseDemo: improve text 2018-11-18 08:50:32 -08:00
Jonathan Daugherty
ae4d331dae MouseDemo: nit 2017-12-09 16:18:35 -08: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
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
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
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
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