Gtk2HsContentsIndex
Graphics.UI.Gtk.General.Selection
Portabilityportable (depends on GHC)
Stabilityprovisional
Maintainergtk2hs-users@lists.sourceforge.net
Contents
Types
Constructors
Methods
Signals
Description
Functions for handling inter-process communication via selections.
Synopsis
type InfoId = CUInt
data TargetTag
data SelectionTag
data TargetList
type SelectionDataM a = ReaderT (Ptr ()) IO a
data TargetFlags
= TargetSameApp
| TargetSameWidget
targetTagNew :: String -> IO TargetTag
selectionTagNew :: String -> IO SelectionTag
targetListNew :: IO TargetList
targetListAdd :: TargetList -> TargetTag -> [TargetFlags] -> InfoId -> IO ()
targetListAddTextTargets :: TargetList -> InfoId -> IO ()
targetListAddImageTargets :: TargetList -> InfoId -> Bool -> IO ()
targetListAddUriTargets :: TargetList -> InfoId -> IO ()
targetListAddRichTextTargets :: TextBufferClass tb => TargetList -> InfoId -> Bool -> tb -> IO ()
targetListRemove :: TargetList -> TargetTag -> IO ()
selectionAddTarget :: WidgetClass widget => widget -> SelectionTag -> TargetTag -> InfoId -> IO ()
selectionClearTargets :: WidgetClass widget => widget -> SelectionTag -> IO ()
selectionOwnerSet :: WidgetClass widget => Maybe widget -> SelectionTag -> TimeStamp -> IO Bool
selectionRemoveAll :: WidgetClass widget => widget -> IO ()
selectionDataSet :: (Integral a, Storable a) => SelectionTag -> [a] -> SelectionDataM ()
selectionDataGet :: (Integral a, Storable a) => SelectionDataM (Maybe [a])
selectionDataSetText :: String -> SelectionDataM Bool
selectionDataGetText :: SelectionDataM (Maybe String)
selectionDataSetPixbuf :: Pixbuf -> SelectionDataM Bool
selectionDataGetPixbuf :: SelectionDataM (Maybe Pixbuf)
selectionDataSetURIs :: [String] -> SelectionDataM Bool
selectionDataGetURIs :: SelectionDataM (Maybe [String])
selectionDataTargetsIncludeImage :: Bool -> SelectionDataM Bool
selectionDataTargetsIncludeText :: SelectionDataM Bool
selectionDataTargetsIncludeUri :: SelectionDataM Bool
selectionDataTargetsIncludeRichText :: TextBufferClass tb => tb -> SelectionDataM Bool
selectionGet :: WidgetClass self => Signal self (InfoId -> TimeStamp -> SelectionDataM ())
selectionReceived :: WidgetClass self => Signal self (TimeStamp -> SelectionDataM ())
Types
type InfoId = CUInt
A number that the application can use to differentiate between different data types or application states.
data TargetTag
A tag that uniquely identifies a target.
show/hide Instances
data SelectionTag
A tag that uniquely identifies a selection.
show/hide Instances
data TargetList
A TargetList contains information about all possible formats (represented as TargetTag) that a widget can create or receive in form of a selection.
type SelectionDataM a = ReaderT (Ptr ()) IO a
A monad providing access to selection data.
data TargetFlags

The TargetFlags enumeration is used to specify constraints on an entry in a TargetList. These flags are only used for drag and drop.

  • If the TargetSameApp flag is set, the target will only be selected for drags within a single application.
  • If the TargetSameWidget flag is set, the target will only be selected for drags within a single widget.
Constructors
TargetSameApp
TargetSameWidget
show/hide Instances
Constructors
targetTagNew :: String -> IO TargetTag
Create a new TargetTag. Note that creating two target tags with the same name will yield two different tags. The name is merely meant to ease application development.
selectionTagNew :: String -> IO SelectionTag
Create a new SelectionTag. Note that creating two selection tags with the same name will yield two different tags. The name is merely meant to ease application development.
targetListNew :: IO TargetList
Create a new, empty TargetList.
Methods
targetListAdd :: TargetList -> TargetTag -> [TargetFlags] -> InfoId -> IO ()

Append another target to the given TargetList.

  • Note that the TargetFlags are only used for drag and drop, not in normal selection handling.
targetListAddTextTargets :: TargetList -> InfoId -> IO ()

Append all text targets supported by the selection mechanism to the target list. All targets are added with the same InfoId.

  • Since Gtk 2.6.
targetListAddImageTargets :: TargetList -> InfoId -> Bool -> IO ()

Append all image targets supported by the selection mechanism to the target list. All targets are added with the same InfoId. If the boolean flag is set, only targets will be added which Gtk+ knows how to convert into a Pixbuf.

  • Since Gtk 2.6.
targetListAddUriTargets :: TargetList -> InfoId -> IO ()

Append all URI (universal resource indicator, fomerly URL) targets supported by the selection mechanism to the target list. All targets are added with the same InfoId.

  • Since Gtk 2.6.
targetListAddRichTextTargets :: TextBufferClass tb => TargetList -> InfoId -> Bool -> tb -> IO ()

Append all rich text targets registered with textBufferRegisterSerializeFormat to the target list. All targets are added with the same InfoId. If the boolean flag is True then deserializable rich text formats will be added, serializable formats otherwise.

  • Since Gtk 2.10.
targetListRemove :: TargetList -> TargetTag -> IO ()
Remove a target from a target list.
selectionAddTarget :: WidgetClass widget => widget -> SelectionTag -> TargetTag -> InfoId -> IO ()
Appends a specified target to the list of supported targets for a given widget and selection.
selectionClearTargets :: WidgetClass widget => widget -> SelectionTag -> IO ()
Remove all targets registered for the given selection for the widget.
selectionOwnerSet :: WidgetClass widget => Maybe widget -> SelectionTag -> TimeStamp -> IO Bool
Claims ownership of a given selection for a particular widget, or, if widget is Nothing, release ownership of the selection.
selectionRemoveAll :: WidgetClass widget => widget -> IO ()

selectionOwnerSetForDisplay :: WidgetClass widget => Display -> widget -> {-GdkAtom-} -> Word32 -> IO Bool selectionOwnerSetForDisplay display widget selection time = liftM toBool $ {} display (toWidget widget) {-selection-} (fromIntegral time)

Removes all handlers and unsets ownership of all selections for a widget. Called when widget is being destroyed. This function will not generally be called by applications.

selectionDataSet :: (Integral a, Storable a) => SelectionTag -> [a] -> SelectionDataM ()
Stores new data in the SelectionDataM monad. The stored data may only be an array of integer types that are no larger than 32 bits.
selectionDataGet :: (Integral a, Storable a) => SelectionDataM (Maybe [a])
Retreives the data in the SelectionDataM monad. The returned array must have elements of the size that were used to set this data. If the size does not match, Nothing is returned.
selectionDataSetText :: String -> SelectionDataM Bool

Sets the contents of the selection from a string. The string is converted to the form determined by the allowed targets of the selection.

  • Returns True if setting the text was successful.
selectionDataGetText :: SelectionDataM (Maybe String)
Gets the contents of the selection data as a string.
selectionDataSetPixbuf :: Pixbuf -> SelectionDataM Bool

Sets the contents of the selection from a Pixbuf. The pixbuf is converted to the form determined by the allowed targets of the selection.

  • Returns True if setting the Pixbuf was successful. Since Gtk 2.6.
selectionDataGetPixbuf :: SelectionDataM (Maybe Pixbuf)

Gets the contents of the selection data as a Pixbuf.

  • Since Gtk 2.6.
selectionDataSetURIs :: [String] -> SelectionDataM Bool

Sets the contents of the selection from a list of URIs. The string is converted to the form determined by the possible targets of the selection.

  • Returns True if setting the URIs was successful. Since Gtk 2.6.
selectionDataGetURIs :: SelectionDataM (Maybe [String])

Gets the contents of the selection data as list of URIs. Returns Nothing if the selection did not contain any URIs.

  • Since Gtk 2.6.
selectionDataTargetsIncludeImage
:: Boolwhether to accept only targets for which GTK+ knows how to convert a pixbuf into the format
-> SelectionDataM Bool

Given a SelectionDataM holding a list of targets, determines if any of the targets in targets can be used to provide a Pixbuf.

  • Since Gtk 2.6
selectionDataTargetsIncludeText :: SelectionDataM Bool
Given a SelectionDataM holding a list of targets, determines if any of the targets in targets can be used to provide text.
selectionDataTargetsIncludeUri :: SelectionDataM Bool

Given a SelectionDataM holding a list of targets, determines if any of the targets in targets can be used to provide URIs.

  • Since Gtk 2.10
selectionDataTargetsIncludeRichText :: TextBufferClass tb => tb -> SelectionDataM Bool

Given a SelectionDataM holding a list of targets, check if, well, dunno really. FIXME: what does the TextBuffer do?

  • Since Gtk 2.10
Signals
selectionGet :: WidgetClass self => Signal self (InfoId -> TimeStamp -> SelectionDataM ())
Emitted in order to ask the application for selection data. Within the handler the function selectionDataSet or one of its derivatives should be called.
selectionReceived :: WidgetClass self => Signal self (TimeStamp -> SelectionDataM ())
Pass the supplied selection data to the application. The application is expected to read the data using selectionDataGet or one of its derivatives.
Produced by Haddock version 0.8