    {-# LINE 2 "./Graphics/UI/Gtk/Ornaments/Frame.chs" #-}
    -- -*-haskell-*-
    -- GIMP Toolkit (GTK) Widget Frame
    --
    -- Author : Axel Simon
    --
    -- Created: 15 May 2001
    --
    -- Copyright (C) 1999-2005 Axel Simon
    --
    -- This library is free software; you can redistribute it and/or
    -- modify it under the terms of the GNU Lesser General Public
    -- License as published by the Free Software Foundation; either
    -- version 2.1 of the License, or (at your option) any later version.
    --
    -- This library is distributed in the hope that it will be useful,
    -- but WITHOUT ANY WARRANTY; without even the implied warranty of
    -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    -- Lesser General Public License for more details.
    --
    -- |
    -- Maintainer : gtk2hs-users@lists.sourceforge.net
    -- Stability : provisional
    -- Portability : portable (depends on GHC)
    --
    -- A bin with a decorative frame and optional label
    --
    module Graphics.UI.Gtk.Ornaments.Frame (
    -- * Detail
    --
    -- | The frame widget is a Bin that surrounds its child with a decorative
    -- frame and an optional label. If present, the label is drawn in a gap in the
    -- top side of the frame. The position of the label can be controlled with
    -- 'frameSetLabelAlign'.

    -- * Class Hierarchy
    -- |
    -- @
    -- | 'GObject'
    -- | +----'Object'
    -- | +----'Widget'
    -- | +----'Container'
    -- | +----'Bin'
    -- | +----Frame
    -- | +----'AspectFrame'
    -- @

    -- * Types
      Frame,
      FrameClass,
      castToFrame, gTypeFrame,
      toFrame,

    -- * Constructors
      frameNew,

    -- * Methods
      frameSetLabel,
      frameGetLabel,
      frameSetLabelWidget,
      frameGetLabelWidget,
      frameSetLabelAlign,
      frameGetLabelAlign,
      ShadowType(..),
      frameSetShadowType,
      frameGetShadowType,

    -- * Attributes
      frameLabel,
      frameLabelXAlign,
      frameLabelYAlign,
      frameShadowType,
      frameLabelWidget,
      ) where

    import Control.Monad (liftM)

    import System.Glib.FFI
    import System.Glib.UTFString
    import System.Glib.Attributes
    import System.Glib.Properties
    import Graphics.UI.Gtk.Abstract.Object (makeNewObject)
    import Graphics.UI.Gtk.Types
    {-# LINE 84 "./Graphics/UI/Gtk/Ornaments/Frame.chs" #-}
    import Graphics.UI.Gtk.General.Enums (ShadowType(..))

    {-# LINE 87 "./Graphics/UI/Gtk/Ornaments/Frame.chs" #-}

    --------------------
    -- Constructors

    -- | Creates a new 'Frame' without a label.
    --
    -- * A label can later be set by calling 'frameSetLabel'.
    --
    frameNew :: IO Frame
    frameNew :: IO Frame
    frameNew =
      (ForeignPtr Frame -> Frame, FinalizerPtr Frame)
    -> IO (Ptr Frame) -> IO Frame
    forall obj.
    GObjectClass obj =>
    (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
    makeNewObject (ForeignPtr Frame -> Frame, FinalizerPtr Frame)
    forall {a}. (ForeignPtr Frame -> Frame, FinalizerPtr a)
    mkFrame (IO (Ptr Frame) -> IO Frame) -> IO (Ptr Frame) -> IO Frame
    forall a b. (a -> b) -> a -> b
    $
      (Ptr Widget -> Ptr Frame) -> IO (Ptr Widget) -> IO (Ptr Frame)
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM (Ptr Widget -> Ptr Frame
    forall a b. Ptr a -> Ptr b
    castPtr :: Ptr Widget -> Ptr Frame) (IO (Ptr Widget) -> IO (Ptr Frame))
    -> IO (Ptr Widget) -> IO (Ptr Frame)
    forall a b. (a -> b) -> a -> b
    $
      Ptr CChar -> IO (Ptr Widget)
    gtk_frame_new
    {-# LINE 100 "./Graphics/UI/Gtk/Ornaments/Frame.chs" #-}
        nullPtr

    --------------------
    -- Methods

    -- | Sets the text of the label.
    --
    frameSetLabel :: (FrameClass self, GlibString string) => self
     -> string -- ^ @label@ - the text to use as the label of the frame
     -> IO ()
    frameSetLabel :: forall self string.
    (FrameClass self, GlibString string) =>
    self -> string -> IO ()
    frameSetLabel self
    self string
    label =
      string -> (Ptr CChar -> IO ()) -> IO ()
    forall a. string -> (Ptr CChar -> IO a) -> IO a
    forall s a. GlibString s => s -> (Ptr CChar -> IO a) -> IO a
    withUTFString string
    label ((Ptr CChar -> IO ()) -> IO ()) -> (Ptr CChar -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr CChar
    labelPtr ->
      (\(Frame ForeignPtr Frame
    arg1) Ptr CChar
    arg2 -> ForeignPtr Frame -> (Ptr Frame -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr Frame
    arg1 ((Ptr Frame -> IO ()) -> IO ()) -> (Ptr Frame -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr Frame
    argPtr1 ->Ptr Frame -> Ptr CChar -> IO ()
    gtk_frame_set_label Ptr Frame
    argPtr1 Ptr CChar
    arg2)
    {-# LINE 113 "./Graphics/UI/Gtk/Ornaments/Frame.chs" #-}
        (toFrame self)
        Ptr CChar
    labelPtr

    -- | Sets the label widget for the frame. This is the widget that will appear
    -- embedded in the top edge of the frame as a title.
    --
    frameSetLabelWidget :: (FrameClass self, WidgetClass labelWidget) => self
     -> labelWidget
     -> IO ()
    frameSetLabelWidget :: forall self labelWidget.
    (FrameClass self, WidgetClass labelWidget) =>
    self -> labelWidget -> IO ()
    frameSetLabelWidget self
    self labelWidget
    labelWidget =
      (\(Frame ForeignPtr Frame
    arg1) (Widget ForeignPtr Widget
    arg2) -> ForeignPtr Frame -> (Ptr Frame -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr Frame
    arg1 ((Ptr Frame -> IO ()) -> IO ()) -> (Ptr Frame -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr Frame
    argPtr1 ->ForeignPtr Widget -> (Ptr Widget -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr Widget
    arg2 ((Ptr Widget -> IO ()) -> IO ()) -> (Ptr Widget -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr Widget
    argPtr2 ->Ptr Frame -> Ptr Widget -> IO ()
    gtk_frame_set_label_widget Ptr Frame
    argPtr1 Ptr Widget
    argPtr2)
    {-# LINE 124 "./Graphics/UI/Gtk/Ornaments/Frame.chs" #-}
        (toFrame self)
        (labelWidget -> Widget
    forall o. WidgetClass o => o -> Widget
    toWidget labelWidget
    labelWidget)

    -- | Retrieves the label widget for the frame. See 'frameSetLabelWidget'.
    --
    frameGetLabelWidget :: FrameClass self => self
     -> IO (Maybe Widget) -- ^ returns the label widget, or @Nothing@ if there is
                          -- none.
    frameGetLabelWidget :: forall self. FrameClass self => self -> IO (Maybe Widget)
    frameGetLabelWidget self
    self =
      (IO (Ptr Widget) -> IO Widget)
    -> IO (Ptr Widget) -> IO (Maybe Widget)
    forall a. (IO (Ptr a) -> IO a) -> IO (Ptr a) -> IO (Maybe a)
    maybeNull ((ForeignPtr Widget -> Widget, FinalizerPtr Widget)
    -> IO (Ptr Widget) -> IO Widget
    forall obj.
    GObjectClass obj =>
    (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
    makeNewObject (ForeignPtr Widget -> Widget, FinalizerPtr Widget)
    forall {a}. (ForeignPtr Widget -> Widget, FinalizerPtr a)
    mkWidget) (IO (Ptr Widget) -> IO (Maybe Widget))
    -> IO (Ptr Widget) -> IO (Maybe Widget)
    forall a b. (a -> b) -> a -> b
    $
      (\(Frame ForeignPtr Frame
    arg1) -> ForeignPtr Frame
    -> (Ptr Frame -> IO (Ptr Widget)) -> IO (Ptr Widget)
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr Frame
    arg1 ((Ptr Frame -> IO (Ptr Widget)) -> IO (Ptr Widget))
    -> (Ptr Frame -> IO (Ptr Widget)) -> IO (Ptr Widget)
    forall a b. (a -> b) -> a -> b
    $ \Ptr Frame
    argPtr1 ->Ptr Frame -> IO (Ptr Widget)
    gtk_frame_get_label_widget Ptr Frame
    argPtr1)
    {-# LINE 135 "./Graphics/UI/Gtk/Ornaments/Frame.chs" #-}
        (toFrame self)

    -- | Sets the alignment of the frame widget's label. The default values for a
    -- newly created frame are 0.0 and 0.5.
    --
    frameSetLabelAlign :: FrameClass self => self
     -> Float -- ^ @xalign@ - The position of the label along the top edge of the
              -- widget. A value of 0.0 represents left alignment; 1.0 represents
              -- right alignment.
     -> Float -- ^ @yalign@ - The y alignment of the label. A value of 0.0 aligns
              -- under the frame; 1.0 aligns above the frame.
     -> IO ()
    frameSetLabelAlign :: forall self. FrameClass self => self -> Float -> Float -> IO ()
    frameSetLabelAlign self
    self Float
    xalign Float
    yalign =
      (\(Frame ForeignPtr Frame
    arg1) CFloat
    arg2 CFloat
    arg3 -> ForeignPtr Frame -> (Ptr Frame -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr Frame
    arg1 ((Ptr Frame -> IO ()) -> IO ()) -> (Ptr Frame -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr Frame
    argPtr1 ->Ptr Frame -> CFloat -> CFloat -> IO ()
    gtk_frame_set_label_align Ptr Frame
    argPtr1 CFloat
    arg2 CFloat
    arg3)
    {-# LINE 149 "./Graphics/UI/Gtk/Ornaments/Frame.chs" #-}
        (toFrame 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)

    -- | Retrieves the X and Y alignment of the frame's label. See
    -- 'frameSetLabelAlign'.
    --
    frameGetLabelAlign :: FrameClass self => self
     -> IO (Float, Float) -- ^ @(xalign, yalign)@
    frameGetLabelAlign :: forall self. FrameClass self => self -> IO (Float, Float)
    frameGetLabelAlign self
    self =
      (Ptr CFloat -> IO (Float, Float)) -> IO (Float, Float)
    forall a b. Storable a => (Ptr a -> IO b) -> IO b
    alloca ((Ptr CFloat -> IO (Float, Float)) -> IO (Float, Float))
    -> (Ptr CFloat -> IO (Float, Float)) -> IO (Float, Float)
    forall a b. (a -> b) -> a -> b
    $ \Ptr CFloat
    xalignPtr ->
      (Ptr CFloat -> IO (Float, Float)) -> IO (Float, Float)
    forall a b. Storable a => (Ptr a -> IO b) -> IO b
    alloca ((Ptr CFloat -> IO (Float, Float)) -> IO (Float, Float))
    -> (Ptr CFloat -> IO (Float, Float)) -> IO (Float, Float)
    forall a b. (a -> b) -> a -> b
    $ \Ptr CFloat
    yalignPtr -> do
      (\(Frame ForeignPtr Frame
    arg1) Ptr CFloat
    arg2 Ptr CFloat
    arg3 -> ForeignPtr Frame -> (Ptr Frame -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr Frame
    arg1 ((Ptr Frame -> IO ()) -> IO ()) -> (Ptr Frame -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr Frame
    argPtr1 ->Ptr Frame -> Ptr CFloat -> Ptr CFloat -> IO ()
    gtk_frame_get_label_align Ptr Frame
    argPtr1 Ptr CFloat
    arg2 Ptr CFloat
    arg3)
    {-# LINE 162 "./Graphics/UI/Gtk/Ornaments/Frame.chs" #-}
        (toFrame self)
        Ptr CFloat
    xalignPtr
        Ptr CFloat
    yalignPtr
      xalign <- Ptr CFloat -> IO CFloat
    forall a. Storable a => Ptr a -> IO a
    peek Ptr CFloat
    xalignPtr
      yalign <- peek yalignPtr
      return (realToFrac xalign, realToFrac yalign)

    -- | Sets the shadow type of the frame.
    --
    frameSetShadowType :: FrameClass self => self -> ShadowType -> IO ()
    frameSetShadowType :: forall self. FrameClass self => self -> ShadowType -> IO ()
    frameSetShadowType self
    self ShadowType
    type_ =
      (\(Frame ForeignPtr Frame
    arg1) CInt
    arg2 -> ForeignPtr Frame -> (Ptr Frame -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr Frame
    arg1 ((Ptr Frame -> IO ()) -> IO ()) -> (Ptr Frame -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr Frame
    argPtr1 ->Ptr Frame -> CInt -> IO ()
    gtk_frame_set_shadow_type Ptr Frame
    argPtr1 CInt
    arg2)
    {-# LINE 174 "./Graphics/UI/Gtk/Ornaments/Frame.chs" #-}
        (toFrame self)
        ((Int -> CInt
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral (Int -> CInt) -> (ShadowType -> Int) -> ShadowType -> CInt
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ShadowType -> Int
    forall a. Enum a => a -> Int
    fromEnum) ShadowType
    type_)

    -- | Retrieves the shadow type of the frame. See 'frameSetShadowType'.
    --
    frameGetShadowType :: FrameClass self => self -> IO ShadowType
    frameGetShadowType :: forall self. FrameClass self => self -> IO ShadowType
    frameGetShadowType self
    self =
      (CInt -> ShadowType) -> IO CInt -> IO ShadowType
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM (Int -> ShadowType
    forall a. Enum a => Int -> a
    toEnum (Int -> ShadowType) -> (CInt -> Int) -> CInt -> ShadowType
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . CInt -> Int
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral) (IO CInt -> IO ShadowType) -> IO CInt -> IO ShadowType
    forall a b. (a -> b) -> a -> b
    $
      (\(Frame ForeignPtr Frame
    arg1) -> ForeignPtr Frame -> (Ptr Frame -> IO CInt) -> IO CInt
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr Frame
    arg1 ((Ptr Frame -> IO CInt) -> IO CInt)
    -> (Ptr Frame -> IO CInt) -> IO CInt
    forall a b. (a -> b) -> a -> b
    $ \Ptr Frame
    argPtr1 ->Ptr Frame -> IO CInt
    gtk_frame_get_shadow_type Ptr Frame
    argPtr1)
    {-# LINE 183 "./Graphics/UI/Gtk/Ornaments/Frame.chs" #-}
        (toFrame self)

    -- | If the frame's label widget is a 'Label', returns the text in the label
    -- widget.
    --
    frameGetLabel :: (FrameClass self, GlibString string) => self
     -> IO string -- ^ returns the text in the label, or if there was no label
                  -- widget or the label widget was not a 'Label' then an
                  -- exception is thrown
    frameGetLabel :: forall self string.
    (FrameClass self, GlibString string) =>
    self -> IO string
    frameGetLabel self
    self =
      String -> IO (Ptr CChar) -> IO (Ptr CChar)
    forall a. String -> IO (Ptr a) -> IO (Ptr a)
    throwIfNull String
    "frameGetLabel: the title of the frame was not a Label widget."
      ((\(Frame ForeignPtr Frame
    arg1) -> ForeignPtr Frame -> (Ptr Frame -> IO (Ptr CChar)) -> IO (Ptr CChar)
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr Frame
    arg1 ((Ptr Frame -> IO (Ptr CChar)) -> IO (Ptr CChar))
    -> (Ptr Frame -> IO (Ptr CChar)) -> IO (Ptr CChar)
    forall a b. (a -> b) -> a -> b
    $ \Ptr Frame
    argPtr1 ->Ptr Frame -> IO (Ptr CChar)
    gtk_frame_get_label Ptr Frame
    argPtr1)
    {-# LINE 195 "./Graphics/UI/Gtk/Ornaments/Frame.chs" #-}
        (toFrame self))
      IO (Ptr CChar) -> (Ptr CChar -> IO string) -> IO string
    forall a b. IO a -> (a -> IO b) -> IO b
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Ptr CChar -> IO string
    forall s. GlibString s => Ptr CChar -> IO s
    peekUTFString

    --------------------
    -- Attributes

    -- | Text of the frame's label.
    --
    frameLabel :: (FrameClass self, GlibString string) => Attr self string
    frameLabel :: forall self string.
    (FrameClass self, GlibString string) =>
    Attr self string
    frameLabel = (self -> IO string)
    -> (self -> string -> IO ()) -> ReadWriteAttr self string string
    forall o a b.
    (o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b
    newAttr
      self -> IO string
    forall self string.
    (FrameClass self, GlibString string) =>
    self -> IO string
    frameGetLabel
      self -> string -> IO ()
    forall self string.
    (FrameClass self, GlibString string) =>
    self -> string -> IO ()
    frameSetLabel

    -- | The horizontal alignment of the label.
    --
    -- Allowed values: [0,1]
    --
    -- Default value: 0.5
    --
    frameLabelXAlign :: FrameClass self => Attr self Float
    frameLabelXAlign :: forall self. FrameClass self => Attr self Float
    frameLabelXAlign = String -> Attr self Float
    forall gobj. GObjectClass gobj => String -> Attr gobj Float
    newAttrFromFloatProperty String
    "label-xalign"

    -- | The vertical alignment of the label.
    --
    -- Allowed values: [0,1]
    --
    -- Default value: 0.5
    --
    frameLabelYAlign :: FrameClass self => Attr self Float
    frameLabelYAlign :: forall self. FrameClass self => Attr self Float
    frameLabelYAlign = String -> Attr self Float
    forall gobj. GObjectClass gobj => String -> Attr gobj Float
    newAttrFromFloatProperty String
    "label-yalign"

    -- | Appearance of the frame border.
    --
    -- Default value: 'ShadowEtchedIn'
    --
    frameShadowType :: FrameClass self => Attr self ShadowType
    frameShadowType :: forall self. FrameClass self => Attr self ShadowType
    frameShadowType = (self -> IO ShadowType)
    -> (self -> ShadowType -> IO ())
    -> ReadWriteAttr self ShadowType ShadowType
    forall o a b.
    (o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b
    newAttr
      self -> IO ShadowType
    forall self. FrameClass self => self -> IO ShadowType
    frameGetShadowType
      self -> ShadowType -> IO ()
    forall self. FrameClass self => self -> ShadowType -> IO ()
    frameSetShadowType

    -- | A widget to display in place of the usual frame label.
    --
    frameLabelWidget :: (FrameClass self, WidgetClass labelWidget) => ReadWriteAttr self (Maybe Widget) labelWidget
    frameLabelWidget :: forall self labelWidget.
    (FrameClass self, WidgetClass labelWidget) =>
    ReadWriteAttr self (Maybe Widget) labelWidget
    frameLabelWidget = (self -> IO (Maybe Widget))
    -> (self -> labelWidget -> IO ())
    -> ReadWriteAttr self (Maybe Widget) labelWidget
    forall o a b.
    (o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b
    newAttr
      self -> IO (Maybe Widget)
    forall self. FrameClass self => self -> IO (Maybe Widget)
    frameGetLabelWidget
      self -> labelWidget -> IO ()
    forall self labelWidget.
    (FrameClass self, WidgetClass labelWidget) =>
    self -> labelWidget -> IO ()
    frameSetLabelWidget

    foreign import ccall unsafe "gtk_frame_new"
      gtk_frame_new :: ((Ptr CChar) -> (IO (Ptr Widget)))

    foreign import ccall safe "gtk_frame_set_label"
      gtk_frame_set_label :: ((Ptr Frame) -> ((Ptr CChar) -> (IO ())))

    foreign import ccall safe "gtk_frame_set_label_widget"
      gtk_frame_set_label_widget :: ((Ptr Frame) -> ((Ptr Widget) -> (IO ())))

    foreign import ccall safe "gtk_frame_get_label_widget"
      gtk_frame_get_label_widget :: ((Ptr Frame) -> (IO (Ptr Widget)))

    foreign import ccall safe "gtk_frame_set_label_align"
      gtk_frame_set_label_align :: ((Ptr Frame) -> (CFloat -> (CFloat -> (IO ()))))

    foreign import ccall unsafe "gtk_frame_get_label_align"
      gtk_frame_get_label_align :: ((Ptr Frame) -> ((Ptr CFloat) -> ((Ptr CFloat) -> (IO ()))))

    foreign import ccall safe "gtk_frame_set_shadow_type"
      gtk_frame_set_shadow_type :: ((Ptr Frame) -> (CInt -> (IO ())))

    foreign import ccall unsafe "gtk_frame_get_shadow_type"
      gtk_frame_get_shadow_type :: ((Ptr Frame) -> (IO CInt))

    foreign import ccall unsafe "gtk_frame_get_label"
      gtk_frame_get_label :: ((Ptr Frame) -> (IO (Ptr CChar)))