Boxed Lists

Boxed Lists

Libadapta provides API to implement the boxed lists pattern.

Boxed lists are composed of a GtkListBox with the GtkListBox:selection-mode set to GTK_SELECTION_NONE and with the .boxed-list style class.

GtkListView cannot be used as a boxed list at the moment.

An example boxed list:

<object class="GtkListBox">
  <property name="selection-mode">none</property>
  <style>
    <class name="boxed-list"/>
  </style>
  <child>
    <object class="AdapActionRow">
      <property name="title">Item 1</property>
    </object>
  </child>
  <child>
    <object class="AdapActionRow">
      <property name="title">Item 2</property>
    </object>
  </child>
  <child>
    <object class="AdapActionRow">
      <property name="title">Item 3</property>
    </object>
  </child>
</object>

boxed-lists

Rows

A number of predefined list row classes are available and intended to be used inside boxed lists:

Action Rows

AdapActionRow is a basic row. It has a title, a subtitle, an icon, and can have prefix and suffix children.

action-row

Switch Rows

AdapSwitchRow is an AdapActionRow with an embedded GtkSwitch. It’s used to represent two states: “on” and “off”.

switch-row

Expander Rows

AdapExpanderRow is similar to AdapActionRow, but can expand to show other rows.

expander-row

Combo Rows

AdapComboRow is a row with an embedded drop down menu, similar to GtkDropDown.

combo-row

Entry Rows

AdapEntryRow is a row with an embedded entry. It can have prefix and suffix widgets, and an apply button.

entry-row

Password Entry Rows

AdapPasswordEntryRow is a variant of AdapEntryRow tailored for entering secrets. It conceals the text and provides a button to show it, along with a Caps Lock indicator.

password-entry-row

Spin Rows

AdapSpinRow is a AdapActionRow with an embedded GtkSpinButton.

spin-row

Property Rows

When used together with the .property style class, AdapActionRow and AdapExpanderRow deemphasize their title and emphasize their subtitle instead, which is useful for displaying read-only properties:

<object class="AdapActionRow">
  <property name="title" translatable="yes">Property Name</property>
  <property name="subtitle">Value</property>
  <property name="subtitle-selectable">True</property>
  <style>
    <class name="property"/>
  </style>
</object>

property-row

Preferences Group

AdapPreferencesGroup provides a boxed list along with a title and a description. It’s mainly meant to be used as a child of AdapPreferencesPage, but can also be used separately.

preferences-group