Trait LayoutManagerExt

Source
pub trait LayoutManagerExt: 'static {
    // Required methods
    fn allocate<P: IsA<Container>>(
        &self,
        container: &P,
        allocation: &ActorBox,
        flags: AllocationFlags,
    );
    fn child_get_property<P: IsA<Container>, Q: IsA<Actor>>(
        &self,
        container: &P,
        actor: &Q,
        property_name: &str,
        value: &mut Value,
    );
    fn child_set_property<P: IsA<Container>, Q: IsA<Actor>>(
        &self,
        container: &P,
        actor: &Q,
        property_name: &str,
        value: &Value,
    );
    fn find_child_property(&self, name: &str) -> Option<ParamSpec>;
    fn get_child_meta<P: IsA<Container>, Q: IsA<Actor>>(
        &self,
        container: &P,
        actor: &Q,
    ) -> Option<LayoutMeta>;
    fn get_preferred_height<P: IsA<Container>>(
        &self,
        container: &P,
        for_width: f32,
    ) -> (f32, f32);
    fn get_preferred_width<P: IsA<Container>>(
        &self,
        container: &P,
        for_height: f32,
    ) -> (f32, f32);
    fn layout_changed(&self);
    fn list_child_properties(&self) -> Vec<ParamSpec>;
    fn set_container<P: IsA<Container>>(&self, container: Option<&P>);
    fn connect_layout_changed<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;
}
Expand description

Trait containing all LayoutManager methods.

§Implementors

BinLayout, BoxLayout, FixedLayout, FlowLayout, GridLayout, LayoutManager

Required Methods§

Source

fn allocate<P: IsA<Container>>( &self, container: &P, allocation: &ActorBox, flags: AllocationFlags, )

Allocates the children of container given an area

See also ActorExt::allocate

§container

the Container using self

§allocation

the ActorBox containing the allocated area of container

§flags

the allocation flags

Source

fn child_get_property<P: IsA<Container>, Q: IsA<Actor>>( &self, container: &P, actor: &Q, property_name: &str, value: &mut Value, )

Gets a property on the LayoutMeta created by self and attached to a child of container

The gobject::Value must already be initialized to the type of the property and has to be unset with gobject::Value::unset after extracting the real value out of it

§container

a Container using self

§actor

a Actor child of container

§property_name

the name of the property to get

§value

a gobject::Value with the value of the property to get

Source

fn child_set_property<P: IsA<Container>, Q: IsA<Actor>>( &self, container: &P, actor: &Q, property_name: &str, value: &Value, )

Sets a property on the LayoutMeta created by self and attached to a child of container

§container

a Container using self

§actor

a Actor child of container

§property_name

the name of the property to set

§value

a gobject::Value with the value of the property to set

Source

fn find_child_property(&self, name: &str) -> Option<ParamSpec>

Retrieves the gobject::ParamSpec for the layout property name inside the LayoutMeta sub-class used by self

§name

the name of the property

§Returns

a gobject::ParamSpec describing the property, or None if no property with that name exists. The returned gobject::ParamSpec is owned by the layout manager and should not be modified or freed

Source

fn get_child_meta<P: IsA<Container>, Q: IsA<Actor>>( &self, container: &P, actor: &Q, ) -> Option<LayoutMeta>

Retrieves the LayoutMeta that the layout self associated to the actor child of container, eventually by creating one if the LayoutManager supports layout properties

§container

a Container using self

§actor

a Actor child of container

§Returns

a LayoutMeta, or None if the LayoutManager does not have layout properties. The returned layout meta instance is owned by the LayoutManager and it should not be unreferenced

Source

fn get_preferred_height<P: IsA<Container>>( &self, container: &P, for_width: f32, ) -> (f32, f32)

Computes the minimum and natural heights of the container according to self.

See also ActorExt::get_preferred_height

§container

the Container using self

§for_width

the width for which the height should be computed, or -1

§min_height_p

return location for the minimum height of the layout, or None

§nat_height_p

return location for the natural height of the layout, or None

Source

fn get_preferred_width<P: IsA<Container>>( &self, container: &P, for_height: f32, ) -> (f32, f32)

Computes the minimum and natural widths of the container according to self.

See also ActorExt::get_preferred_width

§container

the Container using self

§for_height

the height for which the width should be computed, or -1

§min_width_p

return location for the minimum width of the layout, or None

§nat_width_p

return location for the natural width of the layout, or None

Source

fn layout_changed(&self)

Emits the LayoutManager::layout-changed signal on self

This function should only be called by implementations of the LayoutManager class

Source

fn list_child_properties(&self) -> Vec<ParamSpec>

Retrieves all the gobject::ParamSpecs for the layout properties stored inside the LayoutMeta sub-class used by self

§n_pspecs

return location for the number of returned gobject::ParamSpecs

§Returns

the newly-allocated, None-terminated array of gobject::ParamSpecs. Use g_free to free the resources allocated for the array

Source

fn set_container<P: IsA<Container>>(&self, container: Option<&P>)

If the LayoutManager sub-class allows it, allow adding a weak reference of the container using self from within the layout manager

The layout manager should not increase the reference count of the container

§container

a Container using self

Source

fn connect_layout_changed<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

The ::layout-changed signal is emitted each time a layout manager has been changed. Every Actor using the manager instance as a layout manager should connect a handler to the ::layout-changed signal and queue a relayout on themselves:

  static void layout_changed (ClutterLayoutManager *manager,
                              ClutterActor         *self)
  {
    clutter_actor_queue_relayout (self);
  }
  ...
    self->manager = g_object_ref_sink (manager);
    g_signal_connect (self->manager, "layout-changed",
                      G_CALLBACK (layout_changed),
                      self);

Sub-classes of LayoutManager that implement a layout that can be controlled or changed using parameters should emit the ::layout-changed signal whenever one of the parameters changes, by using LayoutManagerExt::layout_changed.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§