gi-gtk-4.0.1: Gtk bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.Gtk.Functions

Contents

Description

 
Synopsis

Methods

accelGroupsActivate

accelGroupsActivate Source #

Arguments

:: (HasCallStack, MonadIO m, IsObject a) 
=> a

object: the Object, usually a Window, on which to activate the accelerator

-> Word32

accelKey: accelerator keyval from a key event

-> [ModifierType]

accelMods: keyboard state mask from a key event

-> m Bool

Returns: True if an accelerator was activated and handled this keypress

Finds the first accelerator in any AccelGroup attached to object that matches accelKey and accelMods, and activates that accelerator.

accelGroupsFromObject

accelGroupsFromObject Source #

Arguments

:: (HasCallStack, MonadIO m, IsObject a) 
=> a

object: a Object, usually a Window

-> m [AccelGroup]

Returns: a list of all accel groups which are attached to object

Gets a list of all accel groups which are attached to object.

acceleratorGetDefaultModMask

acceleratorGetDefaultModMask Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m [ModifierType]

Returns: the default accelerator modifier mask

Gets the modifier mask.

The modifier mask determines which modifiers are considered significant for keyboard accelerators. See acceleratorSetDefaultModMask.

acceleratorGetLabel

acceleratorGetLabel Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word32

acceleratorKey: accelerator keyval

-> [ModifierType]

acceleratorMods: accelerator modifier mask

-> m Text

Returns: a newly-allocated string representing the accelerator.

Converts an accelerator keyval and modifier mask into a string which can be used to represent the accelerator to the user.

acceleratorGetLabelWithKeycode

acceleratorGetLabelWithKeycode Source #

Arguments

:: (HasCallStack, MonadIO m, IsDisplay a) 
=> Maybe a

display: a Display or Nothing to use the default display

-> Word32

acceleratorKey: accelerator keyval

-> Word32

keycode: accelerator keycode

-> [ModifierType]

acceleratorMods: accelerator modifier mask

-> m Text

Returns: a newly-allocated string representing the accelerator.

Converts an accelerator keyval and modifier mask into a (possibly translated) string that can be displayed to a user, similarly to acceleratorGetLabel, but handling keycodes.

This is only useful for system-level components, applications should use acceleratorParse instead.

acceleratorName

acceleratorName Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word32

acceleratorKey: accelerator keyval

-> [ModifierType]

acceleratorMods: accelerator modifier mask

-> m Text

Returns: a newly-allocated accelerator name

Converts an accelerator keyval and modifier mask into a string parseable by acceleratorParse. For example, if you pass in KEY_q and GDK_CONTROL_MASK, this function returns “<Control>q”.

If you need to display accelerators in the user interface, see acceleratorGetLabel.

acceleratorNameWithKeycode

acceleratorNameWithKeycode Source #

Arguments

:: (HasCallStack, MonadIO m, IsDisplay a) 
=> Maybe a

display: a Display or Nothing to use the default display

-> Word32

acceleratorKey: accelerator keyval

-> Word32

keycode: accelerator keycode

-> [ModifierType]

acceleratorMods: accelerator modifier mask

-> m Text

Returns: a newly allocated accelerator name.

Converts an accelerator keyval and modifier mask into a string parseable by acceleratorParseWithKeycode, similarly to acceleratorName but handling keycodes. This is only useful for system-level components, applications should use acceleratorParse instead.

acceleratorParse

acceleratorParse Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

accelerator: string representing an accelerator

-> m (Word32, [ModifierType]) 

Parses a string representing an accelerator. The format looks like “<Control>a” or “<Shift><Alt>F1” or “<Release>z” (the last one is for key release).

The parser is fairly liberal and allows lower or upper case, and also abbreviations such as “<Ctl>” and “<Ctrl>”. Key names are parsed using keyvalFromName. For character keys the name is not the symbol, but the lowercase name, e.g. one would use “<Ctrl>minus” instead of “<Ctrl>-”.

If the parse fails, acceleratorKey and acceleratorMods will be set to 0 (zero).

acceleratorParseWithKeycode

acceleratorParseWithKeycode Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

accelerator: string representing an accelerator

-> m (Word32, [Word32], [ModifierType]) 

Parses a string representing an accelerator, similarly to acceleratorParse but handles keycodes as well. This is only useful for system-level components, applications should use acceleratorParse instead.

If acceleratorCodes is given and the result stored in it is non-Nothing, the result must be freed with free.

If a keycode is present in the accelerator and no acceleratorCodes is given, the parse will fail.

If the parse fails, acceleratorKey, acceleratorMods and acceleratorCodes will be set to 0 (zero).

acceleratorSetDefaultModMask

acceleratorSetDefaultModMask Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> [ModifierType]

defaultModMask: accelerator modifier mask

-> m () 

Sets the modifiers that will be considered significant for keyboard accelerators. The default mod mask depends on the GDK backend in use, but will typically include GDK_CONTROL_MASK | GDK_SHIFT_MASK | GDK_MOD1_MASK | GDK_SUPER_MASK | GDK_HYPER_MASK | GDK_META_MASK. In other words, Control, Shift, Alt, Super, Hyper and Meta. Other modifiers will by default be ignored by AccelGroup.

You must include at least the three modifiers Control, Shift and Alt in any value you pass to this function.

The default mod mask should be changed on application startup, before using any accelerator groups.

acceleratorValid

acceleratorValid Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word32

keyval: a GDK keyval

-> [ModifierType]

modifiers: modifier mask

-> m Bool

Returns: True if the accelerator is valid

Determines whether a given keyval and modifier mask constitute a valid keyboard accelerator. For example, the KEY_a keyval plus GDK_CONTROL_MASK is valid - this is a “Ctrl+a” accelerator. But, you can't, for instance, use the KEY_Control_L keyval as an accelerator.

bindingsActivate

bindingsActivate Source #

Arguments

:: (HasCallStack, MonadIO m, IsObject a) 
=> a

object: object to activate when binding found

-> Word32

keyval: key value of the binding

-> [ModifierType]

modifiers: key modifier of the binding

-> m Bool

Returns: True if a binding was found and activated

Find a key binding matching keyval and modifiers and activate the binding on object.

bindingsActivateEvent

bindingsActivateEvent Source #

Arguments

:: (HasCallStack, MonadIO m, IsObject a) 
=> a

object: a Object (generally must be a widget)

-> EventKey

event: a EventKey

-> m Bool

Returns: True if a matching key binding was found

Looks up key bindings for object to find one matching event, and if one was found, activate it.

checkVersion

checkVersion Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word32

requiredMajor: the required major version

-> Word32

requiredMinor: the required minor version

-> Word32

requiredMicro: the required micro version

-> m (Maybe Text)

Returns: Nothing if the GTK library is compatible with the given version, or a string describing the version mismatch. The returned string is owned by GTK and should not be modified or freed.

Checks that the GTK library in use is compatible with the given version. Generally you would pass in the constants MAJOR_VERSION, MINOR_VERSION, MICRO_VERSION as the three arguments to this function; that produces a check that the library in use is compatible with the version of GTK the application or module was compiled against.

Compatibility is defined by two things: first the version of the running library is newer than the version requiredMajor.required_minor.requiredMicro. Second the running library must be binary compatible with the version requiredMajor.required_minor.requiredMicro (same major version.)

This function is primarily for GTK modules; the module can call this function to check that it wasn’t loaded into an incompatible version of GTK. However, such a check isn’t completely reliable, since the module may be linked against an old version of GTK and calling the old version of checkVersion, but still get loaded into an application using a newer version of GTK.

contentFormatsAddImageTargets

contentFormatsAddImageTargets Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> ContentFormats

list: a ContentFormats

-> Bool

writable: whether to add only targets for which GTK+ knows how to convert a pixbuf into the format

-> m ContentFormats 

Appends the image targets supported by SelectionData to the target list. All targets are added with the same info.

contentFormatsAddTextTargets

contentFormatsAddTextTargets Source #

Appends the text targets supported by SelectionData to the target list. All targets are added with the same info.

contentFormatsAddUriTargets

contentFormatsAddUriTargets Source #

Appends the URI targets supported by SelectionData to the target list. All targets are added with the same info.

deviceGrabAdd

deviceGrabAdd Source #

Arguments

:: (HasCallStack, MonadIO m, IsWidget a, IsDevice b) 
=> a

widget: a Widget

-> b

device: a Device to grab on.

-> Bool

blockOthers: True to prevent other devices to interact with widget.

-> m () 

Adds a GTK grab on device, so all the events on device and its associated pointer or keyboard (if any) are delivered to widget. If the blockOthers parameter is True, any other devices will be unable to interact with widget during the grab.

deviceGrabRemove

deviceGrabRemove Source #

Arguments

:: (HasCallStack, MonadIO m, IsWidget a, IsDevice b) 
=> a

widget: a Widget

-> b

device: a Device

-> m () 

Removes a device grab from the given widget.

You have to pair calls to deviceGrabAdd and deviceGrabRemove.

disableSetlocale

disableSetlocale :: (HasCallStack, MonadIO m) => m () Source #

Prevents init, initCheck and gtk_parse_args() from automatically calling setlocale (LC_ALL, ""). You would want to use this function if you wanted to set the locale for your program to something other than the user’s locale, or if you wanted to set different values for different locale categories.

Most programs should not need to call this function.

distributeNaturalAllocation

distributeNaturalAllocation Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Int32

extraSpace: Extra space to redistribute among children after subtracting minimum sizes and any child padding from the overall allocation

-> Word32

nRequestedSizes: Number of requests to fit into the allocation

-> RequestedSize

sizes: An array of structs with a client pointer and a minimum/natural size in the orientation of the allocation.

-> m Int32

Returns: The remainder of extraSpace after redistributing space to sizes.

Distributes extraSpace to child sizes by bringing smaller children up to natural size first.

The remaining space will be added to the minimumSize member of the GtkRequestedSize struct. If all sizes reach their natural size then the remaining space is returned.

dragCancel

dragCancel Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrag a) 
=> a

drag: a drag context, as e.g. returned by widgetDragBegin

-> m () 

Cancels an ongoing drag operation on the source side.

If you want to be able to cancel a drag operation in this way, you need to keep a pointer to the drag context, either from an explicit call to widgetDragBegin, or by connecting to dragBegin.

If context does not refer to an ongoing drag operation, this function does nothing.

If a drag is cancelled in this way, the result argument of dragFailed is set to gTKDRAGRESULTERROR.

dragGetSourceWidget

dragGetSourceWidget Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrag a) 
=> a

drag: a drag context

-> m (Maybe Widget)

Returns: if the drag is occurring within a single application, a pointer to the source widget. Otherwise, Nothing.

Determines the source widget for a drag.

dragSetIconDefault

dragSetIconDefault Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrag a) 
=> a

drag: the context for a drag

-> m () 

Sets the icon for a particular drag to the default icon.

dragSetIconGicon

dragSetIconGicon Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrag a, IsIcon b) 
=> a

drag: the context for a drag

-> b

icon: a Icon

-> Int32

hotX: the X offset of the hotspot within the icon

-> Int32

hotY: the Y offset of the hotspot within the icon

-> m () 

Sets the icon for a given drag from the given icon. See the documentation for dragSetIconName for more details about using icons in drag and drop.

dragSetIconName

dragSetIconName Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrag a) 
=> a

drag: the context for a drag

-> Text

iconName: name of icon to use

-> Int32

hotX: the X offset of the hotspot within the icon

-> Int32

hotY: the Y offset of the hotspot within the icon

-> m () 

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 symbolic size GTK_ICON_SIZE_DND), thus hotX and hotY have to be used with care.

dragSetIconPaintable

dragSetIconPaintable Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrag a, IsPaintable b) 
=> a

drag: the context for a drag

-> b

paintable: the Paintable to use as icon

-> Int32

hotX: the X offset of the hotspot within the icon

-> Int32

hotY: the Y offset of the hotspot within the icon

-> m () 

Sets paintable as the icon for a given drag. GTK+ retains references for the arguments, and will release them when they are no longer needed.

To position the paintable relative to the mouse, its top left will be positioned hotX, hotY pixels from the mouse cursor.

dragSetIconWidget

dragSetIconWidget Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrag a, IsWidget b) 
=> a

drag: the context for a drag

-> b

widget: a widget to use as an icon

-> Int32

hotX: the X offset within widget of the hotspot

-> Int32

hotY: the Y offset within widget of the hotspot

-> m () 

Changes the icon for drag operation to a given widget. GTK+ will not destroy the widget, so if you don’t want it to persist, you should connect to the “drag-end” signal and destroy it yourself.

eventsPending

eventsPending Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Bool

Returns: True if any events are pending, False otherwise

Checks if any events are pending.

This can be used to update the UI and invoke timeouts etc. while doing some time intensive computation.

Updating the UI during a long computation

C code

// computation going on...

while (gtk_events_pending ())
  gtk_main_iteration ();

// ...computation continued

getBinaryAge

getBinaryAge Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Word32

Returns: the binary age of the GTK library

Returns the binary age as passed to libtool when building the GTK library the process is running against. If libtool means nothing to you, don't worry about it.

getCurrentEvent

getCurrentEvent Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m (Maybe Event)

Returns: a reference of the current event, or Nothing if there is no current event. The returned event must be freed with objectUnref.

Obtains a reference of the event currently being processed by GTK.

For example, if you are handling a clicked signal, the current event will be the EventButton that triggered the clicked signal.

getCurrentEventDevice

getCurrentEventDevice Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m (Maybe Device)

Returns: a Device, or Nothing

If there is a current event and it has a device, return that device, otherwise return Nothing.

getCurrentEventState

getCurrentEventState Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m (Bool, [ModifierType])

Returns: True if there was a current event and it had a state field

If there is a current event and it has a state field, place that state field in state and return True, otherwise return False.

getCurrentEventTime

getCurrentEventTime Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Word32

Returns: the timestamp from the current event, or CURRENT_TIME.

If there is a current event and it has a timestamp, return that timestamp, otherwise return CURRENT_TIME.

getDebugFlags

getDebugFlags Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Word32

Returns: the GTK debug flags.

Returns the GTK debug flags.

This function is intended for GTK modules that want to adjust their debug output based on GTK debug flags.

getDefaultLanguage

getDefaultLanguage Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Language

Returns: the default language as a Language, must not be freed

Returns the Language for the default language currently in effect. (Note that this can change over the life of an application.) The default language is derived from the current locale. It determines, for example, whether GTK uses the right-to-left or left-to-right text direction.

This function is equivalent to languageGetDefault. See that function for details.

getEventTarget

getEventTarget Source #

Arguments

:: (HasCallStack, MonadIO m, IsEvent a) 
=> a

event: a GdkEvent

-> m (Maybe Widget)

Returns: the target widget, or Nothing

If event is Nothing or the event was not associated with any widget, returns Nothing, otherwise returns the widget that is the deepmost receiver of the event.

getEventTargetWithType

getEventTargetWithType Source #

Arguments

:: (HasCallStack, MonadIO m, IsEvent a) 
=> a

event: a GdkEvent

-> GType

type: the type to look for

-> m (Maybe Widget)

Returns: the widget in the target stack with the given type, or Nothing

If event is Nothing or the event was not associated with any widget, returns Nothing, otherwise returns first widget found from the event target to the toplevel that matches type.

getEventWidget

getEventWidget Source #

Arguments

:: (HasCallStack, MonadIO m, IsEvent a) 
=> a

event: a GdkEvent

-> m (Maybe Widget)

Returns: the widget that originally received event, or Nothing

If event is Nothing or the event was not associated with any widget, returns Nothing, otherwise returns the widget that received the event originally.

getInterfaceAge

getInterfaceAge Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Word32

Returns: the interface age of the GTK library

Returns the interface age as passed to libtool when building the GTK library the process is running against. If libtool means nothing to you, don't worry about it.

getLocaleDirection

getLocaleDirection Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m TextDirection

Returns: the TextDirection of the current locale

Get the direction of the current locale. This is the expected reading direction for text and UI.

This function depends on the current locale being set with setlocale() and will default to setting the TextDirectionLtr direction otherwise. TextDirectionNone will never be returned.

GTK sets the default text direction according to the locale during init, and you should normally use widgetGetDirection or widgetGetDefaultDirection to obtain the current direcion.

This function is only needed rare cases when the locale is changed after GTK has already been initialized. In this case, you can use it to update the default text direction as follows:

C code

setlocale (LC_ALL, new_locale);
direction = gtk_get_locale_direction ();
gtk_widget_set_default_direction (direction);

getMainThread

getMainThread Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Thread

Returns: The Thread initialized for GTK, must not be freed

Get the thread from which GTK was initialized.

getMajorVersion

getMajorVersion Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Word32

Returns: the major version number of the GTK library

Returns the major version number of the GTK library. (e.g. in GTK version 3.1.5 this is 3.)

This function is in the library, so it represents the GTK library your code is running against. Contrast with the MAJOR_VERSION macro, which represents the major version of the GTK headers you have included when compiling your code.

getMicroVersion

getMicroVersion Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Word32

Returns: the micro version number of the GTK library

Returns the micro version number of the GTK library. (e.g. in GTK version 3.1.5 this is 5.)

This function is in the library, so it represents the GTK library your code is are running against. Contrast with the MICRO_VERSION macro, which represents the micro version of the GTK headers you have included when compiling your code.

getMinorVersion

getMinorVersion Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Word32

Returns: the minor version number of the GTK library

Returns the minor version number of the GTK library. (e.g. in GTK version 3.1.5 this is 1.)

This function is in the library, so it represents the GTK library your code is are running against. Contrast with the MINOR_VERSION macro, which represents the minor version of the GTK headers you have included when compiling your code.

grabGetCurrent

grabGetCurrent Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m (Maybe Widget)

Returns: The widget which currently has the grab or Nothing if no grab is active

Queries the current grab of the default window group.

hsvToRgb

hsvToRgb Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Double

h: Hue

-> Double

s: Saturation

-> Double

v: Value

-> m (Double, Double, Double) 

Converts a color from HSV space to RGB.

Input values must be in the [0.0, 1.0] range; output values will be in the same range.

imModulesInit

imModulesInit :: (HasCallStack, MonadIO m) => m () Source #

No description available in the introspection data.

init

init :: (HasCallStack, MonadIO m) => m () Source #

Call this function before using any other GTK functions in your GUI applications. It will initialize everything needed to operate the toolkit and parses some standard command line options.

If you are using Application, you don't have to call init or initCheck; the Application::startup handler does it for you.

This function will terminate your program if it was unable to initialize the windowing system for some reason. If you want your program to fall back to a textual interface you want to call initCheck instead.

GTK calls signal (SIGPIPE, SIG_IGN) during initialization, to ignore SIGPIPE signals, since these are almost never wanted in graphical applications. If you do need to handle SIGPIPE for some reason, reset the handler after init, but notice that other libraries (e.g. libdbus or gvfs) might do similar things.

initCheck

initCheck Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Bool

Returns: True if the windowing system has been successfully initialized, False otherwise

This function does the same work as init with only a single change: It does not terminate the program if the windowing system can’t be initialized. Instead it returns False on failure.

This way the application can fall back to some other means of communication with the user - for example a curses or command line interface.

isInitialized

isInitialized Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Bool

Returns: the initialization status

Use this function to check if GTK has been initialized with init or initCheck.

main

main :: (HasCallStack, MonadIO m) => m () Source #

Runs the main loop until mainQuit is called.

You can nest calls to main. In that case mainQuit will make the innermost invocation of the main loop return.

mainDoEvent

mainDoEvent Source #

Arguments

:: (HasCallStack, MonadIO m, IsEvent a) 
=> a

event: An event to process (normally passed by GDK)

-> m () 

Processes a single GDK event.

This is public only to allow filtering of events between GDK and GTK. You will not usually need to call this function directly.

While you should not call this function directly, you might want to know how exactly events are handled. So here is what this function does with the event:

  1. Compress enter/leave notify events. If the event passed build an enter/leave pair together with the next event (peeked from GDK), both events are thrown away. This is to avoid a backlog of (de-)highlighting widgets crossed by the pointer.
  2. Find the widget which got the event. If the widget can’t be determined the event is thrown away unless it belongs to a INCR transaction.
  3. Then the event is pushed onto a stack so you can query the currently handled event with getCurrentEvent.
  4. The event is sent to a widget. If a grab is active all events for widgets that are not in the contained in the grab widget are sent to the latter with a few exceptions: - Deletion and destruction events are still sent to the event widget for obvious reasons. - Events which directly relate to the visual representation of the event widget. - Leave events are delivered to the event widget if there was an enter event delivered to it before without the paired leave event. - Drag events are not redirected because it is unclear what the semantics of that would be.
  5. After finishing the delivery the event is popped from the event stack.

mainIteration

mainIteration Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Bool

Returns: True if mainQuit has been called for the innermost mainloop

Runs a single iteration of the mainloop.

If no events are waiting to be processed GTK will block until the next event is noticed. If you don’t want to block look at mainIterationDo or check if any events are pending with eventsPending first.

mainIterationDo

mainIterationDo Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Bool

blocking: True if you want GTK to block if no events are pending

-> m Bool

Returns: True if mainQuit has been called for the innermost mainloop

Runs a single iteration of the mainloop. If no events are available either return or block depending on the value of blocking.

mainLevel

mainLevel Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Word32

Returns: the nesting level of the current invocation of the main loop

Asks for the current nesting level of the main loop.

mainQuit

mainQuit :: (HasCallStack, MonadIO m) => m () Source #

Makes the innermost invocation of the main loop return when it regains control.

printRunPageSetupDialog

printRunPageSetupDialog Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindow a, IsPageSetup b, IsPrintSettings c) 
=> Maybe a

parent: transient parent

-> Maybe b

pageSetup: an existing PageSetup

-> c

settings: a PrintSettings

-> m PageSetup

Returns: a new PageSetup

Runs a page setup dialog, letting the user modify the values from pageSetup. If the user cancels the dialog, the returned PageSetup is identical to the passed in pageSetup, otherwise it contains the modifications done in the dialog.

Note that this function may use a recursive mainloop to show the page setup dialog. See printRunPageSetupDialogAsync if this is a problem.

printRunPageSetupDialogAsync

printRunPageSetupDialogAsync Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindow a, IsPageSetup b, IsPrintSettings c) 
=> Maybe a

parent: transient parent, or Nothing

-> Maybe b

pageSetup: an existing PageSetup, or Nothing

-> c

settings: a PrintSettings

-> PageSetupDoneFunc

doneCb: a function to call when the user saves the modified page setup

-> m () 

Runs a page setup dialog, letting the user modify the values from pageSetup.

In contrast to printRunPageSetupDialog, this function returns after showing the page setup dialog on platforms that support this, and calls doneCb from a signal handler for the response signal of the dialog.

propagateEvent

propagateEvent Source #

Arguments

:: (HasCallStack, MonadIO m, IsWidget a, IsEvent b) 
=> a

widget: a Widget

-> b

event: an event

-> m () 

Sends an event to a widget, propagating the event to parent widgets if the event remains unhandled. This function will emit the event through all the hierarchy of widget through all propagation phases.

Events received by GTK from GDK normally begin in mainDoEvent. Depending on the type of event, existence of modal dialogs, grabs, etc., the event may be propagated; if so, this function is used.

propagateEvent calls widgetEvent on each widget it decides to send the event to. So widgetEvent is the lowest-level function; it simply emits the Widget::event and possibly an event-specific signal on a widget. propagateEvent is a bit higher-level, and mainDoEvent is the highest level.

All that said, you most likely don’t want to use any of these functions; synthesizing events is rarely needed. There are almost certainly better ways to achieve your goals. For example, use widgetQueueDraw instead of making up expose events.

rcPropertyParseBorder

rcPropertyParseBorder Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> GParamSpec

pspec: a ParamSpec

-> String

gstring: the String to be parsed

-> GValue

propertyValue: a Value which must hold boxed values.

-> m Bool

Returns: True if gstring could be parsed and propertyValue has been set to the resulting Border.

A RcPropertyParser for use with gtk_settings_install_property_parser() or gtk_widget_class_install_style_property_parser() which parses borders in the form "{ left, right, top, bottom }" for integers left, right, top and bottom.

rcPropertyParseColor

rcPropertyParseColor :: (HasCallStack, MonadIO m) => GParamSpec -> String -> GValue -> m Bool Source #

No description available in the introspection data.

rcPropertyParseEnum

rcPropertyParseEnum Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> GParamSpec

pspec: a ParamSpec

-> String

gstring: the String to be parsed

-> GValue

propertyValue: a Value which must hold enum values.

-> m Bool

Returns: True if gstring could be parsed and propertyValue has been set to the resulting EnumValue.

A RcPropertyParser for use with gtk_settings_install_property_parser() or gtk_widget_class_install_style_property_parser() which parses a single enumeration value.

The enumeration value can be specified by its name, its nickname or its numeric value. For consistency with flags parsing, the value may be surrounded by parentheses.

rcPropertyParseFlags

rcPropertyParseFlags Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> GParamSpec

pspec: a ParamSpec

-> String

gstring: the String to be parsed

-> GValue

propertyValue: a Value which must hold flags values.

-> m Bool

Returns: True if gstring could be parsed and propertyValue has been set to the resulting flags value.

A RcPropertyParser for use with gtk_settings_install_property_parser() or gtk_widget_class_install_style_property_parser() which parses flags.

Flags can be specified by their name, their nickname or numerically. Multiple flags can be specified in the form "( flag1 | flag2 | ... )".

rcPropertyParseRequisition

rcPropertyParseRequisition Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> GParamSpec

pspec: a ParamSpec

-> String

gstring: the String to be parsed

-> GValue

propertyValue: a Value which must hold boxed values.

-> m Bool

Returns: True if gstring could be parsed and propertyValue has been set to the resulting Requisition.

A RcPropertyParser for use with gtk_settings_install_property_parser() or gtk_widget_class_install_style_property_parser() which parses a requisition in the form "{ width, height }" for integers width and height.

renderActivity

renderActivity Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyleContext a) 
=> a

context: a StyleContext

-> Context

cr: a Context

-> Double

x: X origin of the rectangle

-> Double

y: Y origin of the rectangle

-> Double

width: rectangle width

-> Double

height: rectangle height

-> m () 

Renders an activity indicator (such as in Spinner). The state StateFlagsChecked determines whether there is activity going on.

renderArrow

renderArrow Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyleContext a) 
=> a

context: a StyleContext

-> Context

cr: a Context

-> Double

angle: arrow angle from 0 to 2 * PI, being 0 the arrow pointing to the north

-> Double

x: X origin of the render area

-> Double

y: Y origin of the render area

-> Double

size: square side for render area

-> m () 

Renders an arrow pointing to angle.

Typical arrow rendering at 0, 1⁄2 π;, π; and 3⁄2 π:

renderBackground

renderBackground Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyleContext a) 
=> a

context: a StyleContext

-> Context

cr: a Context

-> Double

x: X origin of the rectangle

-> Double

y: Y origin of the rectangle

-> Double

width: rectangle width

-> Double

height: rectangle height

-> m () 

Renders the background of an element.

Typical background rendering, showing the effect of background-image, border-width and border-radius:

renderBackgroundGetClip

renderBackgroundGetClip Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyleContext a) 
=> a

context: a StyleContext

-> Double

x: X origin of the rectangle

-> Double

y: Y origin of the rectangle

-> Double

width: rectangle width

-> Double

height: rectangle height

-> m Rectangle 

Returns the area that will be affected (i.e. drawn to) when calling renderBackground for the given context and rectangle.

renderCheck

renderCheck Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyleContext a) 
=> a

context: a StyleContext

-> Context

cr: a Context

-> Double

x: X origin of the rectangle

-> Double

y: Y origin of the rectangle

-> Double

width: rectangle width

-> Double

height: rectangle height

-> m () 

Renders a checkmark (as in a CheckButton).

The StateFlagsChecked state determines whether the check is on or off, and StateFlagsInconsistent determines whether it should be marked as undefined.

Typical checkmark rendering:

renderExpander

renderExpander Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyleContext a) 
=> a

context: a StyleContext

-> Context

cr: a Context

-> Double

x: X origin of the rectangle

-> Double

y: Y origin of the rectangle

-> Double

width: rectangle width

-> Double

height: rectangle height

-> m () 

Renders an expander (as used in TreeView and Expander) in the area defined by x, y, width, height. The state StateFlagsChecked determines whether the expander is collapsed or expanded.

Typical expander rendering:

renderFocus

renderFocus Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyleContext a) 
=> a

context: a StyleContext

-> Context

cr: a Context

-> Double

x: X origin of the rectangle

-> Double

y: Y origin of the rectangle

-> Double

width: rectangle width

-> Double

height: rectangle height

-> m () 

Renders a focus indicator on the rectangle determined by x, y, width, height.

Typical focus rendering:

renderFrame

renderFrame Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyleContext a) 
=> a

context: a StyleContext

-> Context

cr: a Context

-> Double

x: X origin of the rectangle

-> Double

y: Y origin of the rectangle

-> Double

width: rectangle width

-> Double

height: rectangle height

-> m () 

Renders a frame around the rectangle defined by x, y, width, height.

Examples of frame rendering, showing the effect of border-image, border-color, border-width, border-radius and junctions:

renderHandle

renderHandle Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyleContext a) 
=> a

context: a StyleContext

-> Context

cr: a Context

-> Double

x: X origin of the rectangle

-> Double

y: Y origin of the rectangle

-> Double

width: rectangle width

-> Double

height: rectangle height

-> m () 

Renders a handle (as in Paned and Window’s resize grip), in the rectangle determined by x, y, width, height.

Handles rendered for the paned and grip classes:

renderIcon

renderIcon Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyleContext a, IsTexture b) 
=> a

context: a StyleContext

-> Context

cr: a Context

-> b

texture: a Texture containing the icon to draw

-> Double

x: X position for the texture

-> Double

y: Y position for the texture

-> m () 

Renders the icon in texture at the specified x and y coordinates.

This function will render the icon in texture at exactly its size, regardless of scaling factors, which may not be appropriate when drawing on displays with high pixel densities.

renderInsertionCursor

renderInsertionCursor Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyleContext a, IsLayout b) 
=> a

context: a StyleContext

-> Context

cr: a Context

-> Double

x: X origin

-> Double

y: Y origin

-> b

layout: the Layout of the text

-> Int32

index: the index in the Layout

-> Direction

direction: the Direction of the text

-> m () 

Draws a text caret on cr at the specified index of layout.

renderLayout

renderLayout Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyleContext a, IsLayout b) 
=> a

context: a StyleContext

-> Context

cr: a Context

-> Double

x: X origin

-> Double

y: Y origin

-> b

layout: the Layout to render

-> m () 

Renders layout on the coordinates x, y

renderLine

renderLine Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyleContext a) 
=> a

context: a StyleContext

-> Context

cr: a Context

-> Double

x0: X coordinate for the origin of the line

-> Double

y0: Y coordinate for the origin of the line

-> Double

x1: X coordinate for the end of the line

-> Double

y1: Y coordinate for the end of the line

-> m () 

Renders a line from (x0, y0) to (x1, y1).

renderOption

renderOption Source #

Arguments

:: (HasCallStack, MonadIO m, IsStyleContext a) 
=> a

context: a StyleContext

-> Context

cr: a Context

-> Double

x: X origin of the rectangle

-> Double

y: Y origin of the rectangle

-> Double

width: rectangle width

-> Double

height: rectangle height

-> m () 

Renders an option mark (as in a RadioButton), the StateFlagsChecked state will determine whether the option is on or off, and StateFlagsInconsistent whether it should be marked as undefined.

Typical option mark rendering:

renderSlider

renderSlider :: (HasCallStack, MonadIO m, IsStyleContext a) => a -> Context -> Double -> Double -> Double -> Double -> Orientation -> m () Source #

No description available in the introspection data.

rgbToHsv

rgbToHsv Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Double

r: Red

-> Double

g: Green

-> Double

b: Blue

-> m (Double, Double, Double) 

Converts a color from RGB space to HSV.

Input values must be in the [0.0, 1.0] range; output values will be in the same range.

setDebugFlags

setDebugFlags :: (HasCallStack, MonadIO m) => Word32 -> m () Source #

Sets the GTK debug flags.

showUriOnWindow

showUriOnWindow Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindow a) 
=> Maybe a

parent: parent window

-> Text

uri: the uri to show

-> Word32

timestamp: a timestamp to prevent focus stealing

-> m ()

(Can throw GError)

This is a convenience function for launching the default application to show the uri. The uri must be of a form understood by GIO (i.e. you need to install gvfs to get support for uri schemes such as http:// or ftp://, as only local files are handled by GIO itself). Typical examples are

  • file:///home/gnome/pict.jpg
  • http://www.gnome.org
  • mailto:me@gnome.org

Ideally the timestamp is taken from the event triggering the showUriOnWindow call. If timestamp is not known you can take CURRENT_TIME.

This is the recommended call to be used as it passes information necessary for sandbox helpers to parent their dialogs properly.

targetsIncludeImage

targetsIncludeImage Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> [Text]

targets: an array of GdkAtoms

-> Bool

writable: whether to accept only targets for which GTK+ knows how to convert a pixbuf into the format

-> m Bool

Returns: True if targets include a suitable target for images, otherwise False.

Determines if any of the targets in targets can be used to provide a Pixbuf.

targetsIncludeText

targetsIncludeText Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> [Text]

targets: an array of GdkAtoms

-> m Bool

Returns: True if targets include a suitable target for text, otherwise False.

Determines if any of the targets in targets can be used to provide text.

targetsIncludeUri

targetsIncludeUri Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> [Text]

targets: an array of GdkAtoms

-> m Bool

Returns: True if targets include a suitable target for uri lists, otherwise False.

Determines if any of the targets in targets can be used to provide an uri list.

testListAllTypes

testListAllTypes Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m ([GType], Word32)

Returns: 0-terminated array of type ids

Return the type ids that have been registered after calling testRegisterAllTypes.

testRegisterAllTypes

testRegisterAllTypes :: (HasCallStack, MonadIO m) => m () Source #

Force registration of all core Gtk+ and Gdk object types. This allowes to refer to any of those object types via typeFromName after calling this function.

testWidgetWaitForDraw

testWidgetWaitForDraw Source #

Arguments

:: (HasCallStack, MonadIO m, IsWidget a) 
=> a

widget: the widget to wait for

-> m () 

Enters the main loop and waits for widget to be “drawn”. In this context that means it waits for the frame clock of widget to have run a full styling, layout and drawing cycle.

This function is intended to be used for syncing with actions that depend on widget relayouting or on interaction with the display server.

treeGetRowDragData

treeGetRowDragData Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> SelectionData

selectionData: a SelectionData

-> m (Bool, Maybe TreeModel, Maybe TreePath)

Returns: True if selectionData had target type GTK_TREE_MODEL_ROW and is otherwise valid

Obtains a treeModel and path from selection data of target type GTK_TREE_MODEL_ROW. Normally called from a drag_data_received handler. This function can only be used if selectionData originates from the same process that’s calling this function, because a pointer to the tree model is being passed around. If you aren’t in the same process, then you'll get memory corruption. In the TreeDragDest drag_data_received handler, you can assume that selection data of type GTK_TREE_MODEL_ROW is in from the current process. The returned path must be freed with treePathFree.

treeSetRowDragData

treeSetRowDragData Source #

Arguments

:: (HasCallStack, MonadIO m, IsTreeModel a) 
=> SelectionData

selectionData: some SelectionData

-> a

treeModel: a TreeModel

-> TreePath

path: a row in treeModel

-> m Bool

Returns: True if the SelectionData had the proper target type to allow us to set a tree row

Sets selection data of target type GTK_TREE_MODEL_ROW. Normally used in a drag_data_get handler.