Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: SwitchActivateCallback

[307:7] extends: object

Generated low-level callback wrapper for GIR callback activate.

Members

  • callbackObj
  • userFn
  • userData
  • hasUserData

Methods

  • SwitchActivateCallback (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: Switch

[28:7] extends: object

Shows a "light switch" that has two states: on or off. An
example GtkSwitch The user can control which state should be active by clicking the empty area, or by dragging the slider. GtkSwitch can also express situations where the underlying state changes with a delay. In this case, the slider position indicates the user's recent change (represented by the [property@Gtk.Switch:active] property), while the trough color indicates the present underlying state (represented by the [property@Gtk.Switch:state] property). GtkSwitch with delayed state change See [signal@Gtk.Switch::state-set] for details. # Shortcuts and Gestures GtkSwitch supports pan and drag gestures to move the slider. # CSS nodes switch ├── image ├── image ╰── slider GtkSwitch has four css nodes, the main node with the name switch and subnodes for the slider and the on and off images. Neither of them is using any style classes. # Accessibility GtkSwitch uses the [enum@Gtk.AccessibleRole.switch] role.

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • Switch ()

    Creates a new GtkSwitch widget.

  • 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.
  • asActionable ()

    Wraps this handle as Actionable.

    • @r A Actionable 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 animate the switch. Applications should never connect to this signal, but use the [property@Gtk.Switch:active] property.

    • @p Fn is the Aussom callback.
    • @p Fn is called with (Switch Self).
    • @p UserData is retained and passed through to the generated callback wrapper when provided.
    • @r The connected handler id.
  • setOnStateset (callback Fn, UserData = null)

    Emitted to change the underlying state. The ::state-set signal is emitted when the user changes the switch position. The default handler calls [method@Gtk.Switch.set_state] with the value of @state. To implement delayed state change, applications can connect to this signal, initiate the change of the underlying state, and call [method@Gtk.Switch.set_state] when the underlying state change is complete. The signal handler should return %TRUE to prevent the default handler from running.

    • @p Fn is the Aussom callback.
    • @p Fn is called with (Switch Self, bool State).
    • @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.

  • setActive (bool Value)

    Whether the GtkSwitch widget is in its on or off state.

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

    The backend state that is controlled by the switch. Applications should usually set the [property@Gtk.Switch:active] property, except when indicating a change to the backend state which occurs separately from the user's interaction. See [signal@Gtk.Switch::state-set] for details.

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

    Gets whether the GtkSwitch is in its “on” or “off” state.

  • get_state ()

    Gets the underlying state of the GtkSwitch.

  • set_active (bool is_active)

    Changes the state of @self to the desired one.

    • @p is_active is %TRUE if @self should be active, and %FALSE otherwise.
    • @r None.
  • set_state (bool state)

    Sets the underlying state of the GtkSwitch. This function is typically called from a [signal@Gtk.Switch::state-set] signal handler in order to set up delayed state changes. See [signal@Gtk.Switch::state-set] for details.

    • @p state is the new state.
    • @r None.

class: SwitchMeta

[448:14] static extends: object

Generated metadata helpers for Switch class surfaces.

Methods

  • properties ()

    Returns property metadata for Switch.

    • @r A list.
  • signals ()

    Returns signal metadata for Switch.

    • @r A list.

class: SwitchStatesetCallback

[377:7] extends: object

Generated low-level callback wrapper for GIR callback state-set.

Members

  • callbackObj
  • userFn
  • userData
  • hasUserData

Methods

  • SwitchStatesetCallback (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, state, 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.