Skip to content
This repository has been archived by the owner on Dec 28, 2024. It is now read-only.

Commit

Permalink
Make widgetColumn function slightly more flexible.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dretch committed Jul 27, 2024
1 parent 771f062 commit 0d8ec62
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.3.2.0
### Changed
- Make widgetColumn function slightly more flexible.

## 0.3.1.2
### Changed
- Mark as compatible with Monomer 1.6.
Expand Down
2 changes: 1 addition & 1 deletion monomer-hagrid.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cabal-version: 2.0
-- see: https://github.com/sol/hpack

name: monomer-hagrid
version: 0.3.1.2
version: 0.3.2.0
synopsis: A datagrid widget for the Monomer library.
description: A configurable Monomer widget that shows a scrollable grid of data.
category: GUI
Expand Down
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: monomer-hagrid
version: 0.3.1.2
version: 0.3.2.0
synopsis: A datagrid widget for the Monomer library.
description: A configurable Monomer widget that shows a scrollable grid of data.
github: Dretch/monomer-hagrid
Expand Down
6 changes: 3 additions & 3 deletions src/Monomer/Hagrid.hs
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,15 @@ data ColumnWidget e a
LabelWidget (Int -> a -> Text)
| -- | Create a widget of arbitrary type. The function receives the original item
-- index (i.e. not the index in the sorted list) and the item itself.
CustomWidget (forall s. (WidgetModel s) => Int -> a -> WidgetNode s e)
CustomWidget (forall s. WidgetModel s => Int -> a -> WidgetNode s e)

-- | How to create the footer widget for a column.
data ColumnFooterWidget e a
= -- | No footer widget for this column.
NoFooterWidget
| -- | Create a footer widget. The function receives the items in their current sort
-- order, and also along with each item it's original (unsorted) index.
CustomFooterWidget (forall s. (WidgetModel s) => Seq (ItemWithIndex a) -> WidgetNode s e)
CustomFooterWidget (forall s. WidgetModel s => Seq (ItemWithIndex a) -> WidgetNode s e)

-- | How to align the widget within each cell of a column.
data ColumnAlign
Expand Down Expand Up @@ -1031,7 +1031,7 @@ widgetColumn ::
Text ->
-- | Called with the (original, not sorted) index and the item for each row to get the widget to
-- display for that row.
(forall s. Int -> a -> WidgetNode s e) ->
(forall s. WidgetModel s => Int -> a -> WidgetNode s e) ->
Column e a
widgetColumn name get = defaultColumn name (CustomWidget get)

Expand Down

0 comments on commit 0d8ec62

Please sign in to comment.