Skip to main content

RibbonItem

Struct RibbonItem 

Source
pub struct RibbonItem { /* private fields */ }
Expand description

A command in a ribbon group: a button, a toggle, or a button with a menu.

Implementations§

Source§

impl RibbonItem

Source

pub fn button(label: impl Into<String>, icon: IconName) -> Self

A command button (large by default).

Source

pub fn toggle( label: impl Into<String>, icon: IconName, value: Binding<bool>, ) -> Self

A button that stays pressed while value is true (Bold, Ruler…).

Source

pub fn large(self) -> Self

Shows the item as a large button.

Source

pub fn small(self) -> Self

Shows the item as a small icon-and-label row.

Source

pub fn icon_only(self) -> Self

Shows only the icon, with the label as tooltip.

Source

pub fn on_click(self, handler: impl Fn() + 'static) -> Self

Runs handler when the item is clicked.

Source

pub fn menu_item(self, item: MenuItem) -> Self

Adds a drop-down item; a button with items opens a menu.

Source

pub fn menu_separator(self) -> Self

Appends a separator to the drop-down menu.

Source

pub fn enabled(self, enabled: bool) -> Self

Enables or disables the item; disabled items are dimmed and ignore clicks.

Source

pub fn tooltip(self, text: impl Into<String>) -> Self

Hover text (defaults to the label for icon-only items).

Trait Implementations§

Source§

impl Debug for RibbonItem

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more