1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
use crate::view::{SizeConstraint, View};
use crate::views::ResizedView;
use crate::Vec2;
pub trait Resizable: View + Sized {
#[deprecated(note = "Use `Resizable::resized()` instead.")]
fn boxed(
self,
width: SizeConstraint,
height: SizeConstraint,
) -> ResizedView<Self> {
self.resized(width, height)
}
fn resized(
self,
width: SizeConstraint,
height: SizeConstraint,
) -> ResizedView<Self> {
ResizedView::new(width, height, self)
}
fn fixed_size<S: Into<Vec2>>(self, size: S) -> ResizedView<Self> {
ResizedView::with_fixed_size(size, self)
}
fn fixed_width(self, width: usize) -> ResizedView<Self> {
ResizedView::with_fixed_width(width, self)
}
fn fixed_height(self, height: usize) -> ResizedView<Self> {
ResizedView::with_fixed_height(height, self)
}
fn full_screen(self) -> ResizedView<Self> {
ResizedView::with_full_screen(self)
}
fn full_width(self) -> ResizedView<Self> {
ResizedView::with_full_width(self)
}
fn full_height(self) -> ResizedView<Self> {
ResizedView::with_full_height(self)
}
fn max_size<S: Into<Vec2>>(self, size: S) -> ResizedView<Self> {
ResizedView::with_max_size(size, self)
}
fn max_width(self, max_width: usize) -> ResizedView<Self> {
ResizedView::with_max_width(max_width, self)
}
fn max_height(self, max_height: usize) -> ResizedView<Self> {
ResizedView::with_max_height(max_height, self)
}
fn min_size<S: Into<Vec2>>(self, size: S) -> ResizedView<Self> {
ResizedView::with_min_size(size, self)
}
fn min_width(self, min_width: usize) -> ResizedView<Self> {
ResizedView::with_min_width(min_width, self)
}
fn min_height(self, min_height: usize) -> ResizedView<Self> {
ResizedView::with_min_height(min_height, self)
}
}
impl<T: View> Resizable for T {}