{-# OPTIONS_GHC -fno-warn-orphans #-}

{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE UndecidableInstances  #-}

-- | Orphan instances for automatically converting between different
-- widget types. As these use 'UndecidableInstances', they are kept
-- here in solitary confinement.
module GI.Gtk.Declarative.Widget.Conversions where

import           GI.Gtk.Declarative.Container.Box
import           GI.Gtk.Declarative.Widget

-- | Any widget that can be converted to a 'Widget' can be wrapped
-- as a 'BoxChild' with the default properties.
instance FromWidget widget Widget => FromWidget widget BoxChild where
  fromWidget :: widget event -> BoxChild event
fromWidget = BoxChildProperties -> Widget event -> BoxChild event
forall event. BoxChildProperties -> Widget event -> BoxChild event
BoxChild BoxChildProperties
defaultBoxChildProperties (Widget event -> BoxChild event)
-> (widget event -> Widget event) -> widget event -> BoxChild event
forall b c a. (b -> c) -> (a -> b) -> a -> c
. widget event -> Widget event
forall (widget :: * -> *) (target :: * -> *) event.
FromWidget widget target =>
widget event -> target event
fromWidget