Props, reconciler fixes, demo fixes
This commit is contained in:
parent
47163c64f9
commit
290b57d336
17 changed files with 284 additions and 190 deletions
|
|
@ -24,6 +24,7 @@ static ALCHEMY_DELEGATE: &str = "alchemyDelegate";
|
|||
/// colors and so forth.
|
||||
#[derive(Debug)]
|
||||
pub struct Text {
|
||||
text: String,
|
||||
inner_mut: Id<Object>,
|
||||
inner_share: ShareId<Object>,
|
||||
background_color: Id<Object>,
|
||||
|
|
@ -49,6 +50,7 @@ impl Text {
|
|||
};
|
||||
|
||||
Text {
|
||||
text: "".into(),
|
||||
inner_mut: inner_mut,
|
||||
inner_share: inner_share,
|
||||
background_color: Color::transparent().into_nscolor(),
|
||||
|
|
@ -88,9 +90,13 @@ impl Text {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn set_text(&mut self, text: &str) {
|
||||
pub fn set_text(&mut self, text: String) {
|
||||
self.text = text;
|
||||
}
|
||||
|
||||
pub fn render(&mut self) {
|
||||
unsafe {
|
||||
let string_value = NSString::alloc(nil).init_str(text);
|
||||
let string_value = NSString::alloc(nil).init_str(&self.text);
|
||||
msg_send![&*self.inner_mut, setStringValue:string_value];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ impl Window {
|
|||
/// Creates a new `NSWindow` instance, configures it appropriately (e.g, titlebar appearance),
|
||||
/// injects an `NSObject` delegate wrapper, and retains the necessary Objective-C runtime
|
||||
/// pointers.
|
||||
pub fn new<T: AppDelegate>(window_id: usize, content_view: &Component, app_ptr: *const T) -> Window {
|
||||
pub fn new<T: AppDelegate>(window_id: usize, content_view: ShareId<Object>, app_ptr: *const T) -> Window {
|
||||
let dimensions = NSRect::new(NSPoint::new(0., 0.), NSSize::new(0., 0.));
|
||||
|
||||
let style = NSWindowStyleMask::NSResizableWindowMask |
|
||||
|
|
@ -53,9 +53,9 @@ impl Window {
|
|||
// Objective-C runtime gets out of sync.
|
||||
msg_send![window, setReleasedWhenClosed:NO];
|
||||
|
||||
if let Some(view_ptr) = content_view.borrow_native_backing_node() {
|
||||
msg_send![window, setContentView:view_ptr];
|
||||
}
|
||||
//if let Some(view_ptr) = content_view.borrow_native_backing_node() {
|
||||
msg_send![window, setContentView:content_view];
|
||||
//}
|
||||
|
||||
ShareId::from_ptr(window)
|
||||
};
|
||||
|
|
|
|||
Reference in a new issue