@@ -27,7 +27,7 @@ pub fn register_interaction_handler<R: InteractionHandler>(custom: R) {
2727 getOpenFileNameInput : Some ( cb_get_open_file_name_input :: < R > ) ,
2828 getSaveFileNameInput : Some ( cb_get_save_file_name_input :: < R > ) ,
2929 getDirectoryNameInput : Some ( cb_get_directory_name_input :: < R > ) ,
30- getCheckboxInput : None ,
30+ getCheckboxInput : Some ( cb_get_checkbox_input :: < R > ) ,
3131 getFormInput : Some ( cb_get_form_input :: < R > ) ,
3232 showMessageBox : Some ( cb_show_message_box :: < R > ) ,
3333 openUrl : Some ( cb_open_url :: < R > ) ,
@@ -247,7 +247,7 @@ pub trait InteractionHandler: Sync + Send + 'static {
247247 . and_then ( |f| f. try_value_string ( ) )
248248 }
249249
250- fn get_choicebox_input (
250+ fn get_checkbox_input (
251251 & mut self ,
252252 prompt : & str ,
253253 title : & str ,
@@ -256,7 +256,6 @@ pub trait InteractionHandler: Sync + Send + 'static {
256256 form. add_field ( FormInputField :: Checkbox {
257257 prompt : prompt. to_string ( ) ,
258258 value : false ,
259- default : None ,
260259 } ) ;
261260 if !self . get_form_input ( & mut form) {
262261 return None ;
@@ -561,6 +560,25 @@ unsafe extern "C" fn cb_get_directory_name_input<R: InteractionHandler>(
561560 }
562561}
563562
563+ unsafe extern "C" fn cb_get_checkbox_input < R : InteractionHandler > (
564+ ctxt : * mut c_void ,
565+ result_ffi : * mut i64 ,
566+ prompt : * const c_char ,
567+ title : * const c_char ,
568+ ) -> bool {
569+ let ctxt = ctxt as * mut R ;
570+ let prompt = raw_to_string ( prompt) . unwrap ( ) ;
571+ let title = raw_to_string ( title) . unwrap ( ) ;
572+ let result = ( * ctxt) . get_checkbox_input ( & prompt, & title) ;
573+ if let Some ( result) = result {
574+ unsafe { * result_ffi = result } ;
575+ true
576+ } else {
577+ unsafe { * result_ffi = 0 } ;
578+ false
579+ }
580+ }
581+
564582unsafe extern "C" fn cb_get_form_input < R : InteractionHandler > (
565583 ctxt : * mut c_void ,
566584 fields : * mut BNFormInputField ,
0 commit comments