Trait dui::element::hierarchy::Node
[−]
[src]
pub trait Node: Element { fn detach(&mut self) -> Self { ... } fn reparent<E1, E2>(
&mut self,
new_parent: E1,
ref_child: E2
) -> Result<Self, Self>
where
E1: Container,
E2: Node, { ... } fn parent(&self) -> Option<Handle> { ... } fn brother(&self) -> Option<Handle> { ... } fn dialog(&self) -> Option<Handle> { ... } fn dialog_child<S: Into<String>>(&self, name: S) -> Option<Handle> { ... } fn refresh(&mut self) { ... } fn refresh_children(&mut self) { ... } fn update(&self) { ... } fn update_children(&self) { ... } fn redraw(&self, also_redraw_children: bool) { ... } }
Nodes are elements that can be part of a hierarchical structure.
Provided Methods
fn detach(&mut self) -> Self
Detaches an interface element from its parent.
It will automatically call Widget::unmap
to unmap the element if necessary,
and then detach the element.
If left detached it is still necessary to call Element::destroy
to destroy the
detached element.
The elements are not immediately repositioned. Call Node::refresh
for the
container (or any other element in the dialog) to update the dialog layout.
fn reparent<E1, E2>(
&mut self,
new_parent: E1,
ref_child: E2
) -> Result<Self, Self> where
E1: Container,
E2: Node,
&mut self,
new_parent: E1,
ref_child: E2
) -> Result<Self, Self> where
E1: Container,
E2: Node,
Moves an interface element from one position in the hierarchy tree to another.
TODO ref_child NULL doc. See #23.
See Container::append
for more details on the semantics of this method.
fn parent(&self) -> Option<Handle>
Returns the parent of a element.
fn brother(&self) -> Option<Handle>
Returns the brother of an element.
fn dialog(&self) -> Option<Handle>
Returns the handle of the dialog that contains that interface element.
Works also for children of a menu that is associated with a dialog.
fn dialog_child<S: Into<String>>(&self, name: S) -> Option<Handle>
Returns the identifier of the child element that has the NAME attribute equals to the given value on the same dialog hierarchy.
Works also for children of a menu that is associated with a dialog.
This function will only found the child if the NAME attribute is set at the control.
The function returns immediatelly with the result (not needing to traverse the hierarchy) after the child is mapped.
fn refresh(&mut self)
Updates the size and layout of all controls in the same dialog.
Can be called even if the dialog is not mapped.
Can be used for any control, but it will always affect the whole dialog, to refresh the
layout of only a subset of the dialog use Node::refresh_children
.
This function will not change the size of the dialog, except if the SIZE or RASTERSIZE attributes of the dialog where changed before the call. Changing the size of elements without changing the dialog size may position some controls outside the dialog area at the left or bottom borders (the elements will be cropped at the dialog borders by the native system).
Widget::map
also updates the dialog layout, but only when called for the dialog itself,
even if the dialog is already mapped. Since Widget::show
, DialogElement::showxy
and
DialogElement::popup
call Widget::map
, then they all will always update the dialog
layout before showing it, even also if the dialog is already visible.
fn refresh_children(&mut self)
Updates the size and layout of controls after changing size attributes, or attributes that affect the size of the control.
Can be used for any element inside a dialog, only its children will be updated.
The given element must be a container. It must be inside a dialog hierarchy and must be
mapped. It can not be a dialog. For dialogs use Node::refresh
.
This function will not change the size of the given element, even if the natural size of its children would increase its natural size.
fn update(&self)
Mark the element to be redraw when the control returns to the system.
fn update_children(&self)
Mark the element children to be redraw when the control returns to the system.
fn redraw(&self, also_redraw_children: bool)
Force the element and its children to be redraw immediately.
Implementors
impl Node for Handle
impl Node for Dialog
impl Node for MessageDlg
impl Node for FileDlg
impl Node for VBox
impl Node for HBox
impl Node for Radio
impl Node for Fill
impl Node for Label
impl Node for Text
impl Node for Button
impl Node for ProgressBar
impl Node for Toggle
impl Node for Frame
impl Node for List