pub struct RuleBuilder { /* private fields */ }
Expand description
Builder that adds style declarations to a selected rule.
Implementations§
Source§impl RuleBuilder
impl RuleBuilder
Sourcepub fn new<S: AsRef<str>>(selector: S) -> Self
pub fn new<S: AsRef<str>>(selector: S) -> Self
Constructs a new RuleBuilder
for the given selector.
The selector must follow the same syntax as the .pwss file format.
Panics if the selector can’t be parsed.
use pixel_widgets::prelude::*;
// Sets the background of the first direct child of any window widget
RuleBuilder::new("window > * :nth-child(0)").background_color(Color::red());
Sourcepub fn background_none(self) -> Self
pub fn background_none(self) -> Self
Clears the background
Sourcepub fn background_color(self, color: Color) -> Self
pub fn background_color(self, color: Color) -> Self
Sets the background to a color
Sourcepub fn background_image(self, image_data: ImageId, color: Color) -> Self
pub fn background_image(self, image_data: ImageId, color: Color) -> Self
Sets the background to a colored image
Sourcepub fn background_patch(self, patch: PatchId, color: Color) -> Self
pub fn background_patch(self, patch: PatchId, color: Color) -> Self
Sets the background to a colored patch
Sourcepub fn padding_all(self, value: f32) -> Self
pub fn padding_all(self, value: f32) -> Self
Sets all padding values to the same value
Sourcepub fn padding_horizontal(self, value: f32) -> Self
pub fn padding_horizontal(self, value: f32) -> Self
Sets horizontal padding values to the same value
Sourcepub fn padding_vertical(self, value: f32) -> Self
pub fn padding_vertical(self, value: f32) -> Self
Sets vertical padding values to the same value
Sourcepub fn padding_left(self, value: f32) -> Self
pub fn padding_left(self, value: f32) -> Self
Sets left padding
Sourcepub fn padding_right(self, value: f32) -> Self
pub fn padding_right(self, value: f32) -> Self
Sets right padding
Sourcepub fn padding_top(self, value: f32) -> Self
pub fn padding_top(self, value: f32) -> Self
Sets top padding
Sourcepub fn padding_bottom(self, value: f32) -> Self
pub fn padding_bottom(self, value: f32) -> Self
Sets bottom padding
Sourcepub fn margin_all(self, value: f32) -> Self
pub fn margin_all(self, value: f32) -> Self
Sets all margin values to the same value
Sourcepub fn margin_horizontal(self, value: f32) -> Self
pub fn margin_horizontal(self, value: f32) -> Self
Sets horizontal margin values to the same value
Sourcepub fn margin_vertical(self, value: f32) -> Self
pub fn margin_vertical(self, value: f32) -> Self
Sets vertical margin values to the same value
Sourcepub fn margin_left(self, value: f32) -> Self
pub fn margin_left(self, value: f32) -> Self
Sets the left margin
Sourcepub fn margin_right(self, value: f32) -> Self
pub fn margin_right(self, value: f32) -> Self
Sets the right margin
Sourcepub fn margin_top(self, value: f32) -> Self
pub fn margin_top(self, value: f32) -> Self
Sets the top margin
Sourcepub fn margin_bottom(self, value: f32) -> Self
pub fn margin_bottom(self, value: f32) -> Self
Sets the bottom margin
Sourcepub fn fill_width(self) -> Self
pub fn fill_width(self) -> Self
Sets the preferred width to Size::Fill(1)
Sourcepub fn fill_height(self) -> Self
pub fn fill_height(self) -> Self
Sets the preferred height to Size::Fill(1)
Sourcepub fn layout_direction(self, value: Direction) -> Self
pub fn layout_direction(self, value: Direction) -> Self
Sets the direction for layouting
Sourcepub fn align_horizontal(self, value: Align) -> Self
pub fn align_horizontal(self, value: Align) -> Self
Sets the horizontal alignment
Sourcepub fn align_vertical(self, value: Align) -> Self
pub fn align_vertical(self, value: Align) -> Self
Sets the vertical alignment
Sourcepub fn remove_flag(self, value: String) -> Self
pub fn remove_flag(self, value: String) -> Self
Removes a flag from the stylesheet