Props, reconciler fixes, demo fixes

This commit is contained in:
Ryan McGrath 2019-06-05 21:15:46 -07:00
parent 47163c64f9
commit 290b57d336
No known key found for this signature in database
GPG key ID: 811674B62B666830
17 changed files with 284 additions and 190 deletions

View file

@ -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];
}
}