    {-# LINE 2 "./Graphics/UI/Gtk/Display/LevelBar.chs" #-}
    -- -*-haskell-*-
    -- GIMP Toolkit (GTK) Widget LevelBar
    --
    -- Author : Vincent Hanquez
    --
    -- Copyright (C) 2014 Vincent Hanquez
    -- 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 widget which indicates progress visually
    --
    module Graphics.UI.Gtk.Display.LevelBar (
    -- * Detail
    --
    -- | The 'LevelBar' is typically used to display level indicator

    -- * Class Hierarchy
    -- |
    -- @
    -- | 'GObject'
    -- | +----'Object'
    -- | +----'Widget'
    -- | +----LevelBar
    -- @

    -- * Types

      LevelBar,
      LevelBarClass,
      castToLevelBar, gTypeLevelBar,
      toLevelBar,

    -- * Constructors
      levelBarNew,

    -- * Methods
      levelBarSetMode,
      levelBarGetMode,
      levelBarAddOffsetValue,
      levelBarRemoveOffsetValue,
      levelBarGetOffsetValue,

    -- * Attributes

      levelBarInverted,

      levelBarMaxValue,
      levelBarMinValue,
      levelBarValue,
      levelBarMode

      ) 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 78 "./Graphics/UI/Gtk/Display/LevelBar.chs" #-}
    import Graphics.UI.Gtk.General.Enums (LevelBarMode(..))

    {-# LINE 81 "./Graphics/UI/Gtk/Display/LevelBar.chs" #-}

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

    -- | Creates a new 'LevelBar'.
    --
    levelBarNew :: IO LevelBar
    levelBarNew :: IO LevelBar
    levelBarNew =
      (ForeignPtr LevelBar -> LevelBar, FinalizerPtr LevelBar)
    -> IO (Ptr LevelBar) -> IO LevelBar
    forall obj.
    GObjectClass obj =>
    (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
    makeNewObject (ForeignPtr LevelBar -> LevelBar, FinalizerPtr LevelBar)
    forall {a}. (ForeignPtr LevelBar -> LevelBar, FinalizerPtr a)
    mkLevelBar (IO (Ptr LevelBar) -> IO LevelBar)
    -> IO (Ptr LevelBar) -> IO LevelBar
    forall a b. (a -> b) -> a -> b
    $
      (Ptr Widget -> Ptr LevelBar)
    -> IO (Ptr Widget) -> IO (Ptr LevelBar)
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM (Ptr Widget -> Ptr LevelBar
    forall a b. Ptr a -> Ptr b
    castPtr :: Ptr Widget -> Ptr LevelBar) (IO (Ptr Widget) -> IO (Ptr LevelBar))
    -> IO (Ptr Widget) -> IO (Ptr LevelBar)
    forall a b. (a -> b) -> a -> b
    $
      IO (Ptr Widget)
    gtk_level_bar_new
    {-# LINE 92 "./Graphics/UI/Gtk/Display/LevelBar.chs" #-}

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

    -- | Sets the value of the "mode" property.
    --
    levelBarSetMode :: LevelBarClass self => self -> LevelBarMode -> IO ()
    levelBarSetMode :: forall self. LevelBarClass self => self -> LevelBarMode -> IO ()
    levelBarSetMode self
    self LevelBarMode
    mode =
      (\(LevelBar ForeignPtr LevelBar
    arg1) CInt
    arg2 -> ForeignPtr LevelBar -> (Ptr LevelBar -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr LevelBar
    arg1 ((Ptr LevelBar -> IO ()) -> IO ())
    -> (Ptr LevelBar -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr LevelBar
    argPtr1 ->Ptr LevelBar -> CInt -> IO ()
    gtk_level_bar_set_mode Ptr LevelBar
    argPtr1 CInt
    arg2) (self -> LevelBar
    forall o. LevelBarClass o => o -> LevelBar
    toLevelBar self
    self) ((Int -> CInt
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral (Int -> CInt) -> (LevelBarMode -> Int) -> LevelBarMode -> CInt
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . LevelBarMode -> Int
    forall a. Enum a => a -> Int
    fromEnum) LevelBarMode
    mode)

    -- | Returns the value of the "mode" property.
    levelBarGetMode :: LevelBarClass self => self -> IO LevelBarMode
    levelBarGetMode :: forall self. LevelBarClass self => self -> IO LevelBarMode
    levelBarGetMode self
    self =
      (CInt -> LevelBarMode) -> IO CInt -> IO LevelBarMode
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM (Int -> LevelBarMode
    forall a. Enum a => Int -> a
    toEnum (Int -> LevelBarMode) -> (CInt -> Int) -> CInt -> LevelBarMode
    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 LevelBarMode) -> IO CInt -> IO LevelBarMode
    forall a b. (a -> b) -> a -> b
    $
      (\(LevelBar ForeignPtr LevelBar
    arg1) -> ForeignPtr LevelBar -> (Ptr LevelBar -> IO CInt) -> IO CInt
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr LevelBar
    arg1 ((Ptr LevelBar -> IO CInt) -> IO CInt)
    -> (Ptr LevelBar -> IO CInt) -> IO CInt
    forall a b. (a -> b) -> a -> b
    $ \Ptr LevelBar
    argPtr1 ->Ptr LevelBar -> IO CInt
    gtk_level_bar_get_mode Ptr LevelBar
    argPtr1)
    {-# LINE 107 "./Graphics/UI/Gtk/Display/LevelBar.chs" #-}
        (toLevelBar self)

    -- | Add a new offset marker at the position specified by @value
    --
    levelBarAddOffsetValue :: (LevelBarClass self, GlibString string) => self
     -> string -- ^ @name@ - Offset name
     -> Double -- ^ @value@ - Offset position
     -> IO ()
    levelBarAddOffsetValue :: forall self string.
    (LevelBarClass self, GlibString string) =>
    self -> string -> Double -> IO ()
    levelBarAddOffsetValue self
    self string
    name Double
    value =
      string -> (CString -> IO ()) -> IO ()
    forall a. string -> (CString -> IO a) -> IO a
    forall s a. GlibString s => s -> (CString -> IO a) -> IO a
    withUTFString string
    name ((CString -> IO ()) -> IO ()) -> (CString -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \CString
    namePtr ->
      (\(LevelBar ForeignPtr LevelBar
    arg1) CString
    arg2 CDouble
    arg3 -> ForeignPtr LevelBar -> (Ptr LevelBar -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr LevelBar
    arg1 ((Ptr LevelBar -> IO ()) -> IO ())
    -> (Ptr LevelBar -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr LevelBar
    argPtr1 ->Ptr LevelBar -> CString -> CDouble -> IO ()
    gtk_level_bar_add_offset_value Ptr LevelBar
    argPtr1 CString
    arg2 CDouble
    arg3)
    {-# LINE 118 "./Graphics/UI/Gtk/Display/LevelBar.chs" #-}
        (toLevelBar self)
        CString
    namePtr
        (Double -> CDouble
    forall a b. (Real a, Fractional b) => a -> b
    realToFrac Double
    value)

    -- | Add a new offset marker at the position specified by @value
    --
    levelBarRemoveOffsetValue :: (LevelBarClass self, GlibString string) => self
     -> string
     -> IO ()
    levelBarRemoveOffsetValue :: forall self string.
    (LevelBarClass self, GlibString string) =>
    self -> string -> IO ()
    levelBarRemoveOffsetValue self
    self string
    name =
      string -> (CString -> IO ()) -> IO ()
    forall a. string -> (CString -> IO a) -> IO a
    forall s a. GlibString s => s -> (CString -> IO a) -> IO a
    withUTFString string
    name ((CString -> IO ()) -> IO ()) -> (CString -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \CString
    namePtr ->
      (\(LevelBar ForeignPtr LevelBar
    arg1) CString
    arg2 -> ForeignPtr LevelBar -> (Ptr LevelBar -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr LevelBar
    arg1 ((Ptr LevelBar -> IO ()) -> IO ())
    -> (Ptr LevelBar -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr LevelBar
    argPtr1 ->Ptr LevelBar -> CString -> IO ()
    gtk_level_bar_remove_offset_value Ptr LevelBar
    argPtr1 CString
    arg2)
    {-# LINE 130 "./Graphics/UI/Gtk/Display/LevelBar.chs" #-}
        (toLevelBar self)
        CString
    namePtr

    -- | Returns the current fraction of the task that's been completed.
    --
    levelBarGetOffsetValue :: (LevelBarClass self, GlibString string) => self
     -> string
     -> IO Double -- ^ returns the value of the offset
    levelBarGetOffsetValue :: forall self string.
    (LevelBarClass self, GlibString string) =>
    self -> string -> IO Double
    levelBarGetOffsetValue self
    self string
    name =
      (Ptr CDouble -> IO Double) -> IO Double
    forall a b. Storable a => (Ptr a -> IO b) -> IO b
    alloca ((Ptr CDouble -> IO Double) -> IO Double)
    -> (Ptr CDouble -> IO Double) -> IO Double
    forall a b. (a -> b) -> a -> b
    $ \Ptr CDouble
    dPtr ->
      string -> (CString -> IO Double) -> IO Double
    forall a. string -> (CString -> IO a) -> IO a
    forall s a. GlibString s => s -> (CString -> IO a) -> IO a
    withUTFString string
    name ((CString -> IO Double) -> IO Double)
    -> (CString -> IO Double) -> IO Double
    forall a b. (a -> b) -> a -> b
    $ \CString
    namePtr -> do
        (\(LevelBar ForeignPtr LevelBar
    arg1) CString
    arg2 Ptr CDouble
    arg3 -> ForeignPtr LevelBar -> (Ptr LevelBar -> IO CInt) -> IO CInt
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr LevelBar
    arg1 ((Ptr LevelBar -> IO CInt) -> IO CInt)
    -> (Ptr LevelBar -> IO CInt) -> IO CInt
    forall a b. (a -> b) -> a -> b
    $ \Ptr LevelBar
    argPtr1 ->Ptr LevelBar -> CString -> Ptr CDouble -> IO CInt
    gtk_level_bar_get_offset_value Ptr LevelBar
    argPtr1 CString
    arg2 Ptr CDouble
    arg3)
    {-# LINE 142 "./Graphics/UI/Gtk/Display/LevelBar.chs" #-}
          (toLevelBar self) CString
    namePtr Ptr CDouble
    dPtr
        (CDouble -> Double) -> IO CDouble -> IO Double
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM CDouble -> Double
    forall a b. (Real a, Fractional b) => a -> b
    realToFrac (IO CDouble -> IO Double) -> IO CDouble -> IO Double
    forall a b. (a -> b) -> a -> b
    $ Ptr CDouble -> IO CDouble
    forall a. Storable a => Ptr a -> IO a
    peek Ptr CDouble
    dPtr

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

    -- | Level bars normally grow from top to bottom or left to right. Inverted level bars grow in the opposite direction.
    --
    -- Default value: (0)
    --
    -- Since 3.8
    levelBarInverted :: LevelBarClass self => Attr self Bool
    levelBarInverted :: forall self. LevelBarClass self => Attr self Bool
    levelBarInverted = String -> Attr self Bool
    forall gobj. GObjectClass gobj => String -> Attr gobj Bool
    newAttrFromBoolProperty String
    "inverted"

    -- | The "value" property determines the currently filled value of the level bar.
    --
    -- Allowed values: >= 0
    --
    -- Default value: 0
    --
    levelBarValue :: LevelBarClass self => Attr self Double
    levelBarValue :: forall self. LevelBarClass self => Attr self Double
    levelBarValue = String -> Attr self Double
    forall gobj. GObjectClass gobj => String -> Attr gobj Double
    newAttrFromDoubleProperty String
    "value"

    -- | The "min-value" property determines the minimum value of the interval that can be displayed by the bar.
    --
    -- Allowed values: >= 0
    --
    -- Default value: 0
    --
    levelBarMinValue :: LevelBarClass self => Attr self Double
    levelBarMinValue :: forall self. LevelBarClass self => Attr self Double
    levelBarMinValue = String -> Attr self Double
    forall gobj. GObjectClass gobj => String -> Attr gobj Double
    newAttrFromDoubleProperty String
    "min-value"

    -- | The "max-value" property determaxes the maximum value of the interval that can be displayed by the bar.
    --
    -- Allowed values: >= 0
    --
    -- Default value: 1
    levelBarMaxValue :: LevelBarClass self => Attr self Double
    levelBarMaxValue :: forall self. LevelBarClass self => Attr self Double
    levelBarMaxValue = String -> Attr self Double
    forall gobj. GObjectClass gobj => String -> Attr gobj Double
    newAttrFromDoubleProperty String
    "max-value"

    -- | The "bar-mode" property determines the way LevelBar interprets the
    -- value properties to draw the level fill area. Specifically, when the value is
    -- LevelBarModeContinuous, LevelBar will draw a single block
    -- representing the current value in that area; when the value is
    -- LevelBarModeDiscrete, the widget will draw a succession of separate
    -- blocks filling the draw area, with the number of blocks being equal to the
    -- units separating the integral roundings of "min-value" and "max-value".
    --
    -- Default value: LevelBarModeContinuous
    levelBarMode :: LevelBarClass self => Attr self LevelBarMode
    levelBarMode :: forall self. LevelBarClass self => Attr self LevelBarMode
    levelBarMode = (self -> IO LevelBarMode)
    -> (self -> LevelBarMode -> IO ())
    -> ReadWriteAttr self LevelBarMode LevelBarMode
    forall o a b.
    (o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b
    newAttr self -> IO LevelBarMode
    forall self. LevelBarClass self => self -> IO LevelBarMode
    levelBarGetMode self -> LevelBarMode -> IO ()
    forall self. LevelBarClass self => self -> LevelBarMode -> IO ()
    levelBarSetMode

    foreign import ccall unsafe "gtk_level_bar_new"
      gtk_level_bar_new :: (IO (Ptr Widget))

    foreign import ccall safe "gtk_level_bar_set_mode"
      gtk_level_bar_set_mode :: ((Ptr LevelBar) -> (CInt -> (IO ())))

    foreign import ccall safe "gtk_level_bar_get_mode"
      gtk_level_bar_get_mode :: ((Ptr LevelBar) -> (IO CInt))

    foreign import ccall unsafe "gtk_level_bar_add_offset_value"
      gtk_level_bar_add_offset_value :: ((Ptr LevelBar) -> ((Ptr CChar) -> (CDouble -> (IO ()))))

    foreign import ccall unsafe "gtk_level_bar_remove_offset_value"
      gtk_level_bar_remove_offset_value :: ((Ptr LevelBar) -> ((Ptr CChar) -> (IO ())))

    foreign import ccall unsafe "gtk_level_bar_get_offset_value"
      gtk_level_bar_get_offset_value :: ((Ptr LevelBar) -> ((Ptr CChar) -> ((Ptr CDouble) -> (IO CInt))))