Skip to content

Commit

Permalink
add set_attributed_text support to buttons (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
eugenesvk authored Dec 28, 2024
1 parent 6fc579f commit eb2c2d6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/button/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,15 @@ impl Button {
});
}

/// Sets the attributed string to be the attributed string value on this button.
#[cfg(feature = "appkit")]
pub fn set_attributed_text(&self, text: AttributedString) {
self.objc.with_mut(|obj| unsafe {
#[cfg(feature = "appkit")]
let _: () = msg_send![obj, setTitle:&*text];
});
}

/// Sets an image on the underlying button.
pub fn set_image(&mut self, image: Image) {
self.objc.with_mut(|obj| unsafe {
Expand Down

0 comments on commit eb2c2d6

Please sign in to comment.