Skip to main content

Node

Struct Node 

Source
pub struct Node {
Show 21 fields pub name: String, pub reference: String, pub border: Option<NodeId>, pub shortcut: Option<u32>, pub margins: [i32; 4], pub min_size: [i32; 2], pub alignment: u32, pub flags: u32, pub color: u32, pub kind: Kind, pub children: Vec<NodeId>, pub tooltip: String, pub tooltip_dialog: Option<String>, pub string_table: Option<String>, pub hotkey: Option<String>, pub title_desc: Option<(String, String)>, pub enabled: bool, pub cursor: i32, pub rotation: f32, pub size: [i32; 2], pub rect: [i32; 4], /* private fields */
}
Expand description

One element of the interface tree.

Fields§

§name: String

The element’s name in its resource, for example buttonNew. The game finds elements by it.

§reference: String

The reference of the resource the element was made from.

§border: Option<NodeId>

The element’s border, drawn behind it.

§shortcut: Option<u32>

The key that clicks the element.

§margins: [i32; 4]

The margins: left, right, top, bottom.

§min_size: [i32; 2]

The smallest size, in pixels.

§alignment: u32

How the element sits in the space it is given (flags has the bits).

§flags: u32

The element’s flags (flags).

§color: u32

The colour that multiplies the element, 0xAARRGGBB.

§kind: Kind

What the element is.

§children: Vec<NodeId>

The children, in drawing order.

§tooltip: String

The tooltip text.

§tooltip_dialog: Option<String>

The dialog shown as the tooltip, if the tooltip is a dialog.

§string_table: Option<String>

Element: the string table the element’s own strings come from.

§hotkey: Option<String>

Name of the element’s key binding (Element resolved through keyNames), for HotKeyToolTipUI.

§title_desc: Option<(String, String)>

Title and description user data, for TitleDescToolTipUI.

§enabled: bool

Whether the element takes input.

§cursor: i32

Element: the mouse cursor index over it (Element::GetMouseCursorIndex).

§rotation: f32

An image’s rotation in degrees (ImageElement::SetRotation).

§size: [i32; 2]

Content size from the last size pass.

§rect: [i32; 4]

Layout rectangle: left, top, right, bottom.

Implementations§

Source§

impl Node

Source

pub fn new(kind: Kind) -> Node

An element of this kind, with the default values.

Source

pub fn visible(&self) -> bool

Whether the element is shown.

Source

pub fn usable(&self) -> bool

Enabled and not locked by the tutorial (& 0x1800000 clear).

Source

pub fn contains(&self, x: i32, y: i32) -> bool

Whether a point is inside the element’s rectangle.

Trait Implementations§

Source§

impl Clone for Node

Source§

fn clone(&self) -> Node

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Node

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Node

§

impl RefUnwindSafe for Node

§

impl Send for Node

§

impl Sync for Node

§

impl Unpin for Node

§

impl UnsafeUnpin for Node

§

impl UnwindSafe for Node

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.