{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
-}

module GI.Gtk.Objects.MenuBar
    ( 

-- * Exported types
    MenuBar(..)                             ,
    MenuBarK                                ,
    toMenuBar                               ,
    noMenuBar                               ,


 -- * Methods
-- ** menuBarGetChildPackDirection
    menuBarGetChildPackDirection            ,


-- ** menuBarGetPackDirection
    menuBarGetPackDirection                 ,


-- ** menuBarNew
    menuBarNew                              ,


-- ** menuBarNewFromModel
    menuBarNewFromModel                     ,


-- ** menuBarSetChildPackDirection
    menuBarSetChildPackDirection            ,


-- ** menuBarSetPackDirection
    menuBarSetPackDirection                 ,




 -- * Properties
-- ** ChildPackDirection
    MenuBarChildPackDirectionPropertyInfo   ,
    constructMenuBarChildPackDirection      ,
    getMenuBarChildPackDirection            ,
    setMenuBarChildPackDirection            ,


-- ** PackDirection
    MenuBarPackDirectionPropertyInfo        ,
    constructMenuBarPackDirection           ,
    getMenuBarPackDirection                 ,
    setMenuBarPackDirection                 ,




    ) where

import Prelude ()
import Data.GI.Base.ShortPrelude

import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map

import GI.Gtk.Types
import GI.Gtk.Callbacks
import qualified GI.Atk as Atk
import qualified GI.GObject as GObject
import qualified GI.Gio as Gio

newtype MenuBar = MenuBar (ForeignPtr MenuBar)
foreign import ccall "gtk_menu_bar_get_type"
    c_gtk_menu_bar_get_type :: IO GType

type instance ParentTypes MenuBar = MenuBarParentTypes
type MenuBarParentTypes = '[MenuShell, Container, Widget, GObject.Object, Atk.ImplementorIface, Buildable]

instance GObject MenuBar where
    gobjectIsInitiallyUnowned _ = True
    gobjectType _ = c_gtk_menu_bar_get_type
    

class GObject o => MenuBarK o
instance (GObject o, IsDescendantOf MenuBar o) => MenuBarK o

toMenuBar :: MenuBarK o => o -> IO MenuBar
toMenuBar = unsafeCastTo MenuBar

noMenuBar :: Maybe MenuBar
noMenuBar = Nothing

-- VVV Prop "child-pack-direction"
   -- Type: TInterface "Gtk" "PackDirection"
   -- Flags: [PropertyReadable,PropertyWritable]

getMenuBarChildPackDirection :: (MonadIO m, MenuBarK o) => o -> m PackDirection
getMenuBarChildPackDirection obj = liftIO $ getObjectPropertyEnum obj "child-pack-direction"

setMenuBarChildPackDirection :: (MonadIO m, MenuBarK o) => o -> PackDirection -> m ()
setMenuBarChildPackDirection obj val = liftIO $ setObjectPropertyEnum obj "child-pack-direction" val

constructMenuBarChildPackDirection :: PackDirection -> IO ([Char], GValue)
constructMenuBarChildPackDirection val = constructObjectPropertyEnum "child-pack-direction" val

data MenuBarChildPackDirectionPropertyInfo
instance AttrInfo MenuBarChildPackDirectionPropertyInfo where
    type AttrAllowedOps MenuBarChildPackDirectionPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint MenuBarChildPackDirectionPropertyInfo = (~) PackDirection
    type AttrBaseTypeConstraint MenuBarChildPackDirectionPropertyInfo = MenuBarK
    type AttrGetType MenuBarChildPackDirectionPropertyInfo = PackDirection
    type AttrLabel MenuBarChildPackDirectionPropertyInfo = "MenuBar::child-pack-direction"
    attrGet _ = getMenuBarChildPackDirection
    attrSet _ = setMenuBarChildPackDirection
    attrConstruct _ = constructMenuBarChildPackDirection

-- VVV Prop "pack-direction"
   -- Type: TInterface "Gtk" "PackDirection"
   -- Flags: [PropertyReadable,PropertyWritable]

getMenuBarPackDirection :: (MonadIO m, MenuBarK o) => o -> m PackDirection
getMenuBarPackDirection obj = liftIO $ getObjectPropertyEnum obj "pack-direction"

setMenuBarPackDirection :: (MonadIO m, MenuBarK o) => o -> PackDirection -> m ()
setMenuBarPackDirection obj val = liftIO $ setObjectPropertyEnum obj "pack-direction" val

constructMenuBarPackDirection :: PackDirection -> IO ([Char], GValue)
constructMenuBarPackDirection val = constructObjectPropertyEnum "pack-direction" val

data MenuBarPackDirectionPropertyInfo
instance AttrInfo MenuBarPackDirectionPropertyInfo where
    type AttrAllowedOps MenuBarPackDirectionPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint MenuBarPackDirectionPropertyInfo = (~) PackDirection
    type AttrBaseTypeConstraint MenuBarPackDirectionPropertyInfo = MenuBarK
    type AttrGetType MenuBarPackDirectionPropertyInfo = PackDirection
    type AttrLabel MenuBarPackDirectionPropertyInfo = "MenuBar::pack-direction"
    attrGet _ = getMenuBarPackDirection
    attrSet _ = setMenuBarPackDirection
    attrConstruct _ = constructMenuBarPackDirection

type instance AttributeList MenuBar = MenuBarAttributeList
type MenuBarAttributeList = ('[ '("app-paintable", WidgetAppPaintablePropertyInfo), '("border-width", ContainerBorderWidthPropertyInfo), '("can-default", WidgetCanDefaultPropertyInfo), '("can-focus", WidgetCanFocusPropertyInfo), '("child", ContainerChildPropertyInfo), '("child-pack-direction", MenuBarChildPackDirectionPropertyInfo), '("composite-child", WidgetCompositeChildPropertyInfo), '("double-buffered", WidgetDoubleBufferedPropertyInfo), '("events", WidgetEventsPropertyInfo), '("expand", WidgetExpandPropertyInfo), '("halign", WidgetHalignPropertyInfo), '("has-default", WidgetHasDefaultPropertyInfo), '("has-focus", WidgetHasFocusPropertyInfo), '("has-tooltip", WidgetHasTooltipPropertyInfo), '("height-request", WidgetHeightRequestPropertyInfo), '("hexpand", WidgetHexpandPropertyInfo), '("hexpand-set", WidgetHexpandSetPropertyInfo), '("is-focus", WidgetIsFocusPropertyInfo), '("margin", WidgetMarginPropertyInfo), '("margin-bottom", WidgetMarginBottomPropertyInfo), '("margin-end", WidgetMarginEndPropertyInfo), '("margin-left", WidgetMarginLeftPropertyInfo), '("margin-right", WidgetMarginRightPropertyInfo), '("margin-start", WidgetMarginStartPropertyInfo), '("margin-top", WidgetMarginTopPropertyInfo), '("name", WidgetNamePropertyInfo), '("no-show-all", WidgetNoShowAllPropertyInfo), '("opacity", WidgetOpacityPropertyInfo), '("pack-direction", MenuBarPackDirectionPropertyInfo), '("parent", WidgetParentPropertyInfo), '("receives-default", WidgetReceivesDefaultPropertyInfo), '("resize-mode", ContainerResizeModePropertyInfo), '("scale-factor", WidgetScaleFactorPropertyInfo), '("sensitive", WidgetSensitivePropertyInfo), '("style", WidgetStylePropertyInfo), '("take-focus", MenuShellTakeFocusPropertyInfo), '("tooltip-markup", WidgetTooltipMarkupPropertyInfo), '("tooltip-text", WidgetTooltipTextPropertyInfo), '("valign", WidgetValignPropertyInfo), '("vexpand", WidgetVexpandPropertyInfo), '("vexpand-set", WidgetVexpandSetPropertyInfo), '("visible", WidgetVisiblePropertyInfo), '("width-request", WidgetWidthRequestPropertyInfo), '("window", WidgetWindowPropertyInfo)] :: [(Symbol, *)])

type instance SignalList MenuBar = MenuBarSignalList
type MenuBarSignalList = ('[ '("accel-closures-changed", WidgetAccelClosuresChangedSignalInfo), '("activate-current", MenuShellActivateCurrentSignalInfo), '("add", ContainerAddSignalInfo), '("button-press-event", WidgetButtonPressEventSignalInfo), '("button-release-event", WidgetButtonReleaseEventSignalInfo), '("can-activate-accel", WidgetCanActivateAccelSignalInfo), '("cancel", MenuShellCancelSignalInfo), '("check-resize", ContainerCheckResizeSignalInfo), '("child-notify", WidgetChildNotifySignalInfo), '("composited-changed", WidgetCompositedChangedSignalInfo), '("configure-event", WidgetConfigureEventSignalInfo), '("cycle-focus", MenuShellCycleFocusSignalInfo), '("damage-event", WidgetDamageEventSignalInfo), '("deactivate", MenuShellDeactivateSignalInfo), '("delete-event", WidgetDeleteEventSignalInfo), '("destroy", WidgetDestroySignalInfo), '("destroy-event", WidgetDestroyEventSignalInfo), '("direction-changed", WidgetDirectionChangedSignalInfo), '("drag-begin", WidgetDragBeginSignalInfo), '("drag-data-delete", WidgetDragDataDeleteSignalInfo), '("drag-data-get", WidgetDragDataGetSignalInfo), '("drag-data-received", WidgetDragDataReceivedSignalInfo), '("drag-drop", WidgetDragDropSignalInfo), '("drag-end", WidgetDragEndSignalInfo), '("drag-failed", WidgetDragFailedSignalInfo), '("drag-leave", WidgetDragLeaveSignalInfo), '("drag-motion", WidgetDragMotionSignalInfo), '("draw", WidgetDrawSignalInfo), '("enter-notify-event", WidgetEnterNotifyEventSignalInfo), '("event", WidgetEventSignalInfo), '("event-after", WidgetEventAfterSignalInfo), '("focus", WidgetFocusSignalInfo), '("focus-in-event", WidgetFocusInEventSignalInfo), '("focus-out-event", WidgetFocusOutEventSignalInfo), '("grab-broken-event", WidgetGrabBrokenEventSignalInfo), '("grab-focus", WidgetGrabFocusSignalInfo), '("grab-notify", WidgetGrabNotifySignalInfo), '("hide", WidgetHideSignalInfo), '("hierarchy-changed", WidgetHierarchyChangedSignalInfo), '("insert", MenuShellInsertSignalInfo), '("key-press-event", WidgetKeyPressEventSignalInfo), '("key-release-event", WidgetKeyReleaseEventSignalInfo), '("keynav-failed", WidgetKeynavFailedSignalInfo), '("leave-notify-event", WidgetLeaveNotifyEventSignalInfo), '("map", WidgetMapSignalInfo), '("map-event", WidgetMapEventSignalInfo), '("mnemonic-activate", WidgetMnemonicActivateSignalInfo), '("motion-notify-event", WidgetMotionNotifyEventSignalInfo), '("move-current", MenuShellMoveCurrentSignalInfo), '("move-focus", WidgetMoveFocusSignalInfo), '("move-selected", MenuShellMoveSelectedSignalInfo), '("notify", GObject.ObjectNotifySignalInfo), '("parent-set", WidgetParentSetSignalInfo), '("popup-menu", WidgetPopupMenuSignalInfo), '("property-notify-event", WidgetPropertyNotifyEventSignalInfo), '("proximity-in-event", WidgetProximityInEventSignalInfo), '("proximity-out-event", WidgetProximityOutEventSignalInfo), '("query-tooltip", WidgetQueryTooltipSignalInfo), '("realize", WidgetRealizeSignalInfo), '("remove", ContainerRemoveSignalInfo), '("screen-changed", WidgetScreenChangedSignalInfo), '("scroll-event", WidgetScrollEventSignalInfo), '("selection-clear-event", WidgetSelectionClearEventSignalInfo), '("selection-done", MenuShellSelectionDoneSignalInfo), '("selection-get", WidgetSelectionGetSignalInfo), '("selection-notify-event", WidgetSelectionNotifyEventSignalInfo), '("selection-received", WidgetSelectionReceivedSignalInfo), '("selection-request-event", WidgetSelectionRequestEventSignalInfo), '("set-focus-child", ContainerSetFocusChildSignalInfo), '("show", WidgetShowSignalInfo), '("show-help", WidgetShowHelpSignalInfo), '("size-allocate", WidgetSizeAllocateSignalInfo), '("state-changed", WidgetStateChangedSignalInfo), '("state-flags-changed", WidgetStateFlagsChangedSignalInfo), '("style-set", WidgetStyleSetSignalInfo), '("style-updated", WidgetStyleUpdatedSignalInfo), '("touch-event", WidgetTouchEventSignalInfo), '("unmap", WidgetUnmapSignalInfo), '("unmap-event", WidgetUnmapEventSignalInfo), '("unrealize", WidgetUnrealizeSignalInfo), '("visibility-notify-event", WidgetVisibilityNotifyEventSignalInfo), '("window-state-event", WidgetWindowStateEventSignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method MenuBar::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TInterface "Gtk" "MenuBar"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_menu_bar_new" gtk_menu_bar_new :: 
    IO (Ptr MenuBar)


menuBarNew ::
    (MonadIO m) =>
    m MenuBar
menuBarNew  = liftIO $ do
    result <- gtk_menu_bar_new
    checkUnexpectedReturnNULL "gtk_menu_bar_new" result
    result' <- (newObject MenuBar) result
    return result'

-- method MenuBar::new_from_model
-- method type : Constructor
-- Args : [Arg {argName = "model", argType = TInterface "Gio" "MenuModel", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "model", argType = TInterface "Gio" "MenuModel", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "MenuBar"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_menu_bar_new_from_model" gtk_menu_bar_new_from_model :: 
    Ptr Gio.MenuModel ->                    -- model : TInterface "Gio" "MenuModel"
    IO (Ptr MenuBar)


menuBarNewFromModel ::
    (MonadIO m, Gio.MenuModelK a) =>
    a ->                                    -- model
    m MenuBar
menuBarNewFromModel model = liftIO $ do
    let model' = unsafeManagedPtrCastPtr model
    result <- gtk_menu_bar_new_from_model model'
    checkUnexpectedReturnNULL "gtk_menu_bar_new_from_model" result
    result' <- (newObject MenuBar) result
    touchManagedPtr model
    return result'

-- method MenuBar::get_child_pack_direction
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "MenuBar", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "MenuBar", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "PackDirection"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_menu_bar_get_child_pack_direction" gtk_menu_bar_get_child_pack_direction :: 
    Ptr MenuBar ->                          -- _obj : TInterface "Gtk" "MenuBar"
    IO CUInt


menuBarGetChildPackDirection ::
    (MonadIO m, MenuBarK a) =>
    a ->                                    -- _obj
    m PackDirection
menuBarGetChildPackDirection _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_menu_bar_get_child_pack_direction _obj'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr _obj
    return result'

-- method MenuBar::get_pack_direction
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "MenuBar", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "MenuBar", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "PackDirection"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_menu_bar_get_pack_direction" gtk_menu_bar_get_pack_direction :: 
    Ptr MenuBar ->                          -- _obj : TInterface "Gtk" "MenuBar"
    IO CUInt


menuBarGetPackDirection ::
    (MonadIO m, MenuBarK a) =>
    a ->                                    -- _obj
    m PackDirection
menuBarGetPackDirection _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_menu_bar_get_pack_direction _obj'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr _obj
    return result'

-- method MenuBar::set_child_pack_direction
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "MenuBar", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "child_pack_dir", argType = TInterface "Gtk" "PackDirection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "MenuBar", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "child_pack_dir", argType = TInterface "Gtk" "PackDirection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gtk_menu_bar_set_child_pack_direction" gtk_menu_bar_set_child_pack_direction :: 
    Ptr MenuBar ->                          -- _obj : TInterface "Gtk" "MenuBar"
    CUInt ->                                -- child_pack_dir : TInterface "Gtk" "PackDirection"
    IO ()


menuBarSetChildPackDirection ::
    (MonadIO m, MenuBarK a) =>
    a ->                                    -- _obj
    PackDirection ->                        -- child_pack_dir
    m ()
menuBarSetChildPackDirection _obj child_pack_dir = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let child_pack_dir' = (fromIntegral . fromEnum) child_pack_dir
    gtk_menu_bar_set_child_pack_direction _obj' child_pack_dir'
    touchManagedPtr _obj
    return ()

-- method MenuBar::set_pack_direction
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "MenuBar", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "pack_dir", argType = TInterface "Gtk" "PackDirection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "MenuBar", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "pack_dir", argType = TInterface "Gtk" "PackDirection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gtk_menu_bar_set_pack_direction" gtk_menu_bar_set_pack_direction :: 
    Ptr MenuBar ->                          -- _obj : TInterface "Gtk" "MenuBar"
    CUInt ->                                -- pack_dir : TInterface "Gtk" "PackDirection"
    IO ()


menuBarSetPackDirection ::
    (MonadIO m, MenuBarK a) =>
    a ->                                    -- _obj
    PackDirection ->                        -- pack_dir
    m ()
menuBarSetPackDirection _obj pack_dir = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let pack_dir' = (fromIntegral . fromEnum) pack_dir
    gtk_menu_bar_set_pack_direction _obj' pack_dir'
    touchManagedPtr _obj
    return ()