Struct NSMenuItem

Source
pub struct NSMenuItem(/* private fields */);

Implementations§

Source§

impl NSMenuItem

Source

pub unsafe fn set_submenu(&self, menu: *mut NSMenu)

Examples found in repository?
examples/hello_triangle.rs (line 139)
129unsafe fn setup_top_menu(app: &NSApplication) {
130  let mut app_menu = NSMenu::new();
131  {
132    let mut title = util::string("Quit");
133    let action = cobin::util::selector("terminate:");
134    let mut key = util::string("q");
135    app_menu.add_item_with_title_action_key_equivalent(&mut *title, action, &mut *key);
136  }
137
138  let mut app_item = NSMenuItem::new();
139  app_item.set_submenu(&mut *app_menu);
140
141  let mut bar = NSMenu::new();
142  bar.add_item(&mut *app_item);
143
144  app.set_main_menu(&mut *bar);
145}

Trait Implementations§

Source§

impl Message for NSMenuItem

Source§

unsafe fn send_message<A, R>( &self, sel: Sel, args: A, ) -> Result<R, MessageError>
where Self: Sized, A: MessageArguments, R: Any,

Sends a message to self with the given selector and arguments. Read more
Source§

fn verify_message<A, R>(&self, sel: Sel) -> Result<(), MessageError>
where Self: Sized, A: EncodeArguments, R: Encode,

Verifies that the argument and return types match the encoding of the method for the given selector. Read more
Source§

impl NSObjectBase for NSMenuItem

Source§

fn class_name() -> &'static str

Source§

unsafe fn alloc() -> Strong<Self>

Source§

unsafe fn new() -> Strong<Self>

Source§

unsafe fn get_class() -> &'static Class

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
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> NSObjectProtocol for T
where T: NSObjectBase,

Source§

unsafe fn release(&self)

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.