gi-gtk-0.3.18.12: GI/Gtk/Objects/GesturePan.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
-}
module GI.Gtk.Objects.GesturePan
(
-- * Exported types
GesturePan(..) ,
GesturePanK ,
toGesturePan ,
noGesturePan ,
-- * Methods
-- ** gesturePanGetOrientation
gesturePanGetOrientation ,
-- ** gesturePanNew
gesturePanNew ,
-- ** gesturePanSetOrientation
gesturePanSetOrientation ,
-- * Properties
-- ** Orientation
GesturePanOrientationPropertyInfo ,
constructGesturePanOrientation ,
getGesturePanOrientation ,
setGesturePanOrientation ,
-- * Signals
-- ** Pan
GesturePanPanCallback ,
GesturePanPanCallbackC ,
GesturePanPanSignalInfo ,
afterGesturePanPan ,
gesturePanPanCallbackWrapper ,
gesturePanPanClosure ,
mkGesturePanPanCallback ,
noGesturePanPanCallback ,
onGesturePanPan ,
) where
import Prelude ()
import Data.GI.Base.ShortPrelude
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import GI.Gtk.Types
import GI.Gtk.Callbacks
import qualified GI.GObject as GObject
newtype GesturePan = GesturePan (ForeignPtr GesturePan)
foreign import ccall "gtk_gesture_pan_get_type"
c_gtk_gesture_pan_get_type :: IO GType
type instance ParentTypes GesturePan = GesturePanParentTypes
type GesturePanParentTypes = '[GestureDrag, GestureSingle, Gesture, EventController, GObject.Object]
instance GObject GesturePan where
gobjectIsInitiallyUnowned _ = False
gobjectType _ = c_gtk_gesture_pan_get_type
class GObject o => GesturePanK o
instance (GObject o, IsDescendantOf GesturePan o) => GesturePanK o
toGesturePan :: GesturePanK o => o -> IO GesturePan
toGesturePan = unsafeCastTo GesturePan
noGesturePan :: Maybe GesturePan
noGesturePan = Nothing
-- signal GesturePan::pan
type GesturePanPanCallback =
PanDirection ->
Double ->
IO ()
noGesturePanPanCallback :: Maybe GesturePanPanCallback
noGesturePanPanCallback = Nothing
type GesturePanPanCallbackC =
Ptr () -> -- object
CUInt ->
CDouble ->
Ptr () -> -- user_data
IO ()
foreign import ccall "wrapper"
mkGesturePanPanCallback :: GesturePanPanCallbackC -> IO (FunPtr GesturePanPanCallbackC)
gesturePanPanClosure :: GesturePanPanCallback -> IO Closure
gesturePanPanClosure cb = newCClosure =<< mkGesturePanPanCallback wrapped
where wrapped = gesturePanPanCallbackWrapper cb
gesturePanPanCallbackWrapper ::
GesturePanPanCallback ->
Ptr () ->
CUInt ->
CDouble ->
Ptr () ->
IO ()
gesturePanPanCallbackWrapper _cb _ direction offset _ = do
let direction' = (toEnum . fromIntegral) direction
let offset' = realToFrac offset
_cb direction' offset'
onGesturePanPan :: (GObject a, MonadIO m) => a -> GesturePanPanCallback -> m SignalHandlerId
onGesturePanPan obj cb = liftIO $ connectGesturePanPan obj cb SignalConnectBefore
afterGesturePanPan :: (GObject a, MonadIO m) => a -> GesturePanPanCallback -> m SignalHandlerId
afterGesturePanPan obj cb = connectGesturePanPan obj cb SignalConnectAfter
connectGesturePanPan :: (GObject a, MonadIO m) =>
a -> GesturePanPanCallback -> SignalConnectMode -> m SignalHandlerId
connectGesturePanPan obj cb after = liftIO $ do
cb' <- mkGesturePanPanCallback (gesturePanPanCallbackWrapper cb)
connectSignalFunPtr obj "pan" cb' after
-- VVV Prop "orientation"
-- Type: TInterface "Gtk" "Orientation"
-- Flags: [PropertyReadable,PropertyWritable]
getGesturePanOrientation :: (MonadIO m, GesturePanK o) => o -> m Orientation
getGesturePanOrientation obj = liftIO $ getObjectPropertyEnum obj "orientation"
setGesturePanOrientation :: (MonadIO m, GesturePanK o) => o -> Orientation -> m ()
setGesturePanOrientation obj val = liftIO $ setObjectPropertyEnum obj "orientation" val
constructGesturePanOrientation :: Orientation -> IO ([Char], GValue)
constructGesturePanOrientation val = constructObjectPropertyEnum "orientation" val
data GesturePanOrientationPropertyInfo
instance AttrInfo GesturePanOrientationPropertyInfo where
type AttrAllowedOps GesturePanOrientationPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
type AttrSetTypeConstraint GesturePanOrientationPropertyInfo = (~) Orientation
type AttrBaseTypeConstraint GesturePanOrientationPropertyInfo = GesturePanK
type AttrGetType GesturePanOrientationPropertyInfo = Orientation
type AttrLabel GesturePanOrientationPropertyInfo = "GesturePan::orientation"
attrGet _ = getGesturePanOrientation
attrSet _ = setGesturePanOrientation
attrConstruct _ = constructGesturePanOrientation
type instance AttributeList GesturePan = GesturePanAttributeList
type GesturePanAttributeList = ('[ '("button", GestureSingleButtonPropertyInfo), '("exclusive", GestureSingleExclusivePropertyInfo), '("n-points", GestureNPointsPropertyInfo), '("orientation", GesturePanOrientationPropertyInfo), '("propagation-phase", EventControllerPropagationPhasePropertyInfo), '("touch-only", GestureSingleTouchOnlyPropertyInfo), '("widget", EventControllerWidgetPropertyInfo), '("window", GestureWindowPropertyInfo)] :: [(Symbol, *)])
data GesturePanPanSignalInfo
instance SignalInfo GesturePanPanSignalInfo where
type HaskellCallbackType GesturePanPanSignalInfo = GesturePanPanCallback
connectSignal _ = connectGesturePanPan
type instance SignalList GesturePan = GesturePanSignalList
type GesturePanSignalList = ('[ '("begin", GestureBeginSignalInfo), '("cancel", GestureCancelSignalInfo), '("drag-begin", GestureDragDragBeginSignalInfo), '("drag-end", GestureDragDragEndSignalInfo), '("drag-update", GestureDragDragUpdateSignalInfo), '("end", GestureEndSignalInfo), '("notify", GObject.ObjectNotifySignalInfo), '("pan", GesturePanPanSignalInfo), '("sequence-state-changed", GestureSequenceStateChangedSignalInfo), '("update", GestureUpdateSignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])
-- method GesturePan::new
-- method type : Constructor
-- Args : [Arg {argName = "widget", argType = TInterface "Gtk" "Widget", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "orientation", argType = TInterface "Gtk" "Orientation", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "widget", argType = TInterface "Gtk" "Widget", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "orientation", argType = TInterface "Gtk" "Orientation", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "GesturePan"
-- throws : False
-- Skip return : False
foreign import ccall "gtk_gesture_pan_new" gtk_gesture_pan_new ::
Ptr Widget -> -- widget : TInterface "Gtk" "Widget"
CUInt -> -- orientation : TInterface "Gtk" "Orientation"
IO (Ptr GesturePan)
gesturePanNew ::
(MonadIO m, WidgetK a) =>
a -> -- widget
Orientation -> -- orientation
m GesturePan
gesturePanNew widget orientation = liftIO $ do
let widget' = unsafeManagedPtrCastPtr widget
let orientation' = (fromIntegral . fromEnum) orientation
result <- gtk_gesture_pan_new widget' orientation'
checkUnexpectedReturnNULL "gtk_gesture_pan_new" result
result' <- (wrapObject GesturePan) result
touchManagedPtr widget
return result'
-- method GesturePan::get_orientation
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "GesturePan", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "GesturePan", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "Orientation"
-- throws : False
-- Skip return : False
foreign import ccall "gtk_gesture_pan_get_orientation" gtk_gesture_pan_get_orientation ::
Ptr GesturePan -> -- _obj : TInterface "Gtk" "GesturePan"
IO CUInt
gesturePanGetOrientation ::
(MonadIO m, GesturePanK a) =>
a -> -- _obj
m Orientation
gesturePanGetOrientation _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- gtk_gesture_pan_get_orientation _obj'
let result' = (toEnum . fromIntegral) result
touchManagedPtr _obj
return result'
-- method GesturePan::set_orientation
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "GesturePan", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "orientation", argType = TInterface "Gtk" "Orientation", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "GesturePan", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "orientation", argType = TInterface "Gtk" "Orientation", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "gtk_gesture_pan_set_orientation" gtk_gesture_pan_set_orientation ::
Ptr GesturePan -> -- _obj : TInterface "Gtk" "GesturePan"
CUInt -> -- orientation : TInterface "Gtk" "Orientation"
IO ()
gesturePanSetOrientation ::
(MonadIO m, GesturePanK a) =>
a -> -- _obj
Orientation -> -- orientation
m ()
gesturePanSetOrientation _obj orientation = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
let orientation' = (fromIntegral . fromEnum) orientation
gtk_gesture_pan_set_orientation _obj' orientation'
touchManagedPtr _obj
return ()