class led_grid : ?default:bool -> on_xpm_file_name:string -> off_xpm_file_name:string -> nothing_xpm_file_name:string -> columns:int -> rows:int -> packing:(GObj.widget -> unit) -> ?angle:float -> ?no_leds_at:(int * int) list -> unit ->
object
.. end
A LED grid visually represents a matrix of LED lights, where each light is
independently controllable. A light is identified by its 0-based coordinates,
where the origin is top-left.
The optional parameter no_leds_at represents a list of coordinates (such as
(0, 1); (3, 4)
) where *no* lights should be placed.
Each end of each row and column contains an optional, user-settable text
label. Vertical labels can be rotated, to allow for denser writing in
vertical.
The constructor expects three file names identifying the XPM images to use
for the 'on' state, the 'off' state, and for representing the absence of a
light. All three pixmaps should have the same size.
val off_pixmap : GDraw.pixmap
The pixmap objects made from user-supplied files. Notice how the same three
pixmaps are shared among all the lights (and 'holes'):
val on_pixmap : GDraw.pixmap
val nothing_pixmap : GDraw.pixmap
val led_lights_matrix : led_light option array array
A two-dimensional matrix of led_light option:
val left_labels : GMisc.label array
Arrays holding the label widgets decorating each end of rows and columns:
val right_labels : GMisc.label array
val top_labels : GMisc.label array
val bottom_labels : GMisc.label array
val table_widget : GPack.table
The Gtk+ widget holding the whole grid:
val no_leds_at : (int * int, unit) Hashtbl.t
A set of positions which should be left empty. This structure must be
accessed associatively at initialization time, and is more efficient
than a list:
method get_led_light : int -> int -> led_light
Return the LED light identified by (x, y), or throw an exception if no light is
present at that position:
method get : int -> int -> led_light
method get_random_led_light : led_light
Return a random LED light belonging to the grid, if it exists, or loop forever.
This is useful for debugging (and for demos :-)):
method get_top_label : int -> string
Get and set the text of each label. Notice that all arrays are 0-based:
method set_top_label : int -> string -> unit
method get_bottom_label : int -> string
method set_bottom_label : int -> string -> unit
method get_left_label : int -> string
method set_left_label : int -> string -> unit
method get_right_label : int -> string
method set_right_label : int -> string -> unit
method set_top_labels_angle : float -> unit
method set_bottom_labels_angle : float -> unit
method get_widget : GPack.table
Return the Gtk+ widget holding the whole grid: