Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: DropDownMeta

[670:14] static extends: object

Generated metadata helpers for DropDown class surfaces.

Methods

  • properties ()

    Returns property metadata for DropDown.

    • @r A list.
  • signals ()

    Returns signal metadata for DropDown.

    • @r A list.

class: DropDownActivateCallback

[600:7] extends: object

Generated low-level callback wrapper for GIR callback activate.

Members

  • callbackObj
  • userFn
  • userData
  • hasUserData

Methods

  • DropDownActivateCallback (callback Fn, UserData = null)

    Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking Fn.

    • @p Fn is the Aussom callback implementation.
    • @p UserData is retained and passed through to Fn on each invocation when provided.
  • trampoline (nativeSelf, nativeUserData)

    Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.

  • callback ()

    Returns the wrapped NativeCallback.

  • handle ()

    Returns the callback as a NativeHandle.

  • close ()

    Closes the underlying NativeCallback.

  • isClosed ()

    Returns true when the callback has been closed.

class: DropDown

[40:7] extends: object

Allows the user to choose an item from a list of options. An example GtkDropDown The GtkDropDown displays the [selected][property@Gtk.DropDown:selected] choice. The options are given to GtkDropDown in the form of GListModel and how the individual options are represented is determined by a [class@Gtk.ListItemFactory]. The default factory displays simple strings, and adds a checkmark to the selected item in the popup. To set your own factory, use [method@Gtk.DropDown.set_factory]. It is possible to use a separate factory for the items in the popup, with [method@Gtk.DropDown.set_list_factory]. GtkDropDown knows how to obtain strings from the items in a [class@Gtk.StringList]; for other models, you have to provide an expression to find the strings via [method@Gtk.DropDown.set_expression]. GtkDropDown can optionally allow search in the popup, which is useful if the list of options is long. To enable the search entry, use [method@Gtk.DropDown.set_enable_search]. Here is a UI definition example for GtkDropDown with a simple model: xml <object class="GtkDropDown"> <property name="model"> <object class="GtkStringList"> <items> <item translatable="yes">Factory</item> <item translatable="yes">Home</item> <item translatable="yes">Subway</item> </items> </object> </property> </object> If a GtkDropDown is created in this manner, or with [ctor@Gtk.DropDown.new_from_strings], for instance, the object returned from [method@Gtk.DropDown.get_selected_item] will be a [class@Gtk.StringObject]. To learn more about the list widget framework, see the overview. ## CSS nodes GtkDropDown has a single CSS node with name dropdown, with the button and popover nodes as children. ## Accessibility GtkDropDown uses the [enum@Gtk.AccessibleRole.combo_box] role.

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • DropDown (model = null, expression = null)

    Creates a new GtkDropDown. You may want to call [method@Gtk.DropDown.set_factory] to set up a way to map its items to widgets.

    • @p model is the model to use.
    • @p expression is the expression to use.
  • toNativeHandle (Source)

    Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from fn.call(...), another generated wrapper exposing handle(), or null. Returns null when the argument carries no pointer.

    • @p Source is the raw handle, raw buffer, wrapper, or null.
    • @r A raw pointer carrier or null when no pointer is present.
  • getLib ()

    Returns the opened native library for this generated wrapper.

    • @r The opened native library.
  • handle ()

    Returns the wrapped NativeHandle.

    • @r The wrapped NativeHandle.
  • isNull ()

    Returns true when the wrapped handle is null.

    • @r A bool.
  • describe ()

    Returns a small string for debugging generated wrappers.

    • @r A string.
  • asWidget ()

    Wraps this handle as Widget.

    • @r A Widget object.
  • asAccessible ()

    Wraps this handle as Accessible.

    • @r A Accessible object.
  • asBuildable ()

    Wraps this handle as Buildable.

    • @r A Buildable object.
  • asConstraintTarget ()

    Wraps this handle as ConstraintTarget.

    • @r A ConstraintTarget object.
  • connectSignal (string Name, CallbackObj)

    Connects one generated callback wrapper to a named signal.

    • @p Name is the signal name.
    • @p CallbackObj is the generated callback wrapper to connect.
    • @r The connected handler id.
  • disconnectSignalHandler (int HandlerId)

    Disconnects one retained signal handler id.

    • @p HandlerId is the signal handler id to disconnect.
    • @r None.
  • setOnActivate (callback Fn, UserData = null)

    Emitted to when the drop down is activated. The ::activate signal on GtkDropDown is an action signal and emitting it causes the drop down to pop up its dropdown.

    • @p Fn is the Aussom callback.
    • @p Fn is called with (DropDown Self).
    • @p UserData is retained and passed through to the generated callback wrapper when provided.
    • @r The connected handler id.
  • getProperty (string Name)

    Reads one generated property by name.

  • setProperty (string Name, Value)

    Writes one generated property by name.

  • setEnablesearch (bool Value)

    Whether to show a search entry in the popup. Note that search requires [property@Gtk.DropDown:expression] to be set.

    • @p Value is the new property value.
    • @r None.
  • setExpression (object Value)

    An expression to evaluate to obtain strings to match against the search term. See [property@Gtk.DropDown:enable-search] for how to enable search. If [property@Gtk.DropDown:factory] is not set, the expression is also used to bind strings to labels produced by a default factory.

    • @p Value is the new property value.
    • @r None.
  • setFactory (object Value)

    Factory for populating list items.

    • @p Value is the new property value.
    • @r None.
  • setHeaderfactory (object Value)

    The factory for creating header widgets for the popup.

    • @p Value is the new property value.
    • @r None.
  • setListfactory (object Value)

    The factory for populating list items in the popup. If this is not set, [property@Gtk.DropDown:factory] is used.

    • @p Value is the new property value.
    • @r None.
  • setModel (object Value)

    Model for the displayed items.

    • @p Value is the new property value.
    • @r None.
  • setSearchmatchmode (string Value)

    The match mode for the search filter.

    • @p Value is the new property value.
    • @r None.
  • setSelected (int Value)

    The position of the selected item. If no item is selected, the property has the value %GTK_INVALID_LIST_POSITION.

    • @p Value is the new property value.
    • @r None.
  • setShowarrow (bool Value)

    Whether to show an arrow within the GtkDropDown widget.

    • @p Value is the new property value.
    • @r None.
  • get_enable_search ()

    Returns whether search is enabled.

  • get_expression ()

    Gets the expression set that is used to obtain strings from items. See [method@Gtk.DropDown.set_expression].

  • get_factory ()

    Gets the factory that's currently used to populate list items. The factory returned by this function is always used for the item in the button. It is also used for items in the popup if [property@Gtk.DropDown:list-factory] is not set.

  • get_header_factory ()

    Gets the factory that's currently used to create header widgets for the popup.

  • get_list_factory ()

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

  • get_model ()

    Gets the model that provides the displayed items.

  • get_search_match_mode ()

    Returns the match mode that the search filter is using.

  • get_selected ()

    Gets the position of the selected item.

  • get_selected_item ()

    Gets the selected item. If no item is selected, %NULL is returned.

  • get_show_arrow ()

    Returns whether to show an arrow within the widget.

  • set_enable_search (bool enable_search)

    Sets whether a search entry will be shown in the popup that allows to search for items in the list. Note that [property@Gtk.DropDown:expression] must be set for search to work.

    • @p enable_search is whether to enable search.
    • @r None.
  • set_expression (object expression)

    Sets the expression that gets evaluated to obtain strings from items. This is used for search in the popup. The expression must have a value type of %G_TYPE_STRING.

    • @p expression is a GtkExpression.
    • @r None.
  • set_factory (object factory)

    Sets the GtkListItemFactory to use for populating list items.

    • @p factory is the factory to use.
    • @r None.
  • set_header_factory (object factory)

    Sets the GtkListItemFactory to use for creating header widgets for the popup.

    • @p factory is the factory to use.
    • @r None.
  • set_list_factory (object factory)

    Sets the GtkListItemFactory to use for populating list items in the popup.

    • @p factory is the factory to use.
    • @r None.
  • set_model (object model)

    Sets the GListModel to use.

    • @p model is the model to use.
    • @r None.
  • set_search_match_mode (string search_match_mode)

    Sets the match mode for the search filter.

    • @p search_match_mode is the new match mode.
    • @r None.
  • set_selected (int position)

    Selects the item at the given position.

    • @p position is the position of the item to select, or %GTK_INVALID_LIST_POSITION.
    • @r None.
  • set_show_arrow (bool show_arrow)

    Sets whether an arrow will be displayed within the widget.

    • @p show_arrow is whether to show an arrow within the widget.
    • @r None.
  • model ()

    Returns get_model as an Aussom list of wrapper objects. This companion method materializes the full collection up front; use get_model() when lazy or change-notify access is required.

    • @r An Aussom list of elements.

class: DropDownCtors

[581:14] static extends: object

Alternate constructors for DropDown. Usage: DropDownCtors.<name>(...). The primary constructor lives directly on DropDown.

Methods

  • newFromStrings (list strings)

    Creates a new GtkDropDown that is populated with the strings.

    • @p strings is The strings to put in the dropdown.
    • @r A new DropDown.