// GENERATED — DO NOT EDIT

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/struct.LayoutLine.html).
pub type LayoutLine

///|
pub(open) trait ILayoutLine {
  fn as_layout_line(Self) -> LayoutLine
  fn get_extents(Self) -> (Rectangle, Rectangle) = _
  fn get_height(Self) -> Int = _
  fn get_length(Self) -> Int = _
  fn get_pixel_extents(Self) -> (Rectangle, Rectangle) = _
  fn get_resolved_direction(Self) -> Direction = _
  fn get_start_index(Self) -> Int = _
  fn get_x_ranges(Self, Int, Int) -> Array[Int] = _
  fn index_to_x(Self, Int, Bool) -> Int = _
  fn is_paragraph_start(Self) -> Bool = _
  fn ref_(Self) -> LayoutLine? = _
  fn x_to_index(Self, Int) -> (Bool, Int, Int) = _
}

///|
pub impl ILayoutLine for LayoutLine with fn as_layout_line(self) {
  self
}

///|
#borrow(self_, __out_logical_rect)
extern "c" fn moonbit_pango_layout_line_get_extents(
  self_ : LayoutLine,
  __out_logical_rect : Ref[Rectangle],
) -> Rectangle = "moonbit_pango_layout_line_get_extents"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.LayoutLine.get_extents.html).
pub fn LayoutLine::get_extents(self : LayoutLine) -> (Rectangle, Rectangle) {
  let __out_logical_rect = Ref(Rectangle::_zero())
  let __result = moonbit_pango_layout_line_get_extents(self, __out_logical_rect)
  (__result, __out_logical_rect.val)
}

///|
#borrow(self_, height)
extern "c" fn moonbit_pango_layout_line_get_height(
  self_ : LayoutLine,
  height : Ref[Int],
) = "moonbit_pango_layout_line_get_height"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.LayoutLine.get_height.html).
pub fn LayoutLine::get_height(self : LayoutLine) -> Int {
  let height = Ref(0)
  moonbit_pango_layout_line_get_height(self, height)
  height.val
}

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.LayoutLine.get_length.html).
#borrow(self)
pub extern "c" fn LayoutLine::get_length(self : LayoutLine) -> Int = "moonbit_pango_layout_line_get_length"

///|
#borrow(self_, __out_logical_rect)
extern "c" fn moonbit_pango_layout_line_get_pixel_extents(
  self_ : LayoutLine,
  __out_logical_rect : Ref[Rectangle],
) -> Rectangle = "moonbit_pango_layout_line_get_pixel_extents"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.LayoutLine.get_pixel_extents.html).
pub fn LayoutLine::get_pixel_extents(
  self : LayoutLine,
) -> (Rectangle, Rectangle) {
  let __out_logical_rect = Ref(Rectangle::_zero())
  let __result = moonbit_pango_layout_line_get_pixel_extents(
    self, __out_logical_rect,
  )
  (__result, __out_logical_rect.val)
}

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.LayoutLine.get_resolved_direction.html).
#borrow(self)
pub extern "c" fn LayoutLine::get_resolved_direction(
  self : LayoutLine,
) -> Direction = "moonbit_pango_layout_line_get_resolved_direction"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.LayoutLine.get_start_index.html).
#borrow(self)
pub extern "c" fn LayoutLine::get_start_index(self : LayoutLine) -> Int = "moonbit_pango_layout_line_get_start_index"

///|
#borrow(self_, ranges)
extern "c" fn moonbit_pango_layout_line_get_x_ranges(
  self_ : LayoutLine,
  start_index : Int,
  end_index : Int,
  ranges : Ref[FixedArray[Int]],
) = "moonbit_pango_layout_line_get_x_ranges"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.LayoutLine.get_x_ranges.html).
pub fn LayoutLine::get_x_ranges(
  self : LayoutLine,
  start_index : Int,
  end_index : Int,
) -> Array[Int] {
  let ranges : Ref[FixedArray[Int]] = Ref([])
  moonbit_pango_layout_line_get_x_ranges(self, start_index, end_index, ranges)
  let result : Array[Int] = Array::new(capacity=ranges.val.length())
  for i in 0.. Int {
  let x_pos = Ref(0)
  moonbit_pango_layout_line_index_to_x(self, index_, trailing, x_pos)
  x_pos.val
}

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.LayoutLine.is_paragraph_start.html).
#borrow(self)
pub extern "c" fn LayoutLine::is_paragraph_start(self : LayoutLine) -> Bool = "moonbit_pango_layout_line_is_paragraph_start"

///|
#borrow(self_)
extern "c" fn moonbit_pango_layout_line_ref(
  self_ : LayoutLine,
) -> @glib.Nullable[LayoutLine] = "moonbit_pango_layout_line_ref"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.LayoutLine.ref.html).
pub fn LayoutLine::ref_(self : LayoutLine) -> LayoutLine? {
  let raw_result = moonbit_pango_layout_line_ref(self)
  raw_result.to_option()
}

///|
#borrow(self_, index_, trailing)
extern "c" fn moonbit_pango_layout_line_x_to_index(
  self_ : LayoutLine,
  x_pos : Int,
  index_ : Ref[Int],
  trailing : Ref[Int],
) -> Bool = "moonbit_pango_layout_line_x_to_index"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.LayoutLine.x_to_index.html).
pub fn LayoutLine::x_to_index(
  self : LayoutLine,
  x_pos : Int,
) -> (Bool, Int, Int) {
  let index_ = Ref(0)
  let trailing = Ref(0)
  let result = moonbit_pango_layout_line_x_to_index(
    self, x_pos, index_, trailing,
  )
  (result, index_.val, trailing.val)
}

///|
impl ILayoutLine with fn get_extents(self) -> (Rectangle, Rectangle) {
  self.as_layout_line().get_extents()
}

///|
impl ILayoutLine with fn get_height(self) -> Int {
  self.as_layout_line().get_height()
}

///|
impl ILayoutLine with fn get_length(self) -> Int {
  self.as_layout_line().get_length()
}

///|
impl ILayoutLine with fn get_pixel_extents(self) -> (Rectangle, Rectangle) {
  self.as_layout_line().get_pixel_extents()
}

///|
impl ILayoutLine with fn get_resolved_direction(self) -> Direction {
  self.as_layout_line().get_resolved_direction()
}

///|
impl ILayoutLine with fn get_start_index(self) -> Int {
  self.as_layout_line().get_start_index()
}

///|
impl ILayoutLine with fn get_x_ranges(self, start_index, end_index) -> Array[
  Int,
] {
  self.as_layout_line().get_x_ranges(start_index, end_index)
}

///|
impl ILayoutLine with fn index_to_x(self, index_, trailing) -> Int {
  self.as_layout_line().index_to_x(index_, trailing)
}

///|
impl ILayoutLine with fn is_paragraph_start(self) -> Bool {
  self.as_layout_line().is_paragraph_start()
}

///|
impl ILayoutLine with fn ref_(self) -> LayoutLine? {
  self.as_layout_line().ref_()
}

///|
impl ILayoutLine with fn x_to_index(self, x_pos) -> (Bool, Int, Int) {
  self.as_layout_line().x_to_index(x_pos)
}

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/struct.LayoutLine.html).
#borrow(self_)
pub extern "c" fn LayoutLine::get_layout(self_ : LayoutLine) -> Layout = "moonbit_pango_layout_line_layout_get"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/struct.LayoutLine.html).
#borrow(self_)
pub extern "c" fn LayoutLine::set_start_index(self_ : LayoutLine, value : Int) = "moonbit_pango_layout_line_start_index_set"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/struct.LayoutLine.html).
#borrow(self_)
pub extern "c" fn LayoutLine::set_length(self_ : LayoutLine, value : Int) = "moonbit_pango_layout_line_length_set"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/struct.LayoutLine.html).
#borrow(self_)
pub extern "c" fn LayoutLine::get_is_paragraph_start(
  self_ : LayoutLine,
) -> UInt = "moonbit_pango_layout_line_is_paragraph_start_get"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/struct.LayoutLine.html).
#borrow(self_)
pub extern "c" fn LayoutLine::set_is_paragraph_start(
  self_ : LayoutLine,
  value : UInt,
) = "moonbit_pango_layout_line_is_paragraph_start_set"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/struct.LayoutLine.html).
#borrow(self_)
pub extern "c" fn LayoutLine::get_resolved_dir(self_ : LayoutLine) -> UInt = "moonbit_pango_layout_line_resolved_dir_get"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/struct.LayoutLine.html).
#borrow(self_)
pub extern "c" fn LayoutLine::set_resolved_dir(
  self_ : LayoutLine,
  value : UInt,
) = "moonbit_pango_layout_line_resolved_dir_set"