gi-gtk-declarative 0.4.1 → 0.4.2
raw patch · 7 files changed
+31/−27 lines, 7 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- GI.Gtk.Declarative.Container.Patch: instance GI.Gtk.Declarative.Container.Class.IsContainer GI.Gtk.Objects.Box.Box GI.Gtk.Declarative.Container.Box.BoxChild
- GI.Gtk.Declarative.Container.Patch: instance GI.Gtk.Declarative.Container.Class.IsContainer GI.Gtk.Objects.ListBox.ListBox (GI.Gtk.Declarative.Bin.Bin GI.Gtk.Objects.ListBoxRow.ListBoxRow)
- GI.Gtk.Declarative.Widget: instance (GI.Gtk.Declarative.Patch.Patchable (parent child), GHC.Base.Functor (parent child), GI.Gtk.Declarative.EventSource.EventSource (parent child)) => GI.Gtk.Declarative.Widget.FromWidget (parent child) GI.Gtk.Declarative.Widget.Widget
+ GI.Gtk.Declarative.Container.Box: instance GI.Gtk.Declarative.Container.Class.IsContainer GI.Gtk.Objects.Box.Box GI.Gtk.Declarative.Container.Box.BoxChild
+ GI.Gtk.Declarative.Container.ListBox: instance GI.Gtk.Declarative.Container.Class.IsContainer GI.Gtk.Objects.ListBox.ListBox (GI.Gtk.Declarative.Bin.Bin GI.Gtk.Objects.ListBoxRow.ListBoxRow)
+ GI.Gtk.Declarative.Widget: instance (Data.Typeable.Internal.Typeable parent, Data.Typeable.Internal.Typeable child, GI.Gtk.Declarative.Patch.Patchable (parent child), GHC.Base.Functor (parent child), GI.Gtk.Declarative.EventSource.EventSource (parent child)) => GI.Gtk.Declarative.Widget.FromWidget (parent child) GI.Gtk.Declarative.Widget.Widget
- GI.Gtk.Declarative: fromWidget :: (FromWidget widget target, Typeable widget, Typeable event) => widget event -> target event
+ GI.Gtk.Declarative: fromWidget :: FromWidget widget target => widget event -> target event
- GI.Gtk.Declarative.Widget: fromWidget :: (FromWidget widget target, Typeable widget, Typeable event) => widget event -> target event
+ GI.Gtk.Declarative.Widget: fromWidget :: FromWidget widget target => widget event -> target event
Files
- gi-gtk-declarative.cabal +1/−1
- src/GI/Gtk/Declarative/Bin.hs +5/−2
- src/GI/Gtk/Declarative/Container.hs +0/−2
- src/GI/Gtk/Declarative/Container/Box.hs +10/−1
- src/GI/Gtk/Declarative/Container/ListBox.hs +7/−0
- src/GI/Gtk/Declarative/Container/Patch.hs +1/−19
- src/GI/Gtk/Declarative/Widget.hs +7/−2
gi-gtk-declarative.cabal view
@@ -1,5 +1,5 @@ name: gi-gtk-declarative-version: 0.4.1+version: 0.4.2 synopsis: Declarative GTK+ programming in Haskell description: A declarative programming model for GTK+ user interfaces, implementing support for various widgets
src/GI/Gtk/Declarative/Bin.hs view
@@ -3,6 +3,7 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GADTs #-}+{-# LANGUAGE LambdaCase #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedLabels #-} {-# LANGUAGE ScopedTypeVariables #-}@@ -68,8 +69,8 @@ -- Patchable -- -instance Gtk.IsBin parent => Patchable (Bin parent) where- create (Bin ctor attrs child) = do+instance (Gtk.IsBin parent) => Patchable (Bin parent) where+ create (Bin (ctor :: Gtk.ManagedPtr w -> w) attrs child) = do let collected = collectAttributes attrs widget' <- Gtk.new ctor (constructProperties collected) Gtk.widgetShow widget'@@ -81,6 +82,7 @@ childState <- create child childWidget <- someStateWidget childState+ maybe (pure ()) Gtk.widgetDestroy =<< Gtk.binGetChild widget' Gtk.containerAdd widget' childWidget return (SomeState (StateTreeBin (StateTreeNode widget' sc collected ()) childState)) @@ -104,6 +106,7 @@ newChildState <- createNew childWidget <- someStateWidget newChildState Gtk.widgetShow childWidget+ maybe (pure ()) Gtk.widgetDestroy =<< Gtk.binGetChild binWidget Gtk.containerAdd binWidget childWidget return (SomeState (StateTreeBin top' newChildState)) Keep -> return (SomeState st)
src/GI/Gtk/Declarative/Container.hs view
@@ -1,7 +1,5 @@ {-# OPTIONS_GHC -fno-warn-unticked-promoted-constructors #-} {-# LANGUAGE DataKinds #-}-{-# LANGUAGE DefaultSignatures #-}-{-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GADTs #-}
src/GI/Gtk/Declarative/Container/Box.hs view
@@ -1,10 +1,11 @@-{-# OPTIONS_GHC -fno-warn-unticked-promoted-constructors -fno-warn-orphans #-}+{-# OPTIONS_GHC -fno-warn-orphans #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedLabels #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-}@@ -56,3 +57,11 @@ subscribe BoxChild{..} = subscribe child instance ToChildren Gtk.Box Vector BoxChild++instance IsContainer Gtk.Box BoxChild where+ appendChild box BoxChild {properties = BoxChildProperties {expand, fill, padding}} widget' =+ Gtk.boxPackStart box widget' expand fill padding+ replaceChild box boxChild' i old new = do+ Gtk.widgetDestroy old+ appendChild box boxChild' new+ Gtk.boxReorderChild box new i
src/GI/Gtk/Declarative/Container/ListBox.hs view
@@ -11,4 +11,11 @@ import GI.Gtk.Declarative.Bin import GI.Gtk.Declarative.Container.Class +instance IsContainer Gtk.ListBox (Bin Gtk.ListBoxRow) where+ appendChild box _ widget' =+ Gtk.listBoxInsert box widget' (-1)+ replaceChild box _ i old new = do+ Gtk.widgetDestroy old+ Gtk.listBoxInsert box new i+ instance ToChildren Gtk.ListBox Vector (Bin Gtk.ListBoxRow)
src/GI/Gtk/Declarative/Container/Patch.hs view
@@ -1,4 +1,4 @@-{-# OPTIONS_GHC -fno-warn-unticked-promoted-constructors -fno-warn-orphans #-}+{-# OPTIONS_GHC -fno-warn-orphans #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-}@@ -9,7 +9,6 @@ {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedLabels #-} {-# LANGUAGE OverloadedLists #-}-{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-}@@ -26,8 +25,6 @@ import qualified Data.Vector as Vector import qualified GI.Gtk as Gtk -import GI.Gtk.Declarative.Bin-import GI.Gtk.Declarative.Container.Box import GI.Gtk.Declarative.Container.Class import GI.Gtk.Declarative.Patch import GI.Gtk.Declarative.State@@ -114,18 +111,3 @@ padMaybes :: Int -> Vector a -> Vector (Maybe a) padMaybes len xs = Vector.generate len (xs !?)--instance IsContainer Gtk.ListBox (Bin Gtk.ListBoxRow) where- appendChild box _ widget' =- Gtk.listBoxInsert box widget' (-1)- replaceChild box _ i old new = do- Gtk.widgetDestroy old- Gtk.listBoxInsert box new i--instance IsContainer Gtk.Box BoxChild where- appendChild box BoxChild {properties = BoxChildProperties {expand, fill, padding}} widget' =- Gtk.boxPackStart box widget' expand fill padding- replaceChild box boxChild' i old new = do- Gtk.widgetDestroy old- appendChild box boxChild' new- Gtk.boxReorderChild box new i
src/GI/Gtk/Declarative/Widget.hs view
@@ -55,8 +55,13 @@ -- some specifically typed widget, depending on the context in which it's -- used. class FromWidget widget target where- fromWidget :: (Typeable widget, Typeable event) => widget event -> target event+ fromWidget :: widget event -> target event -instance (Patchable (parent child), Functor (parent child), EventSource (parent child))+instance ( Typeable parent+ , Typeable child+ , Patchable (parent child)+ , Functor (parent child)+ , EventSource (parent child)+ ) => FromWidget (parent child) Widget where fromWidget = Widget