Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: ExpanderMeta

[569:14] static extends: object

Generated metadata helpers for Expander class surfaces.

Methods

  • properties ()

    Returns property metadata for Expander.

    • @r A list.
  • signals ()

    Returns signal metadata for Expander.

    • @r A list.

class: Expander

[42:7] extends: object

Allows the user to reveal or conceal a child widget. An
example GtkExpander This is similar to the triangles used in a GtkTreeView. Normally you use an expander as you would use a frame; you create the child widget and use [method@Gtk.Expander.set_child] to add it to the expander. When the expander is toggled, it will take care of showing and hiding the child automatically.

Special Usage There are situations in which you may prefer to show and hide

the expanded widget yourself, such as when you want to actually create the widget at expansion time. In this case, create a GtkExpander but do not add a child to it. The expander widget has an [property@Gtk.Expander:expanded] property which can be used to monitor its expansion state. You should watch this property with a signal connection as follows: c static void expander_callback (GObject *object, GParamSpec *param_spec, gpointer user_data) { GtkExpander *expander; expander = GTK_EXPANDER (object); if (gtk_expander_get_expanded (expander)) { // Show or create widgets } else { // Hide or destroy widgets } } static void create_expander (void) { GtkWidget *expander = gtk_expander_new_with_mnemonic ("_More Options"); g_signal_connect (expander, "notify::expanded", G_CALLBACK (expander_callback), NULL); // ... } # GtkExpander as GtkBuildable An example of a UI definition fragment with GtkExpander: xml <object class="GtkExpander"> <property name="label-widget"> <object class="GtkLabel" id="expander-label"/> </property> <property name="child"> <object class="GtkEntry" id="expander-content"/> </property> </object> # CSS nodes expander-widget ╰── box ├── title │ ├── expander │ ╰── <label widget> ╰── <child> GtkExpander has a main node expander-widget, and subnode box containing the title and child widget. The box subnode title contains node expander, i.e. the expand/collapse arrow; then the label widget if any. The arrow of an expander that is showing its child gets the :checked pseudoclass set on it. # Accessibility GtkExpander uses the [enum@Gtk.AccessibleRole.button] role.

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • Expander (label = null)

    Creates a new expander using @label as the text of the label.

    • @p label is the text of the label.
  • 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)

    Activates the GtkExpander.

    • @p Fn is the Aussom callback.
    • @p Fn is called with (Expander 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.

  • setChild (object Value)

    The child widget.

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

    Whether the expander has been opened to reveal the child.

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

    The text of the expanders label.

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

    A widget to display instead of the usual expander label.

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

    When this property is %TRUE, the expander will resize the toplevel widget containing the expander upon expanding and collapsing.

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

    Whether the text in the label is Pango markup.

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

    Whether an underline in the text indicates a mnemonic.

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

    Gets the child widget of @expander.

  • get_expanded ()

    Queries a GtkExpander and returns its current state. Returns %TRUE if the child widget is revealed.

  • get_label ()

    Fetches the text from a label widget. This is including any embedded underlines indicating mnemonics and Pango markup, as set by [method@Gtk.Expander.set_label]. If the label text has not been set the return value will be %NULL. This will be the case if you create an empty button with gtk_button_new() to use as a container.

  • get_label_widget ()

    Retrieves the label widget for the frame.

  • get_resize_toplevel ()

    Returns whether the expander will resize the toplevel widget containing the expander upon resizing and collapsing.

  • get_use_markup ()

    Returns whether the label’s text is interpreted as Pango markup.

  • get_use_underline ()

    Returns whether an underline in the text indicates a mnemonic.

  • set_child (object child)

    Sets the child widget of @expander.

    • @p child is the child widget.
    • @r None.
  • set_expanded (bool expanded)

    Sets the state of the expander. Set to %TRUE, if you want the child widget to be revealed, and %FALSE if you want the child widget to be hidden.

    • @p expanded is whether the child widget is revealed.
    • @r None.
  • set_label (string label)

    Sets the text of the label of the expander to @label. This will also clear any previously set labels.

    • @p label is a string.
    • @r None.
  • set_label_widget (object label_widget)

    Set the label widget for the expander. This is the widget that will appear embedded alongside the expander arrow.

    • @p label_widget is the new label widget.
    • @r None.
  • set_resize_toplevel (bool resize_toplevel)

    Sets whether the expander will resize the toplevel widget containing the expander upon resizing and collapsing.

    • @p resize_toplevel is whether to resize the toplevel.
    • @r None.
  • set_use_markup (bool use_markup)

    Sets whether the text of the label contains Pango markup.

    • @p use_markup is %TRUE if the label’s text should be parsed for markup.
    • @r None.
  • set_use_underline (bool use_underline)

    If true, an underline in the text indicates a mnemonic.

    • @p use_underline is %TRUE if underlines in the text indicate mnemonics.
    • @r None.

class: ExpanderCtors

[474:14] static extends: object

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

Methods

  • newWithMnemonic (string label)

    Creates a new expander using @label as the text of the label. If characters in @label are preceded by an underscore, they are underlined. If you need a literal underscore character in a label, use “__” (two underscores). The first underlined character represents a keyboard accelerator called a mnemonic. Pressing Alt and that key activates the button.

    • @p label is the text of the label with an underscore in front of the mnemonic character.
    • @r A new Expander.

class: ExpanderActivateCallback

[499:7] extends: object

Generated low-level callback wrapper for GIR callback activate.

Members

  • callbackObj
  • userFn
  • userData
  • hasUserData

Methods

  • ExpanderActivateCallback (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.