gi-gtk4-4.0.12: Gtk 4.x bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Gtk.Objects.ListItem

Contents

- Exported types
- Methods
  - getAccessibleDescription
  - getAccessibleLabel
  - getActivatable
  - getChild
  - getFocusable
  - getItem
  - getPosition
  - getSelectable
  - getSelected
  - setAccessibleDescription
  - setAccessibleLabel
  - setActivatable
  - setChild
  - setFocusable
  - setSelectable
- Properties
  - accessibleDescription
  - accessibleLabel
  - activatable
  - child
  - focusable
  - item
  - position
  - selectable
  - selected

Description

Used by list widgets to represent items in a `ListModel`.

`GtkListItem` objects are managed by the list widget (with its factory) and cannot be created by applications, but they need to be populated by application code. This is done by calling `listItemSetChild`.

`GtkListItem` objects exist in 2 stages:

1. The unbound stage where the listitem is not currently connected to an item in the list. In that case, the ListItem:item property is set to `NULL`.
2. The bound stage where the listitem references an item from the list. The ListItem:item property is not `NULL`.

Synopsis

- newtype ListItem = ListItem (ManagedPtr ListItem)
- class (GObject o, IsDescendantOf ListItem o) => IsListItem o
- toListItem :: (MonadIO m, IsListItem o) => o -> m ListItem
- listItemGetAccessibleDescription :: (HasCallStack, MonadIO m, IsListItem a) => a -> m Text
- listItemGetAccessibleLabel :: (HasCallStack, MonadIO m, IsListItem a) => a -> m Text
- listItemGetActivatable :: (HasCallStack, MonadIO m, IsListItem a) => a -> m Bool
- listItemGetChild :: (HasCallStack, MonadIO m, IsListItem a) => a -> m (Maybe Widget)
- listItemGetFocusable :: (HasCallStack, MonadIO m, IsListItem a) => a -> m Bool
- listItemGetItem :: (HasCallStack, MonadIO m, IsListItem a) => a -> m (Maybe Object)
- listItemGetPosition :: (HasCallStack, MonadIO m, IsListItem a) => a -> m Word32
- listItemGetSelectable :: (HasCallStack, MonadIO m, IsListItem a) => a -> m Bool
- listItemGetSelected :: (HasCallStack, MonadIO m, IsListItem a) => a -> m Bool
- listItemSetAccessibleDescription :: (HasCallStack, MonadIO m, IsListItem a) => a -> Text -> m ()
- listItemSetAccessibleLabel :: (HasCallStack, MonadIO m, IsListItem a) => a -> Text -> m ()
- listItemSetActivatable :: (HasCallStack, MonadIO m, IsListItem a) => a -> Bool -> m ()
- listItemSetChild :: (HasCallStack, MonadIO m, IsListItem a, IsWidget b) => a -> Maybe b -> m ()
- listItemSetFocusable :: (HasCallStack, MonadIO m, IsListItem a) => a -> Bool -> m ()
- listItemSetSelectable :: (HasCallStack, MonadIO m, IsListItem a) => a -> Bool -> m ()
- constructListItemAccessibleDescription :: (IsListItem o, MonadIO m) => Text -> m (GValueConstruct o)
- getListItemAccessibleDescription :: (MonadIO m, IsListItem o) => o -> m Text
- setListItemAccessibleDescription :: (MonadIO m, IsListItem o) => o -> Text -> m ()
- constructListItemAccessibleLabel :: (IsListItem o, MonadIO m) => Text -> m (GValueConstruct o)
- getListItemAccessibleLabel :: (MonadIO m, IsListItem o) => o -> m Text
- setListItemAccessibleLabel :: (MonadIO m, IsListItem o) => o -> Text -> m ()
- constructListItemActivatable :: (IsListItem o, MonadIO m) => Bool -> m (GValueConstruct o)
- getListItemActivatable :: (MonadIO m, IsListItem o) => o -> m Bool
- setListItemActivatable :: (MonadIO m, IsListItem o) => o -> Bool -> m ()
- clearListItemChild :: (MonadIO m, IsListItem o) => o -> m ()
- constructListItemChild :: (IsListItem o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o)
- getListItemChild :: (MonadIO m, IsListItem o) => o -> m (Maybe Widget)
- setListItemChild :: (MonadIO m, IsListItem o, IsWidget a) => o -> a -> m ()
- constructListItemFocusable :: (IsListItem o, MonadIO m) => Bool -> m (GValueConstruct o)
- getListItemFocusable :: (MonadIO m, IsListItem o) => o -> m Bool
- setListItemFocusable :: (MonadIO m, IsListItem o) => o -> Bool -> m ()
- getListItemItem :: (MonadIO m, IsListItem o) => o -> m (Maybe Object)
- getListItemPosition :: (MonadIO m, IsListItem o) => o -> m Word32
- constructListItemSelectable :: (IsListItem o, MonadIO m) => Bool -> m (GValueConstruct o)
- getListItemSelectable :: (MonadIO m, IsListItem o) => o -> m Bool
- setListItemSelectable :: (MonadIO m, IsListItem o) => o -> Bool -> m ()
- getListItemSelected :: (MonadIO m, IsListItem o) => o -> m Bool

# Exported types

newtype ListItem Source #

Memory-managed wrapper type.

Constructors

ListItem (ManagedPtr ListItem) |

#### Instances

Instances details

Eq ListItem Source # |
Instance details Defined in GI.Gtk.Objects.ListItem Methods (==) :: ListItem -> ListItem -> Bool Source # (/=) :: ListItem -> ListItem -> Bool Source #
GObject ListItem Source # |
Instance details Defined in GI.Gtk.Objects.ListItem
ManagedPtrNewtype ListItem Source # |
Instance details Defined in GI.Gtk.Objects.ListItem Methods toManagedPtr :: ListItem -> ManagedPtr ListItem Source #
TypedObject ListItem Source # |
Instance details Defined in GI.Gtk.Objects.ListItem Methods glibType :: IO GType Source #
HasParentTypes ListItem Source # |
Instance details Defined in GI.Gtk.Objects.ListItem
IsGValue (Maybe ListItem) Source # | Convert `ListItem` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gtk.Objects.ListItem Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe ListItem -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe ListItem) Source #
type ParentTypes ListItem Source # |
Instance details Defined in GI.Gtk.Objects.ListItem type ParentTypes ListItem = '[Object]

class (GObject o, IsDescendantOf ListItem o) => IsListItem o Source #

Type class for types which can be safely cast to `ListItem`, for instance with `toListItem`.

#### Instances

Instances details

(GObject o, IsDescendantOf ListItem o) => IsListItem o Source # |
Instance details Defined in GI.Gtk.Objects.ListItem

toListItem :: (MonadIO m, IsListItem o) => o -> m ListItem Source #

Cast to `ListItem`, for types for which this is known to be safe. For general casts, use `castTo`.

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.

#### Getters

getAccessibleDescription, getAccessibleLabel, getActivatable, getChild, getData, getFocusable, getItem, getPosition, getProperty, getQdata, getSelectable, getSelected.

#### Setters

setAccessibleDescription, setAccessibleLabel, setActivatable, setChild, setData, setDataFull, setFocusable, setProperty, setSelectable.

## getAccessibleDescription

listItemGetAccessibleDescription Source #

Arguments

:: (HasCallStack, MonadIO m, IsListItem a) |
=> a | `self`: a listitem
-> m Text | Returns: the accessible description

Gets the accessible description of `self`.

Since: 4.12

## getAccessibleLabel

listItemGetAccessibleLabel Source #

Arguments

:: (HasCallStack, MonadIO m, IsListItem a) |
=> a | `self`: a listitem
-> m Text | Returns: the accessible label

Gets the accessible label of `self`.

Since: 4.12

## getActivatable

listItemGetActivatable Source #

Arguments

:: (HasCallStack, MonadIO m, IsListItem a) |
=> a | `self`: a listitem
-> m Bool | Returns: true if the item is activatable

Checks if a listitem has been set to be activatable via `listItemSetActivatable`.

## getChild

listItemGetChild Source #

Arguments

:: (HasCallStack, MonadIO m, IsListItem a) |
=> a | `self`: a listitem
-> m (Maybe Widget) | Returns: The child

Gets the child previously set via `listItemSetChild` or `NULL` if none was set.

## getFocusable

listItemGetFocusable Source #

Arguments

:: (HasCallStack, MonadIO m, IsListItem a) |
=> a | `self`: a lits item
-> m Bool | Returns: true if the item is focusable

Checks if a listitem has been set to be focusable via `listItemSetFocusable`.

Since: 4.12

## getItem

listItemGetItem Source #

Arguments

:: (HasCallStack, MonadIO m, IsListItem a) |
=> a | `self`: a listitem
-> m (Maybe Object) | Returns: The item displayed

Gets the model item that associated with `self`.

If `self` is unbound, this function returns `NULL`.

## getPosition

listItemGetPosition Source #

Arguments

:: (HasCallStack, MonadIO m, IsListItem a) |
=> a | `self`: a listitem
-> m Word32 | Returns: The position of this item

Gets the position in the model that `self` currently displays.

If `self` is unbound, `GTK_INVALID_LIST_POSITION` is returned.

## getSelectable

listItemGetSelectable Source #

Arguments

:: (HasCallStack, MonadIO m, IsListItem a) |
=> a | `self`: a listitem
-> m Bool | Returns: true if the item is selectable

Checks if a listitem has been set to be selectable via `listItemSetSelectable`.

Do not confuse this function with `listItemGetSelected`.

## getSelected

listItemGetSelected Source #

Arguments

:: (HasCallStack, MonadIO m, IsListItem a) |
=> a | `self`: a listitem
-> m Bool | Returns: true if the item is selected.

Checks if the item is displayed as selected.

The selected state is maintained by the list widget and its model and cannot be set otherwise.

## setAccessibleDescription

listItemSetAccessibleDescription Source #

Arguments

:: (HasCallStack, MonadIO m, IsListItem a) |
=> a | `self`: a listitem
-> Text | `description`: the description
-> m () |

Sets the accessible description for the listitem.

The accessible description may be used by e.g. screen readers.

Since: 4.12

## setAccessibleLabel

listItemSetAccessibleLabel Source #

Arguments

:: (HasCallStack, MonadIO m, IsListItem a) |
=> a | `self`: a listitem
-> Text | `label`: the label
-> m () |

Sets the accessible label for the listitem.

The accessible label may be used by e.g. screen readers.

Since: 4.12

## setActivatable

listItemSetActivatable Source #

Arguments

:: (HasCallStack, MonadIO m, IsListItem a) |
=> a | `self`: a listitem
-> Bool | `activatable`: if the item should be activatable
-> m () |

Sets `self` to be activatable.

If an item is activatable, double-clicking on the item, using the Return key or calling `widgetActivate` will activate the item. Activating instructs the containing view to handle activation. `GtkListView` for example will be emitting the ListView::activate signal.

By default, listitems are activatable.

## setChild

listItemSetChild Source #

Arguments

:: (HasCallStack, MonadIO m, IsListItem a, IsWidget b) |
=> a | `self`: a listitem
-> Maybe b | `child`: The listitem's child or `NULL` to unset
-> m () |

Sets the child to be used for this listitem.

This function is typically called by applications when setting up a listitem so that the widget can be reused when binding it multiple times.

## setFocusable

listItemSetFocusable Source #

Arguments

:: (HasCallStack, MonadIO m, IsListItem a) |
=> a | `self`: a listitem
-> Bool | `focusable`: if the item should be focusable
-> m () |

Sets `self` to be focusable.

If an item is focusable, it can be focused using the keyboard. This works similar to `widgetSetFocusable`.

Note that if items are not focusable, the keyboard cannot be used to activate them and selecting only works if one of the listitem's children is focusable.

By default, listitems are focusable.

Since: 4.12

## setSelectable

listItemSetSelectable Source #

Arguments

:: (HasCallStack, MonadIO m, IsListItem a) |
=> a | `self`: a listitem
-> Bool | `selectable`: if the item should be selectable
-> m () |

Sets `self` to be selectable.

If an item is selectable, clicking on the item or using the keyboard will try to select or unselect the item. If this succeeds is up to the model to determine, as it is managing the selected state.

Note that this means that making an item non-selectable has no influence on the selected state at all. A non-selectable item may still be selected.

By default, listitems are selectable. When rebinding them to a new item, they will also be reset to be selectable by GTK.

# Properties

## accessibleDescription

The accessible description to set on the listitem.

Since: 4.12

constructListItemAccessibleDescription :: (IsListItem o, MonadIO m) => Text -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`accessible-description`” property. This is rarely needed directly, but it is used by `new`.

getListItemAccessibleDescription :: (MonadIO m, IsListItem o) => o -> m Text Source #

Get the value of the “`accessible-description`” property. When overloading is enabled, this is equivalent to

    get listItem #accessibleDescription

setListItemAccessibleDescription :: (MonadIO m, IsListItem o) => o -> Text -> m () Source #

Set the value of the “`accessible-description`” property. When overloading is enabled, this is equivalent to

    set listItem [ #accessibleDescription := value ]

## accessibleLabel

The accessible label to set on the listitem.

Since: 4.12

constructListItemAccessibleLabel :: (IsListItem o, MonadIO m) => Text -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`accessible-label`” property. This is rarely needed directly, but it is used by `new`.

getListItemAccessibleLabel :: (MonadIO m, IsListItem o) => o -> m Text Source #

Get the value of the “`accessible-label`” property. When overloading is enabled, this is equivalent to

    get listItem #accessibleLabel

setListItemAccessibleLabel :: (MonadIO m, IsListItem o) => o -> Text -> m () Source #

Set the value of the “`accessible-label`” property. When overloading is enabled, this is equivalent to

    set listItem [ #accessibleLabel := value ]

## activatable

If the item can be activated by the user.

constructListItemActivatable :: (IsListItem o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`activatable`” property. This is rarely needed directly, but it is used by `new`.

getListItemActivatable :: (MonadIO m, IsListItem o) => o -> m Bool Source #

Get the value of the “`activatable`” property. When overloading is enabled, this is equivalent to

    get listItem #activatable

setListItemActivatable :: (MonadIO m, IsListItem o) => o -> Bool -> m () Source #

Set the value of the “`activatable`” property. When overloading is enabled, this is equivalent to

    set listItem [ #activatable := value ]

## child

Widget used for display.

clearListItemChild :: (MonadIO m, IsListItem o) => o -> m () Source #

Set the value of the “`child`” property to `Nothing`. When overloading is enabled, this is equivalent to

    clear #child

constructListItemChild :: (IsListItem o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`child`” property. This is rarely needed directly, but it is used by `new`.

getListItemChild :: (MonadIO m, IsListItem o) => o -> m (Maybe Widget) Source #

Get the value of the “`child`” property. When overloading is enabled, this is equivalent to

    get listItem #child

setListItemChild :: (MonadIO m, IsListItem o, IsWidget a) => o -> a -> m () Source #

Set the value of the “`child`” property. When overloading is enabled, this is equivalent to

    set listItem [ #child := value ]

## focusable

If the item can be focused with the keyboard.

Since: 4.12

constructListItemFocusable :: (IsListItem o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`focusable`” property. This is rarely needed directly, but it is used by `new`.

getListItemFocusable :: (MonadIO m, IsListItem o) => o -> m Bool Source #

Get the value of the “`focusable`” property. When overloading is enabled, this is equivalent to

    get listItem #focusable

setListItemFocusable :: (MonadIO m, IsListItem o) => o -> Bool -> m () Source #

Set the value of the “`focusable`” property. When overloading is enabled, this is equivalent to

    set listItem [ #focusable := value ]

## item

Displayed item.

getListItemItem :: (MonadIO m, IsListItem o) => o -> m (Maybe Object) Source #

Get the value of the “`item`” property. When overloading is enabled, this is equivalent to

    get listItem #item

## position

Position of the item.

getListItemPosition :: (MonadIO m, IsListItem o) => o -> m Word32 Source #

Get the value of the “`position`” property. When overloading is enabled, this is equivalent to

    get listItem #position

## selectable

If the item can be selected by the user.

constructListItemSelectable :: (IsListItem o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`selectable`” property. This is rarely needed directly, but it is used by `new`.

getListItemSelectable :: (MonadIO m, IsListItem o) => o -> m Bool Source #

Get the value of the “`selectable`” property. When overloading is enabled, this is equivalent to

    get listItem #selectable

setListItemSelectable :: (MonadIO m, IsListItem o) => o -> Bool -> m () Source #

Set the value of the “`selectable`” property. When overloading is enabled, this is equivalent to

    set listItem [ #selectable := value ]

## selected

If the item is currently selected.

getListItemSelected :: (MonadIO m, IsListItem o) => o -> m Bool Source #

Get the value of the “`selected`” property. When overloading is enabled, this is equivalent to

    get listItem #selected