pub struct Select {
pub objc: ObjcProperty,
pub top: LayoutAnchorY,
pub leading: LayoutAnchorX,
pub left: LayoutAnchorX,
pub trailing: LayoutAnchorX,
pub right: LayoutAnchorX,
pub bottom: LayoutAnchorY,
pub width: LayoutAnchorDimension,
pub height: LayoutAnchorDimension,
pub center_x: LayoutAnchorX,
pub center_y: LayoutAnchorY,
/* private fields */
}
Expand description
Wraps NSPopUpSelect
on AppKit. Not currently implemented for iOS.
Acts like a <select>
dropdown, if you’re familiar with HTML. Use for dropdown option
selecting.
Some properties are platform-specific; see the documentation for further information.
use cacao::select::Select;
use cacao::view::View;
use crate::cacao::layout::Layout;
let mut dropdown = Select::new();
let my_view : View<()> = todo!();
// Make sure you don't let your Select drop for as long as you need it.
my_view.add_subview(&dropdown);
Fields
objc: ObjcProperty
A handle for the underlying Objective-C object.
top: LayoutAnchorY
A pointer to the Objective-C runtime top layout constraint.
leading: LayoutAnchorX
A pointer to the Objective-C runtime leading layout constraint.
left: LayoutAnchorX
A pointer to the Objective-C runtime left layout constraint.
trailing: LayoutAnchorX
A pointer to the Objective-C runtime trailing layout constraint.
right: LayoutAnchorX
A pointer to the Objective-C runtime right layout constraint.
bottom: LayoutAnchorY
A pointer to the Objective-C runtime bottom layout constraint.
width: LayoutAnchorDimension
A pointer to the Objective-C runtime width layout constraint.
height: LayoutAnchorDimension
A pointer to the Objective-C runtime height layout constraint.
center_x: LayoutAnchorX
A pointer to the Objective-C runtime center X layout constraint.
center_y: LayoutAnchorY
A pointer to the Objective-C runtime center Y layout constraint.
Implementations
sourceimpl Select
impl Select
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new Select
instance, configures it appropriately,
and retains the necessary Objective-C runtime pointer.
sourcepub fn set_action<F: Fn() + Send + Sync + 'static>(&mut self, action: F)
pub fn set_action<F: Fn() + Send + Sync + 'static>(&mut self, action: F)
Attaches a callback for selection events.
Much like Button
, this really needs to be revisited.
Really, this is not ideal.
I cannot stress this enough.
sourcepub fn set_pulls_down(&self, pulls_down: bool)
pub fn set_pulls_down(&self, pulls_down: bool)
Sets whether this pulls down (dropdown) or pops up.
sourcepub fn remove_all_items(&self)
pub fn remove_all_items(&self)
Removes all items from the dropdown list.
sourcepub fn remove_item_at_index(&self, index: usize)
pub fn remove_item_at_index(&self, index: usize)
Remove the item at the specified index.
pub fn set_selected_index(&self, index: NSInteger)
sourcepub fn get_selected_index(&self) -> usize
pub fn get_selected_index(&self) -> usize
Gets the selected index.
Trait Implementations
sourceimpl Control for &Select
impl Control for &Select
sourcefn set_enabled(&self, is_enabled: bool)
fn set_enabled(&self, is_enabled: bool)
Whether this control is enabled or not.
sourcefn set_control_size(&self, size: ControlSize)
fn set_control_size(&self, size: ControlSize)
Sets the underlying control size.
sourceimpl Control for Select
impl Control for Select
sourcefn set_enabled(&self, is_enabled: bool)
fn set_enabled(&self, is_enabled: bool)
Whether this control is enabled or not.
sourcefn set_control_size(&self, size: ControlSize)
fn set_control_size(&self, size: ControlSize)
Sets the underlying control size.
sourceimpl Layout for &Select
impl Layout for &Select
sourcefn add_subview<V: Layout>(&self, _view: &V)
fn add_subview<V: Layout>(&self, _view: &V)
Adds another Layout-backed control or view as a subview of this view.
sourcefn set_needs_display(&self, needs_display: bool)
fn set_needs_display(&self, needs_display: bool)
Sets whether this needs to be redrawn before being displayed. Read more
sourcefn remove_from_superview(&self)
fn remove_from_superview(&self)
Removes a control or view from the superview.
sourcefn set_frame<R: Into<CGRect>>(&self, rect: R)
fn set_frame<R: Into<CGRect>>(&self, rect: R)
Sets the frame
for the view this trait is applied to. Read more
sourcefn set_translates_autoresizing_mask_into_constraints(&self, translates: bool)
fn set_translates_autoresizing_mask_into_constraints(&self, translates: bool)
Sets whether the view for this trait should translate autoresizing masks into layout constraints. Read more
Sets whether the view for this is hidden or not. Read more
Returns whether this is hidden or not. Read more
Returns whether this is hidden, or whether an ancestor view is hidden.
sourcefn register_for_dragged_types(&self, types: &[PasteboardType])
fn register_for_dragged_types(&self, types: &[PasteboardType])
Register this view for drag and drop operations. Read more
sourcefn unregister_dragged_types(&self)
fn unregister_dragged_types(&self)
Unregisters this as a target for drag and drop operations. Read more
sourcefn set_posts_frame_change_notifications(&self, posts: bool)
fn set_posts_frame_change_notifications(&self, posts: bool)
Sets whether this posts notifications when the frame rectangle changes. Read more
sourcefn set_posts_bounds_change_notifications(&self, posts: bool)
fn set_posts_bounds_change_notifications(&self, posts: bool)
Sets whether this posts notifications when the bounds rectangle changes. Read more
sourceimpl Layout for Select
impl Layout for Select
sourcefn add_subview<V: Layout>(&self, _view: &V)
fn add_subview<V: Layout>(&self, _view: &V)
Adds another Layout-backed control or view as a subview of this view.
sourcefn set_needs_display(&self, needs_display: bool)
fn set_needs_display(&self, needs_display: bool)
Sets whether this needs to be redrawn before being displayed. Read more
sourcefn remove_from_superview(&self)
fn remove_from_superview(&self)
Removes a control or view from the superview.
sourcefn set_frame<R: Into<CGRect>>(&self, rect: R)
fn set_frame<R: Into<CGRect>>(&self, rect: R)
Sets the frame
for the view this trait is applied to. Read more
sourcefn set_translates_autoresizing_mask_into_constraints(&self, translates: bool)
fn set_translates_autoresizing_mask_into_constraints(&self, translates: bool)
Sets whether the view for this trait should translate autoresizing masks into layout constraints. Read more
Sets whether the view for this is hidden or not. Read more
Returns whether this is hidden or not. Read more
Returns whether this is hidden, or whether an ancestor view is hidden.
sourcefn register_for_dragged_types(&self, types: &[PasteboardType])
fn register_for_dragged_types(&self, types: &[PasteboardType])
Register this view for drag and drop operations. Read more
sourcefn unregister_dragged_types(&self)
fn unregister_dragged_types(&self)
Unregisters this as a target for drag and drop operations. Read more
sourcefn set_posts_frame_change_notifications(&self, posts: bool)
fn set_posts_frame_change_notifications(&self, posts: bool)
Sets whether this posts notifications when the frame rectangle changes. Read more
sourcefn set_posts_bounds_change_notifications(&self, posts: bool)
fn set_posts_bounds_change_notifications(&self, posts: bool)
Sets whether this posts notifications when the bounds rectangle changes. Read more
Auto Trait Implementations
impl !RefUnwindSafe for Select
impl !Send for Select
impl !Sync for Select
impl Unpin for Select
impl !UnwindSafe for Select
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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