From: Luca Padovani Date: Fri, 21 Feb 2003 13:09:30 +0000 (+0000) Subject: * click signal changed: now the element argument is optional X-Git-Tag: V_0_0_4_1~16 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=1957a1f151c547f04625c4379e51ab66bddb69c7;p=helm.git * click signal changed: now the element argument is optional and if None it means the click was made on nothing. This is more uniform with the other signals --- diff --git a/helm/DEVEL/lablgtkmathview/gMathView.ml b/helm/DEVEL/lablgtkmathview/gMathView.ml index 23197b227..3687c043b 100644 --- a/helm/DEVEL/lablgtkmathview/gMathView.ml +++ b/helm/DEVEL/lablgtkmathview/gMathView.ml @@ -45,7 +45,7 @@ class math_view_signals obj = object let new_click = let new_marshaller f x y = MathView.Signals.click.S.marshaller - (fun e s -> f (new Gdome.element e) s) x y + (fun e s -> f (option_element_of_option e) s) x y in { S.name = "click"; S.classe = `math_view; S.marshaller = new_marshaller } diff --git a/helm/DEVEL/lablgtkmathview/gMathView.mli b/helm/DEVEL/lablgtkmathview/gMathView.mli index 5b9fdc803..5ffffa4be 100644 --- a/helm/DEVEL/lablgtkmathview/gMathView.mli +++ b/helm/DEVEL/lablgtkmathview/gMathView.mli @@ -31,7 +31,8 @@ class math_view_signals : object ('a) inherit GContainer.container_signals val obj: 'b Gtk.obj - method click : callback:(Gdome.element -> int -> unit) -> GtkSignal.id + method click : + callback:(Gdome.element option -> int -> unit) -> GtkSignal.id method element_over : callback:(Gdome.element option -> int -> unit) -> GtkSignal.id method select_begin : diff --git a/helm/DEVEL/lablgtkmathview/gtkMathView.ml b/helm/DEVEL/lablgtkmathview/gtkMathView.ml index 394d97e14..2420c94c1 100644 --- a/helm/DEVEL/lablgtkmathview/gtkMathView.ml +++ b/helm/DEVEL/lablgtkmathview/gtkMathView.ml @@ -118,7 +118,7 @@ module MathView = struct let marshal_click f _ = function [GtkArgv.POINTER element; GtkArgv.INT state] -> - f (gdome_element_of_boxed_option element) state + f (gdome_element_option_of_boxed_option element) state | _ -> invalid_arg "GtkMathView.MathView.Signals.marshal_click" in { name = "click"; classe = `math_view; marshaller = marshal_click } diff --git a/helm/DEVEL/lablgtkmathview/test/test.ml b/helm/DEVEL/lablgtkmathview/test/test.ml index 4df59756e..ca9abd84b 100644 --- a/helm/DEVEL/lablgtkmathview/test/test.ml +++ b/helm/DEVEL/lablgtkmathview/test/test.ml @@ -103,11 +103,14 @@ let rec action mathview (element : Gdome.element) = end | None -> assert false (* every element has a parent *) -let click mathview (element : Gdome.element) _ = +let click mathview (element : Gdome.element option) _ = let module G = Gdome in - if not (jump element) then - if not (mathview#action_toggle element) then - () + match element with + None -> print_string "CLICKED ON NOTHING\n" ; flush stdout + | Some element -> + if not (jump element) then + if not (mathview#action_toggle element) then + () ;;