pub struct Button {Show 29 fields
pub label: Option<Text>,
pub label_size: f32,
pub text_alignment: Alignment,
pub pos_x: usize,
pub pos_y: usize,
pub width: usize,
pub height: usize,
pub border_size_idle: usize,
pub border_size_hovered: usize,
pub border_size_clicked: usize,
pub shadow_size_idle: usize,
pub shadow_size_hovered: usize,
pub shadow_size_clicked: usize,
pub shadow_intensity_idle: u8,
pub shadow_intensity_hovered: u8,
pub shadow_intensity_clicked: u8,
pub label_col_idle: Color,
pub border_col_idle: Color,
pub bg_col_idle: Color,
pub label_col_hovered: Color,
pub border_col_hovered: Color,
pub bg_col_hovered: Color,
pub label_col_clicked: Color,
pub border_col_clicked: Color,
pub bg_col_clicked: Color,
pub button_type: ButtonType,
pub state: ButtonState,
pub toggled: bool,
pub radius: usize,
}Fields§
§label: Option<Text>§label_size: f32§text_alignment: Alignment§pos_x: usizeThe Button’s horizontal position in pixels
pos_y: usizeThe Button’s vertical position in pixels
width: usizeThe Button’s width in pixels
height: usizeThe Button’s height in pixels
border_size_idle: usizeThe Button’s border size for when the Button is idle
border_size_hovered: usizeThe Button’s border size for when the Button is hovered
border_size_clicked: usizeThe Button’s border size for when the Button is clicked
shadow_size_idle: usizeButton-wide shadow size
shadow_size_hovered: usizeButton-wide shadow size when hoverd
shadow_size_clicked: usizeButton-wide shadow size when clicked
shadow_intensity_idle: u8How intense the shadows should be
shadow_intensity_hovered: u8How intense the shadows should be when hovered
shadow_intensity_clicked: u8How intense the shadows should be when clicked
label_col_idle: ColorThe color of the Button’s label
border_col_idle: ColorThe color of the Button’s border
bg_col_idle: ColorThe color of the Button’s background
label_col_hovered: ColorThe color of the Button’s label when hovered
border_col_hovered: ColorThe color of the Button’s border when hovered
bg_col_hovered: ColorThe color of the Button’s background when hovered
label_col_clicked: ColorThe color of the Button’s label when clicked
border_col_clicked: ColorThe color of the Button’s border when clicked
bg_col_clicked: ColorThe color of the Button’s background when clicked
Whether the Button is a push button or a toggle button
state: ButtonStateThe current state of the Button. Can be Idle, Hovered or Clicked
toggled: boolWhether the toggle button is currently toggled on (only relevant for ButtonType::Toggle)
radius: usizeCorner radius for rounded edges
Implementations§
Source§impl Button
impl Button
Sourcepub fn label(self, text: &str, font: Font, size: f32) -> Self
pub fn label(self, text: &str, font: Font, size: f32) -> Self
Sets the text to be displayed inside the button
Sourcepub fn label_alignment(self, alignment: Alignment) -> Self
pub fn label_alignment(self, alignment: Alignment) -> Self
Determines whether the button label is left-aligned, right-aligned or centered
Sourcepub fn position(self, x: usize, y: usize) -> Self
pub fn position(self, x: usize, y: usize) -> Self
Sets the position of the button inside the window in pixel coordinates
Sourcepub fn shadow(self, size: usize, intensity: u8) -> Self
pub fn shadow(self, size: usize, intensity: u8) -> Self
Determines whether to draw shadows and how large and intense they should be Sets values for idle, hovered and clicked state
Sourcepub fn idle_shadow(self, size: usize, intensity: u8) -> Self
pub fn idle_shadow(self, size: usize, intensity: u8) -> Self
Specifically sets the idle shadow size and intensity
Sourcepub fn hover_shadow(self, size: usize, intensity: u8) -> Self
pub fn hover_shadow(self, size: usize, intensity: u8) -> Self
Specifically sets the shadow size and intensity for when the Button is hovered
Sourcepub fn click_shadow(self, size: usize, intensity: u8) -> Self
pub fn click_shadow(self, size: usize, intensity: u8) -> Self
Specifically sets the shadow size and intensity for when the Button is clicked
Sourcepub fn label_color(self, color: Color) -> Self
pub fn label_color(self, color: Color) -> Self
Sets the label text color for idle, hovered and clicked state
Sourcepub fn idle_label_col(self, color: Color) -> Self
pub fn idle_label_col(self, color: Color) -> Self
Specifically sets the label color for when the Button is idle
Sourcepub fn hover_label_col(self, color: Color) -> Self
pub fn hover_label_col(self, color: Color) -> Self
Specifically sets the label color for when the Button is hovered
Sourcepub fn click_label_col(self, color: Color) -> Self
pub fn click_label_col(self, color: Color) -> Self
Specifically sets the label color for when the Button is clicked
Sourcepub fn border_color(self, color: Color) -> Self
pub fn border_color(self, color: Color) -> Self
Sets the border color for idle, hovered and clicked state
Sourcepub fn background(self, color: Color) -> Self
pub fn background(self, color: Color) -> Self
Sets the button’s background color for idle, hovered and clicked state
Sourcepub fn idle_bg(self, color: Color) -> Self
pub fn idle_bg(self, color: Color) -> Self
Specifically sets the background color for when the Button is idle
Sourcepub fn hover_bg(self, color: Color) -> Self
pub fn hover_bg(self, color: Color) -> Self
Specifically sets the background color for when the Button is hovered
Sourcepub fn click_bg(self, color: Color) -> Self
pub fn click_bg(self, color: Color) -> Self
Specifically sets the background color for when the Button is clicked
Determines whether the button is a push button or toggle button