rust_macios/appkit/
ns_text_field.rs1use objc::{msg_send, sel, sel_impl};
2
3use crate::{foundation::NSString, objective_c_runtime::traits::FromId, object};
4
5use super::{interface_impl, INSControl, INSResponder, INSView};
6
7object! {
8 unsafe pub struct NSTextField;
10}
11
12impl INSResponder for NSTextField {}
13
14impl INSView for NSTextField {}
15
16impl INSControl for NSTextField {}
17
18#[interface_impl(NSControl)]
19impl NSTextField {
20 #[method]
25 pub fn label_with_string(string: NSString) -> Self
26 where
27 Self: Sized + FromId,
28 {
29 unsafe { Self::from_id(msg_send![Self::m_class(), labelWithString: string]) }
30 }
31
32 #[method]
34 pub fn text_field_with_string(string: NSString) -> Self
35 where
36 Self: Sized + FromId,
37 {
38 unsafe { Self::from_id(msg_send![Self::m_class(), textFieldWithString: string]) }
39 }
40
41 #[method]
43 pub fn text_view_with_string(string: NSString) -> Self
44 where
45 Self: Sized + FromId,
46 {
47 unsafe { Self::from_id(msg_send![Self::m_class(), textViewWithString: string]) }
48 }
49}