| |||||||||||||
| |||||||||||||
| |||||||||||||
Description | |||||||||||||
Functions for handling inter-process communication via selections. | |||||||||||||
Synopsis | |||||||||||||
Types | |||||||||||||
type InfoId = CUInt | |||||||||||||
A number that the application can use to differentiate between different data types or application states. | |||||||||||||
data Atom | |||||||||||||
| |||||||||||||
type TargetTag = Atom | |||||||||||||
A tag that uniquely identifies a target. A target describes the format of the underlying data source, for instance, it might be a string. A single selection may support multiple targets: suppose a new target is created for the Haskell data type Double. In this case, the value of the floating point number could also be offered as a string. | |||||||||||||
type SelectionTag = Atom | |||||||||||||
A tag that uniquely identifies a selection. A selection denotes the exchange mechanism that is being used, for instance, the clipboard is the most common exchange mechanism. For drag and drop applications, a new selection tag is usually created for each different kind of data that is being exchanged. | |||||||||||||
type SelectionTypeTag = Atom | |||||||||||||
A tag that defines the encoding of the binary data. For instance, a string might be encoded as UTF-8 or in a different locale. Each encoding would use the same TargetTag but a different SelectionTypeTag. | |||||||||||||
data TargetList | |||||||||||||
| |||||||||||||
type SelectionDataM a = ReaderT (Ptr ()) IO a | |||||||||||||
A monad providing access to selection data. | |||||||||||||
data TargetFlags | |||||||||||||
| |||||||||||||
Constants | |||||||||||||
targetString :: TargetTag | |||||||||||||
If this target is provided by a selection, then the data is a string. | |||||||||||||
selectionTypeAtom :: SelectionTypeTag | |||||||||||||
The type indicating that the associated data is itself a (list of) Graphics.UI.Gtk.General.Selection.Atoms. | |||||||||||||
selectionTypeInteger :: SelectionTypeTag | |||||||||||||
The type indicating that the associated data consists of integers. | |||||||||||||
selectionTypeString :: SelectionTypeTag | |||||||||||||
The type indicating that the associated data is a string without further information on its encoding. | |||||||||||||
Constructors | |||||||||||||
atomNew :: String -> IO Atom | |||||||||||||
Create a new TargetTag, SelectionTag, SelectionTypeTag or PropertyTag. Note that creating two target tags with the same name will create the same tag, in particular, the tag will be the same across different applications. Note that the name of an Atom can be printed by show though comparing the atom is merely an integer comparison. | |||||||||||||
targetListNew :: IO TargetList | |||||||||||||
Create a new, empty TargetList. | |||||||||||||
Methods | |||||||||||||
targetListAdd :: TargetList -> TargetTag -> [TargetFlags] -> InfoId -> IO () | |||||||||||||
Append another target to the given TargetList.
| |||||||||||||
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.
| |||||||||||||
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 Graphics.UI.Gtk.Pixbuf.Pixbuf.
| |||||||||||||
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.
| |||||||||||||
targetListAddRichTextTargets :: TextBufferClass tb => TargetList -> InfoId -> Bool -> tb -> IO () | |||||||||||||
Append all rich text targets registered with Graphics.UI.Gtk.TextBuffer.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.
| |||||||||||||
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. | |||||||||||||
selectionOwnerSetForDisplay :: WidgetClass widget => Display -> Maybe widget -> SelectionTag -> TimeStamp -> IO Bool | |||||||||||||
Set the ownership of a given selection and display. | |||||||||||||
selectionRemoveAll :: WidgetClass widget => widget -> IO () | |||||||||||||
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) => SelectionTypeTag -> [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) => SelectionTypeTag -> 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 or the type tag does not match, Nothing is returned. | |||||||||||||
selectionDataIsValid :: SelectionDataM Bool | |||||||||||||
Check if the currently stored data is valid.
| |||||||||||||
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.
| |||||||||||||
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.
| |||||||||||||
selectionDataGetPixbuf :: SelectionDataM (Maybe Pixbuf) | |||||||||||||
Gets the contents of the selection data as a Pixbuf.
| |||||||||||||
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.
| |||||||||||||
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.
| |||||||||||||
selectionDataTargetsIncludeImage | |||||||||||||
| |||||||||||||
selectionDataGetTarget :: SelectionDataM TargetTag | |||||||||||||
Retrieve the currently set TargetTag in the selection. | |||||||||||||
selectionDataSetTarget :: TargetTag -> SelectionDataM () | |||||||||||||
Set the selection to the given TargetTag. | |||||||||||||
selectionDataGetTargets :: SelectionDataM [TargetTag] | |||||||||||||
Queries the content type of the selection data as a list of targets. Whenever the application is asked whether certain targets are acceptable, it is handed a selection that contains a list of TargetTags as payload. A similar result could be achieved using 'selectionDataGet selectionTypeAtom'. | |||||||||||||
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.
| |||||||||||||
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?
| |||||||||||||
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 2.4.2 |