portico/Sources/Portico/Generated/Range.swift

454 lines
25 KiB
Swift
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Generated by PorticoGen. DO NOT EDIT. See Sources/PorticoGen to make changes.
import Adw
import Gtk
import Gio
import Gdk
// PorticoGen: generateModifierExtension | source: Gtk.Range
/// Modifiers for `Gtk.Range`, available on every Portico view whose
/// backing widget is `Gtk.Range` or one of its subclasses.
extension WidgetView where Target: Gtk.Range {
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Range.setAdjustment(adjustment:)
/// Sets the adjustment to be used as the model object for the `GtkRange`
///
/// The adjustment indicates the current range value, the minimum and
/// maximum range values, the step/page increments used for keybindings
/// and scrolling, and the page size.
///
/// The page size is normally 0 for `GtkScale` and nonzero for `GtkScrollbar`,
/// and indicates the size of the visible area of the widget being scrolled.
/// The page size affects the size of the scrollbar slider.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter adjustment: The adjustment that is controlled by the range.
/// - Returns: A copy of this view with the modifier applied.
public func adjustment(_ adjustment: Gtk.Adjustment) -> Self {
appending { w, _ in
w.setAdjustment(adjustment: adjustment)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Range.setAdjustment(adjustment:), GObject.Object.connectNotify(detail:_:), Gtk.Range.getAdjustment()
/// Sets the adjustment to be used as the model object for the `GtkRange`
///
/// The adjustment indicates the current range value, the minimum and
/// maximum range values, the step/page increments used for keybindings
/// and scrolling, and the page size.
///
/// The page size is normally 0 for `GtkScale` and nonzero for `GtkScrollbar`,
/// and indicates the size of the visible area of the widget being scrolled.
/// The page size affects the size of the scrollbar slider.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Gtk.Adjustment` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
///
/// - Returns: A copy of this view with the modifier applied.
public func adjustment(_ adjustment: Portico.Binding<Gtk.Adjustment>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, adjustment, registry: ctx.registry, notifyDetail: "adjustment",
read: { [w] in w.getAdjustment() },
write: { [w] v in w.setAdjustment(adjustment: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Range.setAdjustment(adjustment:)
/// Sets the adjustment to be used as the model object for the `GtkRange`
///
/// The adjustment indicates the current range value, the minimum and
/// maximum range values, the step/page increments used for keybindings
/// and scrolling, and the page size.
///
/// The page size is normally 0 for `GtkScale` and nonzero for `GtkScrollbar`,
/// and indicates the size of the visible area of the widget being scrolled.
/// The page size affects the size of the scrollbar slider.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Range.setAdjustment(adjustment:)`.
///
/// - Parameter adjustment: The adjustment that is controlled by the range.
/// - Returns: A copy of this view with the modifier applied.
public func adjustment(_ adjustment: @escaping () -> Gtk.Adjustment) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setAdjustment(adjustment: adjustment()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Range.setFillLevel(fillLevel:)
/// Set the new position of the fill level indicator.
///
/// The fill level is probably best described by its most prominent
/// use case, which is an indicator for the amount of pre-buffering in
/// a streaming media player. In that use case, the value of the range
/// would indicate the current play position, and the fill level would
/// be the position up to which the file/stream has been downloaded.
///
/// This amount of prebuffering can be displayed on the ranges trough
/// and is themeable separately from the trough. To enable fill level
/// display, use [method`Gtk`.Range.set_show_fill_level]. The range defaults
/// to not showing the fill level.
///
/// Additionally, its possible to restrict the ranges slider position
/// to values which are smaller than the fill level. This is controlled
/// by [method`Gtk`.Range.set_restrict_to_fill_level] and is by default
/// enabled.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter fillLevel: The fill level (e.g. prebuffering of a network stream).
/// - Returns: A copy of this view with the modifier applied.
public func fillLevel(_ fillLevel: Double) -> Self {
appending { w, _ in
w.setFillLevel(fillLevel: fillLevel)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Range.setFillLevel(fillLevel:), GObject.Object.connectNotify(detail:_:), Gtk.Range.getFillLevel()
/// Set the new position of the fill level indicator.
///
/// The fill level is probably best described by its most prominent
/// use case, which is an indicator for the amount of pre-buffering in
/// a streaming media player. In that use case, the value of the range
/// would indicate the current play position, and the fill level would
/// be the position up to which the file/stream has been downloaded.
///
/// This amount of prebuffering can be displayed on the ranges trough
/// and is themeable separately from the trough. To enable fill level
/// display, use [method`Gtk`.Range.set_show_fill_level]. The range defaults
/// to not showing the fill level.
///
/// Additionally, its possible to restrict the ranges slider position
/// to values which are smaller than the fill level. This is controlled
/// by [method`Gtk`.Range.set_restrict_to_fill_level] and is by default
/// enabled.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Double` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
///
/// - Returns: A copy of this view with the modifier applied.
public func fillLevel(_ fillLevel: Portico.Binding<Double>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, fillLevel, registry: ctx.registry, notifyDetail: "fill-level",
read: { [w] in w.getFillLevel() },
write: { [w] v in w.setFillLevel(fillLevel: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Range.setFillLevel(fillLevel:)
/// Set the new position of the fill level indicator.
///
/// The fill level is probably best described by its most prominent
/// use case, which is an indicator for the amount of pre-buffering in
/// a streaming media player. In that use case, the value of the range
/// would indicate the current play position, and the fill level would
/// be the position up to which the file/stream has been downloaded.
///
/// This amount of prebuffering can be displayed on the ranges trough
/// and is themeable separately from the trough. To enable fill level
/// display, use [method`Gtk`.Range.set_show_fill_level]. The range defaults
/// to not showing the fill level.
///
/// Additionally, its possible to restrict the ranges slider position
/// to values which are smaller than the fill level. This is controlled
/// by [method`Gtk`.Range.set_restrict_to_fill_level] and is by default
/// enabled.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Range.setFillLevel(fillLevel:)`.
///
/// - Parameter fillLevel: The fill level (e.g. prebuffering of a network stream).
/// - Returns: A copy of this view with the modifier applied.
public func fillLevel(_ fillLevel: @escaping () -> Double) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setFillLevel(fillLevel: fillLevel()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Range.setInverted(setting:)
/// Sets whether to invert the range.
///
/// Ranges normally move from lower to higher values as the
/// slider moves from top to bottom or left to right. Inverted
/// ranges have higher values at the top or on the right rather
/// than on the bottom or left.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter inverted: If `true`, the direction in which the slider moves is inverted.
/// - Returns: A copy of this view with the modifier applied.
public func inverted(_ inverted: Bool) -> Self {
appending { w, _ in
w.setInverted(setting: inverted)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Range.setInverted(setting:), GObject.Object.connectNotify(detail:_:), Gtk.Range.getInverted()
/// Sets whether to invert the range.
///
/// Ranges normally move from lower to higher values as the
/// slider moves from top to bottom or left to right. Inverted
/// ranges have higher values at the top or on the right rather
/// than on the bottom or left.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Bool` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
///
/// - Returns: A copy of this view with the modifier applied.
public func inverted(_ inverted: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, inverted, registry: ctx.registry, notifyDetail: "inverted",
read: { [w] in w.getInverted() },
write: { [w] v in w.setInverted(setting: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Range.setInverted(setting:)
/// Sets whether to invert the range.
///
/// Ranges normally move from lower to higher values as the
/// slider moves from top to bottom or left to right. Inverted
/// ranges have higher values at the top or on the right rather
/// than on the bottom or left.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Range.setInverted(setting:)`.
///
/// - Parameter inverted: If `true`, the direction in which the slider moves is inverted.
/// - Returns: A copy of this view with the modifier applied.
public func inverted(_ inverted: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setInverted(setting: inverted()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Range.setRestrictToFillLevel(restrictToFillLevel:)
/// Sets whether the slider is restricted to the fill level.
///
/// See [method`Gtk`.Range.set_fill_level] for a general description
/// of the fill level concept.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter restrictToFillLevel: Controls whether slider movement is restricted to an upper boundary set by the fill level.
/// - Returns: A copy of this view with the modifier applied.
public func restrictToFillLevel(_ restrictToFillLevel: Bool) -> Self {
appending { w, _ in
w.setRestrictToFillLevel(restrictToFillLevel: restrictToFillLevel)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Range.setRestrictToFillLevel(restrictToFillLevel:), GObject.Object.connectNotify(detail:_:), Gtk.Range.getRestrictToFillLevel()
/// Sets whether the slider is restricted to the fill level.
///
/// See [method`Gtk`.Range.set_fill_level] for a general description
/// of the fill level concept.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Bool` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
///
/// - Returns: A copy of this view with the modifier applied.
public func restrictToFillLevel(_ restrictToFillLevel: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, restrictToFillLevel, registry: ctx.registry, notifyDetail: "restrict-to-fill-level",
read: { [w] in w.getRestrictToFillLevel() },
write: { [w] v in w.setRestrictToFillLevel(restrictToFillLevel: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Range.setRestrictToFillLevel(restrictToFillLevel:)
/// Sets whether the slider is restricted to the fill level.
///
/// See [method`Gtk`.Range.set_fill_level] for a general description
/// of the fill level concept.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Range.setRestrictToFillLevel(restrictToFillLevel:)`.
///
/// - Parameter restrictToFillLevel: Controls whether slider movement is restricted to an upper boundary set by the fill level.
/// - Returns: A copy of this view with the modifier applied.
public func restrictToFillLevel(_ restrictToFillLevel: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setRestrictToFillLevel(restrictToFillLevel: restrictToFillLevel()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Range.setRoundDigits(roundDigits:)
/// Sets the number of digits to round the value to when
/// it changes.
///
/// See [signal`Gtk`.Range::change-value].
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter roundDigits: The number of digits to round the value to when it changes.
/// - Returns: A copy of this view with the modifier applied.
public func roundDigits(_ roundDigits: Int32) -> Self {
appending { w, _ in
w.setRoundDigits(roundDigits: roundDigits)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Range.setRoundDigits(roundDigits:), GObject.Object.connectNotify(detail:_:), Gtk.Range.getRoundDigits()
/// Sets the number of digits to round the value to when
/// it changes.
///
/// See [signal`Gtk`.Range::change-value].
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Int32` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
///
/// - Returns: A copy of this view with the modifier applied.
public func roundDigits(_ roundDigits: Portico.Binding<Int32>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, roundDigits, registry: ctx.registry, notifyDetail: "round-digits",
read: { [w] in w.getRoundDigits() },
write: { [w] v in w.setRoundDigits(roundDigits: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Range.setRoundDigits(roundDigits:)
/// Sets the number of digits to round the value to when
/// it changes.
///
/// See [signal`Gtk`.Range::change-value].
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Range.setRoundDigits(roundDigits:)`.
///
/// - Parameter roundDigits: The number of digits to round the value to when it changes.
/// - Returns: A copy of this view with the modifier applied.
public func roundDigits(_ roundDigits: @escaping () -> Int32) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setRoundDigits(roundDigits: roundDigits()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(static) | source: Gtk.Range.setShowFillLevel(showFillLevel:)
/// Sets whether a graphical fill level is show on the trough.
///
/// See [method`Gtk`.Range.set_fill_level] for a general description
/// of the fill level concept.
///
/// Applied once at mount; use the `Binding` or closure overload for a value that changes.
///
/// - Parameter showFillLevel: Controls whether fill level indicator graphics are displayed on the trough.
/// - Returns: A copy of this view with the modifier applied.
public func showFillLevel(_ showFillLevel: Bool) -> Self {
appending { w, _ in
w.setShowFillLevel(showFillLevel: showFillLevel)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers -> bindingModifier(twoWay) | source: Gtk.Range.setShowFillLevel(showFillLevel:), GObject.Object.connectNotify(detail:_:), Gtk.Range.getShowFillLevel()
/// Sets whether a graphical fill level is show on the trough.
///
/// See [method`Gtk`.Range.set_fill_level] for a general description
/// of the fill level concept.
///
/// Applied at mount and re-applied on every change the binding publishes.
/// When `Bool` conforms to `Equatable` this binds in both directions: the widget's `notify` signal writes its current value back into the binding, so changes made in the UI propagate to the bound state. Each direction compares before writing, which terminates the echo after one hop. A value type that is not `Equatable` binds one way only, because the echo cannot be broken.
///
/// - Returns: A copy of this view with the modifier applied.
public func showFillLevel(_ showFillLevel: Portico.Binding<Bool>) -> Self {
appending { w, ctx in
Portico.bindProperty(
w, showFillLevel, registry: ctx.registry, notifyDetail: "show-fill-level",
read: { [w] in w.getShowFillLevel() },
write: { [w] v in w.setShowFillLevel(showFillLevel: v) }
)
}
}
// PorticoGen: generateModifierExtension -> generatePropertyModifiers(closure) | source: Gtk.Range.setShowFillLevel(showFillLevel:)
/// Sets whether a graphical fill level is show on the trough.
///
/// See [method`Gtk`.Range.set_fill_level] for a general description
/// of the fill level concept.
///
/// The closure runs inside a `DependencyTracker`, so any `@State` it reads re-runs it and pushes the new value through `Gtk.Range.setShowFillLevel(showFillLevel:)`.
///
/// - Parameter showFillLevel: Controls whether fill level indicator graphics are displayed on the trough.
/// - Returns: A copy of this view with the modifier applied.
public func showFillLevel(_ showFillLevel: @escaping () -> Bool) -> Self {
appending { w, ctx in
let tracker = DependencyTracker { [w] in w.setShowFillLevel(showFillLevel: showFillLevel()) }
tracker.run()
ctx.registry.add(tracker)
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Range.connectAdjustBounds(_:)
/// Emitted before clamping a value, to give the application a
/// chance to adjust the bounds.
///
/// - Parameter handler: Invoked when the widget emits the `adjust-bounds` signal. The closure receives the signal's arguments in order.
/// - Returns: A copy of this view with the modifier applied.
public func onAdjustBounds(_ handler: @escaping (Double) -> Void) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectAdjustBounds { _, a0 in handler(a0) })
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Range.connectChangeValue(_:)
/// Emitted when a scroll action is performed on a range.
///
/// It allows an application to determine the type of scroll event
/// that occurred and the resultant new value. The application can
/// handle the event itself and return `true` to prevent further
/// processing. Or, by returning `false`, it can pass the event to
/// other handlers until the default GTK handler is reached.
///
/// The value parameter is unrounded. An application that overrides
/// the ::change-value signal is responsible for clamping the value
/// to the desired number of decimal digits; the default GTK
/// handler clamps the value based on [property`Gtk`.Range:round-digits].
///
/// - Parameter handler: Invoked when the widget emits the `change-value` signal. The closure receives the signal's arguments in order. Its return value is forwarded to GTK as the signal's result.
/// - Returns: A copy of this view with the modifier applied.
public func onChangeValue(_ handler: @escaping (Gtk.ScrollType, Double) -> Bool) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectChangeValue { _, a0, a1 in handler(a0, a1) })
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Range.connectMoveSlider(_:)
/// Virtual function that moves the slider.
///
/// Used for keybindings.
///
/// - Parameter handler: Invoked when the widget emits the `move-slider` signal. The closure receives the signal's arguments in order.
/// - Returns: A copy of this view with the modifier applied.
public func onMoveSlider(_ handler: @escaping (Gtk.ScrollType) -> Void) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectMoveSlider { _, a0 in handler(a0) })
}
}
// PorticoGen: generateModifierExtension -> generateSignalModifier | source: Gtk.Range.connectValueChanged(_:)
/// Emitted when the range value changes.
///
/// - Parameter handler: Invoked when the widget emits the `value-changed` signal.
/// - Returns: A copy of this view with the modifier applied.
public func onValueChanged(_ handler: @escaping () -> Void) -> Self {
appending { w, ctx in
ctx.registry.add(w.connectValueChanged { _ in handler() })
}
}
}