{-# LINE 2 "./Graphics/UI/Gtk/Selectors/ColorButton.chs" #-}
module Graphics.UI.Gtk.Selectors.ColorButton (
ColorButton,
ColorButtonClass,
castToColorButton, gTypeColorButton,
toColorButton,
colorButtonNew,
colorButtonNewWithColor,
colorButtonSetColor,
colorButtonGetColor,
colorButtonSetAlpha,
colorButtonGetAlpha,
colorButtonSetUseAlpha,
colorButtonGetUseAlpha,
colorButtonSetTitle,
colorButtonGetTitle,
colorButtonUseAlpha,
colorButtonTitle,
colorButtonAlpha,
onColorSet,
afterColorSet,
) where
import Control.Monad (liftM)
import System.Glib.FFI
import System.Glib.UTFString
import System.Glib.Attributes
import Graphics.UI.Gtk.Abstract.Object (makeNewObject)
import Graphics.UI.Gtk.Types
{-# LINE 88 "./Graphics/UI/Gtk/Selectors/ColorButton.chs" #-}
import Graphics.UI.Gtk.Signals
{-# LINE 89 "./Graphics/UI/Gtk/Selectors/ColorButton.chs" #-}
import Graphics.UI.Gtk.General.Structs (Color)
{-# LINE 92 "./Graphics/UI/Gtk/Selectors/ColorButton.chs" #-}
colorButtonNew :: IO ColorButton
colorButtonNew :: IO ColorButton
colorButtonNew =
(ForeignPtr ColorButton -> ColorButton, FinalizerPtr ColorButton)
-> IO (Ptr ColorButton) -> IO ColorButton
forall obj.
ObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewObject (ForeignPtr ColorButton -> ColorButton, FinalizerPtr ColorButton)
forall {a}. (ForeignPtr ColorButton -> ColorButton, FinalizerPtr a)
mkColorButton (IO (Ptr ColorButton) -> IO ColorButton)
-> IO (Ptr ColorButton) -> IO ColorButton
forall a b. (a -> b) -> a -> b
$
(Ptr Widget -> Ptr ColorButton)
-> IO (Ptr Widget) -> IO (Ptr ColorButton)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (Ptr Widget -> Ptr ColorButton
forall a b. Ptr a -> Ptr b
castPtr :: Ptr Widget -> Ptr ColorButton) (IO (Ptr Widget) -> IO (Ptr ColorButton))
-> IO (Ptr Widget) -> IO (Ptr ColorButton)
forall a b. (a -> b) -> a -> b
$
IO (Ptr Widget)
gtk_color_button_new
{-# LINE 108 "./Graphics/UI/Gtk/Selectors/ColorButton.chs" #-}
colorButtonNewWithColor ::
Color
-> IO ColorButton
colorButtonNewWithColor :: Color -> IO ColorButton
colorButtonNewWithColor Color
color =
(ForeignPtr ColorButton -> ColorButton, FinalizerPtr ColorButton)
-> IO (Ptr ColorButton) -> IO ColorButton
forall obj.
ObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewObject (ForeignPtr ColorButton -> ColorButton, FinalizerPtr ColorButton)
forall {a}. (ForeignPtr ColorButton -> ColorButton, FinalizerPtr a)
mkColorButton (IO (Ptr ColorButton) -> IO ColorButton)
-> IO (Ptr ColorButton) -> IO ColorButton
forall a b. (a -> b) -> a -> b
$
(Ptr Widget -> Ptr ColorButton)
-> IO (Ptr Widget) -> IO (Ptr ColorButton)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (Ptr Widget -> Ptr ColorButton
forall a b. Ptr a -> Ptr b
castPtr :: Ptr Widget -> Ptr ColorButton) (IO (Ptr Widget) -> IO (Ptr ColorButton))
-> IO (Ptr Widget) -> IO (Ptr ColorButton)
forall a b. (a -> b) -> a -> b
$
Color -> (Ptr Color -> IO (Ptr Widget)) -> IO (Ptr Widget)
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Color
color ((Ptr Color -> IO (Ptr Widget)) -> IO (Ptr Widget))
-> (Ptr Color -> IO (Ptr Widget)) -> IO (Ptr Widget)
forall a b. (a -> b) -> a -> b
$ \Ptr Color
colorPtr ->
Ptr () -> IO (Ptr Widget)
gtk_color_button_new_with_color
{-# LINE 119 "./Graphics/UI/Gtk/Selectors/ColorButton.chs" #-}
(castPtr colorPtr)
colorButtonSetColor :: ColorButtonClass self => self
-> Color
-> IO ()
colorButtonSetColor :: forall self. ColorButtonClass self => self -> Color -> IO ()
colorButtonSetColor self
self Color
color =
Color -> (Ptr Color -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Color
color ((Ptr Color -> IO ()) -> IO ()) -> (Ptr Color -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Color
colorPtr ->
(\(ColorButton ForeignPtr ColorButton
arg1) Ptr ()
arg2 -> ForeignPtr ColorButton -> (Ptr ColorButton -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ColorButton
arg1 ((Ptr ColorButton -> IO ()) -> IO ())
-> (Ptr ColorButton -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr ColorButton
argPtr1 ->Ptr ColorButton -> Ptr () -> IO ()
gtk_color_button_set_color Ptr ColorButton
argPtr1 Ptr ()
arg2)
{-# LINE 132 "./Graphics/UI/Gtk/Selectors/ColorButton.chs" #-}
(toColorButton self)
(Ptr Color -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr Color
colorPtr)
colorButtonGetColor :: ColorButtonClass self => self -> IO Color
colorButtonGetColor :: forall self. ColorButtonClass self => self -> IO Color
colorButtonGetColor self
self =
(Ptr Color -> IO Color) -> IO Color
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr Color -> IO Color) -> IO Color)
-> (Ptr Color -> IO Color) -> IO Color
forall a b. (a -> b) -> a -> b
$ \Ptr Color
colorPtr ->
(\(ColorButton ForeignPtr ColorButton
arg1) Ptr ()
arg2 -> ForeignPtr ColorButton -> (Ptr ColorButton -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ColorButton
arg1 ((Ptr ColorButton -> IO ()) -> IO ())
-> (Ptr ColorButton -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr ColorButton
argPtr1 ->Ptr ColorButton -> Ptr () -> IO ()
gtk_color_button_get_color Ptr ColorButton
argPtr1 Ptr ()
arg2)
{-# LINE 141 "./Graphics/UI/Gtk/Selectors/ColorButton.chs" #-}
(toColorButton self)
(Ptr Color -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr Color
colorPtr)
IO () -> IO Color -> IO Color
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr Color -> IO Color
forall a. Storable a => Ptr a -> IO a
peek Ptr Color
colorPtr IO Color -> (Color -> IO Color) -> IO Color
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Color
color ->
Color -> IO Color
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Color
color
colorButtonSetAlpha :: ColorButtonClass self => self
-> Word16
-> IO ()
colorButtonSetAlpha :: forall self. ColorButtonClass self => self -> Word16 -> IO ()
colorButtonSetAlpha self
self Word16
alpha =
(\(ColorButton ForeignPtr ColorButton
arg1) CUShort
arg2 -> ForeignPtr ColorButton -> (Ptr ColorButton -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ColorButton
arg1 ((Ptr ColorButton -> IO ()) -> IO ())
-> (Ptr ColorButton -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr ColorButton
argPtr1 ->Ptr ColorButton -> CUShort -> IO ()
gtk_color_button_set_alpha Ptr ColorButton
argPtr1 CUShort
arg2)
{-# LINE 153 "./Graphics/UI/Gtk/Selectors/ColorButton.chs" #-}
(toColorButton self)
(Word16 -> CUShort
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word16
alpha)
colorButtonGetAlpha :: ColorButtonClass self => self
-> IO Word16
colorButtonGetAlpha :: forall self. ColorButtonClass self => self -> IO Word16
colorButtonGetAlpha self
self =
(CUShort -> Word16) -> IO CUShort -> IO Word16
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CUShort -> Word16
forall a b. (Integral a, Num b) => a -> b
fromIntegral (IO CUShort -> IO Word16) -> IO CUShort -> IO Word16
forall a b. (a -> b) -> a -> b
$
(\(ColorButton ForeignPtr ColorButton
arg1) -> ForeignPtr ColorButton
-> (Ptr ColorButton -> IO CUShort) -> IO CUShort
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ColorButton
arg1 ((Ptr ColorButton -> IO CUShort) -> IO CUShort)
-> (Ptr ColorButton -> IO CUShort) -> IO CUShort
forall a b. (a -> b) -> a -> b
$ \Ptr ColorButton
argPtr1 ->Ptr ColorButton -> IO CUShort
gtk_color_button_get_alpha Ptr ColorButton
argPtr1)
{-# LINE 163 "./Graphics/UI/Gtk/Selectors/ColorButton.chs" #-}
(toColorButton self)
colorButtonSetUseAlpha :: ColorButtonClass self => self
-> Bool
-> IO ()
colorButtonSetUseAlpha :: forall self. ColorButtonClass self => self -> Bool -> IO ()
colorButtonSetUseAlpha self
self Bool
useAlpha =
(\(ColorButton ForeignPtr ColorButton
arg1) CInt
arg2 -> ForeignPtr ColorButton -> (Ptr ColorButton -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ColorButton
arg1 ((Ptr ColorButton -> IO ()) -> IO ())
-> (Ptr ColorButton -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr ColorButton
argPtr1 ->Ptr ColorButton -> CInt -> IO ()
gtk_color_button_set_use_alpha Ptr ColorButton
argPtr1 CInt
arg2)
{-# LINE 173 "./Graphics/UI/Gtk/Selectors/ColorButton.chs" #-}
(toColorButton self)
(Bool -> CInt
forall a. Num a => Bool -> a
fromBool Bool
useAlpha)
colorButtonGetUseAlpha :: ColorButtonClass self => self
-> IO Bool
colorButtonGetUseAlpha :: forall self. ColorButtonClass self => self -> IO Bool
colorButtonGetUseAlpha self
self =
(CInt -> Bool) -> IO CInt -> IO Bool
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (IO CInt -> IO Bool) -> IO CInt -> IO Bool
forall a b. (a -> b) -> a -> b
$
(\(ColorButton ForeignPtr ColorButton
arg1) -> ForeignPtr ColorButton -> (Ptr ColorButton -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ColorButton
arg1 ((Ptr ColorButton -> IO CInt) -> IO CInt)
-> (Ptr ColorButton -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr ColorButton
argPtr1 ->Ptr ColorButton -> IO CInt
gtk_color_button_get_use_alpha Ptr ColorButton
argPtr1)
{-# LINE 184 "./Graphics/UI/Gtk/Selectors/ColorButton.chs" #-}
(toColorButton self)
colorButtonSetTitle :: (ColorButtonClass self, GlibString string) => self
-> string
-> IO ()
colorButtonSetTitle :: forall self string.
(ColorButtonClass self, GlibString string) =>
self -> string -> IO ()
colorButtonSetTitle self
self string
title =
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
title ((CString -> IO ()) -> IO ()) -> (CString -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \CString
titlePtr ->
(\(ColorButton ForeignPtr ColorButton
arg1) CString
arg2 -> ForeignPtr ColorButton -> (Ptr ColorButton -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ColorButton
arg1 ((Ptr ColorButton -> IO ()) -> IO ())
-> (Ptr ColorButton -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr ColorButton
argPtr1 ->Ptr ColorButton -> CString -> IO ()
gtk_color_button_set_title Ptr ColorButton
argPtr1 CString
arg2)
{-# LINE 194 "./Graphics/UI/Gtk/Selectors/ColorButton.chs" #-}
(toColorButton self)
CString
titlePtr
colorButtonGetTitle :: (ColorButtonClass self, GlibString string) => self
-> IO string
colorButtonGetTitle :: forall self string.
(ColorButtonClass self, GlibString string) =>
self -> IO string
colorButtonGetTitle self
self =
(\(ColorButton ForeignPtr ColorButton
arg1) -> ForeignPtr ColorButton
-> (Ptr ColorButton -> IO CString) -> IO CString
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ColorButton
arg1 ((Ptr ColorButton -> IO CString) -> IO CString)
-> (Ptr ColorButton -> IO CString) -> IO CString
forall a b. (a -> b) -> a -> b
$ \Ptr ColorButton
argPtr1 ->Ptr ColorButton -> IO CString
gtk_color_button_get_title Ptr ColorButton
argPtr1)
{-# LINE 203 "./Graphics/UI/Gtk/Selectors/ColorButton.chs" #-}
(toColorButton self)
IO CString -> (CString -> 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
>>= CString -> IO string
forall s. GlibString s => CString -> IO s
peekUTFString
colorButtonUseAlpha :: ColorButtonClass self => Attr self Bool
colorButtonUseAlpha :: forall self. ColorButtonClass self => Attr self Bool
colorButtonUseAlpha = (self -> IO Bool)
-> (self -> Bool -> IO ()) -> ReadWriteAttr self Bool Bool
forall o a b.
(o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b
newAttr
self -> IO Bool
forall self. ColorButtonClass self => self -> IO Bool
colorButtonGetUseAlpha
self -> Bool -> IO ()
forall self. ColorButtonClass self => self -> Bool -> IO ()
colorButtonSetUseAlpha
colorButtonTitle :: (ColorButtonClass self, GlibString string) => Attr self string
colorButtonTitle :: forall self string.
(ColorButtonClass self, GlibString string) =>
Attr self string
colorButtonTitle = (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.
(ColorButtonClass self, GlibString string) =>
self -> IO string
colorButtonGetTitle
self -> string -> IO ()
forall self string.
(ColorButtonClass self, GlibString string) =>
self -> string -> IO ()
colorButtonSetTitle
colorButtonAlpha :: ColorButtonClass self => Attr self Word16
colorButtonAlpha :: forall self. ColorButtonClass self => Attr self Word16
colorButtonAlpha = (self -> IO Word16)
-> (self -> Word16 -> IO ()) -> ReadWriteAttr self Word16 Word16
forall o a b.
(o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b
newAttr
self -> IO Word16
forall self. ColorButtonClass self => self -> IO Word16
colorButtonGetAlpha
self -> Word16 -> IO ()
forall self. ColorButtonClass self => self -> Word16 -> IO ()
colorButtonSetAlpha
onColorSet, afterColorSet :: ColorButtonClass self => self
-> IO ()
-> IO (ConnectId self)
onColorSet :: forall self.
ColorButtonClass self =>
self -> IO () -> IO (ConnectId self)
onColorSet = SignalName -> Bool -> self -> IO () -> IO (ConnectId self)
forall obj.
GObjectClass obj =>
SignalName -> Bool -> obj -> IO () -> IO (ConnectId obj)
connect_NONE__NONE SignalName
"color_set" Bool
False
afterColorSet :: forall self.
ColorButtonClass self =>
self -> IO () -> IO (ConnectId self)
afterColorSet = SignalName -> Bool -> self -> IO () -> IO (ConnectId self)
forall obj.
GObjectClass obj =>
SignalName -> Bool -> obj -> IO () -> IO (ConnectId obj)
connect_NONE__NONE SignalName
"color_set" Bool
True
foreign import ccall safe "gtk_color_button_new"
gtk_color_button_new :: (IO (Ptr Widget))
foreign import ccall safe "gtk_color_button_new_with_color"
gtk_color_button_new_with_color :: ((Ptr ()) -> (IO (Ptr Widget)))
foreign import ccall safe "gtk_color_button_set_color"
gtk_color_button_set_color :: ((Ptr ColorButton) -> ((Ptr ()) -> (IO ())))
foreign import ccall safe "gtk_color_button_get_color"
gtk_color_button_get_color :: ((Ptr ColorButton) -> ((Ptr ()) -> (IO ())))
foreign import ccall safe "gtk_color_button_set_alpha"
gtk_color_button_set_alpha :: ((Ptr ColorButton) -> (CUShort -> (IO ())))
foreign import ccall safe "gtk_color_button_get_alpha"
gtk_color_button_get_alpha :: ((Ptr ColorButton) -> (IO CUShort))
foreign import ccall safe "gtk_color_button_set_use_alpha"
gtk_color_button_set_use_alpha :: ((Ptr ColorButton) -> (CInt -> (IO ())))
foreign import ccall safe "gtk_color_button_get_use_alpha"
gtk_color_button_get_use_alpha :: ((Ptr ColorButton) -> (IO CInt))
foreign import ccall safe "gtk_color_button_set_title"
gtk_color_button_set_title :: ((Ptr ColorButton) -> ((Ptr CChar) -> (IO ())))
foreign import ccall safe "gtk_color_button_get_title"
gtk_color_button_get_title :: ((Ptr ColorButton) -> (IO (Ptr CChar)))