Module Newt

module Newt: sig .. end
Interface to the newt text window system.

exception NewtFailure of string
type color_set = Newt_int.newtColorSet 
type colors = Newt_int.newtColors 
type flags_sense = Newt_int.newtFlagsSense 
type flag = 
| RETURNEXIT
| HIDDEN
| SCROLL
| DISABLED
| BORDER
| WRAP
| NOF12
| MULTIPLE
| SELECTED
| CHECKBOX
| PASSWORD
| SHOWCURSOR
type fd_flag = 
| FD_READ
| FD_WRITE
| FD_EXCEPT
val init : unit -> unit
val finished : unit -> unit
val init_and_finish : (unit -> 'a) -> 'a
init_and_finish f calls Newt.init, then runs the function f (), then finishes (cleans up) the terminal.

It does the right thing even if f throws an exception.

val cls : unit -> unit
val resize_screen : int -> unit
val wait_for_key : unit -> unit
val clear_key_buffer : unit -> unit
val delay : int -> unit
val open_window : int -> int -> int -> int -> string -> unit
val centered_window : int -> int -> string -> unit
val pop_window : unit -> unit
val pop_window_no_refresh : unit -> unit
val set_colors : Newt_int.newtColors -> unit
val set_color : Newt_int.newtColorSet -> string -> string -> unit
val refresh : unit -> unit
val suspend : unit -> unit
val resume : unit -> int
val push_help_line : string -> unit
val redraw_help_line : unit -> unit
val pop_help_line : unit -> unit
val draw_root_text : int -> int -> string -> unit
val bell : unit -> unit
val cursor_on : unit -> unit
val cursor_off : unit -> unit
val get_screen_size : unit -> int * int
type 'a component = Newt._component 
type _component 
type component_ptr 
val component_equals : component_ptr -> [> `Component ] component -> bool
val compact_button : int -> int -> string -> [ `Button | `Component ] component
val button : int -> int -> string -> [ `Button | `Component ] component
val checkbox : int ->
int ->
string -> char -> string option -> [ `Checkbox | `Component ] component
val checkbox_get_value : [> `Checkbox ] component -> char
val checkbox_set_value : [> `Checkbox ] component -> char -> unit
val checkbox_set_flags : [> `Checkbox ] component ->
flag list -> Newt_int.newtFlagsSense -> unit
val radio_button : int ->
int ->
string ->
bool ->
[> `Radio ] component option -> [ `Component | `Radio ] component
val radio_get_current : [> `Radio ] component -> component_ptr
val label : int -> int -> string -> [ `Component | `Label ] component
val label_set_text : [> `Label ] component -> string -> unit
val vertical_scrollbar : int ->
int ->
int ->
color_set ->
color_set -> [ `Component | `VerticalScrollbar ] component
val scrollbar_set : [> `VerticalScrollbar ] component -> int -> int -> unit
type 'a listbox 
val listbox : int -> int -> int -> flag list -> 'a listbox
Create a listbox.
val listbox_get_current : 'a listbox -> 'a option
This returns the data field from the current item, for listboxes which only allow single selection.

If nothing is selected, None is returned.

val listbox_set_current : 'a listbox -> int -> unit
Set the current selection for listboxes which allow single selection.
val listbox_set_current_by_key : 'a listbox -> 'a -> unit
Set the current selection to the row containing data.
Raises Not_found if data is not found.
val listbox_set_entry : 'a listbox -> int -> string -> unit
val listbox_set_width : 'a listbox -> int -> unit
val listbox_set_data : 'a listbox -> int -> 'a -> unit
val listbox_append_entry : 'a listbox -> string -> 'a -> unit
listbox_append_entry lb text data appends a new listbox entry consisting of the text string text and data data to the end of the listbox.
val listbox_insert_entry : 'a listbox -> string -> 'a -> 'a option -> unit
listbox_insert_entry lb text data after inserts a new listbox entry consisting of the text string text and data data after the current listbox entry with data field after. It returns the position of the new entry.
Raises Not_found if after is not found.
val listbox_delete_entry : 'a listbox -> 'a -> unit
listbox_delete_entry lb data deletes the listbox entry which contains data.
Raises Not_found if data is not found.
val listbox_clear : 'a listbox -> unit
Remove all listbox entries.
val listbox_get_entry : 'a listbox -> int -> string * 'a
Return a member of the listbox.
val listbox_get_selection : 'a listbox -> 'a array
listbox_get_selection lb return an array of data from the items selected.
val listbox_clear_selection : 'a listbox -> unit
Clear the current selection.
val listbox_select_item : 'a listbox -> 'a -> flags_sense -> unit
Select the item containing data.
Raises Not_found if data is not found.
val listbox_item_count : 'a listbox -> int
Return the total number of items in the listbox.
val component_of_listbox : 'a listbox -> [ `Component | `Listbox ] component
Convert the specialised listbox type back to a normal component, eg. allowing it to be added to forms.
val textbox_reflowed : int ->
int ->
string ->
int ->
int -> int -> flag list -> [ `Component | `Textbox ] component
val textbox : int ->
int ->
int -> int -> flag list -> [ `Component | `Textbox ] component
val textbox_set_text : [> `Textbox ] component -> string -> unit
val textbox_set_height : [> `Textbox ] component -> int -> unit
val textbox_get_num_lines : [> `Textbox ] component -> int
val reflow_text : string -> int -> int -> int -> string * int * int
val entry : int ->
int ->
string option ->
int -> flag list -> [ `Component | `Entry ] component
val entry_set : [> `Entry ] component -> string -> bool -> unit
val entry_get_value : [> `Entry ] component -> string
val entry_set_flags : [> `Entry ] component -> flag list -> flags_sense -> unit
val scale : int -> int -> int -> int64 -> [ `Component | `Scale ] component
val scale_set : [> `Scale ] component -> int64 -> unit
val form : [> `VerticalScrollbar ] component option ->
string option -> flag list -> [ `Component | `Form ] component
val form_set_timer : [> `Form ] component -> int -> unit
val form_watch_fd : [> `Form ] component -> Unix.file_descr -> fd_flag list -> unit
val form_set_size : [> `Form ] component -> unit
val form_get_current : [> `Form ] component -> component_ptr
val form_set_background : [> `Form ] component -> int -> unit
val form_set_current : [> `Form ] component -> [> `Component ] component -> unit
val form_add_component : [> `Form ] component -> [> `Component ] component -> unit
val form_add_components : [> `Form ] component -> [> `Component ] component list -> unit
val form_set_height : [> `Form ] component -> int -> unit
val form_set_width : [> `Form ] component -> int -> unit
val run_form : [> `Form ] component -> component_ptr option
val form_run : [> `Form ] component -> Newt_int.newtExitStruct
val form_add_hot_key : [> `Form ] component -> int -> unit
val component_takes_focus : [> `Component ] component -> bool -> unit
component_takes_focus co bool enables or disables a component.
val component_add_callback : [> `Component ] component -> (unit -> unit) -> unit
component_add_callback co f adds a general callback function f to a component. This is only available for certain types of component -- see the Newt documentation for more information.