pub trait ContainerImpl: ContainerImplExt + WidgetImpl {
// Provided methods
fn add(&self, widget: &Widget) { ... }
fn remove(&self, widget: &Widget) { ... }
fn check_resize(&self) { ... }
fn set_focus_child(&self, widget: Option<&Widget>) { ... }
fn child_type(&self) -> Type { ... }
fn path_for_child(&self, widget: &Widget) -> WidgetPath { ... }
fn forall(&self, include_internals: bool, callback: &Callback) { ... }
}Provided Methods§
Sourcefn add(&self, widget: &Widget)
fn add(&self, widget: &Widget)
Adds widget to self. Typically used for simple containers
such as Window, Frame, or Button; for more complicated
layout containers such as Box or Grid, this function will
pick default packing parameters that may not be correct. So
consider functions such as BoxExt::pack_start() and
GridExt::attach() as an alternative to ContainerExt::add() in
those cases. A widget may be added to only one container at a time;
you can’t place the same widget inside two different containers.
Note that some containers, such as ScrolledWindow or ListBox,
may add intermediate children between the added widget and the
container.
§widget
a widget to be placed inside self
Sourcefn remove(&self, widget: &Widget)
fn remove(&self, widget: &Widget)
Removes widget from self. widget must be inside self.
Note that self will own a reference to widget, and that this
may be the last reference held; so removing a widget from its
container can destroy that widget. If you want to use widget
again, you need to add a reference to it before removing it from
a container, using g_object_ref(). If you don’t want to use widget
again it’s usually more efficient to simply destroy it directly
using gtk_widget_destroy() since this will remove it from the
container and help break any circular reference count cycles.
§widget
a current child of self
fn check_resize(&self)
Sourcefn set_focus_child(&self, widget: Option<&Widget>)
fn set_focus_child(&self, widget: Option<&Widget>)
Sets, or unsets if child is None, the focused child of self.
This function emits the GtkContainer::set_focus_child signal of
self. Implementations of Container can override the
default behaviour by overriding the class closure of this signal.
This is function is mostly meant to be used by widgets. Applications can use
WidgetExt::grab_focus() to manually set the focus to a specific widget.
§child
Sourcefn child_type(&self) -> Type
fn child_type(&self) -> Type
Sourcefn path_for_child(&self, widget: &Widget) -> WidgetPath
fn path_for_child(&self, widget: &Widget) -> WidgetPath
Returns a newly created widget path representing all the widget hierarchy
from the toplevel down to and including child.
§child
a child of self
§Returns
A newly created WidgetPath
Sourcefn forall(&self, include_internals: bool, callback: &Callback)
fn forall(&self, include_internals: bool, callback: &Callback)
Invokes callback on each direct child of self, including
children that are considered “internal” (implementation details
of the container). “Internal” children generally weren’t added
by the user of the container, but were added by the container
implementation itself.
Most applications should use ContainerExt::foreach(), rather
than ContainerExt::forall().
§callback
a callback
§callback_data
callback user data
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".