animate/legacy/
bin_layout.rs

1use crate::{BinAlignment, LayoutManager};
2use glib::{object as gobject, object::Cast, translate::*};
3use std::fmt;
4
5glib_wrapper! {
6    pub struct BinLayout(Object<ffi::ClutterBinLayout, ffi::ClutterBinLayoutClass, BinLayoutClass>) @extends LayoutManager, gobject::InitiallyUnowned;
7
8    match fn {
9        get_type => || ffi::clutter_bin_layout_get_type(),
10    }
11}
12
13impl BinLayout {
14    /// Creates a new `BinLayout` layout manager
15    /// ## `x_align`
16    /// the default alignment policy to be used on the
17    ///  horizontal axis
18    /// ## `y_align`
19    /// the default alignment policy to be used on the
20    ///  vertical axis
21    ///
22    /// # Returns
23    ///
24    /// the newly created layout manager
25    pub fn new(x_align: BinAlignment, y_align: BinAlignment) -> BinLayout {
26        unsafe {
27            LayoutManager::from_glib_none(ffi::clutter_bin_layout_new(
28                x_align.to_glib(),
29                y_align.to_glib(),
30            ))
31            .unsafe_cast()
32        }
33    }
34}
35
36impl fmt::Display for BinLayout {
37    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
38        write!(f, "BinLayout")
39    }
40}