Trait droom_ui::element::Element [] [src]

pub trait Element: Sized + Copy + Clone {
    unsafe fn from_raw_unchecked(ih: *mut Ihandle) -> Self;
    fn raw(&self) -> *mut Ihandle;
    unsafe fn target_classname() -> &'static str;

    fn from_handle(handle: Handle) -> Result<Self, Handle> { ... }
    fn from_name<S: Into<String>>(name: S) -> Option<Handle> { ... }
    fn from_raw(ih: *mut Ihandle) -> Self { ... }
    unsafe fn classname(&self) -> &CStr { ... }
    fn destroy(self) { ... }
    fn does_attrib_exist(&self, cname: &CString) -> bool { ... }
    fn attribs(&self) -> Vec<String> { ... }
    fn set_attrib<S1, S2>(&mut self, name: S1, value: S2) -> Self where S1: Into<String>, S2: Into<String> { ... }
    fn attrib<S: Into<String>>(&self, name: S) -> Option<String> { ... }
    fn set_attrib_data<S1>(&mut self, name: S1, data: *const c_void) -> Self where S1: Into<String> { ... }
    fn attrib_data<S1>(&mut self, name: S1) -> *mut c_void where S1: Into<String> { ... }
    fn set_attrib_handle<S1, E>(&mut self, name: S1, elem: E) -> Self where S1: Into<String>, E: Element { ... }
    fn attrib_handle<S1>(&mut self, name: S1) -> Option<Handle> where S1: Into<String> { ... }
    fn clear_attrib<S: Into<String>>(&mut self, name: S) -> Self { ... }
    fn reset_attrib<S: Into<String>>(&mut self, name: S) -> Self { ... }
    fn handle_name(&self) -> Option<String> { ... }
    fn add_handle_name<S: Into<String>>(&self, name: S) -> Option<Handle> { ... }
    fn clear_handle_name<S: Into<String>>(name: S) -> Option<Handle> { ... }
}

Every IUP object is an Element.

Required Methods

Constructs an Element from a raw IUP handle.

Safety

The from_raw_unchecked method is faster than from_raw but must be used with care.

The Rust binding performs important operations and checks when a raw IUP handle reaches the bounds of safe Rust binding, that only happens when from_raw is used. Be sure the raw handle has reached safe Rust bounds at least once before using this method.

It's undefined behaviour if the raw handle is incompatible with Self bindings. Instead use the Element::from_handle to perform safe downcasting.

Gets the raw IUP handle associated with this element.

Gets the class name the derived object should be targeting.

Provided Methods

Constructs a specialized Element object from a general Handle if they are compatible.

Constructs from a name associated with a element handle (with Element::add_handle_name or LED).

Constructs an Element from a raw IUP handle.

It's undefined behaviour if the raw handle is incompatible with Self bindings. Instead use the Element::from_handle to perform safe downcasting.

Panics

Panics if the raw handle is a null pointer.

Gets the class name of this element.

Destroys an interface element and all its children.

Only dialogs, timers, popup menus and images should be normally destroyed, but detached controls can also be destroyed.

Menu bars associated with dialogs are automatically destroyed when the dialog is destroyed.

Images associated with controls are NOT automatically destroyed. The application must destroy them when they are not used anymore.

Checks if a specific attribute exists in the element.

Returns the names of all attributes of an element that are set in its internal hash table only.

Sets an interface element attribute.

See also the IUP Attributes Guide.

Gets an interface element attribute.

See also the IUP Attributes Guide.

Sets a raw interface element attribute.

Safety

While this function is not unsafe, care must be taken while using it, prefer to use Element::set_attrib instead. The data pointer must live long enough (most of the time statically).

Gets a raw interface element attribute.

Associates a element with an attribute.

Instead of using Element::add_handle_name and Element::set_attrib with a new creative name, this function automatically creates a non conflict handle name and associates that with the attribute.

Gets the handle associated with an attribute.

Clears the value associated with an attribute and use the default value.

Removes an attribute from element and its children if the attrib is inheritable.

It is useful to reset the state of inheritable attributes in a tree of elements.

Returns the identifier of an interface element that has an associated handle name using Element::add_handle_name or using LED.

Handle names shouldn't be confused with the NAME attribute.

Associates a handle name with an interface element.

Can be called several times with the same element and different names. There is no restriction for the number of names a pointer can have, but Element::handle_name will return the first name found.

Returns the handle of the interface element previously associated to the parameter name.

Handle names shouldn't be confused with the NAME attribute.

Clears the handle name association on the specified name.

Note this will not destroy associated elements, just remove a name from the association table.

Returns the handle of the interface element previously associated to the parameter name.

Handle names shouldn't be confused with the NAME attribute.

Implementors