gtk4/auto/
fixed_layout.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{ffi, LayoutManager};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9    /// [`FixedLayout`][crate::FixedLayout] is a layout manager which can place child widgets
10    /// at fixed positions.
11    ///
12    /// Most applications should never use this layout manager; fixed positioning
13    /// and sizing requires constant recalculations on where children need to be
14    /// positioned and sized. Other layout managers perform this kind of work
15    /// internally so that application developers don't need to do it. Specifically,
16    /// widgets positioned in a fixed layout manager will need to take into account:
17    ///
18    /// - Themes, which may change widget sizes.
19    ///
20    /// - Fonts other than the one you used to write the app will of course
21    ///   change the size of widgets containing text; keep in mind that
22    ///   users may use a larger font because of difficulty reading the
23    ///   default, or they may be using a different OS that provides different
24    ///   fonts.
25    ///
26    /// - Translation of text into other languages changes its size. Also,
27    ///   display of non-English text will use a different font in many
28    ///   cases.
29    ///
30    /// In addition, [`FixedLayout`][crate::FixedLayout] does not pay attention to text direction and
31    /// thus may produce unwanted results if your app is run under right-to-left
32    /// languages such as Hebrew or Arabic. That is: normally GTK will order
33    /// containers appropriately depending on the text direction, e.g. to put labels
34    /// to the right of the thing they label when using an RTL language;
35    /// [`FixedLayout`][crate::FixedLayout] won't be able to do that for you.
36    ///
37    /// Finally, fixed positioning makes it kind of annoying to add/remove UI
38    /// elements, since you have to reposition all the other  elements. This is a
39    /// long-term maintenance problem for your application.
40    ///
41    /// # Implements
42    ///
43    /// [`LayoutManagerExt`][trait@crate::prelude::LayoutManagerExt], [`trait@glib::ObjectExt`]
44    #[doc(alias = "GtkFixedLayout")]
45    pub struct FixedLayout(Object<ffi::GtkFixedLayout, ffi::GtkFixedLayoutClass>) @extends LayoutManager;
46
47    match fn {
48        type_ => || ffi::gtk_fixed_layout_get_type(),
49    }
50}
51
52impl FixedLayout {
53    /// Creates a new [`FixedLayout`][crate::FixedLayout].
54    ///
55    /// # Returns
56    ///
57    /// the newly created [`FixedLayout`][crate::FixedLayout]
58    #[doc(alias = "gtk_fixed_layout_new")]
59    pub fn new() -> FixedLayout {
60        assert_initialized_main_thread!();
61        unsafe { LayoutManager::from_glib_full(ffi::gtk_fixed_layout_new()).unsafe_cast() }
62    }
63}
64
65impl Default for FixedLayout {
66    fn default() -> Self {
67        Self::new()
68    }
69}