{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)

The Navigation interface is used for creating and injecting navigation related
events such as mouse button presses, cursor motion and key presses. The associated
library also provides methods for parsing received events, and for sending and
receiving navigation related bus events. One main usecase is DVD menu navigation.

The main parts of the API are:

* The GstNavigation interface, implemented by elements which provide an application
  with the ability to create and inject navigation events into the pipeline.
* GstNavigation event handling API. GstNavigation events are created in response to
  calls on a GstNavigation interface implementation, and sent in the pipeline. Upstream
  elements can use the navigation event API functions to parse the contents of received
  messages.

* GstNavigation message handling API. GstNavigation messages may be sent on the message
  bus to inform applications of navigation related changes in the pipeline, such as the
  mouse moving over a clickable region, or the set of available angles changing.

The GstNavigation message functions provide functions for creating and parsing
custom bus messages for signaling GstNavigation changes.
-}

#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
       && !defined(__HADDOCK_VERSION__))

module GI.GstVideo.Interfaces.Navigation
    (

-- * Exported types
    Navigation(..)                          ,
    noNavigation                            ,
    IsNavigation                            ,


 -- * Methods
-- ** eventGetType #method:eventGetType#

    navigationEventGetType                  ,


-- ** eventParseCommand #method:eventParseCommand#

    navigationEventParseCommand             ,


-- ** eventParseKeyEvent #method:eventParseKeyEvent#

    navigationEventParseKeyEvent            ,


-- ** eventParseMouseButtonEvent #method:eventParseMouseButtonEvent#

    navigationEventParseMouseButtonEvent    ,


-- ** eventParseMouseMoveEvent #method:eventParseMouseMoveEvent#

    navigationEventParseMouseMoveEvent      ,


-- ** messageGetType #method:messageGetType#

    navigationMessageGetType                ,


-- ** messageNewAnglesChanged #method:messageNewAnglesChanged#

    navigationMessageNewAnglesChanged       ,


-- ** messageNewCommandsChanged #method:messageNewCommandsChanged#

    navigationMessageNewCommandsChanged     ,


-- ** messageNewEvent #method:messageNewEvent#

    navigationMessageNewEvent               ,


-- ** messageNewMouseOver #method:messageNewMouseOver#

    navigationMessageNewMouseOver           ,


-- ** messageParseAnglesChanged #method:messageParseAnglesChanged#

    navigationMessageParseAnglesChanged     ,


-- ** messageParseEvent #method:messageParseEvent#

    navigationMessageParseEvent             ,


-- ** messageParseMouseOver #method:messageParseMouseOver#

    navigationMessageParseMouseOver         ,


-- ** queryGetType #method:queryGetType#

    navigationQueryGetType                  ,


-- ** queryNewAngles #method:queryNewAngles#

    navigationQueryNewAngles                ,


-- ** queryNewCommands #method:queryNewCommands#

    navigationQueryNewCommands              ,


-- ** queryParseAngles #method:queryParseAngles#

    navigationQueryParseAngles              ,


-- ** queryParseCommandsLength #method:queryParseCommandsLength#

    navigationQueryParseCommandsLength      ,


-- ** queryParseCommandsNth #method:queryParseCommandsNth#

    navigationQueryParseCommandsNth         ,


-- ** querySetAngles #method:querySetAngles#

    navigationQuerySetAngles                ,


-- ** querySetCommandsv #method:querySetCommandsv#

    navigationQuerySetCommandsv             ,


-- ** sendCommand #method:sendCommand#

#if ENABLE_OVERLOADING
    NavigationSendCommandMethodInfo         ,
#endif
    navigationSendCommand                   ,


-- ** sendEvent #method:sendEvent#

#if ENABLE_OVERLOADING
    NavigationSendEventMethodInfo           ,
#endif
    navigationSendEvent                     ,


-- ** sendKeyEvent #method:sendKeyEvent#

#if ENABLE_OVERLOADING
    NavigationSendKeyEventMethodInfo        ,
#endif
    navigationSendKeyEvent                  ,


-- ** sendMouseEvent #method:sendMouseEvent#

#if ENABLE_OVERLOADING
    NavigationSendMouseEventMethodInfo      ,
#endif
    navigationSendMouseEvent                ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL

import qualified GI.Gst.Objects.Object as Gst.Object
import qualified GI.Gst.Structs.Event as Gst.Event
import qualified GI.Gst.Structs.Message as Gst.Message
import qualified GI.Gst.Structs.Query as Gst.Query
import qualified GI.Gst.Structs.Structure as Gst.Structure
import {-# SOURCE #-} qualified GI.GstVideo.Enums as GstVideo.Enums

-- interface Navigation 
-- | Memory-managed wrapper type.
newtype Navigation = Navigation (ManagedPtr Navigation)
-- | A convenience alias for `Nothing` :: `Maybe` `Navigation`.
noNavigation :: Maybe Navigation
noNavigation = Nothing

#if ENABLE_OVERLOADING
type instance O.SignalList Navigation = NavigationSignalList
type NavigationSignalList = ('[ ] :: [(Symbol, *)])

#endif

-- | Type class for types which implement `Navigation`.
class ManagedPtrNewtype a => IsNavigation a
instance IsNavigation Navigation
-- XXX Wrapping a foreign struct/union with no known destructor or size, leak?
instance WrappedPtr Navigation where
    wrappedPtrCalloc = return nullPtr
    wrappedPtrCopy = return
    wrappedPtrFree = Nothing


#if ENABLE_OVERLOADING
type family ResolveNavigationMethod (t :: Symbol) (o :: *) :: * where
    ResolveNavigationMethod "sendCommand" o = NavigationSendCommandMethodInfo
    ResolveNavigationMethod "sendEvent" o = NavigationSendEventMethodInfo
    ResolveNavigationMethod "sendKeyEvent" o = NavigationSendKeyEventMethodInfo
    ResolveNavigationMethod "sendMouseEvent" o = NavigationSendMouseEventMethodInfo
    ResolveNavigationMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveNavigationMethod t Navigation, O.MethodInfo info Navigation p) => OL.IsLabel t (Navigation -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

#endif

-- method Navigation::send_command
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "navigation", argType = TInterface (Name {namespace = "GstVideo", name = "Navigation"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The navigation interface instance", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "command", argType = TInterface (Name {namespace = "GstVideo", name = "NavigationCommand"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The command to issue", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_navigation_send_command" gst_navigation_send_command ::
    Ptr Navigation ->                       -- navigation : TInterface (Name {namespace = "GstVideo", name = "Navigation"})
    CUInt ->                                -- command : TInterface (Name {namespace = "GstVideo", name = "NavigationCommand"})
    IO ()

{- |
Sends the indicated command to the navigation interface.
-}
navigationSendCommand ::
    (B.CallStack.HasCallStack, MonadIO m, IsNavigation a) =>
    a
    {- ^ /@navigation@/: The navigation interface instance -}
    -> GstVideo.Enums.NavigationCommand
    {- ^ /@command@/: The command to issue -}
    -> m ()
navigationSendCommand navigation command = liftIO $ do
    navigation' <- unsafeManagedPtrCastPtr navigation
    let command' = (fromIntegral . fromEnum) command
    gst_navigation_send_command navigation' command'
    touchManagedPtr navigation
    return ()

#if ENABLE_OVERLOADING
data NavigationSendCommandMethodInfo
instance (signature ~ (GstVideo.Enums.NavigationCommand -> m ()), MonadIO m, IsNavigation a) => O.MethodInfo NavigationSendCommandMethodInfo a signature where
    overloadedMethod _ = navigationSendCommand

#endif

-- method Navigation::send_event
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "navigation", argType = TInterface (Name {namespace = "GstVideo", name = "Navigation"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_navigation_send_event" gst_navigation_send_event ::
    Ptr Navigation ->                       -- navigation : TInterface (Name {namespace = "GstVideo", name = "Navigation"})
    Ptr Gst.Structure.Structure ->          -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO ()

{- |
/No description available in the introspection data./
-}
navigationSendEvent ::
    (B.CallStack.HasCallStack, MonadIO m, IsNavigation a) =>
    a
    -> Gst.Structure.Structure
    -> m ()
navigationSendEvent navigation structure = liftIO $ do
    navigation' <- unsafeManagedPtrCastPtr navigation
    structure' <- unsafeManagedPtrGetPtr structure
    gst_navigation_send_event navigation' structure'
    touchManagedPtr navigation
    touchManagedPtr structure
    return ()

#if ENABLE_OVERLOADING
data NavigationSendEventMethodInfo
instance (signature ~ (Gst.Structure.Structure -> m ()), MonadIO m, IsNavigation a) => O.MethodInfo NavigationSendEventMethodInfo a signature where
    overloadedMethod _ = navigationSendEvent

#endif

-- method Navigation::send_key_event
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "navigation", argType = TInterface (Name {namespace = "GstVideo", name = "Navigation"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The navigation interface instance", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "event", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The type of the key event. Recognised values are \"key-press\" and\n\"key-release\"", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Character representation of the key. This is typically as produced\nby XKeysymToString.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_navigation_send_key_event" gst_navigation_send_key_event ::
    Ptr Navigation ->                       -- navigation : TInterface (Name {namespace = "GstVideo", name = "Navigation"})
    CString ->                              -- event : TBasicType TUTF8
    CString ->                              -- key : TBasicType TUTF8
    IO ()

{- |
/No description available in the introspection data./
-}
navigationSendKeyEvent ::
    (B.CallStack.HasCallStack, MonadIO m, IsNavigation a) =>
    a
    {- ^ /@navigation@/: The navigation interface instance -}
    -> T.Text
    {- ^ /@event@/: The type of the key event. Recognised values are \"key-press\" and
\"key-release\" -}
    -> T.Text
    {- ^ /@key@/: Character representation of the key. This is typically as produced
by XKeysymToString. -}
    -> m ()
navigationSendKeyEvent navigation event key = liftIO $ do
    navigation' <- unsafeManagedPtrCastPtr navigation
    event' <- textToCString event
    key' <- textToCString key
    gst_navigation_send_key_event navigation' event' key'
    touchManagedPtr navigation
    freeMem event'
    freeMem key'
    return ()

#if ENABLE_OVERLOADING
data NavigationSendKeyEventMethodInfo
instance (signature ~ (T.Text -> T.Text -> m ()), MonadIO m, IsNavigation a) => O.MethodInfo NavigationSendKeyEventMethodInfo a signature where
    overloadedMethod _ = navigationSendKeyEvent

#endif

-- method Navigation::send_mouse_event
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "navigation", argType = TInterface (Name {namespace = "GstVideo", name = "Navigation"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The navigation interface instance", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "event", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The type of mouse event, as a text string. Recognised values are\n\"mouse-button-press\", \"mouse-button-release\" and \"mouse-move\".", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "button", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The button number of the button being pressed or released. Pass 0\nfor mouse-move events.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "x", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The x coordinate of the mouse event.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "y", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The y coordinate of the mouse event.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_navigation_send_mouse_event" gst_navigation_send_mouse_event ::
    Ptr Navigation ->                       -- navigation : TInterface (Name {namespace = "GstVideo", name = "Navigation"})
    CString ->                              -- event : TBasicType TUTF8
    Int32 ->                                -- button : TBasicType TInt
    CDouble ->                              -- x : TBasicType TDouble
    CDouble ->                              -- y : TBasicType TDouble
    IO ()

{- |
Sends a mouse event to the navigation interface. Mouse event coordinates
are sent relative to the display space of the related output area. This is
usually the size in pixels of the window associated with the element
implementing the 'GI.GstVideo.Interfaces.Navigation.Navigation' interface.
-}
navigationSendMouseEvent ::
    (B.CallStack.HasCallStack, MonadIO m, IsNavigation a) =>
    a
    {- ^ /@navigation@/: The navigation interface instance -}
    -> T.Text
    {- ^ /@event@/: The type of mouse event, as a text string. Recognised values are
\"mouse-button-press\", \"mouse-button-release\" and \"mouse-move\". -}
    -> Int32
    {- ^ /@button@/: The button number of the button being pressed or released. Pass 0
for mouse-move events. -}
    -> Double
    {- ^ /@x@/: The x coordinate of the mouse event. -}
    -> Double
    {- ^ /@y@/: The y coordinate of the mouse event. -}
    -> m ()
navigationSendMouseEvent navigation event button x y = liftIO $ do
    navigation' <- unsafeManagedPtrCastPtr navigation
    event' <- textToCString event
    let x' = realToFrac x
    let y' = realToFrac y
    gst_navigation_send_mouse_event navigation' event' button x' y'
    touchManagedPtr navigation
    freeMem event'
    return ()

#if ENABLE_OVERLOADING
data NavigationSendMouseEventMethodInfo
instance (signature ~ (T.Text -> Int32 -> Double -> Double -> m ()), MonadIO m, IsNavigation a) => O.MethodInfo NavigationSendMouseEventMethodInfo a signature where
    overloadedMethod _ = navigationSendMouseEvent

#endif

-- method Navigation::event_get_type
-- method type : MemberFunction
-- Args : [Arg {argCName = "event", argType = TInterface (Name {namespace = "Gst", name = "Event"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GstEvent to inspect.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GstVideo", name = "NavigationEventType"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_navigation_event_get_type" gst_navigation_event_get_type ::
    Ptr Gst.Event.Event ->                  -- event : TInterface (Name {namespace = "Gst", name = "Event"})
    IO CUInt

{- |
Inspect a 'GI.Gst.Structs.Event.Event' and return the 'GI.GstVideo.Enums.NavigationEventType' of the event, or
@/GST_NAVIGATION_EVENT_INVALID/@ if the event is not a 'GI.GstVideo.Interfaces.Navigation.Navigation' event.
-}
navigationEventGetType ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Event.Event
    {- ^ /@event@/: A 'GI.Gst.Structs.Event.Event' to inspect. -}
    -> m GstVideo.Enums.NavigationEventType
navigationEventGetType event = liftIO $ do
    event' <- unsafeManagedPtrGetPtr event
    result <- gst_navigation_event_get_type event'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr event
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Navigation::event_parse_command
-- method type : MemberFunction
-- Args : [Arg {argCName = "event", argType = TInterface (Name {namespace = "Gst", name = "Event"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GstEvent to inspect.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "command", argType = TInterface (Name {namespace = "GstVideo", name = "NavigationCommand"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Pointer to GstNavigationCommand to receive the\n    type of the navigation event.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_navigation_event_parse_command" gst_navigation_event_parse_command ::
    Ptr Gst.Event.Event ->                  -- event : TInterface (Name {namespace = "Gst", name = "Event"})
    Ptr CUInt ->                            -- command : TInterface (Name {namespace = "GstVideo", name = "NavigationCommand"})
    IO CInt

{- |
Inspect a 'GI.GstVideo.Interfaces.Navigation.Navigation' command event and retrieve the enum value of the
associated command.
-}
navigationEventParseCommand ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Event.Event
    {- ^ /@event@/: A 'GI.Gst.Structs.Event.Event' to inspect. -}
    -> m ((Bool, GstVideo.Enums.NavigationCommand))
    {- ^ __Returns:__ TRUE if the navigation command could be extracted, otherwise FALSE. -}
navigationEventParseCommand event = liftIO $ do
    event' <- unsafeManagedPtrGetPtr event
    command <- allocMem :: IO (Ptr CUInt)
    result <- gst_navigation_event_parse_command event' command
    let result' = (/= 0) result
    command' <- peek command
    let command'' = (toEnum . fromIntegral) command'
    touchManagedPtr event
    freeMem command
    return (result', command'')

#if ENABLE_OVERLOADING
#endif

-- method Navigation::event_parse_key_event
-- method type : MemberFunction
-- Args : [Arg {argCName = "event", argType = TInterface (Name {namespace = "Gst", name = "Event"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GstEvent to inspect.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A pointer to a location to receive\n    the string identifying the key press. The returned string is owned by the\n    event, and valid only until the event is unreffed.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_navigation_event_parse_key_event" gst_navigation_event_parse_key_event ::
    Ptr Gst.Event.Event ->                  -- event : TInterface (Name {namespace = "Gst", name = "Event"})
    Ptr CString ->                          -- key : TBasicType TUTF8
    IO CInt

{- |
/No description available in the introspection data./
-}
navigationEventParseKeyEvent ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Event.Event
    {- ^ /@event@/: A 'GI.Gst.Structs.Event.Event' to inspect. -}
    -> m ((Bool, T.Text))
navigationEventParseKeyEvent event = liftIO $ do
    event' <- unsafeManagedPtrGetPtr event
    key <- allocMem :: IO (Ptr CString)
    result <- gst_navigation_event_parse_key_event event' key
    let result' = (/= 0) result
    key' <- peek key
    key'' <- cstringToText key'
    touchManagedPtr event
    freeMem key
    return (result', key'')

#if ENABLE_OVERLOADING
#endif

-- method Navigation::event_parse_mouse_button_event
-- method type : MemberFunction
-- Args : [Arg {argCName = "event", argType = TInterface (Name {namespace = "Gst", name = "Event"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GstEvent to inspect.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "button", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Pointer to a gint that will receive the button\n    number associated with the event.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "x", argType = TBasicType TDouble, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Pointer to a gdouble to receive the x coordinate of the\n    mouse button event.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "y", argType = TBasicType TDouble, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Pointer to a gdouble to receive the y coordinate of the\n    mouse button event.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_navigation_event_parse_mouse_button_event" gst_navigation_event_parse_mouse_button_event ::
    Ptr Gst.Event.Event ->                  -- event : TInterface (Name {namespace = "Gst", name = "Event"})
    Ptr Int32 ->                            -- button : TBasicType TInt
    Ptr CDouble ->                          -- x : TBasicType TDouble
    Ptr CDouble ->                          -- y : TBasicType TDouble
    IO CInt

{- |
Retrieve the details of either a 'GI.GstVideo.Interfaces.Navigation.Navigation' mouse button press event or
a mouse button release event. Determine which type the event is using
'GI.GstVideo.Functions.navigationEventGetType' to retrieve the 'GI.GstVideo.Enums.NavigationEventType'.
-}
navigationEventParseMouseButtonEvent ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Event.Event
    {- ^ /@event@/: A 'GI.Gst.Structs.Event.Event' to inspect. -}
    -> m ((Bool, Int32, Double, Double))
    {- ^ __Returns:__ TRUE if the button number and both coordinates could be extracted,
    otherwise FALSE. -}
navigationEventParseMouseButtonEvent event = liftIO $ do
    event' <- unsafeManagedPtrGetPtr event
    button <- allocMem :: IO (Ptr Int32)
    x <- allocMem :: IO (Ptr CDouble)
    y <- allocMem :: IO (Ptr CDouble)
    result <- gst_navigation_event_parse_mouse_button_event event' button x y
    let result' = (/= 0) result
    button' <- peek button
    x' <- peek x
    let x'' = realToFrac x'
    y' <- peek y
    let y'' = realToFrac y'
    touchManagedPtr event
    freeMem button
    freeMem x
    freeMem y
    return (result', button', x'', y'')

#if ENABLE_OVERLOADING
#endif

-- method Navigation::event_parse_mouse_move_event
-- method type : MemberFunction
-- Args : [Arg {argCName = "event", argType = TInterface (Name {namespace = "Gst", name = "Event"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GstEvent to inspect.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "x", argType = TBasicType TDouble, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Pointer to a gdouble to receive the x coordinate of the\n    mouse movement.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "y", argType = TBasicType TDouble, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Pointer to a gdouble to receive the y coordinate of the\n    mouse movement.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_navigation_event_parse_mouse_move_event" gst_navigation_event_parse_mouse_move_event ::
    Ptr Gst.Event.Event ->                  -- event : TInterface (Name {namespace = "Gst", name = "Event"})
    Ptr CDouble ->                          -- x : TBasicType TDouble
    Ptr CDouble ->                          -- y : TBasicType TDouble
    IO CInt

{- |
Inspect a 'GI.GstVideo.Interfaces.Navigation.Navigation' mouse movement event and extract the coordinates
of the event.
-}
navigationEventParseMouseMoveEvent ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Event.Event
    {- ^ /@event@/: A 'GI.Gst.Structs.Event.Event' to inspect. -}
    -> m ((Bool, Double, Double))
    {- ^ __Returns:__ TRUE if both coordinates could be extracted, otherwise FALSE. -}
navigationEventParseMouseMoveEvent event = liftIO $ do
    event' <- unsafeManagedPtrGetPtr event
    x <- allocMem :: IO (Ptr CDouble)
    y <- allocMem :: IO (Ptr CDouble)
    result <- gst_navigation_event_parse_mouse_move_event event' x y
    let result' = (/= 0) result
    x' <- peek x
    let x'' = realToFrac x'
    y' <- peek y
    let y'' = realToFrac y'
    touchManagedPtr event
    freeMem x
    freeMem y
    return (result', x'', y'')

#if ENABLE_OVERLOADING
#endif

-- method Navigation::message_get_type
-- method type : MemberFunction
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GstMessage to inspect.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GstVideo", name = "NavigationMessageType"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_navigation_message_get_type" gst_navigation_message_get_type ::
    Ptr Gst.Message.Message ->              -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    IO CUInt

{- |
Check a bus message to see if it is a 'GI.GstVideo.Interfaces.Navigation.Navigation' event, and return
the 'GI.GstVideo.Enums.NavigationMessageType' identifying the type of the message if so.
-}
navigationMessageGetType ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Message.Message
    {- ^ /@message@/: A 'GI.Gst.Structs.Message.Message' to inspect. -}
    -> m GstVideo.Enums.NavigationMessageType
    {- ^ __Returns:__ The type of the 'GI.Gst.Structs.Message.Message', or
@/GST_NAVIGATION_MESSAGE_INVALID/@ if the message is not a 'GI.GstVideo.Interfaces.Navigation.Navigation'
notification. -}
navigationMessageGetType message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    result <- gst_navigation_message_get_type message'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr message
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Navigation::message_new_angles_changed
-- method type : MemberFunction
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GstObject to set as source of the new message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cur_angle", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The currently selected angle.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_angles", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The number of viewing angles now available.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_navigation_message_new_angles_changed" gst_navigation_message_new_angles_changed ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    Word32 ->                               -- cur_angle : TBasicType TUInt
    Word32 ->                               -- n_angles : TBasicType TUInt
    IO (Ptr Gst.Message.Message)

{- |
Creates a new 'GI.GstVideo.Interfaces.Navigation.Navigation' message with type
@/GST_NAVIGATION_MESSAGE_ANGLES_CHANGED/@ for notifying an application
that the current angle, or current number of angles available in a
multiangle video has changed.
-}
navigationMessageNewAnglesChanged ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    a
    {- ^ /@src@/: A 'GI.Gst.Objects.Object.Object' to set as source of the new message. -}
    -> Word32
    {- ^ /@curAngle@/: The currently selected angle. -}
    -> Word32
    {- ^ /@nAngles@/: The number of viewing angles now available. -}
    -> m Gst.Message.Message
    {- ^ __Returns:__ The new 'GI.Gst.Structs.Message.Message'. -}
navigationMessageNewAnglesChanged src curAngle nAngles = liftIO $ do
    src' <- unsafeManagedPtrCastPtr src
    result <- gst_navigation_message_new_angles_changed src' curAngle nAngles
    checkUnexpectedReturnNULL "navigationMessageNewAnglesChanged" result
    result' <- (wrapBoxed Gst.Message.Message) result
    touchManagedPtr src
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Navigation::message_new_commands_changed
-- method type : MemberFunction
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GstObject to set as source of the new message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_navigation_message_new_commands_changed" gst_navigation_message_new_commands_changed ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    IO (Ptr Gst.Message.Message)

{- |
Creates a new 'GI.GstVideo.Interfaces.Navigation.Navigation' message with type
@/GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED/@
-}
navigationMessageNewCommandsChanged ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    a
    {- ^ /@src@/: A 'GI.Gst.Objects.Object.Object' to set as source of the new message. -}
    -> m Gst.Message.Message
    {- ^ __Returns:__ The new 'GI.Gst.Structs.Message.Message'. -}
navigationMessageNewCommandsChanged src = liftIO $ do
    src' <- unsafeManagedPtrCastPtr src
    result <- gst_navigation_message_new_commands_changed src'
    checkUnexpectedReturnNULL "navigationMessageNewCommandsChanged" result
    result' <- (wrapBoxed Gst.Message.Message) result
    touchManagedPtr src
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Navigation::message_new_event
-- method type : MemberFunction
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GstObject to set as source of the new message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "event", argType = TInterface (Name {namespace = "Gst", name = "Event"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A navigation #GstEvent", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_navigation_message_new_event" gst_navigation_message_new_event ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    Ptr Gst.Event.Event ->                  -- event : TInterface (Name {namespace = "Gst", name = "Event"})
    IO (Ptr Gst.Message.Message)

{- |
Creates a new 'GI.GstVideo.Interfaces.Navigation.Navigation' message with type
@/GST_NAVIGATION_MESSAGE_EVENT/@.

/Since: 1.6/
-}
navigationMessageNewEvent ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    a
    {- ^ /@src@/: A 'GI.Gst.Objects.Object.Object' to set as source of the new message. -}
    -> Gst.Event.Event
    {- ^ /@event@/: A navigation 'GI.Gst.Structs.Event.Event' -}
    -> m Gst.Message.Message
    {- ^ __Returns:__ The new 'GI.Gst.Structs.Message.Message'. -}
navigationMessageNewEvent src event = liftIO $ do
    src' <- unsafeManagedPtrCastPtr src
    event' <- unsafeManagedPtrGetPtr event
    result <- gst_navigation_message_new_event src' event'
    checkUnexpectedReturnNULL "navigationMessageNewEvent" result
    result' <- (wrapBoxed Gst.Message.Message) result
    touchManagedPtr src
    touchManagedPtr event
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Navigation::message_new_mouse_over
-- method type : MemberFunction
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GstObject to set as source of the new message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "active", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "%TRUE if the mouse has entered a clickable area of the display.\n%FALSE if it over a non-clickable area.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_navigation_message_new_mouse_over" gst_navigation_message_new_mouse_over ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    CInt ->                                 -- active : TBasicType TBoolean
    IO (Ptr Gst.Message.Message)

{- |
Creates a new 'GI.GstVideo.Interfaces.Navigation.Navigation' message with type
@/GST_NAVIGATION_MESSAGE_MOUSE_OVER/@.
-}
navigationMessageNewMouseOver ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    a
    {- ^ /@src@/: A 'GI.Gst.Objects.Object.Object' to set as source of the new message. -}
    -> Bool
    {- ^ /@active@/: 'True' if the mouse has entered a clickable area of the display.
'False' if it over a non-clickable area. -}
    -> m Gst.Message.Message
    {- ^ __Returns:__ The new 'GI.Gst.Structs.Message.Message'. -}
navigationMessageNewMouseOver src active = liftIO $ do
    src' <- unsafeManagedPtrCastPtr src
    let active' = (fromIntegral . fromEnum) active
    result <- gst_navigation_message_new_mouse_over src' active'
    checkUnexpectedReturnNULL "navigationMessageNewMouseOver" result
    result' <- (wrapBoxed Gst.Message.Message) result
    touchManagedPtr src
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Navigation::message_parse_angles_changed
-- method type : MemberFunction
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GstMessage to inspect.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cur_angle", argType = TBasicType TUInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A pointer to a #guint to receive the new\n    current angle number, or NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "n_angles", argType = TBasicType TUInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A pointer to a #guint to receive the new angle\n    count, or NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_navigation_message_parse_angles_changed" gst_navigation_message_parse_angles_changed ::
    Ptr Gst.Message.Message ->              -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr Word32 ->                           -- cur_angle : TBasicType TUInt
    Ptr Word32 ->                           -- n_angles : TBasicType TUInt
    IO CInt

{- |
Parse a 'GI.GstVideo.Interfaces.Navigation.Navigation' message of type GST_NAVIGATION_MESSAGE_ANGLES_CHANGED
and extract the /@curAngle@/ and /@nAngles@/ parameters.
-}
navigationMessageParseAnglesChanged ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Message.Message
    {- ^ /@message@/: A 'GI.Gst.Structs.Message.Message' to inspect. -}
    -> m ((Bool, Word32, Word32))
    {- ^ __Returns:__ 'True' if the message could be successfully parsed. 'False' if not. -}
navigationMessageParseAnglesChanged message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    curAngle <- allocMem :: IO (Ptr Word32)
    nAngles <- allocMem :: IO (Ptr Word32)
    result <- gst_navigation_message_parse_angles_changed message' curAngle nAngles
    let result' = (/= 0) result
    curAngle' <- peek curAngle
    nAngles' <- peek nAngles
    touchManagedPtr message
    freeMem curAngle
    freeMem nAngles
    return (result', curAngle', nAngles')

#if ENABLE_OVERLOADING
#endif

-- method Navigation::message_parse_event
-- method type : MemberFunction
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GstMessage to inspect.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "event", argType = TInterface (Name {namespace = "Gst", name = "Event"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to a #GstEvent to receive\n    the contained navigation event.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_navigation_message_parse_event" gst_navigation_message_parse_event ::
    Ptr Gst.Message.Message ->              -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr (Ptr Gst.Event.Event) ->            -- event : TInterface (Name {namespace = "Gst", name = "Event"})
    IO CInt

{- |
Parse a 'GI.GstVideo.Interfaces.Navigation.Navigation' message of type @/GST_NAVIGATION_MESSAGE_EVENT/@
and extract contained 'GI.Gst.Structs.Event.Event'. The caller must unref the /@event@/ when done
with it.

/Since: 1.6/
-}
navigationMessageParseEvent ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Message.Message
    {- ^ /@message@/: A 'GI.Gst.Structs.Message.Message' to inspect. -}
    -> m ((Bool, Gst.Event.Event))
    {- ^ __Returns:__ 'True' if the message could be successfully parsed. 'False' if not. -}
navigationMessageParseEvent message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    event <- allocMem :: IO (Ptr (Ptr Gst.Event.Event))
    result <- gst_navigation_message_parse_event message' event
    let result' = (/= 0) result
    event' <- peek event
    event'' <- (wrapBoxed Gst.Event.Event) event'
    touchManagedPtr message
    freeMem event
    return (result', event'')

#if ENABLE_OVERLOADING
#endif

-- method Navigation::message_parse_mouse_over
-- method type : MemberFunction
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GstMessage to inspect.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "active", argType = TBasicType TBoolean, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A pointer to a gboolean to receive the\n    active/inactive state, or NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_navigation_message_parse_mouse_over" gst_navigation_message_parse_mouse_over ::
    Ptr Gst.Message.Message ->              -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr CInt ->                             -- active : TBasicType TBoolean
    IO CInt

{- |
Parse a 'GI.GstVideo.Interfaces.Navigation.Navigation' message of type @/GST_NAVIGATION_MESSAGE_MOUSE_OVER/@
and extract the active\/inactive flag. If the mouse over event is marked
active, it indicates that the mouse is over a clickable area.
-}
navigationMessageParseMouseOver ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Message.Message
    {- ^ /@message@/: A 'GI.Gst.Structs.Message.Message' to inspect. -}
    -> m ((Bool, Bool))
    {- ^ __Returns:__ 'True' if the message could be successfully parsed. 'False' if not. -}
navigationMessageParseMouseOver message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    active <- allocMem :: IO (Ptr CInt)
    result <- gst_navigation_message_parse_mouse_over message' active
    let result' = (/= 0) result
    active' <- peek active
    let active'' = (/= 0) active'
    touchManagedPtr message
    freeMem active
    return (result', active'')

#if ENABLE_OVERLOADING
#endif

-- method Navigation::query_get_type
-- method type : MemberFunction
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The query to inspect", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GstVideo", name = "NavigationQueryType"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_navigation_query_get_type" gst_navigation_query_get_type ::
    Ptr Gst.Query.Query ->                  -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    IO CUInt

{- |
Inspect a 'GI.Gst.Structs.Query.Query' and return the 'GI.GstVideo.Enums.NavigationQueryType' associated with
it if it is a 'GI.GstVideo.Interfaces.Navigation.Navigation' query.
-}
navigationQueryGetType ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Query.Query
    {- ^ /@query@/: The query to inspect -}
    -> m GstVideo.Enums.NavigationQueryType
    {- ^ __Returns:__ The 'GI.GstVideo.Enums.NavigationQueryType' of the query, or
@/GST_NAVIGATION_QUERY_INVALID/@ -}
navigationQueryGetType query = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    result <- gst_navigation_query_get_type query'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr query
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Navigation::query_new_angles
-- method type : MemberFunction
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Query"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_navigation_query_new_angles" gst_navigation_query_new_angles ::
    IO (Ptr Gst.Query.Query)

{- |
Create a new 'GI.GstVideo.Interfaces.Navigation.Navigation' angles query. When executed, it will
query the pipeline for the set of currently available angles, which may be
greater than one in a multiangle video.
-}
navigationQueryNewAngles ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Gst.Query.Query
    {- ^ __Returns:__ The new query. -}
navigationQueryNewAngles  = liftIO $ do
    result <- gst_navigation_query_new_angles
    checkUnexpectedReturnNULL "navigationQueryNewAngles" result
    result' <- (wrapBoxed Gst.Query.Query) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Navigation::query_new_commands
-- method type : MemberFunction
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Query"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_navigation_query_new_commands" gst_navigation_query_new_commands ::
    IO (Ptr Gst.Query.Query)

{- |
Create a new 'GI.GstVideo.Interfaces.Navigation.Navigation' commands query. When executed, it will
query the pipeline for the set of currently available commands.
-}
navigationQueryNewCommands ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Gst.Query.Query
    {- ^ __Returns:__ The new query. -}
navigationQueryNewCommands  = liftIO $ do
    result <- gst_navigation_query_new_commands
    checkUnexpectedReturnNULL "navigationQueryNewCommands" result
    result' <- (wrapBoxed Gst.Query.Query) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Navigation::query_parse_angles
-- method type : MemberFunction
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cur_angle", argType = TBasicType TUInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Pointer to a #guint into which to store the\n    currently selected angle value from the query, or NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "n_angles", argType = TBasicType TUInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Pointer to a #guint into which to store the\n    number of angles value from the query, or NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_navigation_query_parse_angles" gst_navigation_query_parse_angles ::
    Ptr Gst.Query.Query ->                  -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Ptr Word32 ->                           -- cur_angle : TBasicType TUInt
    Ptr Word32 ->                           -- n_angles : TBasicType TUInt
    IO CInt

{- |
Parse the current angle number in the 'GI.GstVideo.Interfaces.Navigation.Navigation' angles /@query@/ into the
@/guint/@ pointed to by the /@curAngle@/ variable, and the number of available
angles into the @/guint/@ pointed to by the /@nAngles@/ variable.
-}
navigationQueryParseAngles ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Query.Query
    {- ^ /@query@/: a 'GI.Gst.Structs.Query.Query' -}
    -> m ((Bool, Word32, Word32))
    {- ^ __Returns:__ 'True' if the query could be successfully parsed. 'False' if not. -}
navigationQueryParseAngles query = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    curAngle <- allocMem :: IO (Ptr Word32)
    nAngles <- allocMem :: IO (Ptr Word32)
    result <- gst_navigation_query_parse_angles query' curAngle nAngles
    let result' = (/= 0) result
    curAngle' <- peek curAngle
    nAngles' <- peek nAngles
    touchManagedPtr query
    freeMem curAngle
    freeMem nAngles
    return (result', curAngle', nAngles')

#if ENABLE_OVERLOADING
#endif

-- method Navigation::query_parse_commands_length
-- method type : MemberFunction
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_cmds", argType = TBasicType TUInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the number of commands in this query.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_navigation_query_parse_commands_length" gst_navigation_query_parse_commands_length ::
    Ptr Gst.Query.Query ->                  -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Ptr Word32 ->                           -- n_cmds : TBasicType TUInt
    IO CInt

{- |
Parse the number of commands in the 'GI.GstVideo.Interfaces.Navigation.Navigation' commands /@query@/.
-}
navigationQueryParseCommandsLength ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Query.Query
    {- ^ /@query@/: a 'GI.Gst.Structs.Query.Query' -}
    -> m ((Bool, Word32))
    {- ^ __Returns:__ 'True' if the query could be successfully parsed. 'False' if not. -}
navigationQueryParseCommandsLength query = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    nCmds <- allocMem :: IO (Ptr Word32)
    result <- gst_navigation_query_parse_commands_length query' nCmds
    let result' = (/= 0) result
    nCmds' <- peek nCmds
    touchManagedPtr query
    freeMem nCmds
    return (result', nCmds')

#if ENABLE_OVERLOADING
#endif

-- method Navigation::query_parse_commands_nth
-- method type : MemberFunction
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "nth", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the nth command to retrieve.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cmd", argType = TInterface (Name {namespace = "GstVideo", name = "NavigationCommand"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to store the nth command into.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_navigation_query_parse_commands_nth" gst_navigation_query_parse_commands_nth ::
    Ptr Gst.Query.Query ->                  -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Word32 ->                               -- nth : TBasicType TUInt
    Ptr CUInt ->                            -- cmd : TInterface (Name {namespace = "GstVideo", name = "NavigationCommand"})
    IO CInt

{- |
Parse the 'GI.GstVideo.Interfaces.Navigation.Navigation' command query and retrieve the /@nth@/ command from
it into /@cmd@/. If the list contains less elements than /@nth@/, /@cmd@/ will be
set to @/GST_NAVIGATION_COMMAND_INVALID/@.
-}
navigationQueryParseCommandsNth ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Query.Query
    {- ^ /@query@/: a 'GI.Gst.Structs.Query.Query' -}
    -> Word32
    {- ^ /@nth@/: the nth command to retrieve. -}
    -> m ((Bool, GstVideo.Enums.NavigationCommand))
    {- ^ __Returns:__ 'True' if the query could be successfully parsed. 'False' if not. -}
navigationQueryParseCommandsNth query nth = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    cmd <- allocMem :: IO (Ptr CUInt)
    result <- gst_navigation_query_parse_commands_nth query' nth cmd
    let result' = (/= 0) result
    cmd' <- peek cmd
    let cmd'' = (toEnum . fromIntegral) cmd'
    touchManagedPtr query
    freeMem cmd
    return (result', cmd'')

#if ENABLE_OVERLOADING
#endif

-- method Navigation::query_set_angles
-- method type : MemberFunction
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cur_angle", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the current viewing angle to set.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_angles", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the number of viewing angles to set.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_navigation_query_set_angles" gst_navigation_query_set_angles ::
    Ptr Gst.Query.Query ->                  -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Word32 ->                               -- cur_angle : TBasicType TUInt
    Word32 ->                               -- n_angles : TBasicType TUInt
    IO ()

{- |
Set the 'GI.GstVideo.Interfaces.Navigation.Navigation' angles query result field in /@query@/.
-}
navigationQuerySetAngles ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Query.Query
    {- ^ /@query@/: a 'GI.Gst.Structs.Query.Query' -}
    -> Word32
    {- ^ /@curAngle@/: the current viewing angle to set. -}
    -> Word32
    {- ^ /@nAngles@/: the number of viewing angles to set. -}
    -> m ()
navigationQuerySetAngles query curAngle nAngles = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    gst_navigation_query_set_angles query' curAngle nAngles
    touchManagedPtr query
    return ()

#if ENABLE_OVERLOADING
#endif

-- method Navigation::query_set_commandsv
-- method type : MemberFunction
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_cmds", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the number of commands to set.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cmds", argType = TCArray False (-1) 1 (TInterface (Name {namespace = "GstVideo", name = "NavigationCommand"})), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "An array containing @n_cmds\n    @GstNavigationCommand values.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : [Arg {argCName = "n_cmds", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the number of commands to set.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_navigation_query_set_commandsv" gst_navigation_query_set_commandsv ::
    Ptr Gst.Query.Query ->                  -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Int32 ->                                -- n_cmds : TBasicType TInt
    Ptr CUInt ->                            -- cmds : TCArray False (-1) 1 (TInterface (Name {namespace = "GstVideo", name = "NavigationCommand"}))
    IO ()

{- |
Set the 'GI.GstVideo.Interfaces.Navigation.Navigation' command query result fields in /@query@/. The number
of commands passed must be equal to /@nCommands@/.
-}
navigationQuerySetCommandsv ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Query.Query
    {- ^ /@query@/: a 'GI.Gst.Structs.Query.Query' -}
    -> [GstVideo.Enums.NavigationCommand]
    {- ^ /@cmds@/: An array containing /@nCmds@/
    /@gstNavigationCommand@/ values. -}
    -> m ()
navigationQuerySetCommandsv query cmds = liftIO $ do
    let nCmds = fromIntegral $ length cmds
    query' <- unsafeManagedPtrGetPtr query
    let cmds' = map (fromIntegral . fromEnum) cmds
    cmds'' <- packStorableArray cmds'
    gst_navigation_query_set_commandsv query' nCmds cmds''
    touchManagedPtr query
    freeMem cmds''
    return ()

#if ENABLE_OVERLOADING
#endif