Skip to main content

agg_gui/widgets/text_field/
layout_builders.rs

1//! Layout-trait builders for `TextField`.
2//!
3//! Carved out of `text_field.rs` so the parent module stays under the
4//! project's 800-line cap.  Every method here is a thin chained-style
5//! setter on `WidgetBase` — they don't touch text-editing state, so
6//! they read better as their own cohesive block.
7
8use super::TextField;
9use crate::geometry::Size;
10use crate::layout_props::{HAnchor, Insets, VAnchor};
11
12impl TextField {
13    pub fn with_margin(mut self, m: Insets) -> Self {
14        self.base.margin = m;
15        self
16    }
17    pub fn with_h_anchor(mut self, h: HAnchor) -> Self {
18        self.base.h_anchor = h;
19        self
20    }
21    pub fn with_v_anchor(mut self, v: VAnchor) -> Self {
22        self.base.v_anchor = v;
23        self
24    }
25    pub fn with_min_size(mut self, s: Size) -> Self {
26        self.base.min_size = s;
27        self
28    }
29    pub fn with_max_size(mut self, s: Size) -> Self {
30        self.base.max_size = s;
31        self
32    }
33}