alice
library
manual.

Alice Project

The Canvas structure


________ Synopsis ____________________________________________________

    signature CANVAS
    structure Canvas : CANVAS

The Canvas structure provides access to a canvas implementation based on the Tcl/Tk canvas widget.

See the overview page for a general introduction to the GTK library binding.

See also: GLib Pango Atk, Gdk, Gtk


________ Import ______________________________________________________

    import signature CANVAS from "x-alice:/lib/gtk/CANVAS-sig"
    import structure Canvas from "x-alice:/lib/gtk/Canvas"
  

________ Interface ___________________________________________________

signature CANVAS =
sig
    type object = Core.object
    type gtype = Core.gtype
    type gvalue = Core.gvalue
    type prop   = Core.prop
    type prop_initializer = Core.prop_initializer
(* begin of CORE-sig.aml *)


    datatype event =
	EVENT_NOTHING
      | EVENT_DELETE
      | EVENT_DESTROY
      | EVENT_EXPOSE of 
	{window:object, send:bool, 
	 area_x:int, area_y:int, area_height:int, area_width:int,
	 region:object, count:int}
      | EVENT_MOTION_NOTIFY of
	{window:object, send:bool, time:int,
	 x:real, y:real,
	 state:int, is_hint:int,
	 device: object, x_root:real, y_root:real}
      | EVENT_BUTTON_PRESS of
	{window:object, send:bool, time:int,
	 x:real, y:real, state:int, button:int,
	 device: object, x_root:real, y_root:real}
      | EVENT_2BUTTON_PRESS of
	{window:object, send:bool, time:int,
	 x:real, y:real, state:int, button:int,
	 device: object, x_root:real, y_root:real}
      | EVENT_3BUTTON_PRESS of
	{window:object, send:bool, time:int,
	 x:real, y:real, state:int, button:int,
	 device: object, x_root:real, y_root:real}
      | EVENT_BUTTON_RELEASE of
	{window:object, send:bool, time:int,
	 x:real, y:real, state:int, button:int,
	 device: object, x_root:real, y_root:real}
      | EVENT_KEY_PRESS of
	{window:object, send:bool, time:int, state:int,
	 keyval:int, length:int, string:string, 
	 hardware_keycode:int, group:int}
      | EVENT_KEY_RELEASE of
	{window:object, send:bool, time:int, state:int,
	 keyval:int, length:int, string:string, 
	 hardware_keycode:int, group:int}
      | EVENT_ENTER_NOTIFY of
	{window:object, send:bool, subwindow:object, time:int,
	 x:real, y:real, x_root:real, y_root:real,
	 mode:int, detail:int, focus:bool, state:int}
      | EVENT_LEAVE_NOTIFY of
	{window:object, send:bool, subwindow:object, time:int,
	 x:real, y:real, x_root:real, y_root:real,
	 mode:int, detail:int, focus:bool, state:int}
      | EVENT_FOCUS_CHANGE of {window:object, send:bool, hasFocus:bool}
      | EVENT_CONFIGURE of
	{window:object, send:bool, x:int, y:int,
 	 width:int, height:int}
      | EVENT_MAP
      | EVENT_UNMAP
      | EVENT_PROPERTY_NOTIFY
      | EVENT_SELECTION_CLEAR
      | EVENT_SELECTION_REQUEST
      | EVENT_SELECTION_NOTIFY
      | EVENT_PROXIMITY_IN
      | EVENT_PROXIMITY_OUT
      | EVENT_DRAG_ENTER
      | EVENT_DRAG_LEAVE
      | EVENT_DRAG_MOTION
      | EVENT_DRAG_STATUS
      | EVENT_DROP_START
      | EVENT_DROP_FINISHED
      | EVENT_CLIENT_EVENT
      | EVENT_VISIBILITY_NOTIFY of
	{window:object, send:bool, state:int}
      | EVENT_NO_EXPOSE of {window:object, send:bool}
      | EVENT_SCROLL of
	{window:object, send:bool, time:int, x:real, y:real,
	 state:int, direction:int, device:object,
	 x_root:real, y_root:real}
      | EVENT_WINDOW_STATE
      | EVENT_SETTING
      | EVENT_UNSUPPORTED of object

    datatype arg = 
	BOOL of bool
      | INT of int
      | REAL of real
      | STRING of string
      | OBJECT of object
      | LIST of object list
      | EVENT of event

    val NULL : object
    val TRUE : int
    val FALSE : int

    type callback_function = object * arg list -> unit
    val signalConnect        : object * string * callback_function -> int
    val signalConnectAfter   : object * string * callback_function -> int
    val signalDisconnect     : object * int -> unit
    val signalHandlerBlock   : object * int -> unit
    val signalHandlerUnblock : object * int -> unit

    val latin1ToUtf8 : string -> string
    val utf8ToLatin1 : string -> string

    val lock : Lock.lock


    structure Types :
    sig
        val string : gtype
        val int    : gtype
        val float  : gtype
        val double : gtype
        val pixbuf : gtype
    end

    structure Value :
    sig
        (* exception TypeError *)

        val undefined : unit -> gvalue

        val int : int -> gvalue
        val enum : int * gtype -> gvalue
        val string : string -> gvalue
        val float : real -> gvalue
        val double : real -> gvalue
        val bool : bool -> gvalue
        val object : object -> gvalue
            
        val toInt : gvalue -> int
        val toString : gvalue -> string
        val toReal : gvalue -> real
        val toBool : gvalue -> bool
        val toObject : gvalue -> object

        val getType : gvalue -> gtype
    end

    structure Prop :
    sig
        val setL : object -> prop_initializer list -> unit

        val set : 'a prop -> object * 'a -> unit
        val get : 'a prop -> object -> 'a 

        val rawSet : object * string * gvalue -> unit
        val rawGet : object * string -> gvalue

        val name : 'a prop -> string

        val prop : 'a prop * 'a -> prop_initializer

        (* creation *)
        val newProp : string * ('a -> gvalue) * (gvalue -> 'a) -> 'a prop
    end
(* end of CORE-sig.aml *)

    structure Points :
    sig
        (* constructors *)
        val new : int -> object
        (* methods *)
        val set : object * int * real -> unit
    end
    structure CanvasPathDef :
    sig
        (* constructors *)
        (* methods *)
        val new : unit -> object
    end
    structure Widget :
    sig
        (* constructors *)
        (* methods *)
        val getType : unit -> gtype
        (* properties *)
    end
    structure Text :
    sig
        (* constructors *)
        (* methods *)
        val getType : unit -> gtype
        (* properties *)
        val yOffset : real prop
        val y : real prop
        val xOffset : real prop
        val x : real prop
        val weightSet : bool prop
        val weight : int prop
        val variantSet : bool prop
        val variant : Pango.Variant.t prop
        val underlineSet : bool prop
        val underline : Pango.Underline.t prop
        val textWidth : real prop
        val textHeight : real prop
        val text : string prop
        val styleSet : bool prop
        val style : Pango.Style.t prop
        val strikethroughSet : bool prop
        val strikethrough : bool prop
        val stretchSet : bool prop
        val stretch : Pango.Stretch.t prop
        val sizeSet : bool prop
        val sizePoints : real prop
        val size : int prop
        val scaleSet : bool prop
        val scale : real prop
        val riseSet : bool prop
        val rise : int prop
        val markup : string prop
        val justification : Gtk.Justification.t prop
        val fontDesc : object prop
        val font : string prop
        val fillStipple : object prop
        val fillColorGdk : object prop
        val fillColor : string prop
        val familySet : bool prop
        val family : string prop
        val clipWidth : int prop
        val clipHeight : int prop
        val clip : bool prop
        val attributes : object prop
        val anchor : Gtk.AnchorType.t prop
    end
    structure Bpath :
    sig
        (* constructors *)
        (* methods *)
        (* properties *)
    end
    structure Polygon :
    sig
        (* constructors *)
        (* methods *)
        val getType : unit -> gtype
        (* properties *)
    end
    structure Ellipse :
    sig
        (* constructors *)
        (* methods *)
        val getType : unit -> gtype
        (* properties *)
    end
    structure Rect :
    sig
        (* constructors *)
        (* methods *)
        val getType : unit -> gtype
        (* properties *)
    end
    structure RE :
    sig
        (* constructors *)
        (* methods *)
        (* properties *)
        val y2 : real prop
        val y1 : real prop
        val x2 : real prop
        val x1 : real prop
    end
    structure Shape :
    sig
        (* constructors *)
        (* methods *)
        (* properties *)
        val wind : int prop
        val widthUnits : real prop
        val widthPixels : int prop
        val outlineStipple : object prop
        val outlineColorGdk : object prop
        val outlineColor : string prop
        val miterlimit : real prop
        val joinStyle : Gdk.JoinStyle.t prop
        val fillStipple : object prop
        val fillColor : string prop
        val fillColorGdk : object prop
        val capStyle : Gdk.CapStyle.t prop
    end
    structure RichText :
    sig
        (* constructors *)
        (* methods *)
        val getType : unit -> gtype
        (* properties *)
    end
    structure Pixbuf :
    sig
        (* constructors *)
        (* methods *)
        val getType : unit -> gtype
        (* properties *)
    end
    structure Line :
    sig
        (* constructors *)
        (* methods *)
        val getType : unit -> gtype
        (* properties *)
        val points : ((real * real) list) prop
        val widthUnits : real prop
        val widthPixels : int prop
        val splineSteps : int prop
        val smooth : bool prop
        val capStyle : Gdk.CapStyle.t prop
        val lineStyle : Gdk.LineStyle.t prop
        val joinStyle : Gdk.JoinStyle.t prop
        val lastArrowhead : bool prop
        val firstArrowhead : bool prop
        val fillStipple : object prop
        val fillColor : string prop
        val fillColorGdk : object prop
        val arrowShapeC : real prop
        val arrowShapeB : real prop
        val arrowShapeA : real prop
    end
    structure Clipgroup :
    sig
        (* constructors *)
        (* methods *)
        (* properties *)
    end
    structure Group :
    sig
        (* constructors *)
        val new : { item_list : object list } -> object
        (* methods *)
        val getType : unit -> gtype
        val add : object * gtype * string -> object
        val newItem : object * gtype -> object
        val getFieldItemList : object -> object list
        val setFieldItemList : object * (object list) -> unit
        (* properties *)
        val y : real prop
        val x : real prop
    end
    structure Item :
    sig
        (* constructors *)
        (* methods *)
        val getBounds : object * real * real * real * real -> real * real * real * real
        val grabFocus : object -> unit
        val reparent : object * object -> unit
        val i2cAffine : object * (real vector) -> unit
        val i2wAffine : object * (real vector) -> unit
        val i2w : object * real * real -> real * real
        val w2i : object * real * real -> real * real
        val hide : object -> unit
        val show : object -> unit
        val lowerToBottom : object -> unit
        val raiseToTop : object -> unit
        val lowerWindow : object * int -> unit
        val raiseWindow : object * int -> unit
        val affineAbsolute : object * (real vector) -> unit
        val affineRelative : object * (real vector) -> unit
        val move : object * real * real -> unit
        val set : object * string -> unit
        val getType : unit -> gtype
        (* properties *)
        val parent : object prop
    end
    val newAa : unit -> object
    val new : unit -> object
    val getDither : object -> Gdk.RgbDither.t
    val setDither : object * Gdk.RgbDither.t -> unit
    val getColorPixel : object * int -> int
    val getColor : object * string * object -> int
    val worldToWindow : object * real * real * real * real -> real * real
    val windowToWorld : object * real * real * real * real -> real * real
    val c2w : object * int * int * real * real -> real * real
    val w2cD : object * real * real * real * real -> real * real
    val w2c : object * real * real * int * int -> int * int
    val w2cAffine : object * (real vector) -> unit
    val getItemAt : object * real * real -> object
    val updateNow : object -> unit
    val getScrollOffsets : object * int * int -> int * int
    val scrollTo : object * int * int -> unit
    val getScrollRegion : object * real * real * real * real -> real * real * real * real
    val setScrollRegion : object * real * real * real * real -> unit
    val setCenterScrollRegion : object * bool -> unit
    val setPixelsPerUnit : object * real -> unit
    val root : object -> object
    val getType : unit -> gtype
end

________ Description _________________________________________________

We do not give a full documentation here. We rather recommend to read the Porting Guide. It gives a comprehensive overview on what has been made available.


last modified 2007/Mar/30 17:10