package stk

  1. Overview
  2. Docs

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

class 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.

class 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.

class +'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.

class 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".

class 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.

class 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".

class 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".

class '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..

class 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".

class 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.

class '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.

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

Creates a group.

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

Creates a rect.

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

Creates a label.

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

Creates a glyph.

val 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".

val 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".

val 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".

val 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".

val 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.

val 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

class canvas : ?class_:string option -> ?name:string option -> ?props:Props.t option -> unit -> object ... end
val 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.

OCaml

Innovation. Community. Security.