{-# LINE 2 "./Graphics/UI/Gtk/General/Drag.chs" #-}
-- -*-haskell-*-
-- GIMP Toolkit (GTK) Drag-and-Drop functionality
--
-- Author : Axel Simon
--
-- Created: 26 March 2007
--
-- Copyright (C) 2007 Axel Simon
--
-- This library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- This library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
--
-- functions not bound:
-- dragBegin : necessary to implement custom widgets that may be the source of
-- drags. Would need to pass an event and an array of targets. The event needs
-- to have the following information: Motion {
-- eventTime :: TimeStamp,
-- eventModifier :: [Modifier],
-- eventIsHint (this needs to be True in order to avoid gdk_event_get_screen to be called (which causes havoc))
-- eventXRoot,
-- eventYRoot :: Double }
-- Button {
-- eventClick :: Click,
-- eventTime :: TimeStamp,
-- eventModifier :: [Modifier],
-- Key {
-- eventTime :: TimeStamp,
-- eventModifier :: [Modifier],
-- Crossing {
-- eventTime :: TimeStamp,
-- eventModifier :: [Modifier]}
--
-- drag_set_icon_pixmap : colormaps are a pain, they migth be useful here
-- drag_set_default_icon : obsolete drag_source_set_icon : colormap problem
--
-- |
-- Maintainer : gtk2hs-users@lists.sourceforge.net Stability : provisional
-- Portability : portable (depends on GHC)
--
-- Drag-and-Drop functionality.
--
-- GTK+ has a rich set of functions for doing inter-process communication via
-- the drag-and-drop metaphor. GTK+ can do drag-and-drop (DND) via multiple
-- protocols. The currently supported protocols are the Xdnd and Motif
-- protocols. As well as the functions listed here, applications may need to
-- use some facilities provided for 'Selection's. Also, the Drag and Drop API
-- makes use of signals in the 'Widget' class.
--
module Graphics.UI.Gtk.General.Drag (

-- * Types
  DragContext,
  DragContextClass,
  DragAction(..),
  DestDefaults(..),
  DragProtocol(..),

  DragResult(..),

  castToDragContext, gTypeDragContext,
  toDragContext,

-- * Methods

  dragContextActions,
  dragContextSuggestedAction,
  dragContextAction,


  dragDestSet,
  dragDestSetProxy,
  dragDestUnset,
  dragDestFindTarget,
  dragDestGetTargetList,
  dragDestSetTargetList,

  dragDestAddTextTargets,
  dragDestAddImageTargets,
  dragDestAddURITargets,

  dragStatus,
  dragFinish,
  dragGetData,
  dragGetSourceWidget,
  dragHighlight,
  dragUnhighlight,
  dragSetIconWidget,
  dragSetIconPixbuf,
  dragSetIconStock,

  dragSetIconName,

  dragSetIconDefault,
  dragCheckThreshold,
  dragSourceSet,
  dragSourceSetIconPixbuf,
  dragSourceSetIconStock,

  dragSourceSetIconName,

  dragSourceUnset,

  dragSourceSetTargetList,
  dragSourceGetTargetList,


  dragSourceAddTextTargets,
  dragSourceAddImageTargets,
  dragSourceAddURITargets,


  -- * Signals
  dragBegin,
  dragDataDelete,
  dragDataGet,
  dragDataReceived,
  dragDrop,
  dragEnd,

  dragFailed,

  dragLeave,
  dragMotion
  ) where

import Control.Monad (liftM)

import System.Glib.FFI
import System.Glib.UTFString
import System.Glib.Flags
import Graphics.UI.Gtk.General.StockItems ( StockId )
import Graphics.UI.Gtk.Types
{-# LINE 142 "./Graphics/UI/Gtk/General/Drag.chs" #-}
import Graphics.UI.Gtk.General.DNDTypes
{-# LINE 143 "./Graphics/UI/Gtk/General/Drag.chs" #-}
import Graphics.UI.Gtk.Gdk.Enums ( DragAction(..) )
import Graphics.UI.Gtk.General.Enums ( DestDefaults(..), DragProtocol(..)


                                     , DragResult(..)

                                     )
import Graphics.UI.Gtk.Gdk.Events ( TimeStamp, Modifier )
import Graphics.UI.Gtk.General.Structs ( Point,

  dragContextGetActions, dragContextSetActions,
  dragContextGetSuggestedAction, dragContextSetSuggestedAction,
  dragContextGetAction, dragContextSetAction

  )
import Graphics.UI.Gtk.Signals
import Control.Monad.Reader (runReaderT)

import System.Glib.Attributes ( Attr, newAttr )



{-# LINE 165 "./Graphics/UI/Gtk/General/Drag.chs" #-}


--------------------
-- Methods


-- | A set of actions that the source recommends to be taken. Only valid if
-- 'dragContextSuggestedAction' is set to 'ActionAsk'.
--
-- Removed in Gtk3.
dragContextActions :: Attr DragContext [DragAction]
dragContextActions :: Attr DragContext [DragAction]
dragContextActions = (DragContext -> IO [DragAction])
-> (DragContext -> [DragAction] -> IO ())
-> Attr DragContext [DragAction]
forall o a b.
(o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b
newAttr ((Int -> [DragAction]) -> IO Int -> IO [DragAction]
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Int -> [DragAction]
forall a. Flags a => Int -> [a]
toFlags (IO Int -> IO [DragAction])
-> (DragContext -> IO Int) -> DragContext -> IO [DragAction]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DragContext -> IO Int
dragContextGetActions)
                             (\DragContext
o -> DragContext -> Int -> IO ()
dragContextSetActions DragContext
o (Int -> IO ()) -> ([DragAction] -> Int) -> [DragAction] -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [DragAction] -> Int
forall a. Flags a => [a] -> Int
fromFlags)

-- | The action suggested by the source.
dragContextSuggestedAction :: Attr DragContext DragAction
dragContextSuggestedAction :: Attr DragContext DragAction
dragContextSuggestedAction = (DragContext -> IO DragAction)
-> (DragContext -> DragAction -> IO ())
-> Attr DragContext DragAction
forall o a b.
(o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b
newAttr ((Int -> DragAction) -> IO Int -> IO DragAction
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Int -> DragAction
forall a. Enum a => Int -> a
toEnum (IO Int -> IO DragAction)
-> (DragContext -> IO Int) -> DragContext -> IO DragAction
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DragContext -> IO Int
dragContextGetSuggestedAction)
                                     (\DragContext
o -> DragContext -> Int -> IO ()
dragContextSetSuggestedAction DragContext
o (Int -> IO ()) -> (DragAction -> Int) -> DragAction -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DragAction -> Int
forall a. Enum a => a -> Int
fromEnum)

-- | The action chosen by the destination.
dragContextAction :: Attr DragContext DragAction
dragContextAction :: Attr DragContext DragAction
dragContextAction = (DragContext -> IO DragAction)
-> (DragContext -> DragAction -> IO ())
-> Attr DragContext DragAction
forall o a b.
(o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b
newAttr ((Int -> DragAction) -> IO Int -> IO DragAction
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Int -> DragAction
forall a. Enum a => Int -> a
toEnum (IO Int -> IO DragAction)
-> (DragContext -> IO Int) -> DragContext -> IO DragAction
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DragContext -> IO Int
dragContextGetAction)
                            (\DragContext
o -> DragContext -> Int -> IO ()
dragContextSetAction DragContext
o (Int -> IO ()) -> (DragAction -> Int) -> DragAction -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DragAction -> Int
forall a. Enum a => a -> Int
fromEnum)


-- %hash c:4ff5 d:af3f

-- | Sets a widget as a potential drop destination.
--
-- * The 'DestDefaults' flags specify what actions Gtk should take on behalf
-- of a widget for drops onto that widget. The given actions and any targets
-- set through 'dragDestSetTargetList' only are used if 'DestDefaultMotion'
-- or 'DestDefaultDrop' are given.
--
-- * Things become more complicated when you try to preview the dragged data,
-- as described in the documentation for 'dragMotion'. The default
-- behaviors described by flags make some assumptions, that can conflict
-- with your own signal handlers. For instance 'DestDefaultDrop' causes
-- invocations of 'dragStatus' in the handler of 'dragMotion', and
-- invocations of 'dragFinish' in 'dragDataReceived'. Especially the
-- latter is dramatic, when your own 'dragMotion' handler calls
-- 'dragGetData' to inspect the dragged data.
--

dragDestSet :: WidgetClass widget => widget -> [DestDefaults] -> [DragAction] -> IO ()
dragDestSet :: forall widget.
WidgetClass widget =>
widget -> [DestDefaults] -> [DragAction] -> IO ()
dragDestSet widget
widget [DestDefaults]
flags [DragAction]
actions =
  (\(Widget ForeignPtr Widget
arg1) CInt
arg2 Ptr ()
arg3 CInt
arg4 CInt
arg5 -> ForeignPtr Widget -> (Ptr Widget -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Widget
arg1 ((Ptr Widget -> IO ()) -> IO ()) -> (Ptr Widget -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Widget
argPtr1 ->Ptr Widget -> CInt -> Ptr () -> CInt -> CInt -> IO ()
gtk_drag_dest_set Ptr Widget
argPtr1 CInt
arg2 Ptr ()
arg3 CInt
arg4 CInt
arg5)
{-# LINE 212 "./Graphics/UI/Gtk/General/Drag.chs" #-}
    (toWidget widget)
    ((Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> ([DestDefaults] -> Int) -> [DestDefaults] -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [DestDefaults] -> Int
forall a. Flags a => [a] -> Int
fromFlags) [DestDefaults]
flags)
    Ptr ()
forall a. Ptr a
nullPtr CInt
0
    ((Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> ([DragAction] -> Int) -> [DragAction] -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [DragAction] -> Int
forall a. Flags a => [a] -> Int
fromFlags) [DragAction]
actions)

-- %hash c:89d2 d:af3f
-- | Sets this widget as a proxy for drops to another window.
--
dragDestSetProxy :: WidgetClass widget => widget
  -> DrawWindow -- ^ The window to which to forward drag events.
  -> DragProtocol -- ^ The drag protocol which the 'DrawWindow' accepts.
  -> Bool -- ^ If @True@, send the same coordinates to the destination,
          -- because it is an embedded subwindow.
  -> IO ()
dragDestSetProxy :: forall widget.
WidgetClass widget =>
widget -> DrawWindow -> DragProtocol -> Bool -> IO ()
dragDestSetProxy widget
widget DrawWindow
proxyWindow DragProtocol
protocol Bool
useCoordinates =
  (\(Widget ForeignPtr Widget
arg1) (DrawWindow ForeignPtr DrawWindow
arg2) CInt
arg3 CInt
arg4 -> ForeignPtr Widget -> (Ptr Widget -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Widget
arg1 ((Ptr Widget -> IO ()) -> IO ()) -> (Ptr Widget -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Widget
argPtr1 ->ForeignPtr DrawWindow -> (Ptr DrawWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr DrawWindow
arg2 ((Ptr DrawWindow -> IO ()) -> IO ())
-> (Ptr DrawWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr DrawWindow
argPtr2 ->Ptr Widget -> Ptr DrawWindow -> CInt -> CInt -> IO ()
gtk_drag_dest_set_proxy Ptr Widget
argPtr1 Ptr DrawWindow
argPtr2 CInt
arg3 CInt
arg4)
{-# LINE 228 "./Graphics/UI/Gtk/General/Drag.chs" #-}
    (toWidget widget)
    DrawWindow
proxyWindow
    ((Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (DragProtocol -> Int) -> DragProtocol -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DragProtocol -> Int
forall a. Enum a => a -> Int
fromEnum) DragProtocol
protocol)
    (Bool -> CInt
forall a. Num a => Bool -> a
fromBool Bool
useCoordinates)

-- %hash c:f319 d:af3f
-- | Clears information about a drop destination set with 'dragDestSet'. The
-- widget will no longer receive notification of drags.
--
dragDestUnset :: WidgetClass widget => widget -> IO ()
dragDestUnset :: forall widget. WidgetClass widget => widget -> IO ()
dragDestUnset widget
widget =
  (\(Widget ForeignPtr Widget
arg1) -> ForeignPtr Widget -> (Ptr Widget -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Widget
arg1 ((Ptr Widget -> IO ()) -> IO ()) -> (Ptr Widget -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Widget
argPtr1 ->Ptr Widget -> IO ()
gtk_drag_dest_unset Ptr Widget
argPtr1)
{-# LINE 240 "./Graphics/UI/Gtk/General/Drag.chs" #-}
    (toWidget widget)

-- %hash c:db53 d:af3f
-- | Looks for a match between the targets mentioned in the context and the
-- 'TargetList', returning the first matching target, otherwise returning
-- @Nothing@. If @Nothing@ is given as target list, use the value from
-- 'destGetTargetList'. Some widgets may have different valid targets for
-- different parts of the widget; in that case, they will have to implement a
-- 'dragMotion' handler that passes the correct target list to this
-- function.
--
dragDestFindTarget :: (WidgetClass widget, DragContextClass context) =>
  widget -> context -> Maybe TargetList -> IO (Maybe TargetTag)
dragDestFindTarget :: forall widget context.
(WidgetClass widget, DragContextClass context) =>
widget -> context -> Maybe TargetList -> IO (Maybe TargetTag)
dragDestFindTarget widget
widget context
context (Just TargetList
targetList) = do
  Ptr ()
ttPtr <-
    (\(Widget ForeignPtr Widget
arg1) (DragContext ForeignPtr DragContext
arg2) (TargetList ForeignPtr TargetList
arg3) -> ForeignPtr Widget -> (Ptr Widget -> IO (Ptr ())) -> IO (Ptr ())
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Widget
arg1 ((Ptr Widget -> IO (Ptr ())) -> IO (Ptr ()))
-> (Ptr Widget -> IO (Ptr ())) -> IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ \Ptr Widget
argPtr1 ->ForeignPtr DragContext
-> (Ptr DragContext -> IO (Ptr ())) -> IO (Ptr ())
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr DragContext
arg2 ((Ptr DragContext -> IO (Ptr ())) -> IO (Ptr ()))
-> (Ptr DragContext -> IO (Ptr ())) -> IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ \Ptr DragContext
argPtr2 ->ForeignPtr TargetList
-> (Ptr TargetList -> IO (Ptr ())) -> IO (Ptr ())
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr TargetList
arg3 ((Ptr TargetList -> IO (Ptr ())) -> IO (Ptr ()))
-> (Ptr TargetList -> IO (Ptr ())) -> IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ \Ptr TargetList
argPtr3 ->Ptr Widget -> Ptr DragContext -> Ptr TargetList -> IO (Ptr ())
gtk_drag_dest_find_target Ptr Widget
argPtr1 Ptr DragContext
argPtr2 Ptr TargetList
argPtr3)
{-# LINE 256 "./Graphics/UI/Gtk/General/Drag.chs" #-}
    (toWidget widget)
    (context -> DragContext
forall o. DragContextClass o => o -> DragContext
toDragContext context
context)
    TargetList
targetList
  if Ptr ()
ttPtrPtr () -> Ptr () -> Bool
forall a. Eq a => a -> a -> Bool
==Ptr ()
forall a. Ptr a
nullPtr then Maybe TargetTag -> IO (Maybe TargetTag)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe TargetTag
forall a. Maybe a
Nothing else Maybe TargetTag -> IO (Maybe TargetTag)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (TargetTag -> Maybe TargetTag
forall a. a -> Maybe a
Just (Ptr () -> TargetTag
Atom Ptr ()
ttPtr))
dragDestFindTarget widget
widget context
context Maybe TargetList
Nothing = do
  Ptr ()
ttPtr <-
    (\(Widget ForeignPtr Widget
arg1) (DragContext ForeignPtr DragContext
arg2) (TargetList ForeignPtr TargetList
arg3) -> ForeignPtr Widget -> (Ptr Widget -> IO (Ptr ())) -> IO (Ptr ())
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Widget
arg1 ((Ptr Widget -> IO (Ptr ())) -> IO (Ptr ()))
-> (Ptr Widget -> IO (Ptr ())) -> IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ \Ptr Widget
argPtr1 ->ForeignPtr DragContext
-> (Ptr DragContext -> IO (Ptr ())) -> IO (Ptr ())
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr DragContext
arg2 ((Ptr DragContext -> IO (Ptr ())) -> IO (Ptr ()))
-> (Ptr DragContext -> IO (Ptr ())) -> IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ \Ptr DragContext
argPtr2 ->ForeignPtr TargetList
-> (Ptr TargetList -> IO (Ptr ())) -> IO (Ptr ())
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr TargetList
arg3 ((Ptr TargetList -> IO (Ptr ())) -> IO (Ptr ()))
-> (Ptr TargetList -> IO (Ptr ())) -> IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ \Ptr TargetList
argPtr3 ->Ptr Widget -> Ptr DragContext -> Ptr TargetList -> IO (Ptr ())
gtk_drag_dest_find_target Ptr Widget
argPtr1 Ptr DragContext
argPtr2 Ptr TargetList
argPtr3)
{-# LINE 263 "./Graphics/UI/Gtk/General/Drag.chs" #-}
    (toWidget widget)
    (context -> DragContext
forall o. DragContextClass o => o -> DragContext
toDragContext context
context)
    (ForeignPtr TargetList -> TargetList
TargetList ForeignPtr TargetList
forall a. ForeignPtr a
nullForeignPtr)
  if Ptr ()
ttPtrPtr () -> Ptr () -> Bool
forall a. Eq a => a -> a -> Bool
==Ptr ()
forall a. Ptr a
nullPtr then Maybe TargetTag -> IO (Maybe TargetTag)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe TargetTag
forall a. Maybe a
Nothing else Maybe TargetTag -> IO (Maybe TargetTag)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (TargetTag -> Maybe TargetTag
forall a. a -> Maybe a
Just (Ptr () -> TargetTag
Atom Ptr ()
ttPtr))

-- %hash c:41c7 d:af3f
-- | Returns the list of targets this widget can accept for drag-and-drop.
--
dragDestGetTargetList :: WidgetClass widget => widget -> IO (Maybe TargetList)
dragDestGetTargetList :: forall widget.
WidgetClass widget =>
widget -> IO (Maybe TargetList)
dragDestGetTargetList widget
widget = do
  Ptr TargetList
tlPtr <- (\(Widget ForeignPtr Widget
arg1) -> ForeignPtr Widget
-> (Ptr Widget -> IO (Ptr TargetList)) -> IO (Ptr TargetList)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Widget
arg1 ((Ptr Widget -> IO (Ptr TargetList)) -> IO (Ptr TargetList))
-> (Ptr Widget -> IO (Ptr TargetList)) -> IO (Ptr TargetList)
forall a b. (a -> b) -> a -> b
$ \Ptr Widget
argPtr1 ->Ptr Widget -> IO (Ptr TargetList)
gtk_drag_dest_get_target_list Ptr Widget
argPtr1) (widget -> Widget
forall o. WidgetClass o => o -> Widget
toWidget widget
widget)
  if Ptr TargetList
tlPtrPtr TargetList -> Ptr TargetList -> Bool
forall a. Eq a => a -> a -> Bool
==Ptr TargetList
forall a. Ptr a
nullPtr then Maybe TargetList -> IO (Maybe TargetList)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe TargetList
forall a. Maybe a
Nothing else (TargetList -> Maybe TargetList)
-> IO TargetList -> IO (Maybe TargetList)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TargetList -> Maybe TargetList
forall a. a -> Maybe a
Just (Ptr TargetList -> IO TargetList
mkTargetList Ptr TargetList
tlPtr)

-- %hash c:5c89 d:af3f
-- | Sets the target types that this widget can accept from drag-and-drop. The
-- widget must first be made into a drag destination with 'dragDestSet'.
--
dragDestSetTargetList :: WidgetClass widget => widget -> TargetList -> IO ()
dragDestSetTargetList :: forall widget. WidgetClass widget => widget -> TargetList -> IO ()
dragDestSetTargetList widget
widget TargetList
targetList =
  (\(Widget ForeignPtr Widget
arg1) (TargetList ForeignPtr TargetList
arg2) -> ForeignPtr Widget -> (Ptr Widget -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Widget
arg1 ((Ptr Widget -> IO ()) -> IO ()) -> (Ptr Widget -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Widget
argPtr1 ->ForeignPtr TargetList -> (Ptr TargetList -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr TargetList
arg2 ((Ptr TargetList -> IO ()) -> IO ())
-> (Ptr TargetList -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr TargetList
argPtr2 ->Ptr Widget -> Ptr TargetList -> IO ()
gtk_drag_dest_set_target_list Ptr Widget
argPtr1 Ptr TargetList
argPtr2)
{-# LINE 283 "./Graphics/UI/Gtk/General/Drag.chs" #-}
    (toWidget widget)
    TargetList
targetList


-- %hash c:36c2 d:af3f
-- | Add the text targets supported by the selection mechanism to the target
-- list of the drag source. The targets are added with an 'InfoId' of 0. If
-- you need another value, use 'Graphics.UI.Gtk.General.Selection.targetListAddTextTargets' and
-- 'dragSourceSetTargetList'.
--
dragDestAddTextTargets :: WidgetClass widget => widget -> IO ()
dragDestAddTextTargets :: forall widget. WidgetClass widget => widget -> IO ()
dragDestAddTextTargets widget
widget =
  (\(Widget ForeignPtr Widget
arg1) -> ForeignPtr Widget -> (Ptr Widget -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Widget
arg1 ((Ptr Widget -> IO ()) -> IO ()) -> (Ptr Widget -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Widget
argPtr1 ->Ptr Widget -> IO ()
gtk_drag_dest_add_text_targets Ptr Widget
argPtr1)
{-# LINE 296 "./Graphics/UI/Gtk/General/Drag.chs" #-}
    (toWidget widget)

-- %hash c:691c d:af3f
-- | Add image targets supported by the selection mechanism to the target list
-- of the drag source. The targets are added with an 'InfoId' of 0. If you
-- need another value, use
-- 'Graphics.UI.Gtk.General.Selection.targetListAddTextTargets' and
-- 'dragSourceSetTargetList'.
--
dragDestAddImageTargets :: WidgetClass widget => widget -> IO ()
dragDestAddImageTargets :: forall widget. WidgetClass widget => widget -> IO ()
dragDestAddImageTargets widget
widget =
  (\(Widget ForeignPtr Widget
arg1) -> ForeignPtr Widget -> (Ptr Widget -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Widget
arg1 ((Ptr Widget -> IO ()) -> IO ()) -> (Ptr Widget -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Widget
argPtr1 ->Ptr Widget -> IO ()
gtk_drag_dest_add_image_targets Ptr Widget
argPtr1)
{-# LINE 308 "./Graphics/UI/Gtk/General/Drag.chs" #-}
    (toWidget widget)

-- %hash c:6f83 d:af3f
-- | Add URI targets supported by the selection mechanism to the target list
-- of the drag source. The targets are added with an 'InfoId' of 0. If you
-- need another value, use
-- 'Graphics.UI.Gtk.General.Selection.targetListAddTextTargets' and
-- 'dragSourceSetTargetList'.
--
dragDestAddURITargets :: WidgetClass widget => widget -> IO ()
dragDestAddURITargets :: forall widget. WidgetClass widget => widget -> IO ()
dragDestAddURITargets widget
widget =
  (\(Widget ForeignPtr Widget
arg1) -> ForeignPtr Widget -> (Ptr Widget -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Widget
arg1 ((Ptr Widget -> IO ()) -> IO ()) -> (Ptr Widget -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Widget
argPtr1 ->Ptr Widget -> IO ()
gtk_drag_dest_add_uri_targets Ptr Widget
argPtr1)
{-# LINE 320 "./Graphics/UI/Gtk/General/Drag.chs" #-}
    (toWidget widget)



-- %hash c:a91 d:af3f
-- | Informs the drag source that the drop is finished, and that the data of
-- the drag will no longer be required.
--
dragFinish :: DragContextClass context => context
  -> Bool -- ^ a flag indicating whether the drop was successful
  -> Bool -- ^ a flag indicating whether the source should delete the original data.
  -- (This should be @True@ for a move)
  -> TimeStamp -- ^ the timestamp from the 'dragDrop' signal.
  -> IO ()
dragFinish :: forall context.
DragContextClass context =>
context -> Bool -> Bool -> TimeStamp -> IO ()
dragFinish context
context Bool
success Bool
del TimeStamp
time =
  (\(DragContext ForeignPtr DragContext
arg1) CInt
arg2 CInt
arg3 CUInt
arg4 -> ForeignPtr DragContext -> (Ptr DragContext -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr DragContext
arg1 ((Ptr DragContext -> IO ()) -> IO ())
-> (Ptr DragContext -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr DragContext
argPtr1 ->Ptr DragContext -> CInt -> CInt -> CUInt -> IO ()
gtk_drag_finish Ptr DragContext
argPtr1 CInt
arg2 CInt
arg3 CUInt
arg4)
{-# LINE 336 "./Graphics/UI/Gtk/General/Drag.chs" #-}
    (toDragContext context)
    (Bool -> CInt
forall a. Num a => Bool -> a
fromBool Bool
success)
    (Bool -> CInt
forall a. Num a => Bool -> a
fromBool Bool
del)
    (TimeStamp -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral TimeStamp
time)

-- %hash c:a37d d:af3f
-- | Gets the data associated with a drag. When the data is received or the
-- retrieval fails, GTK+ will emit a 'dragDataReceived' signal. Failure of
-- the retrieval is indicated by passing @Nothing@ in the 'selectionData' signal.
-- However, when 'dragGetData' is called
-- implicitely because the 'DestDefaultDrop' was set, then the widget will
-- not receive notification of failed drops.
--
dragGetData :: (WidgetClass widget, DragContextClass context)
  => widget -- ^ The widget that will receive the 'dragDataReceived' signal.
  -> context
  -> TargetTag -- ^ The target (form of the data) to retrieve.
  -> TimeStamp -- ^ A timestamp for retrieving the data. This will generally be
               -- the time received in a 'dragMotion' or 'dragDrop' signal.
  -> IO ()
dragGetData :: forall widget context.
(WidgetClass widget, DragContextClass context) =>
widget -> context -> TargetTag -> TimeStamp -> IO ()
dragGetData widget
widget context
context (Atom Ptr ()
target) TimeStamp
time =
  (\(Widget ForeignPtr Widget
arg1) (DragContext ForeignPtr DragContext
arg2) Ptr ()
arg3 CUInt
arg4 -> ForeignPtr Widget -> (Ptr Widget -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Widget
arg1 ((Ptr Widget -> IO ()) -> IO ()) -> (Ptr Widget -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Widget
argPtr1 ->ForeignPtr DragContext -> (Ptr DragContext -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr DragContext
arg2 ((Ptr DragContext -> IO ()) -> IO ())
-> (Ptr DragContext -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr DragContext
argPtr2 ->Ptr Widget -> Ptr DragContext -> Ptr () -> CUInt -> IO ()
gtk_drag_get_data Ptr Widget
argPtr1 Ptr DragContext
argPtr2 Ptr ()
arg3 CUInt
arg4)
{-# LINE 358 "./Graphics/UI/Gtk/General/Drag.chs" #-}
    (toWidget widget)
    (context -> DragContext
forall o. DragContextClass o => o -> DragContext
toDragContext context
context)
    Ptr ()
target
    (TimeStamp -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral TimeStamp
time)

-- %hash c:8c18 d:af3f
-- | Queries he source widget for a drag.
--
-- * If the drag is occurring within a single application, a pointer to the
-- source widget is returned. Otherwise the return value is @Nothing@.
--
dragGetSourceWidget :: DragContextClass context => context -> IO (Maybe Widget)
dragGetSourceWidget :: forall context.
DragContextClass context =>
context -> IO (Maybe Widget)
dragGetSourceWidget context
context =
  (IO (Ptr Widget) -> IO Widget)
-> IO (Ptr Widget) -> IO (Maybe Widget)
forall a. (IO (Ptr a) -> IO a) -> IO (Ptr a) -> IO (Maybe a)
maybeNull ((ForeignPtr Widget -> Widget, FinalizerPtr Widget)
-> IO (Ptr Widget) -> IO Widget
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewGObject (ForeignPtr Widget -> Widget, FinalizerPtr Widget)
forall {a}. (ForeignPtr Widget -> Widget, FinalizerPtr a)
mkWidget) (IO (Ptr Widget) -> IO (Maybe Widget))
-> IO (Ptr Widget) -> IO (Maybe Widget)
forall a b. (a -> b) -> a -> b
$
    (\(DragContext ForeignPtr DragContext
arg1) -> ForeignPtr DragContext
-> (Ptr DragContext -> IO (Ptr Widget)) -> IO (Ptr Widget)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr DragContext
arg1 ((Ptr DragContext -> IO (Ptr Widget)) -> IO (Ptr Widget))
-> (Ptr DragContext -> IO (Ptr Widget)) -> IO (Ptr Widget)
forall a b. (a -> b) -> a -> b
$ \Ptr DragContext
argPtr1 ->Ptr DragContext -> IO (Ptr Widget)
gtk_drag_get_source_widget Ptr DragContext
argPtr1)
{-# LINE 373 "./Graphics/UI/Gtk/General/Drag.chs" #-}
    (toDragContext context)

-- %hash c:1765 d:af3f
-- | Draws a highlight around a widget. This will attach handlers to
-- the expose handlers, so the highlight will continue to be displayed
-- until 'dragUnhighlight' is called.
--
dragHighlight :: WidgetClass widget => widget -> IO ()
dragHighlight :: forall widget. WidgetClass widget => widget -> IO ()
dragHighlight widget
widget =
  (\(Widget ForeignPtr Widget
arg1) -> ForeignPtr Widget -> (Ptr Widget -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Widget
arg1 ((Ptr Widget -> IO ()) -> IO ()) -> (Ptr Widget -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Widget
argPtr1 ->Ptr Widget -> IO ()
gtk_drag_highlight Ptr Widget
argPtr1)
{-# LINE 383 "./Graphics/UI/Gtk/General/Drag.chs" #-}
    (toWidget widget)

-- %hash c:f00e d:af3f
-- | Removes a highlight set by 'dragHighlight' from a widget.
--
dragUnhighlight :: WidgetClass widget => widget -> IO ()
dragUnhighlight :: forall widget. WidgetClass widget => widget -> IO ()
dragUnhighlight widget
widget =
  (\(Widget ForeignPtr Widget
arg1) -> ForeignPtr Widget -> (Ptr Widget -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Widget
arg1 ((Ptr Widget -> IO ()) -> IO ()) -> (Ptr Widget -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Widget
argPtr1 ->Ptr Widget -> IO ()
gtk_drag_unhighlight Ptr Widget
argPtr1)
{-# LINE 391 "./Graphics/UI/Gtk/General/Drag.chs" #-}
    (toWidget widget)

-- %hash c:f20 d:af3f
-- | Changes the icon for a drag to a given widget. GTK+ will not destroy
-- the widget, so if you don't want it to persist, you should connect to the
-- 'dragEnd' signal and destroy it yourself.
--
-- * The function must be called with the context of the source side.
--
dragSetIconWidget :: (DragContextClass context, WidgetClass widget) =>
  context -> widget
  -> Int -- ^ x hot-spot
  -> Int -- ^ y hot-spot
  -> IO ()
dragSetIconWidget :: forall context widget.
(DragContextClass context, WidgetClass widget) =>
context -> widget -> Int -> Int -> IO ()
dragSetIconWidget context
context widget
widget Int
hotX Int
hotY =
  (\(DragContext ForeignPtr DragContext
arg1) (Widget ForeignPtr Widget
arg2) CInt
arg3 CInt
arg4 -> ForeignPtr DragContext -> (Ptr DragContext -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr DragContext
arg1 ((Ptr DragContext -> IO ()) -> IO ())
-> (Ptr DragContext -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr DragContext
argPtr1 ->ForeignPtr Widget -> (Ptr Widget -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Widget
arg2 ((Ptr Widget -> IO ()) -> IO ()) -> (Ptr Widget -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Widget
argPtr2 ->Ptr DragContext -> Ptr Widget -> CInt -> CInt -> IO ()
gtk_drag_set_icon_widget Ptr DragContext
argPtr1 Ptr Widget
argPtr2 CInt
arg3 CInt
arg4)
{-# LINE 407 "./Graphics/UI/Gtk/General/Drag.chs" #-}
    (toDragContext context)
    (widget -> Widget
forall o. WidgetClass o => o -> Widget
toWidget widget
widget)
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
hotX)
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
hotY)

-- %hash c:69 d:af3f
-- | Set the given 'Pixbuf' as the icon for the given drag.
--
dragSetIconPixbuf :: DragContextClass context => context -> Pixbuf
  -> Int -- ^ x hot-spot
  -> Int -- ^ y hot-spot
  -> IO ()
dragSetIconPixbuf :: forall context.
DragContextClass context =>
context -> Pixbuf -> Int -> Int -> IO ()
dragSetIconPixbuf context
context Pixbuf
pixbuf Int
hotX Int
hotY =
  (\(DragContext ForeignPtr DragContext
arg1) (Pixbuf ForeignPtr Pixbuf
arg2) CInt
arg3 CInt
arg4 -> ForeignPtr DragContext -> (Ptr DragContext -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr DragContext
arg1 ((Ptr DragContext -> IO ()) -> IO ())
-> (Ptr DragContext -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr DragContext
argPtr1 ->ForeignPtr Pixbuf -> (Ptr Pixbuf -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Pixbuf
arg2 ((Ptr Pixbuf -> IO ()) -> IO ()) -> (Ptr Pixbuf -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Pixbuf
argPtr2 ->Ptr DragContext -> Ptr Pixbuf -> CInt -> CInt -> IO ()
gtk_drag_set_icon_pixbuf Ptr DragContext
argPtr1 Ptr Pixbuf
argPtr2 CInt
arg3 CInt
arg4)
{-# LINE 421 "./Graphics/UI/Gtk/General/Drag.chs" #-}
    (toDragContext context)
    Pixbuf
pixbuf
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
hotX)
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
hotY)

-- %hash c:f73f d:af3f
-- | Sets the icon for a given drag from a stock ID.
--
dragSetIconStock :: DragContextClass context => context -> StockId
  -> Int -- ^ x hot-spot
  -> Int -- ^ y hot-spot
  -> IO ()
dragSetIconStock :: forall context.
DragContextClass context =>
context -> StockId -> Int -> Int -> IO ()
dragSetIconStock context
context StockId
stockId Int
hotX Int
hotY =
  StockId -> (CString -> IO ()) -> IO ()
forall s a. GlibString s => s -> (CString -> IO a) -> IO a
forall a. StockId -> (CString -> IO a) -> IO a
withUTFString StockId
stockId ((CString -> IO ()) -> IO ()) -> (CString -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \CString
stockIdPtr ->
  (\(DragContext ForeignPtr DragContext
arg1) CString
arg2 CInt
arg3 CInt
arg4 -> ForeignPtr DragContext -> (Ptr DragContext -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr DragContext
arg1 ((Ptr DragContext -> IO ()) -> IO ())
-> (Ptr DragContext -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr DragContext
argPtr1 ->Ptr DragContext -> CString -> CInt -> CInt -> IO ()
gtk_drag_set_icon_stock Ptr DragContext
argPtr1 CString
arg2 CInt
arg3 CInt
arg4)
{-# LINE 436 "./Graphics/UI/Gtk/General/Drag.chs" #-}
    (toDragContext context)
    CString
stockIdPtr
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
hotX)
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
hotY)


-- %hash c:1eba d:af3f
-- | Sets the icon for a given drag from a named themed icon. See the docs for
-- 'IconTheme' for more details. Note that the size of the icon depends on the
-- icon theme (the icon is loaded at the DND size), thus x and y hot-spots
-- have to be used with care. Since Gtk 2.8.
--
dragSetIconName :: (DragContextClass context, GlibString string) => context
  -> string
  -> Int -- ^ x hot-spot
  -> Int -- ^ y hot-spot
  -> IO ()
dragSetIconName :: forall context string.
(DragContextClass context, GlibString string) =>
context -> string -> Int -> Int -> IO ()
dragSetIconName context
context string
iconName Int
hotX Int
hotY =
  string -> (CString -> IO ()) -> IO ()
forall a. string -> (CString -> IO a) -> IO a
forall s a. GlibString s => s -> (CString -> IO a) -> IO a
withUTFString string
iconName ((CString -> IO ()) -> IO ()) -> (CString -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \CString
iconNamePtr ->
  (\(DragContext ForeignPtr DragContext
arg1) CString
arg2 CInt
arg3 CInt
arg4 -> ForeignPtr DragContext -> (Ptr DragContext -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr DragContext
arg1 ((Ptr DragContext -> IO ()) -> IO ())
-> (Ptr DragContext -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr DragContext
argPtr1 ->Ptr DragContext -> CString -> CInt -> CInt -> IO ()
gtk_drag_set_icon_name Ptr DragContext
argPtr1 CString
arg2 CInt
arg3 CInt
arg4)
{-# LINE 456 "./Graphics/UI/Gtk/General/Drag.chs" #-}
    (toDragContext context)
    CString
iconNamePtr
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
hotX)
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
hotY)


-- %hash c:2beb d:af3f
-- | Sets the icon for a particular drag to the default icon. This function
-- must be called with a context for the source side of a drag
--
dragSetIconDefault :: DragContextClass context => context -> IO ()
dragSetIconDefault :: forall context. DragContextClass context => context -> IO ()
dragSetIconDefault context
context =
  (\(DragContext ForeignPtr DragContext
arg1) -> ForeignPtr DragContext -> (Ptr DragContext -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr DragContext
arg1 ((Ptr DragContext -> IO ()) -> IO ())
-> (Ptr DragContext -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr DragContext
argPtr1 ->Ptr DragContext -> IO ()
gtk_drag_set_icon_default Ptr DragContext
argPtr1)
{-# LINE 469 "./Graphics/UI/Gtk/General/Drag.chs" #-}
    (toDragContext context)

-- %hash c:5785 d:af3f
-- | Checks to see if a mouse drag starting at @(startX, startY)@ and ending
-- at @(currentX, currenty)@ has passed the GTK+ drag threshold, and thus
-- should trigger the beginning of a drag-and-drop operation.
--
dragCheckThreshold :: WidgetClass widget => widget
                      -> Int -- ^ @startX@
                      -> Int -- ^ @startY@
                      -> Int -- ^ @currentX@
                      -> Int -- ^ @currentY@
                      -> IO Bool
dragCheckThreshold :: forall widget.
WidgetClass widget =>
widget -> Int -> Int -> Int -> Int -> IO Bool
dragCheckThreshold widget
widget Int
startX Int
startY Int
currentX Int
currentY =
  (CInt -> Bool) -> IO CInt -> IO Bool
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (IO CInt -> IO Bool) -> IO CInt -> IO Bool
forall a b. (a -> b) -> a -> b
$
  (\(Widget ForeignPtr Widget
arg1) CInt
arg2 CInt
arg3 CInt
arg4 CInt
arg5 -> ForeignPtr Widget -> (Ptr Widget -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Widget
arg1 ((Ptr Widget -> IO CInt) -> IO CInt)
-> (Ptr Widget -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Widget
argPtr1 ->Ptr Widget -> CInt -> CInt -> CInt -> CInt -> IO CInt
gtk_drag_check_threshold Ptr Widget
argPtr1 CInt
arg2 CInt
arg3 CInt
arg4 CInt
arg5)
{-# LINE 485 "./Graphics/UI/Gtk/General/Drag.chs" #-}
    (toWidget widget)
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
startX)
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
startY)
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
currentX)
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
currentY)

-- %hash c:ce13 d:af3f
-- | Sets up a widget so that GTK+ will start a drag operation when the user
-- clicks and drags on the widget. The widget must have a window. Note that a
-- set of possible targets have to be set for a drag to be successful.
--
dragSourceSet :: WidgetClass widget => widget -> [Modifier] -> [DragAction] -> IO ()
dragSourceSet :: forall widget.
WidgetClass widget =>
widget -> [Modifier] -> [DragAction] -> IO ()
dragSourceSet widget
widget [Modifier]
startButtonMask [DragAction]
actions =
  (\(Widget ForeignPtr Widget
arg1) CInt
arg2 Ptr ()
arg3 CInt
arg4 CInt
arg5 -> ForeignPtr Widget -> (Ptr Widget -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Widget
arg1 ((Ptr Widget -> IO ()) -> IO ()) -> (Ptr Widget -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Widget
argPtr1 ->Ptr Widget -> CInt -> Ptr () -> CInt -> CInt -> IO ()
gtk_drag_source_set Ptr Widget
argPtr1 CInt
arg2 Ptr ()
arg3 CInt
arg4 CInt
arg5)
{-# LINE 499 "./Graphics/UI/Gtk/General/Drag.chs" #-}
    (toWidget widget)
    ((Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> ([Modifier] -> Int) -> [Modifier] -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Modifier] -> Int
forall a. Flags a => [a] -> Int
fromFlags) [Modifier]
startButtonMask)
    Ptr ()
forall a. Ptr a
nullPtr
    CInt
0
    ((Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> ([DragAction] -> Int) -> [DragAction] -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [DragAction] -> Int
forall a. Flags a => [a] -> Int
fromFlags) [DragAction]
actions)

-- %hash c:63f5 d:af3f
-- | Sets the icon that will be used for drags from a particular widget from a
-- 'Pixbuf'.
--
dragSourceSetIconPixbuf :: WidgetClass widget => widget -> Pixbuf -> IO ()
dragSourceSetIconPixbuf :: forall widget. WidgetClass widget => widget -> Pixbuf -> IO ()
dragSourceSetIconPixbuf widget
widget Pixbuf
pixbuf =
  (\(Widget ForeignPtr Widget
arg1) (Pixbuf ForeignPtr Pixbuf
arg2) -> ForeignPtr Widget -> (Ptr Widget -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Widget
arg1 ((Ptr Widget -> IO ()) -> IO ()) -> (Ptr Widget -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Widget
argPtr1 ->ForeignPtr Pixbuf -> (Ptr Pixbuf -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Pixbuf
arg2 ((Ptr Pixbuf -> IO ()) -> IO ()) -> (Ptr Pixbuf -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Pixbuf
argPtr2 ->Ptr Widget -> Ptr Pixbuf -> IO ()
gtk_drag_source_set_icon_pixbuf Ptr Widget
argPtr1 Ptr Pixbuf
argPtr2)
{-# LINE 512 "./Graphics/UI/Gtk/General/Drag.chs" #-}
    (toWidget widget)
    Pixbuf
pixbuf

-- %hash c:b38b d:af3f
-- | Sets the icon that will be used for drags from a particular source to a
-- stock icon.
--
dragSourceSetIconStock :: WidgetClass widget => widget -> StockId -> IO ()
dragSourceSetIconStock :: forall widget. WidgetClass widget => widget -> StockId -> IO ()
dragSourceSetIconStock widget
widget StockId
stockId =
  StockId -> (CString -> IO ()) -> IO ()
forall s a. GlibString s => s -> (CString -> IO a) -> IO a
forall a. StockId -> (CString -> IO a) -> IO a
withUTFString StockId
stockId ((CString -> IO ()) -> IO ()) -> (CString -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \CString
stockIdPtr ->
  (\(Widget ForeignPtr Widget
arg1) CString
arg2 -> ForeignPtr Widget -> (Ptr Widget -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Widget
arg1 ((Ptr Widget -> IO ()) -> IO ()) -> (Ptr Widget -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Widget
argPtr1 ->Ptr Widget -> CString -> IO ()
gtk_drag_source_set_icon_stock Ptr Widget
argPtr1 CString
arg2)
{-# LINE 523 "./Graphics/UI/Gtk/General/Drag.chs" #-}
    (toWidget widget)
    CString
stockIdPtr


-- %hash c:1786 d:af3f
-- | Sets the icon that will be used for drags from a particular source to a
-- themed icon. See the docs for 'IconTheme' for more details.
--
dragSourceSetIconName :: (WidgetClass widget, GlibString string) => widget -> string -> IO ()
dragSourceSetIconName :: forall widget string.
(WidgetClass widget, GlibString string) =>
widget -> string -> IO ()
dragSourceSetIconName widget
widget string
iconName =
  string -> (CString -> IO ()) -> IO ()
forall a. string -> (CString -> IO a) -> IO a
forall s a. GlibString s => s -> (CString -> IO a) -> IO a
withUTFString string
iconName ((CString -> IO ()) -> IO ()) -> (CString -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \CString
iconNamePtr ->
  (\(Widget ForeignPtr Widget
arg1) CString
arg2 -> ForeignPtr Widget -> (Ptr Widget -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Widget
arg1 ((Ptr Widget -> IO ()) -> IO ()) -> (Ptr Widget -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Widget
argPtr1 ->Ptr Widget -> CString -> IO ()
gtk_drag_source_set_icon_name Ptr Widget
argPtr1 CString
arg2)
{-# LINE 535 "./Graphics/UI/Gtk/General/Drag.chs" #-}
    (toWidget widget)
    CString
iconNamePtr


-- %hash c:653c d:af3f
-- | Undoes the effects of 'dragSourceSet'.
--
dragSourceUnset :: WidgetClass widget => widget -> IO ()
dragSourceUnset :: forall widget. WidgetClass widget => widget -> IO ()
dragSourceUnset widget
widget =
  (\(Widget ForeignPtr Widget
arg1) -> ForeignPtr Widget -> (Ptr Widget -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Widget
arg1 ((Ptr Widget -> IO ()) -> IO ()) -> (Ptr Widget -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Widget
argPtr1 ->Ptr Widget -> IO ()
gtk_drag_source_unset Ptr Widget
argPtr1)
{-# LINE 545 "./Graphics/UI/Gtk/General/Drag.chs" #-}
    (toWidget widget)


-- %hash c:facc d:af3f
-- | Changes the target types that this widget offers for drag-and-drop. The
-- widget must first be made into a drag source with 'dragSourceSet'.
--
-- * Since Gtk 2.4.
--
dragSourceSetTargetList :: WidgetClass widget => widget -> TargetList -> IO ()
dragSourceSetTargetList :: forall widget. WidgetClass widget => widget -> TargetList -> IO ()
dragSourceSetTargetList widget
widget TargetList
targetList =
  (\(Widget ForeignPtr Widget
arg1) (TargetList ForeignPtr TargetList
arg2) -> ForeignPtr Widget -> (Ptr Widget -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Widget
arg1 ((Ptr Widget -> IO ()) -> IO ()) -> (Ptr Widget -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Widget
argPtr1 ->ForeignPtr TargetList -> (Ptr TargetList -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr TargetList
arg2 ((Ptr TargetList -> IO ()) -> IO ())
-> (Ptr TargetList -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr TargetList
argPtr2 ->Ptr Widget -> Ptr TargetList -> IO ()
gtk_drag_source_set_target_list Ptr Widget
argPtr1 Ptr TargetList
argPtr2)
{-# LINE 557 "./Graphics/UI/Gtk/General/Drag.chs" #-}
    (toWidget widget)
    TargetList
targetList

-- %hash c:e9aa d:af3f
-- | Gets the list of targets this widget can provide for drag-and-drop.
--
-- * Since Gtk 2.4.
--
dragSourceGetTargetList :: WidgetClass widget => widget -> IO (Maybe TargetList)
dragSourceGetTargetList :: forall widget.
WidgetClass widget =>
widget -> IO (Maybe TargetList)
dragSourceGetTargetList widget
widget = do
  Ptr TargetList
tlPtr <- (\(Widget ForeignPtr Widget
arg1) -> ForeignPtr Widget
-> (Ptr Widget -> IO (Ptr TargetList)) -> IO (Ptr TargetList)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Widget
arg1 ((Ptr Widget -> IO (Ptr TargetList)) -> IO (Ptr TargetList))
-> (Ptr Widget -> IO (Ptr TargetList)) -> IO (Ptr TargetList)
forall a b. (a -> b) -> a -> b
$ \Ptr Widget
argPtr1 ->Ptr Widget -> IO (Ptr TargetList)
gtk_drag_source_get_target_list Ptr Widget
argPtr1) (widget -> Widget
forall o. WidgetClass o => o -> Widget
toWidget widget
widget)
  if Ptr TargetList
tlPtrPtr TargetList -> Ptr TargetList -> Bool
forall a. Eq a => a -> a -> Bool
==Ptr TargetList
forall a. Ptr a
nullPtr then Maybe TargetList -> IO (Maybe TargetList)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe TargetList
forall a. Maybe a
Nothing else (TargetList -> Maybe TargetList)
-> IO TargetList -> IO (Maybe TargetList)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TargetList -> Maybe TargetList
forall a. a -> Maybe a
Just (Ptr TargetList -> IO TargetList
mkTargetList Ptr TargetList
tlPtr)



-- %hash c:1f25 d:af3f
-- | Add the text targets supported by
-- 'Graphics.UI.Gtk.General.Selection.Selection' to the target list of
-- the drag source. The targets are added with @info = 0@. If you need
-- another value, use
-- 'Graphics.UI.Gtk.General.Selection.targetListAddTextTargets' and
-- 'dragSourceSetTargetList'.
--
-- * Since Gtk 2.6.
--
dragSourceAddTextTargets :: WidgetClass widget => widget -> IO ()
dragSourceAddTextTargets :: forall widget. WidgetClass widget => widget -> IO ()
dragSourceAddTextTargets widget
widget =
  (\(Widget ForeignPtr Widget
arg1) -> ForeignPtr Widget -> (Ptr Widget -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Widget
arg1 ((Ptr Widget -> IO ()) -> IO ()) -> (Ptr Widget -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Widget
argPtr1 ->Ptr Widget -> IO ()
gtk_drag_source_add_text_targets Ptr Widget
argPtr1)
{-# LINE 585 "./Graphics/UI/Gtk/General/Drag.chs" #-}
    (toWidget widget)

-- %hash c:44bf d:af3f
-- | Add the image targets supported by 'Selection' to the target list of the
-- drag source. The targets are added with @info = 0@. If you need another
-- value, use 'Graphics.UI.Gtk.General.Selection.targetListAddTextTargets' and 'dragSourceSetTargetList'.
--
-- * Since Gtk 2.6.
--
dragSourceAddImageTargets :: WidgetClass widget => widget -> IO ()
dragSourceAddImageTargets :: forall widget. WidgetClass widget => widget -> IO ()
dragSourceAddImageTargets widget
widget =
  (\(Widget ForeignPtr Widget
arg1) -> ForeignPtr Widget -> (Ptr Widget -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Widget
arg1 ((Ptr Widget -> IO ()) -> IO ()) -> (Ptr Widget -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Widget
argPtr1 ->Ptr Widget -> IO ()
gtk_drag_source_add_image_targets Ptr Widget
argPtr1)
{-# LINE 597 "./Graphics/UI/Gtk/General/Drag.chs" #-}
    (toWidget widget)

-- %hash c:4766 d:af3f
-- | Add the URI targets supported by 'Selection' to the target list of the
-- drag source. The targets are added with @info = 0@. If you need another
-- value, use 'Graphics.UI.Gtk.General.Selection.targetListAddTextTargets' and 'dragSourceSetTargetList'.
--
-- * Since Gtk 2.6.
--
dragSourceAddURITargets :: WidgetClass widget => widget -> IO ()
dragSourceAddURITargets :: forall widget. WidgetClass widget => widget -> IO ()
dragSourceAddURITargets widget
widget =
  (\(Widget ForeignPtr Widget
arg1) -> ForeignPtr Widget -> (Ptr Widget -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Widget
arg1 ((Ptr Widget -> IO ()) -> IO ()) -> (Ptr Widget -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Widget
argPtr1 ->Ptr Widget -> IO ()
gtk_drag_source_add_uri_targets Ptr Widget
argPtr1)
{-# LINE 609 "./Graphics/UI/Gtk/General/Drag.chs" #-}
    (toWidget widget)


-- | Visualises the actions offered by the drag source.
--
-- * This function is called by the drag destination in response to
-- 'dragMotion' called by the drag source. The passed-in action
-- is indicated where @Nothing@ will show that the drop is not
-- allowed.
--
dragStatus :: DragContext -> Maybe DragAction -> TimeStamp -> IO ()
dragStatus :: DragContext -> Maybe DragAction -> TimeStamp -> IO ()
dragStatus DragContext
ctxt Maybe DragAction
mAction TimeStamp
ts =
  (\(DragContext ForeignPtr DragContext
arg1) CInt
arg2 CUInt
arg3 -> ForeignPtr DragContext -> (Ptr DragContext -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr DragContext
arg1 ((Ptr DragContext -> IO ()) -> IO ())
-> (Ptr DragContext -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr DragContext
argPtr1 ->Ptr DragContext -> CInt -> CUInt -> IO ()
gdk_drag_status Ptr DragContext
argPtr1 CInt
arg2 CUInt
arg3) DragContext
ctxt (CInt -> (DragAction -> CInt) -> Maybe DragAction -> CInt
forall b a. b -> (a -> b) -> Maybe a -> b
maybe CInt
0 (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (DragAction -> Int) -> DragAction -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DragAction -> Int
forall a. Enum a => a -> Int
fromEnum) Maybe DragAction
mAction)
    (TimeStamp -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral TimeStamp
ts)

-- %hash c:fcf8 d:b945
-- | The 'dragBegin' signal is emitted on the drag source when a drag is
-- started. A typical reason to connect to this signal is to set up a custom
-- drag icon with 'dragSourceSetIcon'.
--
dragBegin :: WidgetClass self => Signal self (DragContext -> IO ())
dragBegin :: forall self. WidgetClass self => Signal self (DragContext -> IO ())
dragBegin = (Bool -> self -> (DragContext -> IO ()) -> IO (ConnectId self))
-> Signal self (DragContext -> IO ())
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (SignalName
-> Bool -> self -> (DragContext -> IO ()) -> IO (ConnectId self)
forall a' obj.
(GObjectClass a', GObjectClass obj) =>
SignalName -> Bool -> obj -> (a' -> IO ()) -> IO (ConnectId obj)
connect_OBJECT__NONE SignalName
"drag-begin")

-- %hash c:bfef d:a2ff
-- | The 'dragDataDelete' signal is emitted on the drag source when a drag
-- with the action 'ActionMove' is successfully completed. The signal handler
-- is responsible for deleting the data that has been dropped. What \"delete\"
-- means, depends on the context of the drag operation.
--
dragDataDelete :: WidgetClass self => Signal self (DragContext -> IO ())
dragDataDelete :: forall self. WidgetClass self => Signal self (DragContext -> IO ())
dragDataDelete = (Bool -> self -> (DragContext -> IO ()) -> IO (ConnectId self))
-> Signal self (DragContext -> IO ())
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (SignalName
-> Bool -> self -> (DragContext -> IO ()) -> IO (ConnectId self)
forall a' obj.
(GObjectClass a', GObjectClass obj) =>
SignalName -> Bool -> obj -> (a' -> IO ()) -> IO (ConnectId obj)
connect_OBJECT__NONE SignalName
"drag-data-delete")

-- %hash c:eb9c d:844c
-- | The 'dragDataGet' signal is emitted on the drag source when the
-- drop site requests the data which is dragged. It is the
-- responsibility of the signal handler to set the selection data in
-- the format which is indicated by 'InfoId'. See
-- 'Graphics.UI.Gtk.General.Selection.selectionDataSet' and
-- 'Graphics.UI.Gtk.General.Selection.selectionDataSetText'.
--
dragDataGet :: WidgetClass self =>
  Signal self (DragContext -> InfoId -> TimeStamp -> SelectionDataM ())
dragDataGet :: forall self.
WidgetClass self =>
Signal
  self (DragContext -> CUInt -> TimeStamp -> SelectionDataM ())
dragDataGet = (Bool
 -> self
 -> (DragContext -> CUInt -> TimeStamp -> SelectionDataM ())
 -> IO (ConnectId self))
-> Signal
     self (DragContext -> CUInt -> TimeStamp -> SelectionDataM ())
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (\Bool
after self
object DragContext -> CUInt -> TimeStamp -> SelectionDataM ()
handler -> do
      SignalName
-> Bool
-> self
-> (DragContext -> Ptr () -> Word -> Word -> IO ())
-> IO (ConnectId self)
forall a' obj b.
(GObjectClass a', GObjectClass obj) =>
SignalName
-> Bool
-> obj
-> (a' -> Ptr b -> Word -> Word -> IO ())
-> IO (ConnectId obj)
connect_OBJECT_PTR_WORD_WORD__NONE SignalName
"drag-data-get" Bool
after self
object ((DragContext -> Ptr () -> Word -> Word -> IO ())
 -> IO (ConnectId self))
-> (DragContext -> Ptr () -> Word -> Word -> IO ())
-> IO (ConnectId self)
forall a b. (a -> b) -> a -> b
$
        \DragContext
ctxt Ptr ()
dataPtr Word
info Word
time -> do
        SelectionDataM () -> Ptr () -> IO ()
forall r (m :: * -> *) a. ReaderT r m a -> r -> m a
runReaderT (DragContext -> CUInt -> TimeStamp -> SelectionDataM ()
handler DragContext
ctxt (Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
info) (Word -> TimeStamp
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
time)) Ptr ()
dataPtr IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
                    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ())

-- %hash c:9251 d:a6d8
-- | The 'dragDataReceived' signal is emitted on the drop site when the
-- dragged data has been received. If the data was received in order to
-- determine whether the drop will be accepted, the handler is expected to call
-- 'dragStatus' and /not/ finish the drag. If the data was received in response
-- to a 'dragDrop' signal (and this is the last target to be received), the
-- handler for this signal is expected to process the received data and then
-- call 'dragFinish', setting the @success@ parameter depending on whether the
-- data was processed successfully.
--
-- The handler may inspect and modify 'dragContextAction' before calling
-- 'dragFinish', e.g. to implement 'ActionAsk' as shown in the following
-- example:
--
dragDataReceived :: WidgetClass self =>
  Signal self (DragContext -> Point -> InfoId -> TimeStamp -> SelectionDataM ())
dragDataReceived :: forall self.
WidgetClass self =>
Signal
  self
  (DragContext -> Point -> CUInt -> TimeStamp -> SelectionDataM ())
dragDataReceived = (Bool
 -> self
 -> (DragContext
     -> Point -> CUInt -> TimeStamp -> SelectionDataM ())
 -> IO (ConnectId self))
-> Signal
     self
     (DragContext -> Point -> CUInt -> TimeStamp -> SelectionDataM ())
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (\Bool
after self
object DragContext -> Point -> CUInt -> TimeStamp -> SelectionDataM ()
handler -> do
  SignalName
-> Bool
-> self
-> (DragContext -> Int -> Int -> Ptr () -> Word -> Word -> IO ())
-> IO (ConnectId self)
forall a' obj d.
(GObjectClass a', GObjectClass obj) =>
SignalName
-> Bool
-> obj
-> (a' -> Int -> Int -> Ptr d -> Word -> Word -> IO ())
-> IO (ConnectId obj)
connect_OBJECT_INT_INT_PTR_WORD_WORD__NONE SignalName
"drag-data-received" Bool
after self
object ((DragContext -> Int -> Int -> Ptr () -> Word -> Word -> IO ())
 -> IO (ConnectId self))
-> (DragContext -> Int -> Int -> Ptr () -> Word -> Word -> IO ())
-> IO (ConnectId self)
forall a b. (a -> b) -> a -> b
$
    \DragContext
ctxt Int
x Int
y Ptr ()
dataPtr Word
info Word
time -> do
    SelectionDataM () -> Ptr () -> IO ()
forall r (m :: * -> *) a. ReaderT r m a -> r -> m a
runReaderT (DragContext -> Point -> CUInt -> TimeStamp -> SelectionDataM ()
handler DragContext
ctxt (Int -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x, Int -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
y) (Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
info)
               (Word -> TimeStamp
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
time)) Ptr ()
dataPtr IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ())

-- %hash c:4ef4 d:f4b8
-- | The 'dragDrop' signal is emitted on the drop site when the user drops
-- the data onto the widget. The signal handler must determine whether the
-- cursor position is in a drop zone or not. If it is not in a drop zone, it
-- returns @False@ and no further processing is necessary. Otherwise, the
-- handler returns @True@. In this case, the handler must ensure that
-- 'dragFinish' is called to let the source know that the drop is done. The
-- call to 'dragFinish' can be done either directly or in a
-- 'dragDataReceived' handler which gets triggered by calling 'dropGetData'
-- to receive the data for one or more of the supported targets.
--
dragDrop :: WidgetClass self =>
  Signal self (DragContext -> Point -> TimeStamp -> IO Bool)
dragDrop :: forall self.
WidgetClass self =>
Signal self (DragContext -> Point -> TimeStamp -> IO Bool)
dragDrop = (Bool
 -> self
 -> (DragContext -> Point -> TimeStamp -> IO Bool)
 -> IO (ConnectId self))
-> Signal self (DragContext -> Point -> TimeStamp -> IO Bool)
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (\Bool
after self
object DragContext -> Point -> TimeStamp -> IO Bool
handler ->
  SignalName
-> Bool
-> self
-> (DragContext -> Int -> Int -> Word -> IO Bool)
-> IO (ConnectId self)
forall a' obj.
(GObjectClass a', GObjectClass obj) =>
SignalName
-> Bool
-> obj
-> (a' -> Int -> Int -> Word -> IO Bool)
-> IO (ConnectId obj)
connect_OBJECT_INT_INT_WORD__BOOL SignalName
"drag-drop" Bool
after self
object ((DragContext -> Int -> Int -> Word -> IO Bool)
 -> IO (ConnectId self))
-> (DragContext -> Int -> Int -> Word -> IO Bool)
-> IO (ConnectId self)
forall a b. (a -> b) -> a -> b
$ \DragContext
ctxt Int
x Int
y Word
time ->
    DragContext -> Point -> TimeStamp -> IO Bool
handler DragContext
ctxt (Int -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x, Int -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
y) (Word -> TimeStamp
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
time))

-- %hash c:9d4e d:a5ac
-- | The 'dragEnd' signal is emitted on the drag source when a drag is
-- finished. A typical reason to connect to this signal is to undo things done
-- in 'dragBegin'.
--
dragEnd :: WidgetClass self => Signal self (DragContext -> IO ())
dragEnd :: forall self. WidgetClass self => Signal self (DragContext -> IO ())
dragEnd = (Bool -> self -> (DragContext -> IO ()) -> IO (ConnectId self))
-> Signal self (DragContext -> IO ())
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (SignalName
-> Bool -> self -> (DragContext -> IO ()) -> IO (ConnectId self)
forall a' obj.
(GObjectClass a', GObjectClass obj) =>
SignalName -> Bool -> obj -> (a' -> IO ()) -> IO (ConnectId obj)
connect_OBJECT__NONE SignalName
"drag-end")


-- | The 'dragFailed' signal is emitted on the drag source when a drag has
-- failed. The signal handler may hook custom code to handle a failed DND
-- operation based on the type of error, it returns @True@ is the failure has
-- been already handled (not showing the default \"drag operation failed\"
-- animation), otherwise it returns @False@.
--
-- * Available since Gtk+ 2.12.0.
--
dragFailed :: WidgetClass self => Signal self (DragContext -> DragResult -> IO Bool)
dragFailed :: forall self.
WidgetClass self =>
Signal self (DragContext -> DragResult -> IO Bool)
dragFailed = (Bool
 -> self
 -> (DragContext -> DragResult -> IO Bool)
 -> IO (ConnectId self))
-> Signal self (DragContext -> DragResult -> IO Bool)
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (SignalName
-> Bool
-> self
-> (DragContext -> DragResult -> IO Bool)
-> IO (ConnectId self)
forall a' b obj.
(GObjectClass a', Enum b, GObjectClass obj) =>
SignalName
-> Bool -> obj -> (a' -> b -> IO Bool) -> IO (ConnectId obj)
connect_OBJECT_ENUM__BOOL SignalName
"drag-failed")


-- %hash c:4a85 d:6122
-- | The 'dragLeave' signal is emitted on the drop site when the cursor
-- leaves the widget. A typical reason to connect to this signal is to undo
-- things done in 'dragMotion', e.g. undo highlighting with 'dragUnhighlight'
--
dragLeave :: WidgetClass self => Signal self (DragContext -> TimeStamp -> IO ())
dragLeave :: forall self.
WidgetClass self =>
Signal self (DragContext -> TimeStamp -> IO ())
dragLeave = (Bool
 -> self
 -> (DragContext -> TimeStamp -> IO ())
 -> IO (ConnectId self))
-> Signal self (DragContext -> TimeStamp -> IO ())
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (\Bool
after self
object DragContext -> TimeStamp -> IO ()
handler ->
  SignalName
-> Bool
-> self
-> (DragContext -> Word -> IO ())
-> IO (ConnectId self)
forall a' obj.
(GObjectClass a', GObjectClass obj) =>
SignalName
-> Bool -> obj -> (a' -> Word -> IO ()) -> IO (ConnectId obj)
connect_OBJECT_WORD__NONE SignalName
"drag-leave" Bool
after self
object ((DragContext -> Word -> IO ()) -> IO (ConnectId self))
-> (DragContext -> Word -> IO ()) -> IO (ConnectId self)
forall a b. (a -> b) -> a -> b
$ \DragContext
ctxt Word
time ->
    DragContext -> TimeStamp -> IO ()
handler DragContext
ctxt (Word -> TimeStamp
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
time))

-- %hash c:53f7 d:176d
-- | The 'dragMotion' signal is emitted on the drop site when the user moves
-- the cursor over the widget during a drag. The signal handler must determine
-- whether the cursor position is in a drop zone or not. If it is not in a drop
-- zone, it returns @False@ and no further processing is necessary. Otherwise,
-- the handler returns @True@. In this case, the handler is responsible for
-- providing the necessary information for displaying feedback to the user, by
-- calling 'dragStatus'. If the decision whether the drop will be accepted or
-- rejected can't be made based solely on the cursor position and the type of
-- the data, the handler may inspect the dragged data by calling 'dragGetData'
-- and defer the 'dragStatus' call to the 'dragDataReceived' handler.
--
-- Note that there is no 'dragEnter' signal. The drag receiver has to keep
-- track of whether he has received any 'dragMotion' signals since the last
-- 'dragLeave' and if not, treat the 'dragMotion' signal as an \"enter\"
-- signal. Upon an \"enter\", the handler will typically highlight the drop
-- site with 'dragHighlight'.
--
dragMotion :: WidgetClass self =>
  Signal self (DragContext -> Point -> TimeStamp -> IO Bool)
dragMotion :: forall self.
WidgetClass self =>
Signal self (DragContext -> Point -> TimeStamp -> IO Bool)
dragMotion = (Bool
 -> self
 -> (DragContext -> Point -> TimeStamp -> IO Bool)
 -> IO (ConnectId self))
-> Signal self (DragContext -> Point -> TimeStamp -> IO Bool)
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (\Bool
after self
object DragContext -> Point -> TimeStamp -> IO Bool
handler -> do
  SignalName
-> Bool
-> self
-> (DragContext -> Int -> Int -> Word -> IO Bool)
-> IO (ConnectId self)
forall a' obj.
(GObjectClass a', GObjectClass obj) =>
SignalName
-> Bool
-> obj
-> (a' -> Int -> Int -> Word -> IO Bool)
-> IO (ConnectId obj)
connect_OBJECT_INT_INT_WORD__BOOL SignalName
"drag-motion" Bool
after self
object ((DragContext -> Int -> Int -> Word -> IO Bool)
 -> IO (ConnectId self))
-> (DragContext -> Int -> Int -> Word -> IO Bool)
-> IO (ConnectId self)
forall a b. (a -> b) -> a -> b
$ \DragContext
ctxt Int
x Int
y Word
time ->
    DragContext -> Point -> TimeStamp -> IO Bool
handler DragContext
ctxt (Int -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x, Int -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
y) (Word -> TimeStamp
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
time))

foreign import ccall safe "gtk_drag_dest_set"
  gtk_drag_dest_set :: ((Ptr Widget) -> (CInt -> ((Ptr ()) -> (CInt -> (CInt -> (IO ()))))))

foreign import ccall safe "gtk_drag_dest_set_proxy"
  gtk_drag_dest_set_proxy :: ((Ptr Widget) -> ((Ptr DrawWindow) -> (CInt -> (CInt -> (IO ())))))

foreign import ccall safe "gtk_drag_dest_unset"
  gtk_drag_dest_unset :: ((Ptr Widget) -> (IO ()))

foreign import ccall safe "gtk_drag_dest_find_target"
  gtk_drag_dest_find_target :: ((Ptr Widget) -> ((Ptr DragContext) -> ((Ptr TargetList) -> (IO (Ptr ())))))

foreign import ccall safe "gtk_drag_dest_get_target_list"
  gtk_drag_dest_get_target_list :: ((Ptr Widget) -> (IO (Ptr TargetList)))

foreign import ccall safe "gtk_drag_dest_set_target_list"
  gtk_drag_dest_set_target_list :: ((Ptr Widget) -> ((Ptr TargetList) -> (IO ())))

foreign import ccall safe "gtk_drag_dest_add_text_targets"
  gtk_drag_dest_add_text_targets :: ((Ptr Widget) -> (IO ()))

foreign import ccall safe "gtk_drag_dest_add_image_targets"
  gtk_drag_dest_add_image_targets :: ((Ptr Widget) -> (IO ()))

foreign import ccall safe "gtk_drag_dest_add_uri_targets"
  gtk_drag_dest_add_uri_targets :: ((Ptr Widget) -> (IO ()))

foreign import ccall safe "gtk_drag_finish"
  gtk_drag_finish :: ((Ptr DragContext) -> (CInt -> (CInt -> (CUInt -> (IO ())))))

foreign import ccall safe "gtk_drag_get_data"
  gtk_drag_get_data :: ((Ptr Widget) -> ((Ptr DragContext) -> ((Ptr ()) -> (CUInt -> (IO ())))))

foreign import ccall safe "gtk_drag_get_source_widget"
  gtk_drag_get_source_widget :: ((Ptr DragContext) -> (IO (Ptr Widget)))

foreign import ccall safe "gtk_drag_highlight"
  gtk_drag_highlight :: ((Ptr Widget) -> (IO ()))

foreign import ccall safe "gtk_drag_unhighlight"
  gtk_drag_unhighlight :: ((Ptr Widget) -> (IO ()))

foreign import ccall safe "gtk_drag_set_icon_widget"
  gtk_drag_set_icon_widget :: ((Ptr DragContext) -> ((Ptr Widget) -> (CInt -> (CInt -> (IO ())))))

foreign import ccall safe "gtk_drag_set_icon_pixbuf"
  gtk_drag_set_icon_pixbuf :: ((Ptr DragContext) -> ((Ptr Pixbuf) -> (CInt -> (CInt -> (IO ())))))

foreign import ccall safe "gtk_drag_set_icon_stock"
  gtk_drag_set_icon_stock :: ((Ptr DragContext) -> ((Ptr CChar) -> (CInt -> (CInt -> (IO ())))))

foreign import ccall safe "gtk_drag_set_icon_name"
  gtk_drag_set_icon_name :: ((Ptr DragContext) -> ((Ptr CChar) -> (CInt -> (CInt -> (IO ())))))

foreign import ccall safe "gtk_drag_set_icon_default"
  gtk_drag_set_icon_default :: ((Ptr DragContext) -> (IO ()))

foreign import ccall safe "gtk_drag_check_threshold"
  gtk_drag_check_threshold :: ((Ptr Widget) -> (CInt -> (CInt -> (CInt -> (CInt -> (IO CInt))))))

foreign import ccall safe "gtk_drag_source_set"
  gtk_drag_source_set :: ((Ptr Widget) -> (CInt -> ((Ptr ()) -> (CInt -> (CInt -> (IO ()))))))

foreign import ccall safe "gtk_drag_source_set_icon_pixbuf"
  gtk_drag_source_set_icon_pixbuf :: ((Ptr Widget) -> ((Ptr Pixbuf) -> (IO ())))

foreign import ccall safe "gtk_drag_source_set_icon_stock"
  gtk_drag_source_set_icon_stock :: ((Ptr Widget) -> ((Ptr CChar) -> (IO ())))

foreign import ccall safe "gtk_drag_source_set_icon_name"
  gtk_drag_source_set_icon_name :: ((Ptr Widget) -> ((Ptr CChar) -> (IO ())))

foreign import ccall safe "gtk_drag_source_unset"
  gtk_drag_source_unset :: ((Ptr Widget) -> (IO ()))

foreign import ccall safe "gtk_drag_source_set_target_list"
  gtk_drag_source_set_target_list :: ((Ptr Widget) -> ((Ptr TargetList) -> (IO ())))

foreign import ccall safe "gtk_drag_source_get_target_list"
  gtk_drag_source_get_target_list :: ((Ptr Widget) -> (IO (Ptr TargetList)))

foreign import ccall safe "gtk_drag_source_add_text_targets"
  gtk_drag_source_add_text_targets :: ((Ptr Widget) -> (IO ()))

foreign import ccall safe "gtk_drag_source_add_image_targets"
  gtk_drag_source_add_image_targets :: ((Ptr Widget) -> (IO ()))

foreign import ccall safe "gtk_drag_source_add_uri_targets"
  gtk_drag_source_add_uri_targets :: ((Ptr Widget) -> (IO ()))

foreign import ccall safe "gdk_drag_status"
  gdk_drag_status :: ((Ptr DragContext) -> (CInt -> (CUInt -> (IO ()))))