+impl LinkButton {
+ pub fn set_label(&mut self, label: &str) {
+ let cstr = CString::new(label).unwrap();
+ unsafe {
+ ui_linkbutton_set_label(self.ptr, cstr.as_ptr());
+ }
+ }
+
+ pub fn set_uri(&mut self, uri: &str) {
+ let cstr = CString::new(uri).unwrap();
+ unsafe {
+ ui_linkbutton_set_uri(self.ptr, cstr.as_ptr());
+ }
+ }
+
+ pub fn set_visited(&mut self, visited: bool) {
+ unsafe {
+ ui_linkbutton_set_visited(self.ptr, visited as c_int);
+ }
+ }
+
+ pub fn get_label(&self) -> String {
+ unsafe {
+ let cstr_ptr = unsafe { ui_linkbutton_get_label(self.ptr) };
+ if cstr_ptr.is_null() {
+ return String::new();
+ }
+ let cstr = CStr::from_ptr(cstr_ptr);
+ let str = cstr.to_string_lossy().into_owned();
+ libc::free(cstr_ptr as *mut c_void);
+ str
+ }
+ }
+
+ pub fn get_uri(&self) -> String {
+ unsafe {
+ let cstr_ptr = unsafe { ui_linkbutton_get_uri(self.ptr) };
+ if cstr_ptr.is_null() {
+ return String::new();
+ }
+ let cstr = CStr::from_ptr(cstr_ptr);
+ let str = cstr.to_string_lossy().into_owned();
+ libc::free(cstr_ptr as *mut c_void);
+ str
+ }
+ }
+
+ pub fn get_visited(&self) -> bool {
+ unsafe {
+ ui_linkbutton_get_visited(self.ptr) != 0
+ }
+ }
+}
+