// GENERATED — DO NOT EDIT

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/class.Scale.html).
pub type Scale

///|
pub(open) trait IScale {
  fn as_scale(Self) -> Scale
  fn add_mark(Self, Double, PositionType, String?) -> Unit = _
  fn clear_marks(Self) -> Unit = _
  fn get_digits(Self) -> Int = _
  fn get_draw_value(Self) -> Bool = _
  fn get_has_origin(Self) -> Bool = _
  fn get_layout(Self) -> @pango.Layout? = _
  fn get_layout_offsets(Self) -> (Int, Int) = _
  fn get_value_pos(Self) -> PositionType = _
  fn set_digits(Self, Int) -> Unit = _
  fn set_draw_value(Self, Bool) -> Unit = _
  fn set_has_origin(Self, Bool) -> Unit = _
  fn set_value_pos(Self, PositionType) -> Unit = _
}

///|
pub impl IScale for Scale with fn as_scale(self) {
  self
}

///|
#borrow(adjustment)
extern "c" fn moonbit_gtk_scale_new(
  orientation : Orientation,
  adjustment : @glib.Nullable[Adjustment],
) -> Scale = "moonbit_gtk_scale_new"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/ctor.Scale.new.html).
pub fn Scale::new(
  orientation : Orientation,
  adjustment : &IAdjustment?,
) -> Scale {
  moonbit_gtk_scale_new(
    orientation,
    match adjustment {
      Some(v) => @glib.Nullable::some(v.as_adjustment())
      None => @glib.Nullable::null()
    },
  )
}

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/ctor.Scale.new_with_range.html).
pub extern "c" fn Scale::new_with_range(
  orientation : Orientation,
  min : Double,
  max : Double,
  step : Double,
) -> Scale = "moonbit_gtk_scale_new_with_range"

///|
#borrow(self_, markup)
extern "c" fn moonbit_gtk_scale_add_mark(
  self_ : Scale,
  value : Double,
  position : PositionType,
  markup : @glib.Nullable[Bytes],
) = "moonbit_gtk_scale_add_mark"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Scale.add_mark.html).
pub fn Scale::add_mark(
  self : Scale,
  value : Double,
  position : PositionType,
  markup : String?,
) -> Unit {
  moonbit_gtk_scale_add_mark(
    self,
    value,
    position,
    match markup {
      Some(s) => @glib.Nullable::some(@encoding/utf8.encode(s))
      None => @glib.Nullable::null()
    },
  )
}

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Scale.clear_marks.html).
#borrow(self)
pub extern "c" fn Scale::clear_marks(self : Scale) = "moonbit_gtk_scale_clear_marks"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Scale.get_digits.html).
#borrow(self)
pub extern "c" fn Scale::get_digits(self : Scale) -> Int = "moonbit_gtk_scale_get_digits"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Scale.get_draw_value.html).
#borrow(self)
pub extern "c" fn Scale::get_draw_value(self : Scale) -> Bool = "moonbit_gtk_scale_get_draw_value"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Scale.get_has_origin.html).
#borrow(self)
pub extern "c" fn Scale::get_has_origin(self : Scale) -> Bool = "moonbit_gtk_scale_get_has_origin"

///|
#borrow(self_)
extern "c" fn moonbit_gtk_scale_get_layout(
  self_ : Scale,
) -> @glib.Nullable[@pango.Layout] = "moonbit_gtk_scale_get_layout"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Scale.get_layout.html).
pub fn Scale::get_layout(self : Scale) -> @pango.Layout? {
  let raw_result = moonbit_gtk_scale_get_layout(self)
  raw_result.to_option()
}

///|
#borrow(self_, x, y)
extern "c" fn moonbit_gtk_scale_get_layout_offsets(
  self_ : Scale,
  x : Ref[Int],
  y : Ref[Int],
) = "moonbit_gtk_scale_get_layout_offsets"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Scale.get_layout_offsets.html).
pub fn Scale::get_layout_offsets(self : Scale) -> (Int, Int) {
  let x = Ref(0)
  let y = Ref(0)
  moonbit_gtk_scale_get_layout_offsets(self, x, y)
  (x.val, y.val)
}

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Scale.get_value_pos.html).
#borrow(self)
pub extern "c" fn Scale::get_value_pos(self : Scale) -> PositionType = "moonbit_gtk_scale_get_value_pos"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Scale.set_digits.html).
#borrow(self)
pub extern "c" fn Scale::set_digits(self : Scale, digits : Int) = "moonbit_gtk_scale_set_digits"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Scale.set_draw_value.html).
#borrow(self)
pub extern "c" fn Scale::set_draw_value(self : Scale, draw_value : Bool) = "moonbit_gtk_scale_set_draw_value"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Scale.set_has_origin.html).
#borrow(self)
pub extern "c" fn Scale::set_has_origin(self : Scale, has_origin : Bool) = "moonbit_gtk_scale_set_has_origin"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Scale.set_value_pos.html).
#borrow(self)
pub extern "c" fn Scale::set_value_pos(self : Scale, pos : PositionType) = "moonbit_gtk_scale_set_value_pos"

///|
impl IScale with fn add_mark(self, value, position, markup) -> Unit {
  self.as_scale().add_mark(value, position, markup)
}

///|
impl IScale with fn clear_marks(self) -> Unit {
  self.as_scale().clear_marks()
}

///|
impl IScale with fn get_digits(self) -> Int {
  self.as_scale().get_digits()
}

///|
impl IScale with fn get_draw_value(self) -> Bool {
  self.as_scale().get_draw_value()
}

///|
impl IScale with fn get_has_origin(self) -> Bool {
  self.as_scale().get_has_origin()
}

///|
impl IScale with fn get_layout(self) -> @pango.Layout? {
  self.as_scale().get_layout()
}

///|
impl IScale with fn get_layout_offsets(self) -> (Int, Int) {
  self.as_scale().get_layout_offsets()
}

///|
impl IScale with fn get_value_pos(self) -> PositionType {
  self.as_scale().get_value_pos()
}

///|
impl IScale with fn set_digits(self, digits) -> Unit {
  self.as_scale().set_digits(digits)
}

///|
impl IScale with fn set_draw_value(self, draw_value) -> Unit {
  self.as_scale().set_draw_value(draw_value)
}

///|
impl IScale with fn set_has_origin(self, has_origin) -> Unit {
  self.as_scale().set_has_origin(has_origin)
}

///|
impl IScale with fn set_value_pos(self, pos) -> Unit {
  self.as_scale().set_value_pos(pos)
}

///|
pub fn Scale::as_widget(self : Scale) -> Widget = "%identity"

///|
pub impl IWidget for Scale with fn as_widget(self) {
  self.as_widget()
}

///|
pub fn Scale::as_gobject_object(self : Scale) -> @gobject.Object = "%identity"

///|
pub impl @gobject.IObject for Scale with fn as_object(self) {
  self.as_gobject_object()
}

///|
pub fn Scale::as_orientable(self : Scale) -> Orientable = "%identity"

///|
pub impl IOrientable for Scale with fn as_orientable(self) {
  self.as_orientable()
}