Skip to main content

MacWidget

Struct MacWidget 

Source
pub struct MacWidget(WidgetKind);

Tuple Fields§

§0: WidgetKind

Implementations§

Source§

impl MacWidget

Source

pub(crate) fn label( mtm: MainThreadMarker, text: &str, style: LabelStyle, ) -> Self

Source

pub(crate) fn button( mtm: MainThreadMarker, title: &str, (style, icon): (ButtonStyle, Icon), selected: Option<bool>, on_click: ClickHandler, ) -> Self

A button made with a selection is an on-off button, shown on while selected.

Source

pub(crate) fn nav_item( mtm: MainThreadMarker, title: &str, icon: Icon, badge: &str, selected: bool, on_click: ClickHandler, ) -> Self

Source

pub(crate) fn text_field( mtm: MainThreadMarker, text: &str, placeholder: &str, on_change: TextHandler, on_submit: Option<ClickHandler>, ) -> Self

Source

pub(crate) fn text_area( mtm: MainThreadMarker, text: &str, lines: u32, on_change: TextHandler, ) -> Self

Plain text over lines lines, which wraps and scrolls; Return starts a new line.

Source

pub(crate) fn checkbox( mtm: MainThreadMarker, title: &str, checked: bool, on_toggle: ToggleHandler, ) -> Self

Source

pub(crate) fn progress(mtm: MainThreadMarker, percent: Option<i64>) -> Self

A bar filled to percent, or an animated one while work goes on without one.

Source

pub(crate) fn switch( mtm: MainThreadMarker, title: &str, on: bool, on_toggle: ToggleHandler, ) -> Self

Source

pub(crate) fn slider( mtm: MainThreadMarker, value: i64, min: i64, max: i64, on_change: NumberHandler, ) -> Self

Slides smoothly, reporting the whole number nearest the knob as it changes.

Source

pub(crate) fn picker( mtm: MainThreadMarker, options: &[String], selected: &str, on_pick: TextHandler, ) -> Self

Source

pub(crate) fn image( mtm: MainThreadMarker, path: Option<&Path>, size: ImageSize, ) -> Self

An image view that scales its image to fit, keeping its shape, and centres it.

Source

pub(crate) fn set_image(&self, path: Option<&Path>)

Shows the image in the file at path, or nothing when there is none or it can’t be read.

Source

pub(crate) fn divider(mtm: MainThreadMarker) -> Self

Source

pub(crate) fn context_menu( mtm: MainThreadMarker, entries: &[MenuEntry<usize>], on_select: MenuHandler, ) -> Self

Source

pub(crate) fn drop_target(mtm: MainThreadMarker, on_drop: DropHandler) -> Self

Source

pub(crate) fn surface(mtm: MainThreadMarker, surface: Surface) -> Self

Source

pub(crate) fn scroll(mtm: MainThreadMarker) -> Self

A borderless area that scrolls its content up and down, on whatever is behind it. Where scroll bars take space, the bar always shows, in the strip kept for it.

Source

pub(crate) fn scroll_bar_width(mtm: MainThreadMarker) -> f32

The width a scroll bar takes from the content beside it; overlay scroll bars, the default with a trackpad, take none.

Source

pub(crate) fn content_view(&self) -> &NSView

The view a scroll area’s content goes in.

§Panics

When this isn’t a scroll area, which only a runtime bug would ask.

Source

pub(crate) fn set_scroll_content(&self, size: Size)

Source

pub(crate) fn view(&self) -> &NSView

Source

pub(crate) fn set_text(&self, text: &str)

Source

pub(crate) fn set_checked(&self, checked: bool)

Source

pub(crate) fn set_badge(&self, badge: &str)

Source

pub(crate) fn set_value(&self, value: i64)

Source

pub(crate) fn set_options(&self, options: &[String])

Replaces a picker’s items, keeping the one it shows if it is still there. Items are added through the menu, which keeps any with the same title.

Source

pub(crate) fn measure(&self) -> Size

Source

pub(crate) fn set_frame(&self, frame: Frame)

Source

pub(crate) fn remove(self)

Takes the control off screen. Its handler may be running right now (a button that removes itself), so the control and its handler are released at the end of the current event instead of immediately.

Trait Implementations§

Source§

impl Debug for MacWidget

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> AutoreleaseSafe for T
where T: ?Sized,

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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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.