Move Single, Container and Composite to Widgets package

This commit is contained in:
Francisco Vallarino 2020-10-05 16:59:29 -03:00
parent 3fe72d9b2d
commit 33b66b939e
21 changed files with 21 additions and 20 deletions

View File

@ -19,7 +19,6 @@ import TextShow
import qualified Data.Sequence as Seq
import Monomer.Core.Composite
import Monomer.Core.Style
import Monomer.Core.Types
import Monomer.Core.Util

View File

@ -16,7 +16,6 @@ import Monomer.Core.Combinators
import Monomer.Core.Style
import Monomer.Graphics.Color
import Monomer.Main.Util
import Monomer.Core.Composite
import Monomer.Core.Types
import Monomer.Core.Util
import Monomer.Widgets

View File

@ -23,7 +23,6 @@ import qualified SDL
import qualified Data.Sequence as Seq
import Monomer.Core.BasicTypes
import Monomer.Core.Composite
import Monomer.Core.Style
import Monomer.Core.Types
import Monomer.Event.Core
@ -36,6 +35,7 @@ import Monomer.Main.Util
import Monomer.Main.WidgetTask
import Monomer.Graphics.NanoVGRenderer
import Monomer.Graphics.Types
import Monomer.Widgets.Composite
data MainLoopArgs s e = MainLoopArgs {
_mlOS :: Text,

View File

@ -2,6 +2,7 @@ module Monomer.Widgets (
module Monomer.Widgets.Box,
module Monomer.Widgets.Button,
module Monomer.Widgets.Checkbox,
module Monomer.Widgets.Composite,
module Monomer.Widgets.Dropdown,
module Monomer.Widgets.FloatingField,
module Monomer.Widgets.Grid,
@ -20,6 +21,7 @@ module Monomer.Widgets (
import Monomer.Widgets.Box
import Monomer.Widgets.Button
import Monomer.Widgets.Checkbox
import Monomer.Widgets.Composite
import Monomer.Widgets.Dropdown
import Monomer.Widgets.FloatingField
import Monomer.Widgets.Grid

View File

@ -15,12 +15,12 @@ import Data.Maybe
import qualified Data.Sequence as Seq
import Monomer.Core.BasicTypes
import Monomer.Core.BaseContainer
import Monomer.Core.Combinators
import Monomer.Core.Internal
import Monomer.Core.Types
import Monomer.Core.Util
import Monomer.Event.Types
import Monomer.Widgets.Container
data BoxCfg s e = BoxCfg {
_boxExpandContent :: Maybe Bool,

View File

@ -12,7 +12,6 @@ import Data.Default
import Data.Maybe
import Data.Text (Text)
import Monomer.Core.BaseSingle
import Monomer.Core.BasicTypes
import Monomer.Core.Combinators
import Monomer.Core.Style
@ -21,6 +20,7 @@ import Monomer.Core.Util
import Monomer.Event.Types
import Monomer.Graphics.Drawing
import Monomer.Graphics.Types
import Monomer.Widgets.Single
data ButtonCfg s e = ButtonCfg {
_btnTextOverflow :: Maybe TextOverflow,

View File

@ -15,7 +15,6 @@ import Control.Monad
import Data.Default
import Data.Text (Text)
import Monomer.Core.BaseSingle
import Monomer.Core.BasicTypes
import Monomer.Core.Combinators
import Monomer.Core.Style
@ -26,6 +25,7 @@ import Monomer.Event.Keyboard
import Monomer.Event.Types
import Monomer.Graphics.Drawing
import Monomer.Graphics.Types
import Monomer.Widgets.Single
data CheckboxCfg s e = CheckboxCfg {
_ckcOnChange :: [Bool -> e],

View File

@ -2,7 +2,7 @@
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE RecordWildCards #-}
module Monomer.Core.Composite (
module Monomer.Widgets.Composite (
EventResponse(..),
EventHandler,
UIBuilder,

View File

@ -4,7 +4,7 @@
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Monomer.Core.BaseContainer (
module Monomer.Widgets.Container (
Container(..),
createContainer,
initWrapper,

View File

@ -24,7 +24,6 @@ import Data.Typeable (Typeable, cast)
import qualified Data.Map as M
import qualified Data.Sequence as Seq
import Monomer.Core.BaseContainer
import Monomer.Core.BasicTypes
import Monomer.Core.Combinators
import Monomer.Core.Internal
@ -36,6 +35,7 @@ import Monomer.Event.Types
import Monomer.Graphics.Color
import Monomer.Graphics.Drawing
import Monomer.Graphics.Types
import Monomer.Widgets.Container
import Monomer.Widgets.Label
import Monomer.Widgets.ListView

View File

@ -9,12 +9,12 @@ import Data.Sequence (Seq(..), (|>))
import qualified Data.Sequence as Seq
import Monomer.Core.BaseContainer
import Monomer.Core.BasicTypes
import Monomer.Core.Internal
import Monomer.Core.Style
import Monomer.Core.Types
import Monomer.Core.Util
import Monomer.Widgets.Container
hgrid :: (Traversable t) => t (WidgetInstance s e) -> WidgetInstance s e
hgrid children = (defaultWidgetInstance "hgrid" (makeFixedGrid True)) {

View File

@ -26,7 +26,6 @@ import qualified Codec.Picture as Pic
import qualified Data.ByteString.Lazy as BSL
import qualified Network.Wreq as Wreq
import Monomer.Core.BaseSingle
import Monomer.Core.BasicTypes
import Monomer.Core.Combinators
import Monomer.Core.Style
@ -34,6 +33,7 @@ import Monomer.Core.Types
import Monomer.Core.Util
import Monomer.Graphics.Drawing
import Monomer.Graphics.Types
import Monomer.Widgets.Single
data ImageFit
= FitNone

View File

@ -18,7 +18,6 @@ import Data.Typeable
import qualified Data.Sequence as Seq
import qualified Data.Text as T
import Monomer.Core.BaseSingle
import Monomer.Core.BasicTypes
import Monomer.Core.Style
import Monomer.Core.StyleUtil
@ -28,6 +27,7 @@ import Monomer.Event.Keyboard
import Monomer.Event.Types
import Monomer.Graphics.Drawing
import Monomer.Graphics.Types
import Monomer.Widgets.Single
import qualified Monomer.Core.Lens.Style as S

View File

@ -8,7 +8,6 @@ import Data.Default
import Data.Maybe
import Data.Text (Text)
import Monomer.Core.BaseSingle
import Monomer.Core.BasicTypes
import Monomer.Core.Combinators
import Monomer.Core.Style
@ -16,6 +15,7 @@ import Monomer.Core.Types
import Monomer.Core.Util
import Monomer.Graphics.Drawing
import Monomer.Graphics.Types
import Monomer.Widgets.Single
newtype LabelCfg = LabelCfg {
_lscTextOverflow :: Maybe TextOverflow

View File

@ -24,7 +24,6 @@ import Data.Typeable (Typeable, cast)
import qualified Data.Sequence as Seq
import Monomer.Core.BaseContainer
import Monomer.Core.BasicTypes
import Monomer.Core.Combinators
import Monomer.Core.Style
@ -36,6 +35,7 @@ import Monomer.Graphics.Color
import Monomer.Graphics.Drawing
import Monomer.Graphics.Types
import Monomer.Widgets.Box
import Monomer.Widgets.Container
import Monomer.Widgets.Label
import Monomer.Widgets.Scroll
import Monomer.Widgets.Spacer

View File

@ -15,7 +15,6 @@ import Control.Monad
import Data.Default
import Data.Text (Text)
import Monomer.Core.BaseSingle
import Monomer.Core.BasicTypes
import Monomer.Core.Combinators
import Monomer.Core.Style
@ -26,6 +25,7 @@ import Monomer.Event.Keyboard
import Monomer.Event.Types
import Monomer.Graphics.Drawing
import Monomer.Graphics.Types
import Monomer.Widgets.Single
data RadioCfg s e a = RadioCfg {
_rdcOnChange :: [a -> e],

View File

@ -19,7 +19,6 @@ import Data.Typeable
import qualified Data.Sequence as Seq
import Monomer.Core.BaseContainer
import Monomer.Core.BasicTypes
import Monomer.Core.Internal
import Monomer.Core.Style
@ -29,6 +28,7 @@ import Monomer.Event.Types
import Monomer.Graphics.Color
import Monomer.Graphics.Drawing
import Monomer.Graphics.Types
import Monomer.Widgets.Container
data ActiveBar
= HBar

View File

@ -2,7 +2,7 @@
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RecordWildCards #-}
module Monomer.Core.BaseSingle (
module Monomer.Widgets.Single (
Single(..),
createSingle
) where

View File

@ -7,12 +7,12 @@ import Control.Applicative ((<|>))
import Data.Default
import Data.Maybe
import Monomer.Core.BaseSingle
import Monomer.Core.BasicTypes
import Monomer.Core.Combinators
import Monomer.Core.Style
import Monomer.Core.Types
import Monomer.Core.Util
import Monomer.Widgets.Single
data SpacerCfg = SpacerCfg {
_spcWidth :: Maybe Double,

View File

@ -10,12 +10,12 @@ import Data.Sequence (Seq(..), (<|), (|>))
import qualified Data.Sequence as Seq
import Monomer.Core.BaseContainer
import Monomer.Core.BasicTypes
import Monomer.Core.Internal
import Monomer.Core.Style
import Monomer.Core.Types
import Monomer.Core.Util
import Monomer.Widgets.Container
hstack :: (Traversable t) => t (WidgetInstance s e) -> WidgetInstance s e
hstack children = (defaultWidgetInstance "hstack" (makeStack True)) {

View File

@ -200,7 +200,8 @@
- Widget.Widgets moved to Widget?
- WidgetCombinators and StyleCombinators merged into a single Combinators?
- Create Lens package. BasicTypes lenses should also be there
- Create separate Util/WidgetUtil
- Create separate Util/WidgetUtil (rename Types to WidgetTypes)
- Simplify imports
- WidgetRequest for error messages? Probably not worth it
- Maybe provide a config where a notification/lens can be sent?
- Make sure that focus change requests do not leave overlay if active (most likely an if clause is needed in handleFocusChange)