kas_widgets/frame.rs
1// Licensed under the Apache License, Version 2.0 (the "License");
2// you may not use this file except in compliance with the License.
3// You may obtain a copy of the License in the LICENSE-APACHE file or at:
4// https://www.apache.org/licenses/LICENSE-2.0
5
6//! A simple frame
7
8use kas::prelude::*;
9
10impl_scope! {
11 /// A frame around content
12 ///
13 /// This widget provides a simple abstraction: drawing a frame around its
14 /// contents.
15 #[autoimpl(Deref, DerefMut using self.inner)]
16 #[autoimpl(class_traits using self.inner where W: trait)]
17 #[derive(Clone, Default)]
18 #[widget{
19 Data = W::Data;
20 layout = frame!(self.inner);
21 }]
22 pub struct Frame<W: Widget> {
23 core: widget_core!(),
24 #[widget]
25 pub inner: W,
26 }
27
28 impl Self {
29 /// Construct a frame
30 #[inline]
31 pub fn new(inner: W) -> Self {
32 Frame {
33 core: Default::default(),
34 inner,
35 }
36 }
37 }
38}