Module Stk.CanvasSource

Canvas.

A canvas widget is composed of a root canvas group. A group can contain full_items (a groups is a fullitem too).

Coordinates of an item are relative to its parent group.

All item classes takes optional x and y arguments to define their coordinates relatively to their group, with default value 0. The group can be given with the optional group argument, or set with the set_group method. These three arguments are also handled by convenient functions to create items.

Items

Sourceclass virtual item : ?group:group option -> ?x:int option -> ?y:int option -> unit -> object ... end

This virtual class defines the item interface. Most of the virtual methods correspond to methods of Widget.widget and are defined by inherting from Widget.widget or other widgets.

Sourceclass virtual full_item : ?classes:string list option -> ?name:string option -> ?props:Props.t option -> ?wdata: Widget.wdata option -> ?group:group option -> ?x:int option -> ?y:int option -> unit -> object ... end

A full_item is a Widget.widget with item interface.

Sourceclass virtual +'b container_item : ?classes:string list option -> ?name:string option -> ?props:Props.t option -> ?wdata: Widget.wdata option -> ?group:group option -> ?x:int option -> ?y:int option -> unit -> object ... end

a container_item is a Container.container with item interface.

Sourceclass group : ?classes:string list option -> ?name:string option -> ?props:Props.t option -> ?wdata: Widget.wdata option -> ?group:group option -> ?x:int option -> ?y:int option -> unit -> object ... end

A group is a [full_item] container_item. Its kind is "canvas_group".

Sourceclass rect : ?classes:string list option -> ?name:string option -> ?props:Props.t option -> ?wdata: Widget.wdata option -> ?group:group option -> ?x:int option -> ?y:int option -> w: int -> h:int -> unit -> object ... end

An item to draw a rectangle. Its kind is "rect". Width and height of the rectangle can be specified with optional arguments w and h.

Sourceval bezier_points : (int * int) list -> (G.t * (int * int) list) option
Sourceclass bezier_curve : ?classes:string list option -> ?name:string option -> ?props:Props.t option -> ?wdata: Widget.wdata option -> ?group:group option -> ?x:int option -> ?y:int option -> ?points: (int * int) list option -> unit -> object ... end

Widgets inheriting a widget and an item keeps the original widget kind but can be identified specifically in theming for example by using "canvas > <kind>".

Sourceclass bin : ?classes:string list option -> ?name:string option -> ?props:Props.t option -> ?wdata: Widget.wdata option -> ?group:group option -> ?x:int option -> ?y:int option -> unit -> object ... end

A Bin.bin as item.

Sourceclass label : ?classes:string list option -> ?name:string option -> ?props:Props.t option -> ?wdata: Widget.wdata option -> ?group:group option -> ?x:int option -> ?y:int option -> unit -> object ... end

A Text.label as item.

Sourceclass glyph : ?classes:string list option -> ?name:string option -> ?props:Props.t option -> ?wdata: Widget.wdata option -> ?group:group option -> ?x:int option -> ?y:int option -> unit -> object ... end

A Text.glyph as item.

Sourceclass 'a box : ?classes:string list option -> ?name:string option -> ?props:Props.t option -> ?wdata: Widget.wdata option -> ?group:group option -> ?x:int option -> ?y:int option -> unit -> object ... end

A Pack.box as item.

Sourceclass paned : ?classes:string list option -> ?name:string option -> ?props:Props.t option -> ?wdata: Widget.wdata option -> ?group:group option -> ?x:int option -> ?y:int option -> unit -> object ... end

A Pack.paned as item.

Sourceclass fixed_size : ?classes:string list option -> ?name:string option -> ?props:Props.t option -> ?wdata: Widget.wdata option -> ?group:group option -> ?x:int option -> ?y:int option -> ?w: int option -> ?h:int option -> unit -> object ... end

A Bin.fixed_size as item.

Sourceclass 'a flex : ?classes:string list option -> ?name:string option -> ?props:Props.t option -> ?wdata: Widget.wdata option -> ?group:group option -> ?x:int option -> ?y:int option -> unit -> object ... end

A Flex.flex as item.

Convenient functions to create items

These convenient functions are used to create items. They all take x and y optional arguments to specify the coordinates of the created item, and group to specify the group the item belongs to. Other arguments are generic widget arguments or arguments specific to the kind of item.

Sourceval group : ?classes:string list -> ?name:string -> ?props:Props.t -> ?wdata:Widget.wdata -> ?group:group -> ?x:int -> ?y:int -> unit -> group

Creates a group.

Sourceval rect : ?classes:string list -> ?name:string -> ?props:Props.t -> ?wdata:Widget.wdata -> ?group:group -> ?x:int -> ?y:int -> w:int -> h:int -> unit -> rect

Creates a rect.

Sourceval bezier_curve : ?classes:string list -> ?name:string -> ?props:Props.t -> ?wdata:Widget.wdata -> ?group:group -> ?x:int -> ?y:int -> ?points:(int * int) list -> unit -> bezier_curve

Creates a bezier_curve.

Sourceval bin : ?classes:string list -> ?name:string -> ?props:Props.t -> ?wdata:Widget.wdata -> ?group:group -> ?x:int -> ?y:int -> unit -> bin

Creates a bin.

Sourceval label : ?classes:string list -> ?name:string -> ?props:Props.t -> ?wdata:Widget.wdata -> ?group:group -> ?x:int -> ?y:int -> string -> label

Creates a label.

Sourceval glyph : ?classes:string list -> ?name:string -> ?props:Props.t -> ?wdata:Widget.wdata -> ?group:group -> ?x:int -> ?y:int -> int -> glyph

Creates a glyph.

Sourceval vbox : ?classes:string list -> ?name:string -> ?props:Props.t -> ?wdata:Widget.wdata -> ?group:group -> ?x:int -> ?y:int -> unit -> 'a box

Creates a box with vertical orientation.

Sourceval hbox : ?classes:string list -> ?name:string -> ?props:Props.t -> ?wdata:Widget.wdata -> ?group:group -> ?x:int -> ?y:int -> unit -> 'a box

Creates a box with horizontal orientation.

Sourceval vpaned : ?classes:string list -> ?name:string -> ?props:Props.t -> ?wdata:Widget.wdata -> ?group:group -> ?x:int -> ?y:int -> unit -> paned

Creates a paned with vertical orientation.

Sourceval hpaned : ?classes:string list -> ?name:string -> ?props:Props.t -> ?wdata:Widget.wdata -> ?group:group -> ?x:int -> ?y:int -> unit -> paned

Creates a paned with horizontal orientation.

Sourceval fixed_size : ?classes:string list -> ?name:string -> ?props:Props.t -> ?wdata:Widget.wdata -> ?group:group -> ?x:int -> ?y:int -> ?w:int -> ?h:int -> unit -> fixed_size

Creates a fixed_size.

Sourceval flex : ?classes:string list -> ?name:string -> ?props:Props.t -> ?wdata:Widget.wdata -> ?group:group -> ?x:int -> ?y:int -> ?orientation:Props.orientation -> ?justification:Flex.justification -> ?items_alignment:Flex.items_alignment -> ?content_alignment:Flex.content_alignment -> ?inter_space:int -> ?wrap:bool -> ?wrap_on_break:bool -> ?collapse_spaces:bool -> unit -> 'a flex

Creates a flex.

Canvas widget

Sourceclass canvas : ?classes:string list option -> ?name:string option -> ?props:Props.t option -> ?wdata: Widget.wdata option -> unit -> object ... end
Sourceval canvas : ?classes:string list -> ?name:string -> ?props:Props.t -> ?wdata:Widget.wdata -> ?pack:(Widget.widget -> unit) -> unit -> canvas

Convenient function to create a canvas. See Widget arguments for arguments.