/usr/lib/ocaml/lablgtk2/gContainer.ml is in liblablgtk2-ocaml-dev 2.14.2+dfsg-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | (**************************************************************************)
(* Lablgtk *)
(* *)
(* This program is free software; you can redistribute it *)
(* and/or modify it under the terms of the GNU Library General *)
(* Public License as published by the Free Software Foundation *)
(* version 2, with the exception described in file COPYING which *)
(* comes with the library. *)
(* *)
(* This program is distributed in the hope that it will be useful, *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)
(* GNU Library General Public License for more details. *)
(* *)
(* You should have received a copy of the GNU Library General *)
(* Public License along with this program; if not, write to the *)
(* Free Software Foundation, Inc., 59 Temple Place, Suite 330, *)
(* Boston, MA 02111-1307 USA *)
(* *)
(* *)
(**************************************************************************)
(* $Id: gContainer.ml 1499 2010-04-08 08:00:42Z garrigue $ *)
open StdLabels
open Gaux
open Gobject
open Gtk
open GtkBase
open OgtkBaseProps
open GObj
open GData
open Container
class focus obj = object
val obj = obj
(* method circulate = focus obj *)
method set (child : widget option) =
let child = may_map child ~f:(fun x -> x#as_widget) in
set_focus_child obj (Gpointer.optboxed child)
method set_hadjustment adj =
set_focus_hadjustment obj
(Gpointer.optboxed (may_map adj ~f:as_adjustment))
method set_vadjustment adj =
set_focus_vadjustment obj
(Gpointer.optboxed (may_map adj ~f:as_adjustment))
end
class ['a] container_impl obj = object (self)
inherit ['a] widget_impl obj
inherit container_props
method add w = add obj (as_widget w)
method remove w = remove obj (as_widget w)
method children = List.map ~f:(new widget) (children obj)
method all_children =
let l = ref [] in
forall obj ~f:(fun w -> l := new widget w :: !l);
List.rev !l
method focus = new focus obj
end
class container = ['a] container_impl
class container_signals_impl obj = object
inherit widget_signals_impl obj
inherit container_sigs
end
class type container_signals = container_signals_impl
class container_full obj = object
inherit container obj
method connect = new container_signals_impl obj
end
let cast_container (w : widget) =
new container_full (cast w#as_widget)
let pack_container ~create =
Container.make_params ~cont:
(fun p ?packing ?show () -> pack_return (create p) ~packing ~show)
class ['a] bin_impl obj = object
inherit ['a] container_impl obj
method child = new widget (Bin.get_child obj)
end
class bin = ['a] bin_impl
class virtual ['a] item_container obj = object (self)
inherit ['b] widget_impl obj
inherit container_props
method add (w : 'a) =
add obj w#as_item
method remove (w : 'a) =
remove obj w#as_item
method private virtual wrap : Gtk.widget obj -> 'a
method children : 'a list =
List.map ~f:self#wrap (children obj)
method all_children =
let l = ref [] in
forall obj ~f:(fun w -> l := self#wrap w :: !l);
List.rev !l
method focus = new focus obj
method virtual insert : 'a -> pos:int -> unit
method append (w : 'a) = self#insert w ~pos:(-1)
method prepend (w : 'a) = self#insert w ~pos:0
end
class item_signals obj = object
inherit container_signals_impl (obj : [> Gtk.item] obj)
inherit item_sigs
end
|