Class ColumnViewColumn

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class ColumnViewColumn extends GObject

Represents the columns in a GtkColumnView.

The main ingredient for a GtkColumnViewColumn is the GtkListItemFactory that tells the columnview how to create cells for this column from items in the model.

Columns have a title, and can optionally have a header menu set with setHeaderMenu(MenuModel).

A sorter can be associated with a column using setSorter(Sorter), to let users influence sorting by clicking on the column header.

  • Constructor Details

    • ColumnViewColumn

      public ColumnViewColumn(MemorySegment address)
      Create a ColumnViewColumn instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • ColumnViewColumn

      public ColumnViewColumn(@Nullable String title, @Nullable ListItemFactory factory)

      Creates a new GtkColumnViewColumn that uses the given factory for mapping items to widgets.

      You most likely want to call ColumnView.appendColumn(ColumnViewColumn) next.

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

      column = gtk_column_view_column_new (_("Name"),
        gtk_builder_list_item_factory_new_from_resource ("/name.ui"));
      
      Parameters:
      title - Title to use for this column
      factory - The factory to populate items with
    • ColumnViewColumn

      public ColumnViewColumn()
      Create a new ColumnViewColumn.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the ColumnViewColumn class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected ColumnViewColumn asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class GObject
      Returns:
      the instance as if it were its parent type
    • getColumnView

      public @Nullable ColumnView getColumnView()

      Gets the column view that's currently displaying this column.

      If this ColumnViewColumn has not been added to a column view yet, NULL is returned.

      Returns:
      The column view displaying self.
    • getExpand

      public boolean getExpand()
      Returns whether this column should expand.
      Returns:
      true if this column expands
    • getFactory

      public @Nullable ListItemFactory getFactory()
      Gets the factory that's currently used to populate list items for this column.
      Returns:
      The factory in use
    • getFixedWidth

      public int getFixedWidth()
      Gets the fixed width of the column.
      Returns:
      the fixed with of the column
    • getHeaderMenu

      public @Nullable MenuModel getHeaderMenu()
      Gets the menu model that is used to create the context menu for the column header.
      Returns:
      the GMenuModel
    • getId

      public @Nullable String getId()
      Returns the ID set with setId(String).
      Returns:
      The column's ID
      Since:
      4.10
    • getResizable

      public boolean getResizable()
      Returns whether this column is resizable.
      Returns:
      true if this column is resizable
    • getSorter

      public @Nullable Sorter getSorter()
      Returns the sorter that is associated with the column.
      Returns:
      the GtkSorter of this ColumnViewColumn
    • getTitle

      public @Nullable String getTitle()
      Returns the title set with setTitle(String).
      Returns:
      The column's title
    • getVisible

      public boolean getVisible()
      Returns whether this column is visible.
      Returns:
      true if this column is visible
    • setExpand

      public void setExpand(boolean expand)

      Sets the column to take available extra space.

      The extra space is shared equally amongst all columns that have are set to expand.

      Parameters:
      expand - whether this column should expand to fill available space
    • setFactory

      public void setFactory(@Nullable ListItemFactory factory)
      Sets the GtkListItemFactory to use for populating list items for this column.
      Parameters:
      factory - the factory to use
    • setFixedWidth

      public void setFixedWidth(int fixedWidth)

      Sets the fixed width of the column.

      If fixedWidth is -1, the fixed width of the column is unset.

      Setting a fixed width overrides the automatically calculated width. Interactive resizing also sets the “fixed-width” property.

      Parameters:
      fixedWidth - the new fixed width, or -1
    • setHeaderMenu

      public void setHeaderMenu(@Nullable MenuModel menu)
      Sets the menu model that is used to create the context menu for the column header.
      Parameters:
      menu - a GMenuModel
    • setId

      public void setId(@Nullable String id)

      Sets the id of this column.

      GTK makes no use of this, but applications can use it when storing column view configuration.

      It is up to callers to ensure uniqueness of IDs.

      Parameters:
      id - ID to use for this column
      Since:
      4.10
    • setResizable

      public void setResizable(boolean resizable)
      Sets whether this column should be resizable by dragging.
      Parameters:
      resizable - whether this column should be resizable
    • setSorter

      public void setSorter(@Nullable Sorter sorter)

      Associates a sorter with the column.

      If sorter is unset, the column will not let users change the sorting by clicking on its header.

      This sorter can be made active by clicking on the column header, or by calling ColumnView.sortByColumn(ColumnViewColumn, SortType).

      See ColumnView.getSorter() for the necessary steps for setting up customizable sorting for ColumnView.

      Parameters:
      sorter - the GtkSorter to associate with column
    • setTitle

      public void setTitle(@Nullable String title)

      Sets the title of this column.

      The title is displayed in the header of a GtkColumnView for this column and is therefore user-facing text that should be translated.

      Parameters:
      title - Title to use for this column
    • setVisible

      public void setVisible(boolean visible)
      Sets whether this column should be visible in views.
      Parameters:
      visible - whether this column should be visible
    • builder

      public static ColumnViewColumn.Builder<? extends ColumnViewColumn.Builder> builder()
      A ColumnViewColumn.Builder object constructs a ColumnViewColumn with the specified properties. Use the various set...() methods to set properties, and finish construction with ColumnViewColumn.Builder.build().
      Returns:
      the builder object