{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE TypeFamilies #-}
module GI.Gtk.Declarative.Container.Class where
import qualified GI.Gtk as Gtk
import Data.Vector (Vector)
import qualified Data.Vector as Vector
import Data.Int (Int32)
class IsContainer container child | container -> child where
appendChild
:: container
-> child event
-> Gtk.Widget
-> IO ()
replaceChild
:: container
-> child event
-> Int32
-> Gtk.Widget
-> Gtk.Widget
-> IO ()
newtype Children child event = Children { unChildren :: Vector (child event) }
deriving (Functor)
class ToChildren widget parent child | widget -> parent, widget -> child where
toChildren :: (Gtk.ManagedPtr widget -> widget) -> parent (child event) -> Children child event
default toChildren :: parent ~ [] => (Gtk.ManagedPtr widget -> widget) -> parent (child event) -> Children child event
toChildren _ = Children . Vector.fromList