{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE TypeFamilies #-}
module GI.Gtk.Declarative.Container.Class where
import Data.Int (Int32)
import Data.Vector (Vector)
import qualified GI.Gtk as Gtk
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 ~ Vector => (Gtk.ManagedPtr widget -> widget) -> parent (child event) -> Children child event
toChildren _ = Children