Struct me3_framework::overlay::Button
source · [−]pub struct Button { /* private fields */ }
Expand description
Clickable button with text.
See also Ui::button
.
if ui.add(egui::Button::new("Click me")).clicked() {
do_stuff();
}
// A greyed-out and non-interactive button:
if ui.add_enabled(false, egui::Button::new("Can't click this")).clicked() {
unreachable!();
}
Implementations
sourceimpl Button
impl Button
pub fn new(text: impl Into<WidgetText>) -> Button
sourcepub fn image_and_text(
texture_id: TextureId,
size: impl Into<Vec2>,
text: impl Into<WidgetText>
) -> Button
pub fn image_and_text(
texture_id: TextureId,
size: impl Into<Vec2>,
text: impl Into<WidgetText>
) -> Button
Creates a button with an image to the left of the text. The size of the image as displayed is defined by the size Vec2 provided.
sourcepub fn wrap(self, wrap: bool) -> Button
pub fn wrap(self, wrap: bool) -> Button
If true
, the text will wrap to stay within the max width of the Ui
.
By default Self::wrap
will be true in vertical layouts
and horizontal layouts with wrapping,
and false on non-wrapping horizontal layouts.
Note that any \n
in the text will always produce a new line.
sourcepub fn fill(self, fill: impl Into<Color32>) -> Button
pub fn fill(self, fill: impl Into<Color32>) -> Button
Override background fill color. Note that this will override any on-hover effects. Calling this will also turn on the frame.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Button
impl Send for Button
impl Sync for Button
impl Unpin for Button
impl UnwindSafe for Button
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more