stop
| _ -> false)))
-let toggle_visibility ~(win: GWindow.window) ~(check: GMenu.check_menu_item) =
+let toggle_widget_visibility ~(widget: GObj.widget)
+ ~(check: GMenu.check_menu_item)
+=
+ ignore (check#connect#toggled (fun _ ->
+ if check#active then widget#misc#show () else widget#misc#hide ()))
+
+let toggle_window_visibility ~(window: GWindow.window)
+ ~(check: GMenu.check_menu_item)
+=
ignore (check#connect#toggled (fun _ ->
- if check#active then win#show () else win#misc#hide ()));
- ignore (win#event#connect#delete (fun _ ->
- win#misc#hide ();
+ if check#active then window#show () else window#misc#hide ()));
+ ignore (window#event#connect#delete (fun _ ->
+ window#misc#hide ();
check#set_active false;
true))
(** given a window and a check menu item it links the two so that the former
* is only hidden on delete and the latter toggle show/hide of the former *)
-val toggle_visibility:
- win:GWindow.window -> check:GMenu.check_menu_item -> unit
+val toggle_window_visibility:
+ window:GWindow.window -> check:GMenu.check_menu_item -> unit
+
+ (** given a window and a check menu item it links the two so that the former
+ * is only hidden on delete and the latter toggle show/hide of the former *)
+val toggle_widget_visibility:
+ widget:GObj.widget -> check:GMenu.check_menu_item -> unit
val toggle_win:
?check:GMenu.check_menu_item -> GWindow.window -> unit -> unit
connect_button tbar#assumptionButton (tac (A.Assumption loc));
connect_button tbar#cutButton (tac_w_term (A.Cut (loc, hole)));
connect_button tbar#autoButton (tac (A.Auto (loc,None)));
- ignore(self#main#tacticsBarMenuItem#connect#toggled
- ~callback:(fun _ ->
- if self#main#tacticsBarMenuItem#active then
- self#main#tacticsButtonsHandlebox#misc#show ()
- else
- self#main#tacticsButtonsHandlebox#misc#hide ()));
+ MatitaGtkMisc.toggle_widget_visibility
+ ~widget:(self#main#tacticsButtonsHandlebox :> GObj.widget)
+ ~check:self#main#tacticsBarMenuItem;
let module Hr = Helm_registry in
if not(Hr.get_opt_default Hr.get_bool false "matita.tactics_bar") then
self#main#tacticsBarMenuItem#set_active false;