Gjsify LogoGjsify Logo

The #GNode struct represents one node in a [n-ary tree][glib-N-ary-Trees].

record

Hierarchy

  • Node

Index

Constructors

Properties

children: GLib.Node

points to the first child of the #GNode. The other children are accessed by using the next pointer of each child.

field
data: object

contains the actual data of the node.

field
next: GLib.Node

points to the node's next sibling (a sibling is another #GNode with the same parent).

field
parent: GLib.Node

points to the parent of the #GNode, or is %NULL if the #GNode is the root of the tree.

field
prev: GLib.Node

points to the node's previous sibling.

field
name: string

Methods

  • child_index(data: object): number
  • Gets the position of the first child of a #GNode which contains the given data.

    Parameters

    • data: object

      the data to find

    Returns number

  • child_position(child: GLib.Node): number
  • Gets the position of a #GNode with respect to its siblings. child must be a child of node. The first child is numbered 0, the second 1, and so on.

    Parameters

    Returns number

  • depth(): number
  • Gets the depth of a #GNode.

    If node is %NULL the depth is 0. The root node has a depth of 1. For the children of the root node the depth is 2. And so on.

    Returns number

  • destroy(): void
  • is_ancestor(descendant: GLib.Node): boolean
  • Returns %TRUE if node is an ancestor of descendant. This is true if node is the parent of descendant, or if node is the grandparent of descendant etc.

    Parameters

    Returns boolean

  • max_height(): number
  • Gets the maximum height of all branches beneath a #GNode. This is the maximum distance from the #GNode to all leaf nodes.

    If root is %NULL, 0 is returned. If root has no children, 1 is returned. If root has children, 2 is returned. And so on.

    Returns number

  • n_children(): number
  • Gets the number of nodes in a tree.

    Parameters

    • flags: TraverseFlags

      which types of children are to be counted, one of %G_TRAVERSE_ALL, %G_TRAVERSE_LEAVES and %G_TRAVERSE_NON_LEAVES

    Returns number

  • reverse_children(): void
  • Reverses the order of the children of a #GNode. (It doesn't change the order of the grandchildren.)

    Returns void

  • unlink(): void

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method