2024-01-10 06:14:59 +00:00
|
|
|
{-# LANGUAGE CPP #-}
|
|
|
|
{-# LANGUAGE DataKinds #-}
|
|
|
|
{-# LANGUAGE FlexibleContexts #-}
|
|
|
|
{-# LANGUAGE OverloadedStrings #-}
|
|
|
|
{-# LANGUAGE TypeApplications #-}
|
|
|
|
{-# LANGUAGE RankNTypes #-}
|
|
|
|
{-# LANGUAGE ViewPatterns #-}
|
|
|
|
{-# OPTIONS_GHC -Wno-unused-record-wildcards #-}
|
|
|
|
{-# OPTIONS_GHC -Wno-unused-matches #-}
|
|
|
|
{-# LANGUAGE FlexibleInstances #-}
|
|
|
|
{-# LANGUAGE MultiParamTypeClasses #-}
|
|
|
|
{-# LANGUAGE TemplateHaskell #-}
|
|
|
|
{-# LANGUAGE BangPatterns #-}
|
|
|
|
{-# LANGUAGE InstanceSigs #-}
|
|
|
|
|
|
|
|
{-
|
|
|
|
This module contains the BrickState. One could be tempted to include this data structure in GHCup.Brick.Common,
|
|
|
|
but it is better to make a separated module in order to avoid cyclic dependencies.
|
|
|
|
|
|
|
|
This happens because the BrickState is sort of a container for all widgets,
|
|
|
|
but widgets depends on common functionality, hence:
|
|
|
|
|
|
|
|
BrickState `depends on` Widgets.XYZ `depends on` Common
|
|
|
|
|
|
|
|
The linear relation above breaks if BrickState is defined in Common.
|
|
|
|
|
|
|
|
-}
|
|
|
|
|
|
|
|
module GHCup.Brick.BrickState where
|
|
|
|
|
|
|
|
import GHCup.Types ( KeyBindings )
|
|
|
|
import GHCup.Brick.Common ( BrickData(..), BrickSettings(..), Mode(..))
|
|
|
|
import GHCup.Brick.Widgets.Navigation ( BrickInternalState)
|
2024-02-28 08:37:17 +00:00
|
|
|
import GHCup.Brick.Widgets.Menus.Context (ContextMenu)
|
2024-01-10 06:14:59 +00:00
|
|
|
import Optics.TH (makeLenses)
|
|
|
|
|
|
|
|
|
|
|
|
data BrickState = BrickState
|
|
|
|
{ _appData :: BrickData
|
|
|
|
, _appSettings :: BrickSettings
|
|
|
|
, _appState :: BrickInternalState
|
2024-02-28 08:37:17 +00:00
|
|
|
, _contextMenu :: ContextMenu
|
2024-01-10 06:14:59 +00:00
|
|
|
, _appKeys :: KeyBindings
|
|
|
|
, _mode :: Mode
|
|
|
|
}
|
|
|
|
--deriving Show
|
|
|
|
|
|
|
|
makeLenses ''BrickState
|