Struct div::div_handle::DivHandle

source ·
pub struct DivHandle(_);
Expand description

A light-weight key to refer to the state necessary to manipulate a div.

This is a unique identifier that will become invalid once the div has been deleted.

Implementations§

source§

impl DivHandle

source

pub fn hide(&self) -> Result<(), DivError>

Hides the div and all child nodes.

The div node is removed from the DOM but it is kept in memory. Call delete to give up memory or call show later to display pane again.

source

pub fn show(&self) -> Result<(), DivError>

Displays a div again after it has been hidden by calling hide

source

pub fn reposition(&self, x: i32, y: i32) -> Result<(), DivError>

Adjust the relative position of the div.

The provided parameters are taken in the original scale when initializing, taking any calls to the global div::resize() into consideration.

source

pub fn resize(&self, w: u32, h: u32) -> Result<(), DivError>

Adjust the size of the div.

The provided parameters are taken in the original scale when initializing, taking any calls to the global div::resize() into consideration.

source

pub fn reposition_and_resize( &self, x: i32, y: i32, w: u32, h: u32 ) -> Result<(), DivError>

Adjust the position and size of the div in a single call, which is slightly more efficient than calling resize and reposition separately.

The provided parameters are taken in the original scale when initializing, taking any calls to the global div::resize() into consideration.

source

pub fn set_css(&self, property: &str, value: &str) -> Result<(), DivError>

Set CSS property of div

source

pub fn add_class(&self, css_class: &str) -> Result<(), DivError>

Add a CSS class to the div

source

pub fn remove_class(&self, css_class: &str) -> Result<(), DivError>

Remove a CSS class to the div

source

pub fn delete(&mut self) -> Result<(), DivError>

Removes a div from the DOM and deletes it

source

pub fn parent_element(&self) -> Result<HtmlElement, DivError>

Get a reference to the DOM element associated with the div. The provided HTML when creating a new div will be the child node(s) of the returned element.

source

pub fn first_inner_node(&self) -> Result<Node, DivError>

Get a reference to the DOM node created by the provided HTML when creating the pane. If multiple nodes have been created, the first node is returned.

Trait Implementations§

source§

impl Clone for DivHandle

source§

fn clone(&self) -> DivHandle

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for DivHandle

source§

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

Formats the value using the given formatter. Read more
source§

impl Hash for DivHandle

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq<DivHandle> for DivHandle

source§

fn eq(&self, other: &DivHandle) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for DivHandle

source§

impl Eq for DivHandle

source§

impl StructuralEq for DivHandle

source§

impl StructuralPartialEq for DivHandle

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.