package stk

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

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 full_item : ?class_:string option -> ?name:string option -> ?props:Props.t option -> ?group: group option -> ?x:int option -> ?y:int option -> unit -> object ... end

A full_item is a Widget.widget with item interface.

Sourceclass +'b container_item : ?class_:string option -> ?name:string option -> ?props:Props.t 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 : ?class_:string option -> ?name:string option -> ?props:Props.t option -> ?group: group option -> ?x:int option -> ?y:int option -> unit -> object ... end

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

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

An item to draw a rectangle. Default class_ is "canvas_rect". Width and height of the rectangle can be specified with optional arguments w and h.

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

A Text.label as item. Default class_ is "canvas_label".

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

A Text.glyph as item. Default class_ is "canvas_glyph".

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

A Pack.box as item..

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

A Pack.paned as item. Default class_ is "canvas_paned".

Sourceclass fixed_size : ?class_:string option -> ?name:string option -> ?props:Props.t 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 : ?class_:string option -> ?name:string option -> ?props:Props.t option -> ?group: group option -> ?x:int option -> ?y:int option -> unit -> object ... end

A Flex.flex as item. Default class_ is "canvas_flex".

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 : ?class_:string -> ?name:string -> ?props:Props.t -> ?group:group -> ?x:int -> ?y:int -> unit -> group

Creates a group.

Sourceval rect : ?class_:string -> ?name:string -> ?props:Props.t -> ?group:group -> ?x:int -> ?y:int -> w:int -> h:int -> unit -> rect

Creates a rect.

Sourceval label : ?class_:string -> ?name:string -> ?props:Props.t -> ?group:group -> ?x:int -> ?y:int -> string -> label

Creates a label.

Sourceval glyph : ?class_:string -> ?name:string -> ?props:Props.t -> ?group:group -> ?x:int -> ?y:int -> int -> glyph

Creates a glyph.

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

Creates a box with vertical orientation. Default class_ is "canvas_hbox".

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

Creates a box with horizontal orientation. Default class_ is "canvas_hbox".

Sourceval vpaned : ?class_:string -> ?name:string -> ?props:Props.t -> ?group:group -> ?x:int -> ?y:int -> unit -> paned

Creates a paned with vertical orientation. Default class_ is "canvas_vpaned".

Sourceval hpaned : ?class_:string -> ?name:string -> ?props:Props.t -> ?group:group -> ?x:int -> ?y:int -> unit -> paned

Creates a paned with horizontal orientation. Default class_ is "canvas_hpaned".

Sourceval fixed_size : ?class_:string -> ?name:string -> ?props:Props.t -> ?group:group -> ?x:int -> ?y:int -> ?w:int -> ?h:int -> unit -> fixed_size

Creates a fixed_size.

Sourceval flex : ?class_:string -> ?name:string -> ?props:Props.t -> ?group:group -> ?x:int -> ?y:int -> ?orientation:Props.orientation -> ?justification:Flex.justification -> ?items_alignment:Flex.item_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 : ?class_:string option -> ?name:string option -> ?props:Props.t option -> unit -> object ... end
Sourceval canvas : ?class_:string -> ?name:string -> ?props:Props.t -> ?pack:(Widget.widget -> unit) -> unit -> canvas

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