type gr_look_list =
Std_color
| Std_mono
| Window_color
| Os2_color
| Motif_color
| Motif_mono
| Open_look_color
| Open_look_mono
;;
gr_look_list defines the set of values which the global
variable look can take.
gr_set_look : gr_look_list -> unit
-
gr_get_look : unit -> gr_look_list
-
gr_backcolor : unit -> color
- These functions are used to read (gr_get_look) and to set
(gr_set_look) the global variable look. gr_backcolor () returns
the background colour associated with the current look.
gr_grey : int;;
-
gr_darkgrey : int;;
- gr_grey and gr_darkgrey are two colours used in the drawing of
Camlwin graphics objects.
type direction =
Vertical
| Horizontal
;;
defines a direction.
type coord =
{ x : int
; y : int
}
;;
defines a point by its coordinates.
type rect =
{ x1 : int
; y1 : int
; x2 : int
; y2 : int
}
;;
define a rectangle by the coordinates of two diametrically
opposed points.
gr_long_space : int
gr_short_space : int
gr_line_width : int
gr_text_height : int
- defines the constants which are used to calculate the sizes of
different objects.
gr_do_nothing : 'a -> 'b -> bool
- defines a general callback that does nothing. This is used to
initialize the callback function of graphical objects.
gr_empty_image : image
- defines an empty image. It is used to initialize the
background of menu objects.
gr_empty_line : string
- defines an empty string. It is used to initialize string
objects.
gr_inside : coord -> rect -> bool
- gr_inside Coord Rect returns true if the point at
coordinates Coord is in the rectangle Rect, false
otherwise.
gr_draw_rect : int -> int -> int -> int -> unit
- gr_draw_rect x y w h draws a rectangle with the current
colour. Its lower left corner is at (x,y), its width is w and its
height is h.
gr_draw_triangle : int -> int -> int -> unit
- gr_draw_triangle x y l draws a triangle with its three
vertices at: (x, y), (x+l/2,y-l), (x-l/2,y-l).
nth_elem : 'a list -> int -> 'a
- nth_elem List n returns the nth. element of the list List. If
n is too big, a Failure exception is raise .
set_nth_elem : 'a list -> int -> 'a -> 'a list
- set_nth_elem List n val sets the nth. element of the list
List to the value val. Does nothing if n is too big.
del_nth_elem : 'a list -> int -> 'a list
- del_nth_elem List n deletes the nth. element of the list
List. Does nothing if n is too big.
gr_debug : unit -> unit
-
gr_no_debug : unit -> unit
- gr_debug () activates the debug mode and gr_no_debug
deactivates it. When Camlwin is in debug mode, all the events
are saved in the text file msg.ml. This is one way of debugging a
program. Another simple method is to use printexc. Include #open
"printexc";; at the beginning of the main file, and add f
before the main loop (gr_main_loop). So that, the program
prints the failure that made it end abnormally.
ins_char : string -> char -> int -> string
- ins_char str a n inserts the character a in the string str at
the position n.
input_file : in_channel -> string
- input_channel Channel returns the content of the input
stream defined by Channel.