// GENERATED — DO NOT EDIT

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

///|
pub(open) trait IGesture {
  fn as_gesture(Self) -> Gesture
  fn get_bounding_box(Self) -> (@gdk.Rectangle, Bool) = _
  fn get_bounding_box_center(Self) -> (Bool, Double, Double) = _
  fn get_device(Self) -> @gdk.Device? = _
  fn get_group(Self) -> Array[Gesture] = _
  fn get_last_updated_sequence(Self) -> @gdk.EventSequence? = _
  fn get_point(Self, @gdk.EventSequence?) -> (Bool, Double, Double) = _
  fn get_sequence_state(Self, @gdk.EventSequence) -> EventSequenceState = _
  fn get_sequences(Self) -> Array[@gdk.EventSequence] = _
  fn group(Self, &IGesture) -> Unit = _
  fn handles_sequence(Self, @gdk.EventSequence?) -> Bool = _
  fn is_active(Self) -> Bool = _
  fn is_grouped_with(Self, &IGesture) -> Bool = _
  fn is_recognized(Self) -> Bool = _
  fn set_state(Self, EventSequenceState) -> Bool = _
  fn ungroup(Self) -> Unit = _
  fn connect_begin(Self, (Gesture, @gdk.EventSequence?) -> Unit) -> UInt64 = _
  fn connect_cancel(Self, (Gesture, @gdk.EventSequence?) -> Unit) -> UInt64 = _
  fn connect_end(Self, (Gesture, @gdk.EventSequence?) -> Unit) -> UInt64 = _
  fn connect_sequence_state_changed(
    Self,
    (Gesture, @gdk.EventSequence?, EventSequenceState) -> Unit,
  ) -> UInt64 = _
  fn connect_update(Self, (Gesture, @gdk.EventSequence?) -> Unit) -> UInt64 = _
}

///|
pub impl IGesture for Gesture with fn as_gesture(self) {
  self
}

///|
#borrow(self_, native_result)
extern "c" fn moonbit_gtk_gesture_get_bounding_box(
  self_ : Gesture,
  native_result : Ref[Int],
) -> @gdk.Rectangle = "moonbit_gtk_gesture_get_bounding_box"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Gesture.get_bounding_box.html).
pub fn Gesture::get_bounding_box(self : Gesture) -> (@gdk.Rectangle, Bool) {
  let native_result = Ref(0)
  let __result = moonbit_gtk_gesture_get_bounding_box(self, native_result)
  (__result, native_result.val != 0)
}

///|
#borrow(self_, x, y)
extern "c" fn moonbit_gtk_gesture_get_bounding_box_center(
  self_ : Gesture,
  x : Ref[Double],
  y : Ref[Double],
) -> Bool = "moonbit_gtk_gesture_get_bounding_box_center"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Gesture.get_bounding_box_center.html).
pub fn Gesture::get_bounding_box_center(
  self : Gesture,
) -> (Bool, Double, Double) {
  let x = Ref(0.0)
  let y = Ref(0.0)
  let result = moonbit_gtk_gesture_get_bounding_box_center(self, x, y)
  (result, x.val, y.val)
}

///|
#borrow(self_)
extern "c" fn moonbit_gtk_gesture_get_device(
  self_ : Gesture,
) -> @glib.Nullable[@gdk.Device] = "moonbit_gtk_gesture_get_device"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Gesture.get_device.html).
pub fn Gesture::get_device(self : Gesture) -> @gdk.Device? {
  let raw_result = moonbit_gtk_gesture_get_device(self)
  raw_result.to_option()
}

///|
#borrow(self_, result)
extern "c" fn moonbit_gtk_gesture_get_group(
  self_ : Gesture,
  result : Ref[FixedArray[Gesture]],
) = "moonbit_gtk_gesture_get_group"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Gesture.get_group.html).
pub fn Gesture::get_group(self : Gesture) -> Array[Gesture] {
  let result_ref : Ref[FixedArray[Gesture]] = Ref([])
  moonbit_gtk_gesture_get_group(self, result_ref)
  let values : Array[Gesture] = Array::new(capacity=result_ref.val.length())
  for value in result_ref.val {
    values.push(value)
  }
  values
}

///|
#borrow(self_)
extern "c" fn moonbit_gtk_gesture_get_last_updated_sequence(
  self_ : Gesture,
) -> @glib.Nullable[@gdk.EventSequence] = "moonbit_gtk_gesture_get_last_updated_sequence"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Gesture.get_last_updated_sequence.html).
pub fn Gesture::get_last_updated_sequence(
  self : Gesture,
) -> @gdk.EventSequence? {
  let raw_result = moonbit_gtk_gesture_get_last_updated_sequence(self)
  raw_result.to_option()
}

///|
#borrow(self_, sequence, x, y)
extern "c" fn moonbit_gtk_gesture_get_point(
  self_ : Gesture,
  sequence : @glib.Nullable[@gdk.EventSequence],
  x : Ref[Double],
  y : Ref[Double],
) -> Bool = "moonbit_gtk_gesture_get_point"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Gesture.get_point.html).
pub fn Gesture::get_point(
  self : Gesture,
  sequence : @gdk.EventSequence?,
) -> (Bool, Double, Double) {
  let x = Ref(0.0)
  let y = Ref(0.0)
  let result = moonbit_gtk_gesture_get_point(
    self,
    match sequence {
      Some(v) => @glib.Nullable::some(v)
      None => @glib.Nullable::null()
    },
    x,
    y,
  )
  (result, x.val, y.val)
}

///|
#borrow(self_, sequence)
extern "c" fn moonbit_gtk_gesture_get_sequence_state(
  self_ : Gesture,
  sequence : @gdk.EventSequence,
) -> EventSequenceState = "moonbit_gtk_gesture_get_sequence_state"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Gesture.get_sequence_state.html).
pub fn Gesture::get_sequence_state(
  self : Gesture,
  sequence : @gdk.EventSequence,
) -> EventSequenceState {
  moonbit_gtk_gesture_get_sequence_state(self, sequence)
}

///|
#borrow(self_, result)
extern "c" fn moonbit_gtk_gesture_get_sequences(
  self_ : Gesture,
  result : Ref[FixedArray[@gdk.EventSequence]],
) = "moonbit_gtk_gesture_get_sequences"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Gesture.get_sequences.html).
pub fn Gesture::get_sequences(self : Gesture) -> Array[@gdk.EventSequence] {
  let result_ref : Ref[FixedArray[@gdk.EventSequence]] = Ref([])
  moonbit_gtk_gesture_get_sequences(self, result_ref)
  let values : Array[@gdk.EventSequence] = Array::new(
    capacity=result_ref.val.length(),
  )
  for value in result_ref.val {
    values.push(value)
  }
  values
}

///|
#borrow(self_, gesture)
extern "c" fn moonbit_gtk_gesture_group(self_ : Gesture, gesture : Gesture) = "moonbit_gtk_gesture_group"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Gesture.group.html).
pub fn Gesture::group(self : Gesture, gesture : &IGesture) -> Unit {
  moonbit_gtk_gesture_group(self, gesture.as_gesture())
}

///|
#borrow(self_, sequence)
extern "c" fn moonbit_gtk_gesture_handles_sequence(
  self_ : Gesture,
  sequence : @glib.Nullable[@gdk.EventSequence],
) -> Bool = "moonbit_gtk_gesture_handles_sequence"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Gesture.handles_sequence.html).
pub fn Gesture::handles_sequence(
  self : Gesture,
  sequence : @gdk.EventSequence?,
) -> Bool {
  moonbit_gtk_gesture_handles_sequence(
    self,
    match sequence {
      Some(v) => @glib.Nullable::some(v)
      None => @glib.Nullable::null()
    },
  )
}

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

///|
#borrow(self_, other)
extern "c" fn moonbit_gtk_gesture_is_grouped_with(
  self_ : Gesture,
  other : Gesture,
) -> Bool = "moonbit_gtk_gesture_is_grouped_with"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Gesture.is_grouped_with.html).
pub fn Gesture::is_grouped_with(self : Gesture, other : &IGesture) -> Bool {
  moonbit_gtk_gesture_is_grouped_with(self, other.as_gesture())
}

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Gesture.set_state.html).
#borrow(self)
pub extern "c" fn Gesture::set_state(
  self : Gesture,
  state : EventSequenceState,
) -> Bool = "moonbit_gtk_gesture_set_state"

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

///|
#borrow(instance)
extern "c" fn gtk_gesture_connect_begin(
  instance : Gesture,
  function : FuncRef[
    (Gesture, @gdk.EventSequence?, (Gesture, @gdk.EventSequence?) -> Unit) -> Unit,
  ],
  closure : (Gesture, @gdk.EventSequence?) -> Unit,
) -> UInt64 = "moonbit_gtk_gesture_connect_begin"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/signal.Gesture.begin.html).
pub fn Gesture::connect_begin(
  self : Gesture,
  f : (Gesture, @gdk.EventSequence?) -> Unit,
) -> UInt64 {
  gtk_gesture_connect_begin(
    self,
    fn(instance_, sequence, f) { f(instance_, sequence) },
    f,
  )
}

///|
#borrow(instance)
extern "c" fn gtk_gesture_connect_cancel(
  instance : Gesture,
  function : FuncRef[
    (Gesture, @gdk.EventSequence?, (Gesture, @gdk.EventSequence?) -> Unit) -> Unit,
  ],
  closure : (Gesture, @gdk.EventSequence?) -> Unit,
) -> UInt64 = "moonbit_gtk_gesture_connect_cancel"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/signal.Gesture.cancel.html).
pub fn Gesture::connect_cancel(
  self : Gesture,
  f : (Gesture, @gdk.EventSequence?) -> Unit,
) -> UInt64 {
  gtk_gesture_connect_cancel(
    self,
    fn(instance_, sequence, f) { f(instance_, sequence) },
    f,
  )
}

///|
#borrow(instance)
extern "c" fn gtk_gesture_connect_end(
  instance : Gesture,
  function : FuncRef[
    (Gesture, @gdk.EventSequence?, (Gesture, @gdk.EventSequence?) -> Unit) -> Unit,
  ],
  closure : (Gesture, @gdk.EventSequence?) -> Unit,
) -> UInt64 = "moonbit_gtk_gesture_connect_end"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/signal.Gesture.end.html).
pub fn Gesture::connect_end(
  self : Gesture,
  f : (Gesture, @gdk.EventSequence?) -> Unit,
) -> UInt64 {
  gtk_gesture_connect_end(
    self,
    fn(instance_, sequence, f) { f(instance_, sequence) },
    f,
  )
}

///|
#borrow(instance)
extern "c" fn gtk_gesture_connect_sequence_state_changed(
  instance : Gesture,
  function : FuncRef[
    (
      Gesture,
      @gdk.EventSequence?,
      EventSequenceState,
      (Gesture, @gdk.EventSequence?, EventSequenceState) -> Unit,
    ) -> Unit,
  ],
  closure : (Gesture, @gdk.EventSequence?, EventSequenceState) -> Unit,
) -> UInt64 = "moonbit_gtk_gesture_connect_sequence_state_changed"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/signal.Gesture.sequence-state-changed.html).
pub fn Gesture::connect_sequence_state_changed(
  self : Gesture,
  f : (Gesture, @gdk.EventSequence?, EventSequenceState) -> Unit,
) -> UInt64 {
  gtk_gesture_connect_sequence_state_changed(
    self,
    fn(instance_, sequence, state, f) { f(instance_, sequence, state) },
    f,
  )
}

///|
#borrow(instance)
extern "c" fn gtk_gesture_connect_update(
  instance : Gesture,
  function : FuncRef[
    (Gesture, @gdk.EventSequence?, (Gesture, @gdk.EventSequence?) -> Unit) -> Unit,
  ],
  closure : (Gesture, @gdk.EventSequence?) -> Unit,
) -> UInt64 = "moonbit_gtk_gesture_connect_update"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/signal.Gesture.update.html).
pub fn Gesture::connect_update(
  self : Gesture,
  f : (Gesture, @gdk.EventSequence?) -> Unit,
) -> UInt64 {
  gtk_gesture_connect_update(
    self,
    fn(instance_, sequence, f) { f(instance_, sequence) },
    f,
  )
}

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/property.Gesture.n-points.html).
#borrow(self_)
pub extern "c" fn Gesture::get_n_points(self_ : Gesture) -> UInt = "moonbit_gtk_gesture_get_n_points"

///|
impl IGesture with fn get_bounding_box(self) -> (@gdk.Rectangle, Bool) {
  self.as_gesture().get_bounding_box()
}

///|
impl IGesture with fn get_bounding_box_center(self) -> (Bool, Double, Double) {
  self.as_gesture().get_bounding_box_center()
}

///|
impl IGesture with fn get_device(self) -> @gdk.Device? {
  self.as_gesture().get_device()
}

///|
impl IGesture with fn get_group(self) -> Array[Gesture] {
  self.as_gesture().get_group()
}

///|
impl IGesture with fn get_last_updated_sequence(self) -> @gdk.EventSequence? {
  self.as_gesture().get_last_updated_sequence()
}

///|
impl IGesture with fn get_point(self, sequence) -> (Bool, Double, Double) {
  self.as_gesture().get_point(sequence)
}

///|
impl IGesture with fn get_sequence_state(self, sequence) -> EventSequenceState {
  self.as_gesture().get_sequence_state(sequence)
}

///|
impl IGesture with fn get_sequences(self) -> Array[@gdk.EventSequence] {
  self.as_gesture().get_sequences()
}

///|
impl IGesture with fn group(self, gesture) -> Unit {
  self.as_gesture().group(gesture)
}

///|
impl IGesture with fn handles_sequence(self, sequence) -> Bool {
  self.as_gesture().handles_sequence(sequence)
}

///|
impl IGesture with fn is_active(self) -> Bool {
  self.as_gesture().is_active()
}

///|
impl IGesture with fn is_grouped_with(self, other) -> Bool {
  self.as_gesture().is_grouped_with(other)
}

///|
impl IGesture with fn is_recognized(self) -> Bool {
  self.as_gesture().is_recognized()
}

///|
impl IGesture with fn set_state(self, state) -> Bool {
  self.as_gesture().set_state(state)
}

///|
impl IGesture with fn ungroup(self) -> Unit {
  self.as_gesture().ungroup()
}

///|
impl IGesture with fn connect_begin(self, f) -> UInt64 {
  self.as_gesture().connect_begin(f)
}

///|
impl IGesture with fn connect_cancel(self, f) -> UInt64 {
  self.as_gesture().connect_cancel(f)
}

///|
impl IGesture with fn connect_end(self, f) -> UInt64 {
  self.as_gesture().connect_end(f)
}

///|
impl IGesture with fn connect_sequence_state_changed(self, f) -> UInt64 {
  self.as_gesture().connect_sequence_state_changed(f)
}

///|
impl IGesture with fn connect_update(self, f) -> UInt64 {
  self.as_gesture().connect_update(f)
}

///|
pub fn Gesture::as_event_controller(self : Gesture) -> EventController = "%identity"

///|
pub impl IEventController for Gesture with fn as_event_controller(self) {
  self.as_event_controller()
}

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

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