hledger-ui
Safe HaskellNone
LanguageGHC2021

Hledger.UI.UIScreens

Description

Constructors and updaters for all hledger-ui screens.

Constructors (*New) create and initialise a new screen with valid state, based on the provided options, reporting date, journal, and screen-specific parameters.

Updaters (*Update) recalculate an existing screen's state, based on new options, reporting date, journal, and the old screen state.

These are gathered in this low-level module so that any screen's handler can create or regenerate all other screens. Drawing and event-handling code is elsewhere, in per-screen modules.

Synopsis

Documentation

screenUpdate :: UIOpts -> Day -> Journal -> Screen -> Screen Source #

Regenerate the content of any screen from new options, reporting date and journal.

esNew :: String -> Screen Source #

Construct an error screen. Screen-specific arguments: the error message to show.

esUpdate :: ErrorScreenState -> ErrorScreenState Source #

Update an error screen. Currently a no-op since error screen depends only on its screen-specific state.

msNew :: Screen Source #

Construct a menu screen, with the first item selected. Screen-specific arguments: none.

msUpdate :: MenuScreenState -> MenuScreenState Source #

Update a menu screen. Currently a no-op since menu screen has unchanging content.

asNew :: UIOpts -> Day -> Journal -> Maybe AccountName -> Screen Source #

Construct an accounts screen listing the appropriate set of accounts, with the appropriate one selected. Screen-specific arguments: the account to select if any.

asUpdate :: UIOpts -> Day -> Journal -> AccountsScreenState -> AccountsScreenState Source #

Update an accounts screen's state from these options, reporting date, and journal.

csNew :: UIOpts -> Day -> Journal -> Maybe AccountName -> Screen Source #

Construct a cash accounts screen listing the appropriate set of accounts, with the appropriate one selected. Screen-specific arguments: the account to select if any.

csUpdate :: UIOpts -> Day -> Journal -> AccountsScreenState -> AccountsScreenState Source #

Update a balance sheet screen's state from these options, reporting date, and journal.

csItemIndex :: Int Source #

Positions of menu screen items, so we can move selection to them.

bsNew :: UIOpts -> Day -> Journal -> Maybe AccountName -> Screen Source #

Construct a balance sheet screen listing the appropriate set of accounts, with the appropriate one selected. Screen-specific arguments: the account to select if any.

bsUpdate :: UIOpts -> Day -> Journal -> AccountsScreenState -> AccountsScreenState Source #

Update a balance sheet screen's state from these options, reporting date, and journal.

isNew :: UIOpts -> Day -> Journal -> Maybe AccountName -> Screen Source #

Construct an income statement screen listing the appropriate set of accounts, with the appropriate one selected. Screen-specific arguments: the account to select if any.

isUpdate :: UIOpts -> Day -> Journal -> AccountsScreenState -> AccountsScreenState Source #

Update an income statement screen's state from these options, reporting date, and journal.

rsNew :: UIOpts -> Day -> Journal -> AccountName -> Bool -> Screen Source #

Construct a register screen listing the appropriate set of transactions, with the appropriate one selected. Screen-specific arguments: the account whose register this is, whether to force inclusive balances.

rsUpdate :: UIOpts -> Day -> Journal -> RegisterScreenState -> RegisterScreenState Source #

Update a register screen from these options, reporting date, and journal.

tsNew :: AccountName -> [NumberedTransaction] -> NumberedTransaction -> Screen Source #

Construct a transaction screen showing one of a given list of transactions, with the ability to step back and forth through the list. Screen-specific arguments: the account whose transactions are being shown, the list of showable transactions, the currently shown transaction.

tsUpdate :: TransactionScreenState -> TransactionScreenState Source #

Update a transaction screen. This currently does nothing because the initialisation in rsHandle is not so easy to extract. To see the updated transaction, one must exit and re-enter the transaction screen. See also tsHandle.