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>
impl<'a, T: AsRef<str>> MacComboBox<'a, T>
Sourcepub fn new(
id_salt: impl Hash + Debug,
text: &'a mut String,
items: &'a [T],
) -> Self
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.
Sourcepub fn control_size(self, size: MacControlSize) -> Self
pub fn control_size(self, size: MacControlSize) -> Self
Sets the control size (Regular, Small, or Mini).
Sourcepub fn fixed_rect(self, rect: Rect) -> Self
pub fn fixed_rect(self, rect: Rect) -> Self
Pins the combo box to an exact NIB rectangle.
Sourcepub fn frame_height(&self) -> f32
pub fn frame_height(&self) -> f32
Resolves outer frame height in points.
Sourcepub fn visual_height(&self) -> f32
pub fn visual_height(&self) -> f32
Resolves visual bezel height in points (20.0pt Regular, 16.0pt Small, 13.0pt Mini).
Resolves right dropdown trigger button width in points.
Sourcepub fn text_inset(&self) -> f32
pub fn text_inset(&self) -> f32
Resolves left text padding inset in points.
Sourcepub fn corner_radius(&self) -> f32
pub fn corner_radius(&self) -> f32
Resolves corner radius in points.
Sourcepub fn item_height(&self) -> f32
pub fn item_height(&self) -> f32
Resolves popover single item row height in points ($18.0,\text{pt}$).
Sourcepub fn visible_items(&self) -> usize
pub fn visible_items(&self) -> usize
Resolves visible items count before scrolling ($5$).
Sourcepub fn popover_viewport_height(&self) -> f32
pub fn popover_viewport_height(&self) -> f32
Resolves popover viewport height before scrolling ($90.0,\text{pt}$).
Sourcepub fn compute_header_layout(&self, ui: &Ui) -> ComboBoxHeaderLayout
pub fn compute_header_layout(&self, ui: &Ui) -> ComboBoxHeaderLayout
Phase 1: Computes the layout rectangles of the outer frame, text area, and trigger button.
Sourcepub fn compute_popover_geometry(
&self,
ui: &Ui,
header_rect: Rect,
item_count: usize,
) -> ComboBoxPopoverGeometry
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.
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>
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>
impl<'a, T> Sync for MacComboBox<'a, T>
impl<'a, T> Unpin for MacComboBox<'a, T>
impl<'a, T> UnsafeUnpin for MacComboBox<'a, T>where
&'a [T]: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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