clutter-ocaml / src / clutterActor.ml

open OclutterProps
open ClutterProps
open Clutter

class type actor_o = object
  method as_actor : actor obj
end

(*type actor_type = < as_actor : actor obj; .. >*)

class actor_signals_impl obj = object
  inherit ['a] gobject_signals obj
  inherit actor_sigs
end
	    
class virtual ['a] actor_skel (obj : actor obj) = object(self)
  inherit actor_props
  method virtual obj : 'a obj
  method set_anchor_point = Actor.set_anchor_point obj
  method set_anchor_point_from_gravity =
    Actor.set_anchor_point_from_gravity obj
  method move_anchor_point = Actor.move_anchor_point obj
  method move_anchor_point_from_gravity =
    Actor.move_anchor_point_from_gravity obj
  method transform_stage_point = Actor.transform_stage_point obj
  method id = Gobject.get_oid obj
  method as_actor = obj
  method allocate box = Actor.allocate obj (ActorBox.unwrap box)
  method get_allocation_box = ActorBox.wrap (Actor.get_allocation_box obj)
  method apply_transform_to_point = Actor.apply_transform_to_point obj
  method get_abs_allocation_vertices = Actor.get_abs_allocation_vertices obj
  method move_by = Actor.move_by obj
  method raise_top = Actor.raise_top obj
  method hide = Actor.hide obj
  method show = Actor.show obj
  method show_all = Actor.show_all obj
  method set_position = Actor.set_position obj
  method set_rotation = Actor.set_rotation obj
  method set_scale = Actor.set_scale obj
  method get_size = self#width, self#height
  method set_size = Actor.set_size obj
  method get_parent = Actor.get_parent obj
  method realize = Actor.realize obj
  method unrealize = Actor.unrealize obj
  method paint = Actor.paint obj
  method queue_redraw = Actor.queue_redraw obj
  method queue_relayout = Actor.queue_relayout obj
  method destroy = Actor.destroy obj
  method set_geometry = Actor.set_geometry obj
  method get_geometry = Actor.get_geometry obj
end

let to_actor a = (a :> [< `actor] actor_skel)

class actor obj = object(self)
  inherit ['a] actor_skel (obj : [> `actor] Clutter.obj)
  method obj = obj
  method connect = new actor_signals_impl obj
end

(** ClutterEntry: A single line text entry actor *)
module Entry = struct
  class entry_skel obj = object (self)
    inherit ['a] actor_skel (as_actor obj)
    inherit entry_props 
    method obj : entry Clutter.obj = obj
  end

  class entry_signals_impl obj = object
    inherit ['a] gobject_signals obj
    inherit entry_sigs
    inherit actor_sigs
  end
    
  class entry obj = object
    inherit entry_skel (obj : [> `entry] Clutter.obj)
    method connect = new entry_signals_impl obj
  end
    
  let make_entry ~create =
    Entry.make_params ~cont:
      (fun pl ->
	 Actor.make_params pl ~cont:
	   (fun pl () ->
	      let (e : #entry_skel) = create pl in
	      e)
      )
      
  let create =
    make_entry [] ~create:
      (fun pl ->
	 let t = Entry.create pl in
	 new entry t)
end

(** ClutterLabel: Actor for displaying text *)
module Label = struct
  class label_skel obj = object (self)
    inherit ['a] actor_skel (as_actor obj)
    inherit label_props 
    method obj : label Clutter.obj = obj
  end

  class label obj = object
    inherit label_skel (obj : [> `label] Clutter.obj)
    method connect = new actor_signals_impl obj
  end
    
  let make_label ~create =
    Label.make_params ~cont:
      (fun pl ->
	 Actor.make_params pl ~cont:
	   (fun pl () ->
	      let (e : #label_skel) = create pl in
	      e)
      )
      
  let create =
    make_label [] ~create:
      (fun pl ->
	 let t = Label.create pl in
	 new label t)
end

(** CloneTexture: Actor for cloning existing textures in an efficient way. *)
module CloneTexture = struct
  class clone_texture_skel obj = object (self)
    inherit ['a] actor_skel (as_actor obj)
    inherit clone_texture_props 
    method obj : clone_texture Clutter.obj = obj
  end

  class clone_texture obj = object
    inherit clone_texture_skel (obj : [> `clonetexture] Clutter.obj)
    method connect = new actor_signals_impl obj
  end
    
  let make_clone_texture ~create =
    CloneTexture.make_params ~cont:
      (fun pl ->
	 Actor.make_params pl ~cont:
	   (fun pl () ->
	      let (e : #clone_texture_skel) = create pl in
	      e)
      )
      
  let create parent =
    make_clone_texture [] ~parent_texture:(parent#obj) ~create:
      (fun pl ->
	 let t = CloneTexture.create pl in
	 new clone_texture t)
end
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.