{- | 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.Socket ( -- * Exported types Socket(..) , SocketK , toSocket , noSocket , -- * Methods -- ** socketAddId socketAddId , -- ** socketGetId socketGetId , -- ** socketGetPlugWindow socketGetPlugWindow , -- ** socketNew socketNew , -- * Signals -- ** PlugAdded SocketPlugAddedCallback , SocketPlugAddedCallbackC , SocketPlugAddedSignalInfo , afterSocketPlugAdded , mkSocketPlugAddedCallback , noSocketPlugAddedCallback , onSocketPlugAdded , socketPlugAddedCallbackWrapper , socketPlugAddedClosure , -- ** PlugRemoved SocketPlugRemovedCallback , SocketPlugRemovedCallbackC , SocketPlugRemovedSignalInfo , afterSocketPlugRemoved , mkSocketPlugRemovedCallback , noSocketPlugRemovedCallback , onSocketPlugRemoved , socketPlugRemovedCallbackWrapper , socketPlugRemovedClosure , ) where import Prelude () import Data.GI.Base.ShortPrelude import qualified Data.Text as T import qualified Data.ByteString.Char8 as B import qualified Data.Map as Map import GI.Gtk.Types import GI.Gtk.Callbacks import qualified GI.Atk as Atk import qualified GI.GObject as GObject import qualified GI.Gdk as Gdk newtype Socket = Socket (ForeignPtr Socket) foreign import ccall "gtk_socket_get_type" c_gtk_socket_get_type :: IO GType type instance ParentTypes Socket = SocketParentTypes type SocketParentTypes = '[Container, Widget, GObject.Object, Atk.ImplementorIface, Buildable] instance GObject Socket where gobjectIsInitiallyUnowned _ = True gobjectType _ = c_gtk_socket_get_type class GObject o => SocketK o instance (GObject o, IsDescendantOf Socket o) => SocketK o toSocket :: SocketK o => o -> IO Socket toSocket = unsafeCastTo Socket noSocket :: Maybe Socket noSocket = Nothing -- signal Socket::plug-added type SocketPlugAddedCallback = IO () noSocketPlugAddedCallback :: Maybe SocketPlugAddedCallback noSocketPlugAddedCallback = Nothing type SocketPlugAddedCallbackC = Ptr () -> -- object Ptr () -> -- user_data IO () foreign import ccall "wrapper" mkSocketPlugAddedCallback :: SocketPlugAddedCallbackC -> IO (FunPtr SocketPlugAddedCallbackC) socketPlugAddedClosure :: SocketPlugAddedCallback -> IO Closure socketPlugAddedClosure cb = newCClosure =<< mkSocketPlugAddedCallback wrapped where wrapped = socketPlugAddedCallbackWrapper cb socketPlugAddedCallbackWrapper :: SocketPlugAddedCallback -> Ptr () -> Ptr () -> IO () socketPlugAddedCallbackWrapper _cb _ _ = do _cb onSocketPlugAdded :: (GObject a, MonadIO m) => a -> SocketPlugAddedCallback -> m SignalHandlerId onSocketPlugAdded obj cb = liftIO $ connectSocketPlugAdded obj cb SignalConnectBefore afterSocketPlugAdded :: (GObject a, MonadIO m) => a -> SocketPlugAddedCallback -> m SignalHandlerId afterSocketPlugAdded obj cb = connectSocketPlugAdded obj cb SignalConnectAfter connectSocketPlugAdded :: (GObject a, MonadIO m) => a -> SocketPlugAddedCallback -> SignalConnectMode -> m SignalHandlerId connectSocketPlugAdded obj cb after = liftIO $ do cb' <- mkSocketPlugAddedCallback (socketPlugAddedCallbackWrapper cb) connectSignalFunPtr obj "plug-added" cb' after -- signal Socket::plug-removed type SocketPlugRemovedCallback = IO Bool noSocketPlugRemovedCallback :: Maybe SocketPlugRemovedCallback noSocketPlugRemovedCallback = Nothing type SocketPlugRemovedCallbackC = Ptr () -> -- object Ptr () -> -- user_data IO CInt foreign import ccall "wrapper" mkSocketPlugRemovedCallback :: SocketPlugRemovedCallbackC -> IO (FunPtr SocketPlugRemovedCallbackC) socketPlugRemovedClosure :: SocketPlugRemovedCallback -> IO Closure socketPlugRemovedClosure cb = newCClosure =<< mkSocketPlugRemovedCallback wrapped where wrapped = socketPlugRemovedCallbackWrapper cb socketPlugRemovedCallbackWrapper :: SocketPlugRemovedCallback -> Ptr () -> Ptr () -> IO CInt socketPlugRemovedCallbackWrapper _cb _ _ = do result <- _cb let result' = (fromIntegral . fromEnum) result return result' onSocketPlugRemoved :: (GObject a, MonadIO m) => a -> SocketPlugRemovedCallback -> m SignalHandlerId onSocketPlugRemoved obj cb = liftIO $ connectSocketPlugRemoved obj cb SignalConnectBefore afterSocketPlugRemoved :: (GObject a, MonadIO m) => a -> SocketPlugRemovedCallback -> m SignalHandlerId afterSocketPlugRemoved obj cb = connectSocketPlugRemoved obj cb SignalConnectAfter connectSocketPlugRemoved :: (GObject a, MonadIO m) => a -> SocketPlugRemovedCallback -> SignalConnectMode -> m SignalHandlerId connectSocketPlugRemoved obj cb after = liftIO $ do cb' <- mkSocketPlugRemovedCallback (socketPlugRemovedCallbackWrapper cb) connectSignalFunPtr obj "plug-removed" cb' after type instance AttributeList Socket = SocketAttributeList type SocketAttributeList = ('[ '("app-paintable", WidgetAppPaintablePropertyInfo), '("border-width", ContainerBorderWidthPropertyInfo), '("can-default", WidgetCanDefaultPropertyInfo), '("can-focus", WidgetCanFocusPropertyInfo), '("child", ContainerChildPropertyInfo), '("composite-child", WidgetCompositeChildPropertyInfo), '("double-buffered", WidgetDoubleBufferedPropertyInfo), '("events", WidgetEventsPropertyInfo), '("expand", WidgetExpandPropertyInfo), '("halign", WidgetHalignPropertyInfo), '("has-default", WidgetHasDefaultPropertyInfo), '("has-focus", WidgetHasFocusPropertyInfo), '("has-tooltip", WidgetHasTooltipPropertyInfo), '("height-request", WidgetHeightRequestPropertyInfo), '("hexpand", WidgetHexpandPropertyInfo), '("hexpand-set", WidgetHexpandSetPropertyInfo), '("is-focus", WidgetIsFocusPropertyInfo), '("margin", WidgetMarginPropertyInfo), '("margin-bottom", WidgetMarginBottomPropertyInfo), '("margin-end", WidgetMarginEndPropertyInfo), '("margin-left", WidgetMarginLeftPropertyInfo), '("margin-right", WidgetMarginRightPropertyInfo), '("margin-start", WidgetMarginStartPropertyInfo), '("margin-top", WidgetMarginTopPropertyInfo), '("name", WidgetNamePropertyInfo), '("no-show-all", WidgetNoShowAllPropertyInfo), '("opacity", WidgetOpacityPropertyInfo), '("parent", WidgetParentPropertyInfo), '("receives-default", WidgetReceivesDefaultPropertyInfo), '("resize-mode", ContainerResizeModePropertyInfo), '("scale-factor", WidgetScaleFactorPropertyInfo), '("sensitive", WidgetSensitivePropertyInfo), '("style", WidgetStylePropertyInfo), '("tooltip-markup", WidgetTooltipMarkupPropertyInfo), '("tooltip-text", WidgetTooltipTextPropertyInfo), '("valign", WidgetValignPropertyInfo), '("vexpand", WidgetVexpandPropertyInfo), '("vexpand-set", WidgetVexpandSetPropertyInfo), '("visible", WidgetVisiblePropertyInfo), '("width-request", WidgetWidthRequestPropertyInfo), '("window", WidgetWindowPropertyInfo)] :: [(Symbol, *)]) data SocketPlugAddedSignalInfo instance SignalInfo SocketPlugAddedSignalInfo where type HaskellCallbackType SocketPlugAddedSignalInfo = SocketPlugAddedCallback connectSignal _ = connectSocketPlugAdded data SocketPlugRemovedSignalInfo instance SignalInfo SocketPlugRemovedSignalInfo where type HaskellCallbackType SocketPlugRemovedSignalInfo = SocketPlugRemovedCallback connectSignal _ = connectSocketPlugRemoved type instance SignalList Socket = SocketSignalList type SocketSignalList = ('[ '("accel-closures-changed", WidgetAccelClosuresChangedSignalInfo), '("add", ContainerAddSignalInfo), '("button-press-event", WidgetButtonPressEventSignalInfo), '("button-release-event", WidgetButtonReleaseEventSignalInfo), '("can-activate-accel", WidgetCanActivateAccelSignalInfo), '("check-resize", ContainerCheckResizeSignalInfo), '("child-notify", WidgetChildNotifySignalInfo), '("composited-changed", WidgetCompositedChangedSignalInfo), '("configure-event", WidgetConfigureEventSignalInfo), '("damage-event", WidgetDamageEventSignalInfo), '("delete-event", WidgetDeleteEventSignalInfo), '("destroy", WidgetDestroySignalInfo), '("destroy-event", WidgetDestroyEventSignalInfo), '("direction-changed", WidgetDirectionChangedSignalInfo), '("drag-begin", WidgetDragBeginSignalInfo), '("drag-data-delete", WidgetDragDataDeleteSignalInfo), '("drag-data-get", WidgetDragDataGetSignalInfo), '("drag-data-received", WidgetDragDataReceivedSignalInfo), '("drag-drop", WidgetDragDropSignalInfo), '("drag-end", WidgetDragEndSignalInfo), '("drag-failed", WidgetDragFailedSignalInfo), '("drag-leave", WidgetDragLeaveSignalInfo), '("drag-motion", WidgetDragMotionSignalInfo), '("draw", WidgetDrawSignalInfo), '("enter-notify-event", WidgetEnterNotifyEventSignalInfo), '("event", WidgetEventSignalInfo), '("event-after", WidgetEventAfterSignalInfo), '("focus", WidgetFocusSignalInfo), '("focus-in-event", WidgetFocusInEventSignalInfo), '("focus-out-event", WidgetFocusOutEventSignalInfo), '("grab-broken-event", WidgetGrabBrokenEventSignalInfo), '("grab-focus", WidgetGrabFocusSignalInfo), '("grab-notify", WidgetGrabNotifySignalInfo), '("hide", WidgetHideSignalInfo), '("hierarchy-changed", WidgetHierarchyChangedSignalInfo), '("key-press-event", WidgetKeyPressEventSignalInfo), '("key-release-event", WidgetKeyReleaseEventSignalInfo), '("keynav-failed", WidgetKeynavFailedSignalInfo), '("leave-notify-event", WidgetLeaveNotifyEventSignalInfo), '("map", WidgetMapSignalInfo), '("map-event", WidgetMapEventSignalInfo), '("mnemonic-activate", WidgetMnemonicActivateSignalInfo), '("motion-notify-event", WidgetMotionNotifyEventSignalInfo), '("move-focus", WidgetMoveFocusSignalInfo), '("notify", GObject.ObjectNotifySignalInfo), '("parent-set", WidgetParentSetSignalInfo), '("plug-added", SocketPlugAddedSignalInfo), '("plug-removed", SocketPlugRemovedSignalInfo), '("popup-menu", WidgetPopupMenuSignalInfo), '("property-notify-event", WidgetPropertyNotifyEventSignalInfo), '("proximity-in-event", WidgetProximityInEventSignalInfo), '("proximity-out-event", WidgetProximityOutEventSignalInfo), '("query-tooltip", WidgetQueryTooltipSignalInfo), '("realize", WidgetRealizeSignalInfo), '("remove", ContainerRemoveSignalInfo), '("screen-changed", WidgetScreenChangedSignalInfo), '("scroll-event", WidgetScrollEventSignalInfo), '("selection-clear-event", WidgetSelectionClearEventSignalInfo), '("selection-get", WidgetSelectionGetSignalInfo), '("selection-notify-event", WidgetSelectionNotifyEventSignalInfo), '("selection-received", WidgetSelectionReceivedSignalInfo), '("selection-request-event", WidgetSelectionRequestEventSignalInfo), '("set-focus-child", ContainerSetFocusChildSignalInfo), '("show", WidgetShowSignalInfo), '("show-help", WidgetShowHelpSignalInfo), '("size-allocate", WidgetSizeAllocateSignalInfo), '("state-changed", WidgetStateChangedSignalInfo), '("state-flags-changed", WidgetStateFlagsChangedSignalInfo), '("style-set", WidgetStyleSetSignalInfo), '("style-updated", WidgetStyleUpdatedSignalInfo), '("touch-event", WidgetTouchEventSignalInfo), '("unmap", WidgetUnmapSignalInfo), '("unmap-event", WidgetUnmapEventSignalInfo), '("unrealize", WidgetUnrealizeSignalInfo), '("visibility-notify-event", WidgetVisibilityNotifyEventSignalInfo), '("window-state-event", WidgetWindowStateEventSignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)]) -- method Socket::new -- method type : Constructor -- Args : [] -- Lengths : [] -- hInArgs : [] -- returnType : TInterface "Gtk" "Socket" -- throws : False -- Skip return : False foreign import ccall "gtk_socket_new" gtk_socket_new :: IO (Ptr Socket) socketNew :: (MonadIO m) => m Socket socketNew = liftIO $ do result <- gtk_socket_new checkUnexpectedReturnNULL "gtk_socket_new" result result' <- (newObject Socket) result return result' -- method Socket::add_id -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Socket", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "window", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Socket", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "window", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "gtk_socket_add_id" gtk_socket_add_id :: Ptr Socket -> -- _obj : TInterface "Gtk" "Socket" Word64 -> -- window : TBasicType TUInt64 IO () socketAddId :: (MonadIO m, SocketK a) => a -> -- _obj Word64 -> -- window m () socketAddId _obj window = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj gtk_socket_add_id _obj' window touchManagedPtr _obj return () -- method Socket::get_id -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Socket", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Socket", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TUInt64 -- throws : False -- Skip return : False foreign import ccall "gtk_socket_get_id" gtk_socket_get_id :: Ptr Socket -> -- _obj : TInterface "Gtk" "Socket" IO Word64 socketGetId :: (MonadIO m, SocketK a) => a -> -- _obj m Word64 socketGetId _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- gtk_socket_get_id _obj' touchManagedPtr _obj return result -- method Socket::get_plug_window -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Socket", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Socket", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Gdk" "Window" -- throws : False -- Skip return : False foreign import ccall "gtk_socket_get_plug_window" gtk_socket_get_plug_window :: Ptr Socket -> -- _obj : TInterface "Gtk" "Socket" IO (Ptr Gdk.Window) socketGetPlugWindow :: (MonadIO m, SocketK a) => a -> -- _obj m Gdk.Window socketGetPlugWindow _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- gtk_socket_get_plug_window _obj' checkUnexpectedReturnNULL "gtk_socket_get_plug_window" result result' <- (newObject Gdk.Window) result touchManagedPtr _obj return result'