{-# LINE 2 "./Graphics/UI/Gtk/Layout/AspectFrame.chs" #-}
module Graphics.UI.Gtk.Layout.AspectFrame (
AspectFrame,
AspectFrameClass,
castToAspectFrame, gTypeAspectFrame,
toAspectFrame,
aspectFrameNew,
aspectFrameSet,
aspectFrameXAlign,
aspectFrameYAlign,
aspectFrameRatio,
aspectFrameObeyChild,
) where
import Control.Monad (liftM)
import Data.Maybe (isNothing)
import System.Glib.FFI
import System.Glib.Attributes
import System.Glib.Properties
import Graphics.UI.Gtk.Abstract.Object (makeNewObject)
import Graphics.UI.Gtk.Types
{-# LINE 76 "./Graphics/UI/Gtk/Layout/AspectFrame.chs" #-}
{-# LINE 78 "./Graphics/UI/Gtk/Layout/AspectFrame.chs" #-}
aspectFrameNew ::
Float
-> Float
-> Maybe Float
-> IO AspectFrame
aspectFrameNew :: Float -> Float -> Maybe Float -> IO AspectFrame
aspectFrameNew Float
xalign Float
yalign Maybe Float
ratio =
(ForeignPtr AspectFrame -> AspectFrame, FinalizerPtr AspectFrame)
-> IO (Ptr AspectFrame) -> IO AspectFrame
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewObject (ForeignPtr AspectFrame -> AspectFrame, FinalizerPtr AspectFrame)
forall {a}. (ForeignPtr AspectFrame -> AspectFrame, FinalizerPtr a)
mkAspectFrame (IO (Ptr AspectFrame) -> IO AspectFrame)
-> IO (Ptr AspectFrame) -> IO AspectFrame
forall a b. (a -> b) -> a -> b
$
(Ptr Widget -> Ptr AspectFrame)
-> IO (Ptr Widget) -> IO (Ptr AspectFrame)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (Ptr Widget -> Ptr AspectFrame
forall a b. Ptr a -> Ptr b
castPtr :: Ptr Widget -> Ptr AspectFrame) (IO (Ptr Widget) -> IO (Ptr AspectFrame))
-> IO (Ptr Widget) -> IO (Ptr AspectFrame)
forall a b. (a -> b) -> a -> b
$
Ptr CChar -> CFloat -> CFloat -> CFloat -> CInt -> IO (Ptr Widget)
gtk_aspect_frame_new
{-# LINE 100 "./Graphics/UI/Gtk/Layout/AspectFrame.chs" #-}
nullPtr
(Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
xalign)
(Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
yalign)
(CFloat -> (Float -> CFloat) -> Maybe Float -> CFloat
forall b a. b -> (a -> b) -> Maybe a -> b
maybe CFloat
0.0 Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Maybe Float
ratio)
(Bool -> CInt
forall a. Num a => Bool -> a
fromBool (Bool -> CInt) -> Bool -> CInt
forall a b. (a -> b) -> a -> b
$ Maybe Float -> Bool
forall a. Maybe a -> Bool
isNothing Maybe Float
ratio)
aspectFrameSet :: AspectFrameClass self => self
-> Float
-> Float
-> Maybe Float
-> IO ()
aspectFrameSet :: forall self.
AspectFrameClass self =>
self -> Float -> Float -> Maybe Float -> IO ()
aspectFrameSet self
self Float
xalign Float
yalign Maybe Float
ratio =
(\(AspectFrame ForeignPtr AspectFrame
arg1) CFloat
arg2 CFloat
arg3 CFloat
arg4 CInt
arg5 -> ForeignPtr AspectFrame -> (Ptr AspectFrame -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr AspectFrame
arg1 ((Ptr AspectFrame -> IO ()) -> IO ())
-> (Ptr AspectFrame -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr AspectFrame
argPtr1 ->Ptr AspectFrame -> CFloat -> CFloat -> CFloat -> CInt -> IO ()
gtk_aspect_frame_set Ptr AspectFrame
argPtr1 CFloat
arg2 CFloat
arg3 CFloat
arg4 CInt
arg5)
{-# LINE 123 "./Graphics/UI/Gtk/Layout/AspectFrame.chs" #-}
(toAspectFrame self)
(Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
xalign)
(Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
yalign)
(CFloat -> (Float -> CFloat) -> Maybe Float -> CFloat
forall b a. b -> (a -> b) -> Maybe a -> b
maybe CFloat
0.0 Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Maybe Float
ratio)
(Bool -> CInt
forall a. Num a => Bool -> a
fromBool (Bool -> CInt) -> Bool -> CInt
forall a b. (a -> b) -> a -> b
$ Maybe Float -> Bool
forall a. Maybe a -> Bool
isNothing Maybe Float
ratio)
aspectFrameXAlign :: AspectFrameClass self => Attr self Float
aspectFrameXAlign :: forall self. AspectFrameClass self => Attr self Float
aspectFrameXAlign = String -> Attr self Float
forall gobj. GObjectClass gobj => String -> Attr gobj Float
newAttrFromFloatProperty String
"xalign"
aspectFrameYAlign :: AspectFrameClass self => Attr self Float
aspectFrameYAlign :: forall self. AspectFrameClass self => Attr self Float
aspectFrameYAlign = String -> Attr self Float
forall gobj. GObjectClass gobj => String -> Attr gobj Float
newAttrFromFloatProperty String
"yalign"
aspectFrameRatio :: AspectFrameClass self => Attr self Float
aspectFrameRatio :: forall self. AspectFrameClass self => Attr self Float
aspectFrameRatio = String -> Attr self Float
forall gobj. GObjectClass gobj => String -> Attr gobj Float
newAttrFromFloatProperty String
"ratio"
aspectFrameObeyChild :: AspectFrameClass self => Attr self Bool
aspectFrameObeyChild :: forall self. AspectFrameClass self => Attr self Bool
aspectFrameObeyChild = String -> Attr self Bool
forall gobj. GObjectClass gobj => String -> Attr gobj Bool
newAttrFromBoolProperty String
"obey-child"
foreign import ccall unsafe "gtk_aspect_frame_new"
gtk_aspect_frame_new :: ((Ptr CChar) -> (CFloat -> (CFloat -> (CFloat -> (CInt -> (IO (Ptr Widget)))))))
foreign import ccall safe "gtk_aspect_frame_set"
gtk_aspect_frame_set :: ((Ptr AspectFrame) -> (CFloat -> (CFloat -> (CFloat -> (CInt -> (IO ()))))))