module Graphics.UI.Gtk.MenuComboToolbar.ToolPalette (
ToolPalette,
ToolPaletteClass,
castToToolPalette,
toToolPalette,
ToolPaletteDragTargets (..),
toolPaletteNew,
toolPaletteUnsetIconSize,
toolPaletteUnsetStyle,
toolPaletteGetHAdjustment,
toolPaletteGetVAdjustment,
toolPaletteSetGroupPosition,
toolPaletteGetGroupPosition,
toolPaletteIconSize,
toolPaletteIconSizeSet,
toolPaletteToolbarStyle,
toolPaletteChildExclusive,
toolPaletteChildExpand,
toolPaletteSetScrollAdjustments,
) where
import Control.Monad (liftM)
import System.Glib.FFI
import System.Glib.Attributes
import System.Glib.Properties
import System.Glib.GList
import System.Glib.UTFString
import Graphics.UI.Gtk.General.Structs (IconSize (..))
import Graphics.UI.Gtk.General.Enums (ToolbarStyle (..))
import Graphics.UI.Gtk.Abstract.Object (makeNewObject)
import Graphics.UI.Gtk.Types
import Graphics.UI.Gtk.Signals
data ToolPaletteDragTargets = ToolPaletteDragItems
| ToolPaletteDragGroups
deriving (Eq)
instance Enum ToolPaletteDragTargets where
fromEnum ToolPaletteDragItems = 1
fromEnum ToolPaletteDragGroups = 2
toEnum 1 = ToolPaletteDragItems
toEnum 2 = ToolPaletteDragGroups
toEnum unmatched = error ("ToolPaletteDragTargets.toEnum: Cannot match " ++ show unmatched)
succ ToolPaletteDragItems = ToolPaletteDragGroups
succ _ = undefined
pred ToolPaletteDragGroups = ToolPaletteDragItems
pred _ = undefined
enumFromTo x y | fromEnum x == fromEnum y = [ y ]
| otherwise = x : enumFromTo (succ x) y
enumFrom x = enumFromTo x ToolPaletteDragGroups
enumFromThen _ _ = error "Enum ToolPaletteDragTargets: enumFromThen not implemented"
enumFromThenTo _ _ _ = error "Enum ToolPaletteDragTargets: enumFromThenTo not implemented"
toolPaletteNew :: IO ToolPalette
toolPaletteNew =
makeNewObject mkToolPalette $
liftM (castPtr :: Ptr Widget -> Ptr ToolPalette) $
gtk_tool_palette_new
toolPaletteUnsetIconSize :: ToolPaletteClass self => self -> IO ()
toolPaletteUnsetIconSize palette =
(\(ToolPalette arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_tool_palette_unset_icon_size argPtr1)
(toToolPalette palette)
toolPaletteUnsetStyle :: ToolPaletteClass self => self -> IO ()
toolPaletteUnsetStyle palette =
(\(ToolPalette arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_tool_palette_unset_style argPtr1)
(toToolPalette palette)
toolPaletteGetHAdjustment :: ToolPaletteClass self => self
-> IO Adjustment
toolPaletteGetHAdjustment palette =
makeNewObject mkAdjustment $
(\(ToolPalette arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_tool_palette_get_hadjustment argPtr1)
(toToolPalette palette)
toolPaletteGetVAdjustment :: ToolPaletteClass self => self
-> IO Adjustment
toolPaletteGetVAdjustment palette =
makeNewObject mkAdjustment $
(\(ToolPalette arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_tool_palette_get_vadjustment argPtr1)
(toToolPalette palette)
toolPaletteGetGroupPosition :: (ToolPaletteClass palette, ToolItemGroupClass group)
=> palette
-> group
-> IO Int
toolPaletteGetGroupPosition palette group =
liftM fromIntegral $
(\(ToolPalette arg1) (ToolItemGroup arg2) -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_tool_palette_get_group_position argPtr1 argPtr2)
(toToolPalette palette)
(toToolItemGroup group)
toolPaletteSetGroupPosition :: (ToolPaletteClass palette, ToolItemGroupClass group)
=> palette
-> group
-> Int
-> IO ()
toolPaletteSetGroupPosition palette group position =
(\(ToolPalette arg1) (ToolItemGroup arg2) arg3 -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_tool_palette_set_group_position argPtr1 argPtr2 arg3)
(toToolPalette palette)
(toToolItemGroup group)
(fromIntegral position)
toolPaletteIconSize :: ToolPaletteClass self => Attr self IconSize
toolPaletteIconSize =
newAttrFromEnumProperty "icon-size"
gtk_icon_size_get_type
toolPaletteIconSizeSet :: ToolPaletteClass self => Attr self Bool
toolPaletteIconSizeSet =
newAttrFromBoolProperty "icon-size-set"
toolPaletteToolbarStyle :: ToolPaletteClass self => Attr self ToolbarStyle
toolPaletteToolbarStyle =
newAttrFromEnumProperty "toolbar-style"
gtk_toolbar_style_get_type
toolPaletteChildExclusive :: ToolPaletteClass self => Attr self Bool
toolPaletteChildExclusive =
newAttrFromBoolProperty "exclusive"
toolPaletteChildExpand :: ToolPaletteClass self => Attr self Bool
toolPaletteChildExpand =
newAttrFromBoolProperty "expand"
toolPaletteSetScrollAdjustments :: ToolPaletteClass self => Signal self (Adjustment -> Adjustment -> IO ())
toolPaletteSetScrollAdjustments = Signal (connect_OBJECT_OBJECT__NONE "set-scroll-adjustments")
foreign import ccall safe "gtk_tool_palette_new"
gtk_tool_palette_new :: (IO (Ptr Widget))
foreign import ccall safe "gtk_tool_palette_unset_icon_size"
gtk_tool_palette_unset_icon_size :: ((Ptr ToolPalette) -> (IO ()))
foreign import ccall safe "gtk_tool_palette_unset_style"
gtk_tool_palette_unset_style :: ((Ptr ToolPalette) -> (IO ()))
foreign import ccall safe "gtk_tool_palette_get_hadjustment"
gtk_tool_palette_get_hadjustment :: ((Ptr ToolPalette) -> (IO (Ptr Adjustment)))
foreign import ccall safe "gtk_tool_palette_get_vadjustment"
gtk_tool_palette_get_vadjustment :: ((Ptr ToolPalette) -> (IO (Ptr Adjustment)))
foreign import ccall safe "gtk_tool_palette_get_group_position"
gtk_tool_palette_get_group_position :: ((Ptr ToolPalette) -> ((Ptr ToolItemGroup) -> (IO CInt)))
foreign import ccall safe "gtk_tool_palette_set_group_position"
gtk_tool_palette_set_group_position :: ((Ptr ToolPalette) -> ((Ptr ToolItemGroup) -> (CInt -> (IO ()))))
foreign import ccall unsafe "gtk_icon_size_get_type"
gtk_icon_size_get_type :: CUInt
foreign import ccall unsafe "gtk_toolbar_style_get_type"
gtk_toolbar_style_get_type :: CUInt