Window

Struct Window 

Source
pub struct Window {
    pub id: Arc<SourceID>,
    /* private fields */
}
Expand description

Represents an OS window. All outline functions must return a set of windows as a result of their evaluation, which represents all the windows that are currently open as part of the application. The ID of the window that a particular component belongs to is propagated down the outline evaluation phase, because this is needed to acquire window-specific information that depends on which monitor the OS thinks the window belongs to, like DPI or orientation.

Fields§

§id: Arc<SourceID>

Implementations§

Source§

impl Window

Source

pub fn new( id: Arc<SourceID>, attributes: WindowAttributes, child: Box<dyn ComponentWrap<dyn Empty>>, ) -> Self

Examples found in repository?
examples/textbox-rs.rs (lines 101-108)
70    fn call(
71        &mut self,
72        mut store: Self::Store,
73        args: TextState,
74        mut scope: ScopeID<'_>,
75    ) -> (Self::Store, im::HashMap<Arc<SourceID>, Option<Window>>) {
76        if store.0 != args {
77            let textbox = TextBox::new(
78                gen_id!(scope),
79                MinimalText {
80                    area: FILL_DRECT,
81                    padding: AbsRect::splat(12.0).into(),
82                    textedit: args.text.clone(), // Be careful to take the value from args, not store.0, which is stale.
83                },
84                40.0,
85                56.0,
86                cosmic_text::FamilyOwned::SansSerif,
87                sRGB::white(),
88                Default::default(),
89                Default::default(),
90                cosmic_text::Wrap::Word,
91                Some(cosmic_text::Align::Right),
92            );
93
94            let region = Region::new(
95                gen_id!(scope),
96                MinimalArea {
97                    area: AbsRect::new(90.0, 0.0, -90.0, -180.0) + RelRect::new(0.0, 0.0, 1.0, 1.0),
98                },
99                feather_ui::children![fixed::Prop, textbox],
100            );
101            let window = Window::new(
102                gen_id!(scope),
103                winit::window::Window::default_attributes()
104                    .with_title(env!("CARGO_CRATE_NAME"))
105                    .with_inner_size(winit::dpi::PhysicalSize::new(600, 400))
106                    .with_resizable(true),
107                Box::new(region),
108            );
109
110            store.1 = im::HashMap::new();
111            store.1.insert(window.id.clone(), Some(window));
112            store.0 = args.clone();
113        }
114        let windows = store.1.clone();
115        (store, windows)
116    }
More examples
Hide additional examples
examples/paragraph-rs.rs (lines 161-167)
106    fn call(
107        &mut self,
108        mut store: Self::Store,
109        args: Blocker,
110        mut scope: ScopeID<'_>,
111    ) -> (Self::Store, im::HashMap<Arc<SourceID>, Option<Window>>) {
112        if store.0 != args {
113            let flex = {
114                let rect = Shape::<MinimalFlexChild, { ShapeKind::RoundRect as u8 }>::new(
115                    gen_id!(scope),
116                    MinimalFlexChild {
117                        area: AbsRect::new(0.0, 0.0, 40.0, 40.0).into(),
118                    },
119                    0.0,
120                    0.0,
121                    wide::f32x4::splat(10.0),
122                    sRGB::new(0.2, 0.7, 0.4, 1.0),
123                    sRGB::transparent(),
124                    feather_ui::DAbsPoint::zero(),
125                );
126
127                let mut p = Paragraph::new(
128                    gen_id!(scope),
129                    MinimalFlex {
130                        area: FILL_DRECT,
131                        obstacles: vec![AbsRect::new(200.0, 30.0, 300.0, 150.0).into()],
132                    },
133                );
134
135                let text = "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?";
136                p.set_text(
137                    text,
138                    40.0,
139                    56.0,
140                    cosmic_text::FamilyOwned::SansSerif,
141                    sRGB::white(),
142                    Default::default(),
143                    Default::default(),
144                    true,
145                );
146                p.prepend(Box::new(rect.clone()));
147                p.append(Box::new(rect.clone()));
148                p.append(Box::new(rect.clone()));
149
150                p
151            };
152
153            let region = Region::new(
154                gen_id!(scope),
155                MinimalArea {
156                    area: AbsRect::new(90.0, 90.0, -90.0, -90.0) + RelRect::new(0.0, 0.0, 1.0, 1.0),
157                },
158                feather_ui::children![fixed::Prop, flex],
159            );
160
161            let window = Window::new(
162                gen_id!(scope),
163                winit::window::Window::default_attributes()
164                    .with_title(env!("CARGO_CRATE_NAME"))
165                    .with_resizable(true),
166                Box::new(region),
167            );
168
169            store.1 = im::HashMap::new();
170            store.1.insert(window.id.clone(), Some(window));
171            store.0 = args.clone();
172        }
173        let windows = store.1.clone();
174        (store, windows)
175    }
examples/graph-rs.rs (lines 157-163)
59    fn call(
60        &mut self,
61        mut store: Self::Store,
62        args: GraphState,
63        mut scope: ScopeID<'_>,
64    ) -> (Self::Store, im::HashMap<Arc<SourceID>, Option<Window>>) {
65        if store.0 != args {
66            let mut children: im::Vector<Option<Box<ChildOf<dyn fixed::Prop>>>> = im::Vector::new();
67            let domain: Arc<CrossReferenceDomain> = Default::default();
68
69            let mut node_ids: Vec<Arc<SourceID>> = Vec::new();
70
71            for (i, id) in scope.iter(0..args.nodes.len()) {
72                let node = args.nodes[i];
73                const BASE: sRGB = sRGB::new(0.2, 0.7, 0.4, 1.0);
74
75                let point = DomainPoint::new(id, domain.clone());
76                node_ids.push(point.id.clone());
77
78                let circle = Shape::<DRect, { ShapeKind::Circle as u8 }>::new(
79                    gen_id!(point.id),
80                    FILL_DRECT,
81                    0.0,
82                    0.0,
83                    [0.0, 20.0],
84                    if args.selected == Some(i) {
85                        sRGB::new(0.7, 1.0, 0.8, 1.0)
86                    } else {
87                        BASE
88                    },
89                    BASE,
90                    DAbsPoint::zero(),
91                );
92
93                let bag = Region::<MinimalArea>::new(
94                    gen_id!(point.id),
95                    MinimalArea {
96                        area: AbsRect::new(
97                            node.x - NODE_RADIUS,
98                            node.y - NODE_RADIUS,
99                            node.x + NODE_RADIUS,
100                            node.y + NODE_RADIUS,
101                        )
102                        .into(),
103                    },
104                    feather_ui::children![fixed::Prop, point, circle],
105                );
106
107                children.push_back(Some(Box::new(bag)));
108            }
109
110            for ((a, b), id) in scope.iter(&args.edges) {
111                let line = DomainLine::<()> {
112                    id,
113                    fill: sRGB::white(),
114                    domain: domain.clone(),
115                    start: node_ids[*a].clone(),
116                    end: node_ids[*b].clone(),
117                    props: ().into(),
118                };
119
120                children.push_back(Some(Box::new(line)));
121            }
122
123            let subregion = Region::new(
124                gen_id!(scope),
125                MinimalArea {
126                    area: AbsRect::new(
127                        args.offset.x,
128                        args.offset.y,
129                        args.offset.x + 10000.0,
130                        args.offset.y + 10000.0,
131                    )
132                    .into(),
133                },
134                children,
135            );
136
137            let mousearea: MouseArea<MinimalArea> = MouseArea::new(
138                gen_id!(scope),
139                MinimalArea { area: FILL_DRECT },
140                Some(4.0),
141                [
142                    Some(Slot(feather_ui::APP_SOURCE_ID.into(), 0)),
143                    Some(Slot(feather_ui::APP_SOURCE_ID.into(), 0)),
144                    Some(Slot(feather_ui::APP_SOURCE_ID.into(), 0)),
145                    None,
146                    None,
147                    None,
148                ],
149            );
150
151            let region = Region::new(
152                gen_id!(scope),
153                MinimalArea { area: FILL_DRECT },
154                feather_ui::children![fixed::Prop, subregion, mousearea],
155            );
156
157            let window = Window::new(
158                gen_id!(scope),
159                feather_ui::winit::window::Window::default_attributes()
160                    .with_title(env!("CARGO_CRATE_NAME"))
161                    .with_resizable(true),
162                Box::new(region),
163            );
164
165            store.1 = im::HashMap::new();
166            store.1.insert(window.id.clone(), Some(window));
167            store.0 = args.clone();
168        }
169        let windows = store.1.clone();
170        (store, windows)
171    }
examples/grid-rs.rs (lines 217-223)
109    fn call(
110        &mut self,
111        mut store: Self::Store,
112        args: CounterState,
113        mut scope: ScopeID<'_>,
114    ) -> (Self::Store, im::HashMap<Arc<SourceID>, Option<Window>>) {
115        if store.0 != args {
116            let button = {
117                let text = {
118                    Text::<FixedData> {
119                        id: scope.create(),
120                        props: FixedData {
121                            area: AbsRect::new(10.0, 15.0, 10.0, 15.0)
122                                + RelRect::new(0.0, 0.0, UNSIZED_AXIS, UNSIZED_AXIS),
123                            anchor: feather_ui::RelPoint::zero().into(),
124                            ..Default::default()
125                        }
126                        .into(),
127                        text: format!("Boxes: {}", args.count),
128                        font_size: 40.0,
129                        line_height: 56.0,
130                        ..Default::default()
131                    }
132                };
133
134                let rect = Shape::<DRect, { ShapeKind::RoundRect as u8 }>::new(
135                    scope.create(),
136                    feather_ui::FILL_DRECT,
137                    0.0,
138                    0.0,
139                    wide::f32x4::splat(10.0),
140                    sRGB::new(0.2, 0.7, 0.4, 1.0),
141                    sRGB::transparent(),
142                    DAbsPoint::zero(),
143                );
144
145                Button::<FixedData>::new(
146                    scope.create(),
147                    FixedData {
148                        area: AbsRect::new(0.0, 20.0, 0.0, 0.0)
149                            + RelRect::new(0.5, 0.0, UNSIZED_AXIS, UNSIZED_AXIS),
150                        anchor: feather_ui::RelPoint::new(0.5, 0.0).into(),
151                        zindex: 0,
152                    },
153                    Slot(feather_ui::APP_SOURCE_ID.into(), 0),
154                    feather_ui::children![fixed::Prop, rect, text],
155                )
156            };
157
158            const NUM_COLUMNS: usize = 5;
159            let rectgrid = {
160                let mut children: im::Vector<Option<Box<ChildOf<dyn grid::Prop>>>> =
161                    im::Vector::new();
162                {
163                    for (i, id) in scope.iter(0..args.count) {
164                        children.push_back(Some(Box::new(Shape::<
165                            GridChild,
166                            { ShapeKind::RoundRect as u8 },
167                        >::new(
168                            id,
169                            GridChild {
170                                area: FILL_DRECT,
171                                x: i % NUM_COLUMNS,
172                                y: i / NUM_COLUMNS,
173                            },
174                            0.0,
175                            0.0,
176                            wide::f32x4::splat(4.0),
177                            sRGB::new(
178                                (0.1 * i as f32) % 1.0,
179                                (0.65 * i as f32) % 1.0,
180                                (0.2 * i as f32) % 1.0,
181                                1.0,
182                            ),
183                            sRGB::transparent(),
184                            DAbsPoint::zero(),
185                        ))));
186                    }
187                }
188
189                GridBox::<GridData>::new(
190                    scope.create(),
191                    GridData {
192                        area: AbsRect::new(0.0, 200.0, 0.0, 0.0)
193                            + RelRect::new(0.0, 0.0, UNSIZED_AXIS, 1.0),
194
195                        rlimits: feather_ui::RelLimits::new(0.0..1.0, 0.0..),
196                        direction: feather_ui::RowDirection::LeftToRight,
197                        rows: [40.0, 20.0, 40.0, 20.0, 40.0, 20.0, 10.0]
198                            .map(DValue::from)
199                            .to_vec(),
200                        columns: [80.0, 40.0, 80.0, 40.0, 80.0].map(DValue::from).to_vec(),
201                        spacing: AbsPoint::new(4.0, 4.0).into(),
202                        padding: AbsRect::new(8.0, 8.0, 8.0, 8.0).into(),
203                    },
204                    children,
205                )
206            };
207
208            let region = Region::new(
209                scope.create(),
210                FixedData {
211                    area: FILL_DRECT,
212                    zindex: 0,
213                    ..Default::default()
214                },
215                feather_ui::children![fixed::Prop, button, rectgrid],
216            );
217            let window = Window::new(
218                scope.create(),
219                winit::window::Window::default_attributes()
220                    .with_title(env!("CARGO_CRATE_NAME"))
221                    .with_resizable(true),
222                Box::new(region),
223            );
224
225            store.1 = im::HashMap::new();
226            store.1.insert(window.id.clone(), Some(window));
227            store.0 = args.clone();
228        }
229        let windows = store.1.clone();
230        (store, windows)
231    }
examples/basic-rs.rs (lines 166-172)
53    fn call(
54        &mut self,
55        mut store: Self::Store,
56        app: CounterState,
57        mut id: ScopeID<'_>,
58    ) -> (Self::Store, im::HashMap<Arc<SourceID>, Option<Window>>) {
59        if store.0 != app {
60            let button = {
61                let text = Text::<FixedData> {
62                    id: gen_id!(id),
63                    props: Rc::new(FixedData {
64                        area: AbsRect::new(8.0, 0.0, 8.0, 0.0)
65                            + RelRect::new(0.0, 0.5, UNSIZED_AXIS, UNSIZED_AXIS),
66                        anchor: feather_ui::RelPoint::new(0.0, 0.5).into(),
67                        ..Default::default()
68                    }),
69                    color: sRGB::new(1.0, 1.0, 0.0, 1.0),
70                    text: format!("Clicks: {}", app.count),
71                    font_size: 40.0,
72                    line_height: 56.0,
73                    align: Some(cosmic_text::Align::Center),
74                    ..Default::default()
75                };
76
77                let rect = shape::round_rect::<DRect>(
78                    gen_id!(id),
79                    feather_ui::FILL_DRECT,
80                    0.0,
81                    0.0,
82                    wide::f32x4::splat(10.0),
83                    sRGB::new(0.2, 0.7, 0.4, 1.0),
84                    sRGB::transparent(),
85                    DAbsPoint::zero(),
86                );
87
88                Button::<FixedData>::new(
89                    gen_id!(id),
90                    FixedData {
91                        area: AbsRect::new(45.0, 45.0, 0.0, 0.0)
92                            + RelRect::new(0.0, 0.0, UNSIZED_AXIS, 1.0),
93
94                        ..Default::default()
95                    },
96                    Slot(feather_ui::APP_SOURCE_ID.into(), 0),
97                    feather_ui::children![fixed::Prop, rect, text],
98                )
99            };
100
101            let block = {
102                let text = Text::<FixedData> {
103                    id: gen_id!(id),
104                    props: Rc::new(FixedData {
105                        area: RelRect::new(0.5, 0.0, UNSIZED_AXIS, UNSIZED_AXIS).into(),
106                        limits: feather_ui::AbsLimits::new(.., 10.0..200.0).into(),
107                        rlimits: feather_ui::RelLimits::new(..1.0, ..),
108                        anchor: feather_ui::RelPoint::new(0.5, 0.0).into(),
109                        padding: AbsRect::new(8.0, 8.0, 8.0, 8.0).into(),
110                        ..Default::default()
111                    }),
112                    text: (0..app.count).map(|_| "█").collect::<String>(),
113                    font_size: 40.0,
114                    line_height: 56.0,
115                    wrap: feather_ui::cosmic_text::Wrap::WordOrGlyph,
116                    align: Some(cosmic_text::Align::Center),
117                    ..Default::default()
118                };
119
120                let rect = shape::round_rect::<DRect>(
121                    gen_id!(id),
122                    feather_ui::FILL_DRECT,
123                    0.0,
124                    0.0,
125                    wide::f32x4::splat(10.0),
126                    sRGB::new(0.7, 0.2, 0.4, 1.0),
127                    sRGB::transparent(),
128                    DAbsPoint::zero(),
129                );
130
131                Region::<FixedData>::new_layer(
132                    gen_id!(id),
133                    FixedData {
134                        area: AbsRect::new(45.0, 245.0, 0.0, 0.0)
135                            + RelRect::new(0.0, 0.0, UNSIZED_AXIS, UNSIZED_AXIS),
136                        limits: feather_ui::AbsLimits::new(100.0..300.0, ..).into(),
137                        ..Default::default()
138                    },
139                    sRGB32::from_alpha(128),
140                    0.0,
141                    feather_ui::children![fixed::Prop, rect, text],
142                )
143            };
144
145            let pixel = shape::round_rect::<DRect>(
146                gen_id!(id),
147                PxRect::new(1.0, 1.0, 2.0, 2.0).into(),
148                0.0,
149                0.0,
150                wide::f32x4::zeroed(),
151                sRGB::new(1.0, 1.0, 1.0, 1.0),
152                sRGB::transparent(),
153                DAbsPoint::zero(),
154            );
155
156            let region = Region::new(
157                gen_id!(id),
158                FixedData {
159                    area: AbsRect::new(90.0, 90.0, 0.0, 200.0)
160                        + RelRect::new(0.0, 0.0, UNSIZED_AXIS, 0.0),
161                    zindex: 0,
162                    ..Default::default()
163                },
164                feather_ui::children![fixed::Prop, button, block, pixel],
165            );
166            let window = Window::new(
167                gen_id!(id),
168                winit::window::Window::default_attributes()
169                    .with_title(env!("CARGO_CRATE_NAME"))
170                    .with_resizable(true),
171                Box::new(region),
172            );
173
174            store.1 = im::HashMap::new();
175            store.1.insert(window.id.clone(), Some(window));
176            store.0 = app.clone();
177        }
178        let windows = store.1.clone();
179        (store, windows)
180    }
examples/image-rs.rs (lines 256-263)
45    fn call(
46        &mut self,
47        _: Self::Store,
48        _: (),
49        mut scope: ScopeID<'_>,
50    ) -> (Self::Store, im::HashMap<Arc<SourceID>, Option<Window>>) {
51        let pixel = Shape::<DRect, { ShapeKind::RoundRect as u8 }>::new(
52            scope.create(),
53            PxRect::new(1.0, 1.0, 2.0, 2.0).into(),
54            0.0,
55            0.0,
56            wide::f32x4::splat(0.0),
57            sRGB::new(1.0, 1.0, 1.0, 1.0),
58            sRGB::transparent(),
59            feather_ui::DAbsPoint::zero(),
60        );
61
62        let mut children: im::Vector<Option<Box<feather_ui::component::ChildOf<dyn fixed::Prop>>>> =
63            im::Vector::new();
64        children.push_back(Some(Box::new(pixel)));
65
66        let mut genimage = |pos: AbsPoint,
67                            w: Option<f32>,
68                            h: Option<f32>,
69                            res: &dyn feather_ui::resource::Location,
70                            size: Option<AbsPoint>| {
71            Image::<DRect>::new(
72                scope.create(),
73                AbsRect::new(
74                    pos.x,
75                    pos.y,
76                    w.map(|x| x + pos.x).unwrap_or_default(),
77                    h.map(|y| y + pos.y).unwrap_or_default(),
78                ) + RelRect::new(
79                    0.0,
80                    0.0,
81                    if w.is_none() { UNSIZED_AXIS } else { 0.0 },
82                    if h.is_none() { UNSIZED_AXIS } else { 0.0 },
83                ),
84                res,
85                size.unwrap_or_default().into(),
86                false,
87            )
88        };
89
90        #[cfg(feature = "png")]
91        {
92            let testimage = PathBuf::from("./premul_test.png");
93
94            children.push_back(Some(Box::new(genimage(
95                AbsPoint::new(0.0, 0.0),
96                Some(100.0),
97                Some(100.0),
98                &testimage,
99                None,
100            ))));
101
102            children.push_back(Some(Box::new(genimage(
103                AbsPoint::new(100.0, 0.0),
104                None,
105                Some(100.0),
106                &testimage,
107                None,
108            ))));
109
110            children.push_back(Some(Box::new(genimage(
111                AbsPoint::new(0.0, 100.0),
112                None,
113                None,
114                &testimage,
115                Some(AbsPoint::new(100.0, 100.0)),
116            ))));
117
118            children.push_back(Some(Box::new(genimage(
119                AbsPoint::new(100.0, 100.0),
120                None,
121                None,
122                &testimage,
123                None,
124            ))));
125        }
126
127        #[cfg(feature = "svg")]
128        {
129            let testsvg = PathBuf::from("./FRI_logo.svg");
130
131            children.push_back(Some(Box::new(genimage(
132                AbsPoint::new(200.0, 0.0),
133                Some(100.0),
134                Some(100.0),
135                &testsvg,
136                None,
137            ))));
138
139            children.push_back(Some(Box::new(genimage(
140                AbsPoint::new(300.0, 0.0),
141                None,
142                Some(100.0),
143                &testsvg,
144                None,
145            ))));
146
147            children.push_back(Some(Box::new(genimage(
148                AbsPoint::new(200.0, 100.0),
149                None,
150                None,
151                &testsvg,
152                Some(AbsPoint::new(100.0, 100.0)),
153            ))));
154
155            children.push_back(Some(Box::new(genimage(
156                AbsPoint::new(300.0, 100.0),
157                None,
158                None,
159                &testsvg,
160                None,
161            ))));
162        }
163
164        #[cfg(feature = "png")]
165        {
166            let testimage = PathBuf::from("./test_color.png");
167
168            children.push_back(Some(Box::new(genimage(
169                AbsPoint::new(0.0, 200.0),
170                Some(100.0),
171                Some(100.0),
172                &testimage,
173                None,
174            ))));
175
176            children.push_back(Some(Box::new(genimage(
177                AbsPoint::new(100.0, 200.0),
178                Some(100.0),
179                None,
180                &testimage,
181                None,
182            ))));
183
184            children.push_back(Some(Box::new(genimage(
185                AbsPoint::new(0.0, 300.0),
186                None,
187                None,
188                &testimage,
189                Some(AbsPoint::new(100.0, 100.0)),
190            ))));
191
192            children.push_back(Some(Box::new(genimage(
193                AbsPoint::new(100.0, 300.0),
194                None,
195                None,
196                &testimage,
197                None,
198            ))));
199        }
200
201        #[cfg(feature = "jxl")]
202        {
203            let testimage = PathBuf::from("./dice.jxl");
204
205            children.push_back(Some(Box::new(genimage(
206                AbsPoint::new(200.0, 200.0),
207                Some(100.0),
208                Some(100.0),
209                &testimage,
210                None,
211            ))));
212
213            children.push_back(Some(Box::new(genimage(
214                AbsPoint::new(300.0, 200.0),
215                Some(100.0),
216                None,
217                &testimage,
218                None,
219            ))));
220
221            children.push_back(Some(Box::new(genimage(
222                AbsPoint::new(200.0, 300.0),
223                None,
224                None,
225                &testimage,
226                Some(AbsPoint::new(100.0, 100.0)),
227            ))));
228
229            children.push_back(Some(Box::new(genimage(
230                AbsPoint::new(300.0, 300.0),
231                None,
232                None,
233                &testimage,
234                None,
235            ))));
236        }
237
238        let region = Region::new(
239            gen_id!(scope),
240            FixedData {
241                area: AbsRect::new(10.0, 10.0, -10.0, -10.0) + RelRect::new(0.0, 0.0, 1.0, 1.0),
242
243                zindex: 0,
244                ..Default::default()
245            },
246            children,
247        );
248
249        #[cfg(feature = "svg")]
250        let icon = Some(
251            feather_ui::resource::load_icon(&std::path::PathBuf::from("./FRI_logo.svg")).unwrap(),
252        );
253        #[cfg(not(feature = "svg"))]
254        let icon = None;
255
256        let window = Window::new(
257            gen_id!(scope),
258            winit::window::Window::default_attributes()
259                .with_title(env!("CARGO_CRATE_NAME"))
260                .with_resizable(true)
261                .with_window_icon(icon),
262            Box::new(region),
263        );
264
265        let mut store = im::HashMap::new();
266        store.insert(window.id.clone(), Some(window));
267        let windows = store.clone();
268        (store, windows)
269    }
Source

pub fn on_window_event( id: Arc<SourceID>, rtree: Weak<Node>, event: WindowEvent, manager: &mut StateManager, driver: Weak<Driver>, ) -> InputResult<()>

Trait Implementations§

Source§

impl Clone for Window

Source§

fn clone(&self) -> Window

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Component for Window

Source§

type Props = Size2D<f32, Pixel>

Source§

fn layout( &self, manager: &mut StateManager, _: &Driver, _: &Arc<SourceID>, ) -> Box<dyn Layout<PxDim>>

Source§

impl FromLua for Window

Source§

fn from_lua(value: Value, _: &Lua) -> Result<Self>

Performs the conversion.
Source§

impl StateMachineChild for Window

Source§

fn init(&self, _: &Weak<Driver>) -> Result<Box<dyn StateMachineWrapper>, Error>

Source§

fn apply_children( &self, f: &mut dyn FnMut(&dyn StateMachineChild) -> Result<()>, ) -> Result<()>

Source§

fn id(&self) -> Arc<SourceID>

Source§

impl UserData for Window

Source§

fn add_fields<F>(fields: &mut F)
where F: UserDataFields<Self>,

Adds custom fields specific to this userdata.
Source§

fn add_methods<M>(methods: &mut M)
where M: UserDataMethods<Self>,

Adds custom methods and operators specific to this userdata.
Source§

fn register(registry: &mut UserDataRegistry<Self>)

Registers this type for use in Lua. Read more

Auto Trait Implementations§

§

impl Freeze for Window

§

impl !RefUnwindSafe for Window

§

impl !Send for Window

§

impl !Sync for Window

§

impl Unpin for Window

§

impl !UnwindSafe for Window

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<U, C> ComponentWrap<U> for C
where C: Component, &'a U: for<'a> From<&'a <C as Component>::Props>, <C as Component>::Props: Sized, U: ?Sized,

Source§

fn layout( &self, state: &mut StateManager, driver: &Driver, window: &Arc<SourceID>, ) -> Box<dyn Layout<U>>

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromLuaMulti for T
where T: FromLua,

Source§

fn from_lua_multi(values: MultiValue, lua: &Lua) -> Result<T, Error>

Performs the conversion. Read more
Source§

fn from_lua_args( args: MultiValue, i: usize, to: Option<&str>, lua: &Lua, ) -> Result<T, Error>

Source§

unsafe fn from_stack_multi(nvals: i32, lua: &RawLua) -> Result<T, Error>

Source§

unsafe fn from_stack_args( nargs: i32, i: usize, to: Option<&str>, lua: &RawLua, ) -> Result<T, Error>

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoLua for T
where T: UserData + MaybeSend + 'static,

Source§

fn into_lua(self, lua: &Lua) -> Result<Value, Error>

Performs the conversion.
Source§

impl<T> IntoLuaMulti for T
where T: IntoLua,

Source§

fn into_lua_multi(self, lua: &Lua) -> Result<MultiValue, Error>

Performs the conversion.
Source§

unsafe fn push_into_stack_multi(self, lua: &RawLua) -> Result<i32, Error>

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> MaybeSend for T