{- |
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.SearchBar
    ( 

-- * Exported types
    SearchBar(..)                           ,
    SearchBarK                              ,
    toSearchBar                             ,
    noSearchBar                             ,


 -- * Methods
-- ** searchBarConnectEntry
    searchBarConnectEntry                   ,


-- ** searchBarGetSearchMode
    searchBarGetSearchMode                  ,


-- ** searchBarGetShowCloseButton
    searchBarGetShowCloseButton             ,


-- ** searchBarHandleEvent
    searchBarHandleEvent                    ,


-- ** searchBarNew
    searchBarNew                            ,


-- ** searchBarSetSearchMode
    searchBarSetSearchMode                  ,


-- ** searchBarSetShowCloseButton
    searchBarSetShowCloseButton             ,




 -- * Properties
-- ** SearchModeEnabled
    SearchBarSearchModeEnabledPropertyInfo  ,
    constructSearchBarSearchModeEnabled     ,
    getSearchBarSearchModeEnabled           ,
    setSearchBarSearchModeEnabled           ,


-- ** ShowCloseButton
    SearchBarShowCloseButtonPropertyInfo    ,
    constructSearchBarShowCloseButton       ,
    getSearchBarShowCloseButton             ,
    setSearchBarShowCloseButton             ,




    ) 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.Gdk as Gdk

newtype SearchBar = SearchBar (ForeignPtr SearchBar)
foreign import ccall "gtk_search_bar_get_type"
    c_gtk_search_bar_get_type :: IO GType

type instance ParentTypes SearchBar = SearchBarParentTypes
type SearchBarParentTypes = '[Bin, Container, Widget, GObject.Object, Atk.ImplementorIface, Buildable]

instance GObject SearchBar where
    gobjectIsInitiallyUnowned _ = True
    gobjectType _ = c_gtk_search_bar_get_type
    

class GObject o => SearchBarK o
instance (GObject o, IsDescendantOf SearchBar o) => SearchBarK o

toSearchBar :: SearchBarK o => o -> IO SearchBar
toSearchBar = unsafeCastTo SearchBar

noSearchBar :: Maybe SearchBar
noSearchBar = Nothing

-- VVV Prop "search-mode-enabled"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable,PropertyWritable]

getSearchBarSearchModeEnabled :: (MonadIO m, SearchBarK o) => o -> m Bool
getSearchBarSearchModeEnabled obj = liftIO $ getObjectPropertyBool obj "search-mode-enabled"

setSearchBarSearchModeEnabled :: (MonadIO m, SearchBarK o) => o -> Bool -> m ()
setSearchBarSearchModeEnabled obj val = liftIO $ setObjectPropertyBool obj "search-mode-enabled" val

constructSearchBarSearchModeEnabled :: Bool -> IO ([Char], GValue)
constructSearchBarSearchModeEnabled val = constructObjectPropertyBool "search-mode-enabled" val

data SearchBarSearchModeEnabledPropertyInfo
instance AttrInfo SearchBarSearchModeEnabledPropertyInfo where
    type AttrAllowedOps SearchBarSearchModeEnabledPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint SearchBarSearchModeEnabledPropertyInfo = (~) Bool
    type AttrBaseTypeConstraint SearchBarSearchModeEnabledPropertyInfo = SearchBarK
    type AttrGetType SearchBarSearchModeEnabledPropertyInfo = Bool
    type AttrLabel SearchBarSearchModeEnabledPropertyInfo = "SearchBar::search-mode-enabled"
    attrGet _ = getSearchBarSearchModeEnabled
    attrSet _ = setSearchBarSearchModeEnabled
    attrConstruct _ = constructSearchBarSearchModeEnabled

-- VVV Prop "show-close-button"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct]

getSearchBarShowCloseButton :: (MonadIO m, SearchBarK o) => o -> m Bool
getSearchBarShowCloseButton obj = liftIO $ getObjectPropertyBool obj "show-close-button"

setSearchBarShowCloseButton :: (MonadIO m, SearchBarK o) => o -> Bool -> m ()
setSearchBarShowCloseButton obj val = liftIO $ setObjectPropertyBool obj "show-close-button" val

constructSearchBarShowCloseButton :: Bool -> IO ([Char], GValue)
constructSearchBarShowCloseButton val = constructObjectPropertyBool "show-close-button" val

data SearchBarShowCloseButtonPropertyInfo
instance AttrInfo SearchBarShowCloseButtonPropertyInfo where
    type AttrAllowedOps SearchBarShowCloseButtonPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint SearchBarShowCloseButtonPropertyInfo = (~) Bool
    type AttrBaseTypeConstraint SearchBarShowCloseButtonPropertyInfo = SearchBarK
    type AttrGetType SearchBarShowCloseButtonPropertyInfo = Bool
    type AttrLabel SearchBarShowCloseButtonPropertyInfo = "SearchBar::show-close-button"
    attrGet _ = getSearchBarShowCloseButton
    attrSet _ = setSearchBarShowCloseButton
    attrConstruct _ = constructSearchBarShowCloseButton

type instance AttributeList SearchBar = SearchBarAttributeList
type SearchBarAttributeList = ('[ '("app-paintable", WidgetAppPaintablePropertyInfo), '("border-width", ContainerBorderWidthPropertyInfo), '("can-default", WidgetCanDefaultPropertyInfo), '("can-focus", WidgetCanFocusPropertyInfo), '("child", ContainerChildPropertyInfo), '("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), '("parent", WidgetParentPropertyInfo), '("receives-default", WidgetReceivesDefaultPropertyInfo), '("resize-mode", ContainerResizeModePropertyInfo), '("scale-factor", WidgetScaleFactorPropertyInfo), '("search-mode-enabled", SearchBarSearchModeEnabledPropertyInfo), '("sensitive", WidgetSensitivePropertyInfo), '("show-close-button", SearchBarShowCloseButtonPropertyInfo), '("style", WidgetStylePropertyInfo), '("tooltip-markup", WidgetTooltipMarkupPropertyInfo), '("tooltip-text", WidgetTooltipTextPropertyInfo), '("valign", WidgetValignPropertyInfo), '("vexpand", WidgetVexpandPropertyInfo), '("vexpand-set", WidgetVexpandSetPropertyInfo), '("visible", WidgetVisiblePropertyInfo), '("width-request", WidgetWidthRequestPropertyInfo), '("window", WidgetWindowPropertyInfo)] :: [(Symbol, *)])

type instance SignalList SearchBar = SearchBarSignalList
type SearchBarSignalList = ('[ '("accel-closures-changed", WidgetAccelClosuresChangedSignalInfo), '("add", ContainerAddSignalInfo), '("button-press-event", WidgetButtonPressEventSignalInfo), '("button-release-event", WidgetButtonReleaseEventSignalInfo), '("can-activate-accel", WidgetCanActivateAccelSignalInfo), '("check-resize", ContainerCheckResizeSignalInfo), '("child-notify", WidgetChildNotifySignalInfo), '("composited-changed", WidgetCompositedChangedSignalInfo), '("configure-event", WidgetConfigureEventSignalInfo), '("damage-event", WidgetDamageEventSignalInfo), '("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), '("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-focus", WidgetMoveFocusSignalInfo), '("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-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 SearchBar::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TInterface "Gtk" "SearchBar"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_search_bar_new" gtk_search_bar_new :: 
    IO (Ptr SearchBar)


searchBarNew ::
    (MonadIO m) =>
    m SearchBar
searchBarNew  = liftIO $ do
    result <- gtk_search_bar_new
    checkUnexpectedReturnNULL "gtk_search_bar_new" result
    result' <- (newObject SearchBar) result
    return result'

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

foreign import ccall "gtk_search_bar_connect_entry" gtk_search_bar_connect_entry :: 
    Ptr SearchBar ->                        -- _obj : TInterface "Gtk" "SearchBar"
    Ptr Entry ->                            -- entry : TInterface "Gtk" "Entry"
    IO ()


searchBarConnectEntry ::
    (MonadIO m, SearchBarK a, EntryK b) =>
    a ->                                    -- _obj
    b ->                                    -- entry
    m ()
searchBarConnectEntry _obj entry = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let entry' = unsafeManagedPtrCastPtr entry
    gtk_search_bar_connect_entry _obj' entry'
    touchManagedPtr _obj
    touchManagedPtr entry
    return ()

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

foreign import ccall "gtk_search_bar_get_search_mode" gtk_search_bar_get_search_mode :: 
    Ptr SearchBar ->                        -- _obj : TInterface "Gtk" "SearchBar"
    IO CInt


searchBarGetSearchMode ::
    (MonadIO m, SearchBarK a) =>
    a ->                                    -- _obj
    m Bool
searchBarGetSearchMode _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_search_bar_get_search_mode _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "gtk_search_bar_get_show_close_button" gtk_search_bar_get_show_close_button :: 
    Ptr SearchBar ->                        -- _obj : TInterface "Gtk" "SearchBar"
    IO CInt


searchBarGetShowCloseButton ::
    (MonadIO m, SearchBarK a) =>
    a ->                                    -- _obj
    m Bool
searchBarGetShowCloseButton _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_search_bar_get_show_close_button _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method SearchBar::handle_event
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "SearchBar", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "event", argType = TInterface "Gdk" "Event", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "SearchBar", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "event", argType = TInterface "Gdk" "Event", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gtk_search_bar_handle_event" gtk_search_bar_handle_event :: 
    Ptr SearchBar ->                        -- _obj : TInterface "Gtk" "SearchBar"
    Ptr Gdk.Event ->                        -- event : TInterface "Gdk" "Event"
    IO CInt


searchBarHandleEvent ::
    (MonadIO m, SearchBarK a) =>
    a ->                                    -- _obj
    Gdk.Event ->                            -- event
    m Bool
searchBarHandleEvent _obj event = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let event' = unsafeManagedPtrGetPtr event
    result <- gtk_search_bar_handle_event _obj' event'
    let result' = (/= 0) result
    touchManagedPtr _obj
    touchManagedPtr event
    return result'

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

foreign import ccall "gtk_search_bar_set_search_mode" gtk_search_bar_set_search_mode :: 
    Ptr SearchBar ->                        -- _obj : TInterface "Gtk" "SearchBar"
    CInt ->                                 -- search_mode : TBasicType TBoolean
    IO ()


searchBarSetSearchMode ::
    (MonadIO m, SearchBarK a) =>
    a ->                                    -- _obj
    Bool ->                                 -- search_mode
    m ()
searchBarSetSearchMode _obj search_mode = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let search_mode' = (fromIntegral . fromEnum) search_mode
    gtk_search_bar_set_search_mode _obj' search_mode'
    touchManagedPtr _obj
    return ()

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

foreign import ccall "gtk_search_bar_set_show_close_button" gtk_search_bar_set_show_close_button :: 
    Ptr SearchBar ->                        -- _obj : TInterface "Gtk" "SearchBar"
    CInt ->                                 -- visible : TBasicType TBoolean
    IO ()


searchBarSetShowCloseButton ::
    (MonadIO m, SearchBarK a) =>
    a ->                                    -- _obj
    Bool ->                                 -- visible
    m ()
searchBarSetShowCloseButton _obj visible = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let visible' = (fromIntegral . fromEnum) visible
    gtk_search_bar_set_show_close_button _obj' visible'
    touchManagedPtr _obj
    return ()