Skip to main content

draw_tool_button

Function draw_tool_button 

Source
pub fn draw_tool_button(
    ui: &mut Ui,
    icon: &Icon,
    tooltip: &str,
    is_selected: bool,
) -> Response
Expand description

Left toolbar button (no dropdown arrow).

Layout:

  • Outer rect: 52×38px
  • Inner hover rect: 8.5px horizontal margin, 1.5px vertical margin
  • Inner rounding: the theme’s medium radius
  • Icon: optically sized and centered in outer rect

A selected tool has a neutral fill; a latched utility uses contrasting ink and fill. The tooltip opens to the right of the bar, so it never covers the next button.

§Arguments

  • ui - The egui UI context
  • icon - The Icon to display
  • tooltip - Hover tooltip text, also the accessible name
  • is_selected - Whether button is selected/active

§Returns

The egui Response for click handling.