summaryrefslogtreecommitdiff
path: root/ide/utils/configwin.mli
diff options
context:
space:
mode:
Diffstat (limited to 'ide/utils/configwin.mli')
-rw-r--r--ide/utils/configwin.mli148
1 files changed, 83 insertions, 65 deletions
diff --git a/ide/utils/configwin.mli b/ide/utils/configwin.mli
index 078befc6..2d4dd4a7 100644
--- a/ide/utils/configwin.mli
+++ b/ide/utils/configwin.mli
@@ -1,26 +1,27 @@
-(**************************************************************************)
-(* Cameleon *)
-(* *)
-(* Copyright (C) 2002 Institut National de Recherche en Informatique et *)
-(* en Automatique. All rights reserved. *)
-(* *)
-(* This program is free software; you can redistribute it and/or modify *)
-(* it under the terms of the GNU General Public License as published by *)
-(* the Free Software Foundation; either version 2 of the License, or *)
-(* any later version. *)
-(* *)
-(* This program is distributed in the hope that it will be useful, *)
-(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)
-(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)
-(* GNU General Public License for more details. *)
-(* *)
-(* You should have received a copy of the GNU General Public License *)
-(* along with this program; if not, write to the Free Software *)
-(* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA *)
-(* 02111-1307 USA *)
-(* *)
-(* Contact: Maxence.Guesdon@inria.fr *)
-(**************************************************************************)
+(*********************************************************************************)
+(* Cameleon *)
+(* *)
+(* Copyright (C) 2005 Institut National de Recherche en Informatique et *)
+(* en Automatique. All rights reserved. *)
+(* *)
+(* This program is free software; you can redistribute it and/or modify *)
+(* it under the terms of the GNU Library General Public License as *)
+(* published by the Free Software Foundation; either version 2 of the *)
+(* License, or any later version. *)
+(* *)
+(* This program is distributed in the hope that it will be useful, *)
+(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)
+(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)
+(* GNU Library General Public License for more details. *)
+(* *)
+(* You should have received a copy of the GNU Library General Public *)
+(* License along with this program; if not, write to the Free Software *)
+(* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA *)
+(* 02111-1307 USA *)
+(* *)
+(* Contact: Maxence.Guesdon@inria.fr *)
+(* *)
+(*********************************************************************************)
(** This module is the interface of the Configwin library. *)
@@ -30,8 +31,8 @@
type parameter_kind;;
(** This type represents the structure of the configuration window. *)
-type configuration_structure =
- | Section of string * parameter_kind list
+type configuration_structure =
+ | Section of string * parameter_kind list
(** label of the section, parameters *)
| Section_list of string * configuration_structure list
(** label of the section, list of the sub sections *)
@@ -50,13 +51,20 @@ type return_button =
on the apply button.*)
-(** {2 The key option class (to use with the {!Uoptions} library)} *)
+(** {2 The key option class (to use with the {!Config_file} library)} *)
-module KeyOption : sig
- val string_to_key : string -> (Gdk.Tags.modifier list * int)
- val key_to_string : (Gdk.Tags.modifier list * int) -> string
- val t : (Gdk.Tags.modifier list * int) Uoptions.option_class
-end
+val string_to_key : string -> Gdk.Tags.modifier list * int
+
+val key_to_string : Gdk.Tags.modifier list * int -> string
+
+val key_cp_wrapper : (Gdk.Tags.modifier list * int) Config_file.wrappers
+
+class key_cp :
+ ?group:Config_file.group ->
+ string list ->
+ ?short_name:string ->
+ Gdk.Tags.modifier list * int ->
+ string -> [Gdk.Tags.modifier list * int] Config_file.cp_custom_type
(** {2 Functions to create parameters} *)
@@ -69,6 +77,13 @@ end
val string : ?editable: bool -> ?expand: bool -> ?help: string ->
?f: (string -> unit) -> string -> string -> parameter_kind
+(** Same as {!Configwin.string} but for values which are not strings. *)
+val custom_string : ?editable: bool -> ?expand: bool -> ?help: string ->
+ ?f: ('a -> unit) ->
+ to_string: ('a -> string) ->
+ of_string: (string -> 'a) ->
+ string -> 'a -> parameter_kind
+
(** [bool label value] creates a boolean parameter.
@param editable indicate if the value is editable (default is [true]).
@param help an optional help message.
@@ -88,12 +103,12 @@ val bool : ?editable: bool -> ?help: string ->
always returning false.
*)
val strings : ?editable: bool -> ?help: string ->
- ?f: (string list -> unit) ->
+ ?f: (string list -> unit) ->
?eq: (string -> string -> bool) ->
- ?add: (unit -> string list) ->
+ ?add: (unit -> string list) ->
string -> string list -> parameter_kind
-
-(** [list label f_strings value] creates a list parameter.
+
+(** [list label f_strings value] creates a list parameter.
[f_strings] is a function taking a value and returning a list
of strings to display it. The list length should be the same for
any value, and the same as the titles list length. The [value]
@@ -117,15 +132,15 @@ val strings : ?editable: bool -> ?help: string ->
no color for any element.
*)
val list : ?editable: bool -> ?help: string ->
- ?f: ('a list -> unit) ->
+ ?f: ('a list -> unit) ->
?eq: ('a -> 'a -> bool) ->
?edit: ('a -> 'a) ->
- ?add: (unit -> 'a list) ->
+ ?add: (unit -> 'a list) ->
?titles: string list ->
?color: ('a -> string option) ->
- string ->
+ string ->
('a -> string list) ->
- 'a list ->
+ 'a list ->
parameter_kind
(** [color label value] creates a color parameter.
@@ -134,7 +149,7 @@ val list : ?editable: bool -> ?help: string ->
@param help an optional help message.
@param f the function called to apply the value (default function does nothing).
*)
-val color : ?editable: bool -> ?expand: bool -> ?help: string ->
+val color : ?editable: bool -> ?expand: bool -> ?help: string ->
?f: (string -> unit) -> string -> string -> parameter_kind
(** [font label value] creates a font parameter.
@@ -143,7 +158,7 @@ val color : ?editable: bool -> ?expand: bool -> ?help: string ->
@param help an optional help message.
@param f the function called to apply the value (default function does nothing).
*)
-val font : ?editable: bool -> ?expand: bool -> ?help: string ->
+val font : ?editable: bool -> ?expand: bool -> ?help: string ->
?f: (string -> unit) -> string -> string -> parameter_kind
(** [combo label choices value] creates a combo parameter.
@@ -156,8 +171,8 @@ val font : ?editable: bool -> ?expand: bool -> ?help: string ->
@param blank_allowed indicate if the empty selection [""] is accepted
(default is [false]).
*)
-val combo : ?editable: bool -> ?expand: bool -> ?help: string ->
- ?f: (string -> unit) ->
+val combo : ?editable: bool -> ?expand: bool -> ?help: string ->
+ ?f: (string -> unit) ->
?new_allowed: bool -> ?blank_allowed: bool ->
string -> string list -> string -> parameter_kind
@@ -167,14 +182,21 @@ val combo : ?editable: bool -> ?expand: bool -> ?help: string ->
@param help an optional help message.
@param f the function called to apply the value (default function does nothing).
*)
-val text : ?editable: bool -> ?expand: bool -> ?help: string ->
+val text : ?editable: bool -> ?expand: bool -> ?help: string ->
?f: (string -> unit) -> string -> string -> parameter_kind
-(** Same as {!Configwin.text} but html bindings are available
- in the text widget. Use the [configwin_html_config] utility
+(** Same as {!Configwin.text} but for values which are not strings. *)
+val custom_text : ?editable: bool -> ?expand: bool -> ?help: string ->
+ ?f: ('a -> unit) ->
+ to_string: ('a -> string) ->
+ of_string: (string -> 'a) ->
+ string -> 'a -> parameter_kind
+
+(** Same as {!Configwin.text} but html bindings are available
+ in the text widget. Use the [configwin_html_config] utility
to edit your bindings.
*)
-val html : ?editable: bool -> ?expand: bool -> ?help: string ->
+val html : ?editable: bool -> ?expand: bool -> ?help: string ->
?f: (string -> unit) -> string -> string -> parameter_kind
(** [filename label value] creates a filename parameter.
@@ -194,8 +216,8 @@ val filename : ?editable: bool -> ?expand: bool -> ?help: string ->
is [Pervasives.(=)]. If you want to allow doubles in the list, give a function
always returning false.
*)
-val filenames : ?editable: bool -> ?help: string ->
- ?f: (string list -> unit) ->
+val filenames : ?editable: bool -> ?help: string ->
+ ?f: (string list -> unit) ->
?eq: (string -> string -> bool) ->
string -> string list -> parameter_kind
@@ -208,8 +230,8 @@ val filenames : ?editable: bool -> ?help: string ->
is a tupe [(day,month,year)], where [month] is between [0] and [11]. The default
function creates the string [year/month/day].
*)
-val date : ?editable: bool -> ?expand: bool -> ?help: string ->
- ?f: ((int * int * int) -> unit) ->
+val date : ?editable: bool -> ?expand: bool -> ?help: string ->
+ ?f: ((int * int * int) -> unit) ->
?f_string: ((int * int * int -> string)) ->
string -> (int * int * int) -> parameter_kind
@@ -221,7 +243,7 @@ val date : ?editable: bool -> ?expand: bool -> ?help: string ->
@param f the function called to apply the value (default function does nothing).
*)
val hotkey : ?editable: bool -> ?expand: bool -> ?help: string ->
- ?f: ((Gdk.Tags.modifier list * int) -> unit) ->
+ ?f: ((Gdk.Tags.modifier list * int) -> unit) ->
string -> (Gdk.Tags.modifier list * int) -> parameter_kind
val modifiers : ?editable: bool -> ?expand: bool -> ?help: string ->
@@ -229,7 +251,6 @@ val modifiers : ?editable: bool -> ?expand: bool -> ?help: string ->
?f: (Gdk.Tags.modifier list -> unit) ->
string -> Gdk.Tags.modifier list -> parameter_kind
-
(** [custom box f expand] creates a custom parameter, with
the given [box], the [f] function is called when the user
wants to apply his changes, and [expand] indicates if the box
@@ -241,8 +262,8 @@ val custom : ?label: string -> GPack.box -> (unit -> unit) -> bool -> parameter_
(** {2 Functions creating configuration windows and boxes} *)
(** This function takes a configuration structure and creates a window
- to configure the various parameters.
- @param apply this function is called when the apply button is clicked, after
+ to configure the various parameters.
+ @param apply this function is called when the apply button is clicked, after
giving new values to parameters.
*)
val edit :
@@ -263,9 +284,9 @@ val get :
configuration_structure list ->
return_button
-(** This function takes a list of parameter specifications and
+(** This function takes a list of parameter specifications and
creates a window to configure the various parameters.
- @param apply this function is called when the apply button is clicked, after
+ @param apply this function is called when the apply button is clicked, after
giving new values to parameters.*)
val simple_edit :
?apply: (unit -> unit) ->
@@ -274,7 +295,7 @@ val simple_edit :
?height:int ->
parameter_kind list -> return_button
-(** This function takes a list of parameter specifications and
+(** This function takes a list of parameter specifications and
creates a window to configure the various parameters,
without Apply button.*)
val simple_get :
@@ -284,17 +305,14 @@ val simple_get :
parameter_kind list -> return_button
(** Create a [GPack.box] with the list of given parameters,
- and the given list of buttons (defined by their label and callback).
- Before calling the callback of a button, the [apply] function
- of each parameter is called.
+ Return the box and the function to call to apply new values to parameters.
*)
-val box : parameter_kind list ->
- (string * (unit -> unit)) list -> GPack.box
+val box : parameter_kind list -> GData.tooltips -> GPack.box * (unit -> unit)
(** Create a [GPack.box] with the list of given configuration structure list,
and the given list of buttons (defined by their label and callback).
Before calling the callback of a button, the [apply] function
of each parameter is called.
*)
-val tabbed_box : configuration_structure list ->
- (string * (unit -> unit)) list -> GPack.box
+val tabbed_box : configuration_structure list ->
+ (string * (unit -> unit)) list -> GData.tooltips -> GPack.box