Gnome::Gtk4::ListView

use v6.d;

#------------------------------------------------------------------------------- #--[Class Description]---------------------------------------------------------- #-------------------------------------------------------------------------------

=begin rakudoc

Description

Gnome::Gtk4::ListView presents a large dynamic list of items.

Gnome::Gtk4::ListView uses its factory to generate one row widget for each visible item and shows them in a linear display, either vertically or horizontally.

The .set-show-separators() method offers a simple way to set separators between the rows.

Gnome::Gtk4::ListView allows the user to select items according to the selection characteristics of the model. For models that allow multiple selected items, it is possible to turn on rubberband selection, using .set-enable-rubberband().

If you need multiple columns with headers, see Gnome::Gtk4::ColumnView.

To learn more about the list widget framework, see the overview.

CSS nodes

listview[.separators][.rich-list][.navigation-sidebar][.data-table]
β”œβ”€β”€ row[.activatable]
β”‚
β”œβ”€β”€ row[.activatable]
β”‚
β”Š
╰── [rubberband]

Gnome::Gtk4::ListView uses a single CSS node named listview. It may carry the .separators style class, when show-separators property is set. Each child widget uses a single CSS node named row. If the activatable defined in Gnome::Gtk4::ListItem property is set, the corresponding row will have the .activatable style class. For rubberband selection, a node with name rubberband is used.

The main listview node may also carry style classes to select the style of list presentation: .rich-list, .navigation-sidebar or .data-table.

Accessibility

Gnome::Gtk4::ListView uses the GTK_ACCESSIBLE_ROLE_LIST role, and the list items use the GTK_ACCESSIBLE_ROLE_LIST_ITEM role.

Uml Diagram

=end rakudoc

#------------------------------------------------------------------------------- #--[Class Initialization]------------------------------------------------------- #-------------------------------------------------------------------------------

=begin rakudoc

Class initialization

new

:native-object

Create an object using a native object from an object of the same type found elsewhere. See also Gnome::N::TopLevelSupportClass.

method new ( N-Object() :$native-object! )

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

new-listview

Creates a new Gnome::Gtk4::ListView that uses the given $factory for mapping items to widgets.

The function takes ownership of the arguments, so you can write code like

method new-listview ( N-Object() $model, N-Object() $factory --> Gnome::Gtk4::ListView )
  • $model; (transfer ownership: full) the model to use.

  • $factory; (transfer ownership: full) The factory to populate items with.

=end rakudoc

#------------------------------------------------------------------------------- #--[Methods]-------------------------------------------------------------------- #-------------------------------------------------------------------------------

=begin rakudoc

Methods

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

get-enable-rubberband

Returns whether rows can be selected by dragging with the mouse.

method get-enable-rubberband (--> Bool )

Return value; True if rubberband selection is enabled.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

get-factory

Gets the factory that's currently used to populate list items.

method get-factory (--> N-Object )

Return value; The factory in use.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

get-header-factory

Gets the factory that's currently used to populate section headers.

method get-header-factory (--> N-Object )

Return value; The factory in use.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

get-model

Gets the model that's currently used to read the items displayed.

method get-model (--> N-Object )

Return value; The model in use.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

get-show-separators

Returns whether the list box should show separators between rows.

method get-show-separators (--> Bool )

Return value; True if the list box shows separators.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

get-single-click-activate

Returns whether rows will be activated on single click and selected on hover.

method get-single-click-activate (--> Bool )

Return value; True if rows are activated on single click.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

get-tab-behavior

Gets the behavior set for the <kbd>Tab</kbd> key.

method get-tab-behavior (--> GtkListTabBehavior )

Return value; The behavior of the <kbd>Tab</kbd> key.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

scroll-to

Scrolls to the item at the given position and performs the actions specified in $flags.

This function works no matter if the listview is shown or focused. If it isn't, then the changes will take effect once that happens.

method scroll-to ( UInt() $pos, UInt $flags, N-Object $scroll )
  • $pos; position of the item. Must be less than the number of items in the view..

  • $flags; actions to perform.

  • $scroll; (transfer ownership: full) details of how to perform the scroll operation or undefined to scroll into view

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

set-enable-rubberband

Sets whether selections can be changed by dragging with the mouse.

method set-enable-rubberband ( Bool() $enable-rubberband )
  • $enable-rubberband; True to enable rubberband selection.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

set-factory

Sets the Gnome::Gtk4::ListItemFactory to use for populating list items.

method set-factory ( N-Object() $factory )
  • $factory; the factory to use.

Example using set-factory

my Gnome::Gtk4::ListView $list-view;
with $list-view .= new-listview( N-Object, N-Object) {
  my $signal-factory .= new-signallistitemfactory;
  .set-factory($!signal-factory);
  …
}

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

set-header-factory

Sets the Gnome::Gtk4::ListItemFactory to use for populating the Gnome::Gtk4::ListHeader objects used in section headers.

If this factory is set to undefined, the list will not show section headers.

method set-header-factory ( N-Object() $factory )
  • $factory; the factory to use.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

set-model

Sets the model to use.

This must be a Gnome::Gtk4::ListHeader to use.

method set-model ( N-Object() $model )
  • $model; the model to use.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

set-show-separators

Sets whether the list box should show separators between rows.

method set-show-separators ( Bool() $show-separators )
  • $show-separators; True to show separators.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

set-single-click-activate

Sets whether rows should be activated on single click and selected on hover.

method set-single-click-activate ( Bool() $single-click-activate )
  • $single-click-activate; True to activate items on single click.

=end rakudoc

#------------------------------------------------------------------------------- =begin rakudoc

set-tab-behavior

Sets the behavior of the <kbd>Tab</kbd> and <kbd>Shift</kbd>+<kbd>Tab</kbd> keys.

method set-tab-behavior ( GtkListTabBehavior $tab-behavior )
  • $tab-behavior; The desired tab behavior.

=end rakudoc

#------------------------------------------------------------------------------- #--[Signal Documentation]------------------------------------------------------- #-------------------------------------------------------------------------------

=begin rakudoc

Signals

activate

Emitted when a row has been activated by the user, usually via activating the GtkListView|list.activate-item action.

This allows for a convenient way to handle activation in a listview. See .set-activatable() in class ListItem for details on how to use this signal.

method handler (
  guint $position,
  Int :$_handle_id,
  N-GObject :$_native-object,
  *%user-options
)
  • $position; position of item to activate.

  • $_handle_id; The registered event handler id.

  • $_native-object; The native object provided by the Raku object which registered this event. This is a native Gnome::Gtk4::ListView object.

  • %user-options; A list of named arguments provided by .register-signal() in class Object.

=end rakudoc

Gnome::Gtk4 v0.2.10

Modules for package Gnome::Gtk4:api<2>. The language binding to GNOME’s user interface toolkit version 4

Authors

    License

    Artistic-2.0

    Dependencies

    CairoXMLXML::XPathGnome::Gio:api<2>Gnome::Gsk4:api<2>Gnome::Gdk4:api<2>Gnome::Graphene:api<2>Gnome::Pango:api<2>Gnome::GObject:api<2>Gnome::Glib:api<2>Gnome::N:api<2>

    Test Dependencies

    Provides

    • Gnome::Gtk4::AboutDialog
    • Gnome::Gtk4::ActionBar
    • Gnome::Gtk4::ActivateAction
    • Gnome::Gtk4::Adjustment
    • Gnome::Gtk4::AlertDialog
    • Gnome::Gtk4::AlternativeTrigger
    • Gnome::Gtk4::AnyFilter
    • Gnome::Gtk4::AppChooserButton
    • Gnome::Gtk4::AppChooserDialog
    • Gnome::Gtk4::AppChooserWidget
    • Gnome::Gtk4::Application
    • Gnome::Gtk4::ApplicationWindow
    • Gnome::Gtk4::AspectFrame
    • Gnome::Gtk4::Assistant
    • Gnome::Gtk4::AssistantPage
    • Gnome::Gtk4::BinLayout
    • Gnome::Gtk4::BoolFilter
    • Gnome::Gtk4::Box
    • Gnome::Gtk4::BoxLayout
    • Gnome::Gtk4::Builder
    • Gnome::Gtk4::BuilderListItemFactory
    • Gnome::Gtk4::Button
    • Gnome::Gtk4::Calendar
    • Gnome::Gtk4::CallbackAction
    • Gnome::Gtk4::CellArea
    • Gnome::Gtk4::CellAreaBox
    • Gnome::Gtk4::CellRenderer
    • Gnome::Gtk4::CellRendererAccel
    • Gnome::Gtk4::CellRendererCombo
    • Gnome::Gtk4::CellRendererPixbuf
    • Gnome::Gtk4::CellRendererProgress
    • Gnome::Gtk4::CellRendererSpin
    • Gnome::Gtk4::CellRendererSpinner
    • Gnome::Gtk4::CellRendererText
    • Gnome::Gtk4::CellRendererToggle
    • Gnome::Gtk4::CellView
    • Gnome::Gtk4::CenterBox
    • Gnome::Gtk4::CenterLayout
    • Gnome::Gtk4::CheckButton
    • Gnome::Gtk4::ColorButton
    • Gnome::Gtk4::ColorChooserDialog
    • Gnome::Gtk4::ColorChooserWidget
    • Gnome::Gtk4::ColumnView
    • Gnome::Gtk4::ComboBox
    • Gnome::Gtk4::ComboBoxText
    • Gnome::Gtk4::Constraint
    • Gnome::Gtk4::ConstraintLayout
    • Gnome::Gtk4::ConstraintLayoutChild
    • Gnome::Gtk4::CssProvider
    • Gnome::Gtk4::CustomLayout
    • Gnome::Gtk4::Dialog
    • Gnome::Gtk4::DragIcon
    • Gnome::Gtk4::DragSource
    • Gnome::Gtk4::DrawingArea
    • Gnome::Gtk4::DropControllerMotion
    • Gnome::Gtk4::DropDown
    • Gnome::Gtk4::DropTarget
    • Gnome::Gtk4::DropTargetAsync
    • Gnome::Gtk4::EditableLabel
    • Gnome::Gtk4::EmojiChooser
    • Gnome::Gtk4::Entry
    • Gnome::Gtk4::EntryBuffer
    • Gnome::Gtk4::EntryCompletion
    • Gnome::Gtk4::EventController
    • Gnome::Gtk4::EveryFilter
    • Gnome::Gtk4::Expander
    • Gnome::Gtk4::Expression
    • Gnome::Gtk4::FileChooserDialog
    • Gnome::Gtk4::FileChooserWidget
    • Gnome::Gtk4::FileFilter
    • Gnome::Gtk4::Filter
    • Gnome::Gtk4::Fixed
    • Gnome::Gtk4::FixedLayout
    • Gnome::Gtk4::FixedLayoutChild
    • Gnome::Gtk4::FlowBox
    • Gnome::Gtk4::FlowBoxChild
    • Gnome::Gtk4::FontButton
    • Gnome::Gtk4::FontChooserDialog
    • Gnome::Gtk4::FontChooserWidget
    • Gnome::Gtk4::Frame
    • Gnome::Gtk4::GLArea
    • Gnome::Gtk4::Gesture
    • Gnome::Gtk4::GestureClick
    • Gnome::Gtk4::GestureDrag
    • Gnome::Gtk4::GestureLongPress
    • Gnome::Gtk4::GesturePan
    • Gnome::Gtk4::GestureRotate
    • Gnome::Gtk4::GestureSingle
    • Gnome::Gtk4::GestureStylus
    • Gnome::Gtk4::GestureSwipe
    • Gnome::Gtk4::GestureZoom
    • Gnome::Gtk4::Grid
    • Gnome::Gtk4::GridLayout
    • Gnome::Gtk4::GridLayoutChild
    • Gnome::Gtk4::GridView
    • Gnome::Gtk4::HeaderBar
    • Gnome::Gtk4::IconPaintable
    • Gnome::Gtk4::IconTheme
    • Gnome::Gtk4::IconView
    • Gnome::Gtk4::Image
    • Gnome::Gtk4::InfoBar
    • Gnome::Gtk4::KeyvalTrigger
    • Gnome::Gtk4::Label
    • Gnome::Gtk4::LayoutChild
    • Gnome::Gtk4::LayoutManager
    • Gnome::Gtk4::LevelBar
    • Gnome::Gtk4::LinkButton
    • Gnome::Gtk4::ListBase
    • Gnome::Gtk4::ListBox
    • Gnome::Gtk4::ListBoxRow
    • Gnome::Gtk4::ListItem
    • Gnome::Gtk4::ListItemFactory
    • Gnome::Gtk4::ListStore
    • Gnome::Gtk4::ListView
    • Gnome::Gtk4::LockButton
    • Gnome::Gtk4::MediaControls
    • Gnome::Gtk4::MenuButton
    • Gnome::Gtk4::MessageDialog
    • Gnome::Gtk4::MnemonicAction
    • Gnome::Gtk4::MnemonicTrigger
    • Gnome::Gtk4::MultiFilter
    • Gnome::Gtk4::MultiSelection
    • Gnome::Gtk4::MultiSorter
    • Gnome::Gtk4::N-AccessibleList
    • Gnome::Gtk4::N-Bitset
    • Gnome::Gtk4::N-BitsetIter
    • Gnome::Gtk4::N-Border
    • Gnome::Gtk4::N-CssSection
    • Gnome::Gtk4::N-Requisition
    • Gnome::Gtk4::N-ScrollInfo
    • Gnome::Gtk4::N-TextIter
    • Gnome::Gtk4::N-TreeIter
    • Gnome::Gtk4::N-TreePath
    • Gnome::Gtk4::N-TreeRowReference
    • Gnome::Gtk4::NamedAction
    • Gnome::Gtk4::NeverTrigger
    • Gnome::Gtk4::NoSelection
    • Gnome::Gtk4::Notebook
    • Gnome::Gtk4::NotebookPage
    • Gnome::Gtk4::NothingAction
    • Gnome::Gtk4::NumericSorter
    • Gnome::Gtk4::Overlay
    • Gnome::Gtk4::OverlayLayout
    • Gnome::Gtk4::OverlayLayoutChild
    • Gnome::Gtk4::PageSetupUnixDialog
    • Gnome::Gtk4::Paned
    • Gnome::Gtk4::PasswordEntry
    • Gnome::Gtk4::Picture
    • Gnome::Gtk4::Popover
    • Gnome::Gtk4::PopoverMenu
    • Gnome::Gtk4::PopoverMenuBar
    • Gnome::Gtk4::PrintOperation
    • Gnome::Gtk4::PrintUnixDialog
    • Gnome::Gtk4::ProgressBar
    • Gnome::Gtk4::R-Accessible
    • Gnome::Gtk4::R-Actionable
    • Gnome::Gtk4::R-AppChooser
    • Gnome::Gtk4::R-Buildable
    • Gnome::Gtk4::R-BuilderScope
    • Gnome::Gtk4::R-CellEditable
    • Gnome::Gtk4::R-CellLayout
    • Gnome::Gtk4::R-ColorChooser
    • Gnome::Gtk4::R-ConstraintTarget
    • Gnome::Gtk4::R-Editable
    • Gnome::Gtk4::R-FileChooser
    • Gnome::Gtk4::R-FontChooser
    • Gnome::Gtk4::R-Native
    • Gnome::Gtk4::R-Orientable
    • Gnome::Gtk4::R-PrintOperationPreview
    • Gnome::Gtk4::R-Root
    • Gnome::Gtk4::R-Scrollable
    • Gnome::Gtk4::R-SelectionModel
    • Gnome::Gtk4::R-ShortcutManager
    • Gnome::Gtk4::R-StyleProvider
    • Gnome::Gtk4::R-SymbolicPaintable
    • Gnome::Gtk4::R-TreeDragDest
    • Gnome::Gtk4::R-TreeDragSource
    • Gnome::Gtk4::R-TreeModel
    • Gnome::Gtk4::R-TreeSortable
    • Gnome::Gtk4::Range
    • Gnome::Gtk4::Revealer
    • Gnome::Gtk4::Scale
    • Gnome::Gtk4::ScaleButton
    • Gnome::Gtk4::Scrollbar
    • Gnome::Gtk4::ScrolledWindow
    • Gnome::Gtk4::SearchBar
    • Gnome::Gtk4::SearchEntry
    • Gnome::Gtk4::Separator
    • Gnome::Gtk4::Shortcut
    • Gnome::Gtk4::ShortcutAction
    • Gnome::Gtk4::ShortcutController
    • Gnome::Gtk4::ShortcutLabel
    • Gnome::Gtk4::ShortcutTrigger
    • Gnome::Gtk4::ShortcutsGroup
    • Gnome::Gtk4::ShortcutsSection
    • Gnome::Gtk4::ShortcutsShortcut
    • Gnome::Gtk4::ShortcutsWindow
    • Gnome::Gtk4::SignalAction
    • Gnome::Gtk4::SignalListItemFactory
    • Gnome::Gtk4::SingleSelection
    • Gnome::Gtk4::Snapshot
    • Gnome::Gtk4::Sorter
    • Gnome::Gtk4::SpinButton
    • Gnome::Gtk4::Spinner
    • Gnome::Gtk4::Stack
    • Gnome::Gtk4::StackPage
    • Gnome::Gtk4::StackSidebar
    • Gnome::Gtk4::StackSwitcher
    • Gnome::Gtk4::Statusbar
    • Gnome::Gtk4::StringFilter
    • Gnome::Gtk4::StringList
    • Gnome::Gtk4::StringObject
    • Gnome::Gtk4::StringSorter
    • Gnome::Gtk4::StyleContext
    • Gnome::Gtk4::Switch
    • Gnome::Gtk4::T-aboutdialog
    • Gnome::Gtk4::T-accessible
    • Gnome::Gtk4::T-activateaction
    • Gnome::Gtk4::T-application
    • Gnome::Gtk4::T-assistant
    • Gnome::Gtk4::T-bitset
    • Gnome::Gtk4::T-border
    • Gnome::Gtk4::T-builder
    • Gnome::Gtk4::T-builderscope
    • Gnome::Gtk4::T-cellrenderer
    • Gnome::Gtk4::T-cellrendereraccel
    • Gnome::Gtk4::T-csssection
    • Gnome::Gtk4::T-dialog
    • Gnome::Gtk4::T-editable
    • Gnome::Gtk4::T-entry
    • Gnome::Gtk4::T-enums
    • Gnome::Gtk4::T-expression
    • Gnome::Gtk4::T-filechooser
    • Gnome::Gtk4::T-filter
    • Gnome::Gtk4::T-fontchooser
    • Gnome::Gtk4::T-iconpaintable
    • Gnome::Gtk4::T-icontheme
    • Gnome::Gtk4::T-iconview
    • Gnome::Gtk4::T-image
    • Gnome::Gtk4::T-levelbar
    • Gnome::Gtk4::T-messagedialog
    • Gnome::Gtk4::T-native
    • Gnome::Gtk4::T-notebook
    • Gnome::Gtk4::T-popovermenu
    • Gnome::Gtk4::T-printoperation
    • Gnome::Gtk4::T-revealer
    • Gnome::Gtk4::T-scrolledwindow
    • Gnome::Gtk4::T-shortcutaction
    • Gnome::Gtk4::T-shortcutsshortcut
    • Gnome::Gtk4::T-show
    • Gnome::Gtk4::T-sorter
    • Gnome::Gtk4::T-spinbutton
    • Gnome::Gtk4::T-stack
    • Gnome::Gtk4::T-stringfilter
    • Gnome::Gtk4::T-stylecontext
    • Gnome::Gtk4::T-styleprovider
    • Gnome::Gtk4::T-textiter
    • Gnome::Gtk4::T-textview
    • Gnome::Gtk4::T-treednd
    • Gnome::Gtk4::T-treedragdest
    • Gnome::Gtk4::T-treemodel
    • Gnome::Gtk4::T-treesortable
    • Gnome::Gtk4::T-treeview
    • Gnome::Gtk4::T-treeviewcolumn
    • Gnome::Gtk4::T-types
    • Gnome::Gtk4::T-widget
    • Gnome::Gtk4::Text
    • Gnome::Gtk4::TextBuffer
    • Gnome::Gtk4::TextChildAnchor
    • Gnome::Gtk4::TextMark
    • Gnome::Gtk4::TextTag
    • Gnome::Gtk4::TextTagTable
    • Gnome::Gtk4::TextView
    • Gnome::Gtk4::ToggleButton
    • Gnome::Gtk4::Tooltip
    • Gnome::Gtk4::TreeExpander
    • Gnome::Gtk4::TreeListModel
    • Gnome::Gtk4::TreeListRow
    • Gnome::Gtk4::TreeListRowSorter
    • Gnome::Gtk4::TreeModelSort
    • Gnome::Gtk4::TreeSelection
    • Gnome::Gtk4::TreeStore
    • Gnome::Gtk4::TreeView
    • Gnome::Gtk4::TreeViewColumn
    • Gnome::Gtk4::Video
    • Gnome::Gtk4::Viewport
    • Gnome::Gtk4::VolumeButton
    • Gnome::Gtk4::Widget
    • Gnome::Gtk4::WidgetPaintable
    • Gnome::Gtk4::Window
    • Gnome::Gtk4::WindowControls
    • Gnome::Gtk4::WindowHandle

    Documentation

    The Camelia image is copyright 2009 by Larry Wall. "Raku" is a trademark of the Yet Another Society. All rights reserved.

    Built with Podlite β€” the markup and publishing tools behind this site.