Skip to main content

MacComboBox

Struct MacComboBox 

Source
pub struct MacComboBox<'a, T: AsRef<str>> { /* private fields */ }
Expand description

Authentic macOS AppKit Combo Box (NSComboBox equivalent).

§Example

use egui_macview::{MacAppearance, MacComboBox, MacTheme};
let theme = MacTheme::new(MacAppearance::Aqua);
let mut font_name = String::from("SF Pro Text");
let fonts = ["Helvetica Neue", "Menlo", "SF Mono", "SF Pro Display", "SF Pro Text"];
MacComboBox::new("font_combo", &mut font_name, &fonts).width(180.0).theme(&theme).show(ui);

Implementations§

Source§

impl<'a, T: AsRef<str>> MacComboBox<'a, T>

Source

pub fn new( id_salt: impl Hash + Debug, text: &'a mut String, items: &'a [T], ) -> Self

Creates a new combo box for an item slice and a mutable text buffer.

Source

pub fn control_size(self, size: MacControlSize) -> Self

Sets the control size (Regular, Small, or Mini).

Source

pub fn theme(self, theme: &'a MacTheme) -> Self

Injects dynamic theme.

Source

pub fn width(self, width: f32) -> Self

Overrides default width.

Source

pub fn fixed_rect(self, rect: Rect) -> Self

Pins the combo box to an exact NIB rectangle.

Source

pub fn frame_height(&self) -> f32

Resolves outer frame height in points.

Source

pub fn visual_height(&self) -> f32

Resolves visual bezel height in points (20.0pt Regular, 16.0pt Small, 13.0pt Mini).

Source

pub fn button_width(&self) -> f32

Resolves right dropdown trigger button width in points.

Source

pub fn text_inset(&self) -> f32

Resolves left text padding inset in points.

Source

pub fn corner_radius(&self) -> f32

Resolves corner radius in points.

Source

pub fn item_height(&self) -> f32

Resolves popover single item row height in points ($18.0,\text{pt}$).

Source

pub fn visible_items(&self) -> usize

Resolves visible items count before scrolling ($5$).

Source

pub fn popover_viewport_height(&self) -> f32

Resolves popover viewport height before scrolling ($90.0,\text{pt}$).

Source

pub fn compute_header_layout(&self, ui: &Ui) -> ComboBoxHeaderLayout

Phase 1: Computes the layout rectangles of the outer frame, text area, and trigger button.

Source

pub fn compute_popover_geometry( &self, ui: &Ui, header_rect: Rect, item_count: usize, ) -> ComboBoxPopoverGeometry

Phase 2: Computes popover dimensions and screen-edge boundary clamping.

Source

pub fn show(self, ui: &mut Ui) -> Response

Shows the combo box widget.

Auto Trait Implementations§

§

impl<'a, T> !UnwindSafe for MacComboBox<'a, T>

§

impl<'a, T> Forget for MacComboBox<'a, T>

§

impl<'a, T> Freeze for MacComboBox<'a, T>
where &'a [T]: Freeze,

§

impl<'a, T> Move for MacComboBox<'a, T>

§

impl<'a, T> RefUnwindSafe for MacComboBox<'a, T>
where &'a [T]: RefUnwindSafe,

§

impl<'a, T> Send for MacComboBox<'a, T>
where &'a [T]: Send,

§

impl<'a, T> Sync for MacComboBox<'a, T>
where &'a [T]: Sync,

§

impl<'a, T> Unpin for MacComboBox<'a, T>
where &'a [T]: Unpin,

§

impl<'a, T> UnsafeUnpin for MacComboBox<'a, T>
where &'a [T]: UnsafeUnpin,

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

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.