blob: cae6cf3c7a689e85e79e5d6a5cee2da0f44e55ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
class type message_view =
object
inherit GObj.widget
method add_selection_clipboard : GData.clipboard -> unit
method clear : unit -> unit
method push : Interface.message_level -> string -> unit
end
let message_view () : message_view =
let buffer = GText.buffer ~tag_table:Tags.Message.table () in
let view = GText.view ~buffer
~editable:false ~cursor_visible:false ~wrap_mode:`WORD ()
in
let () = view#set_left_margin 2 in
object
inherit GObj.widget view#as_widget
method clear () =
buffer#set_text ""
method push level msg =
let tags = match level with
| Interface.Error -> [Tags.Message.error]
| _ -> []
in
buffer#insert ~tags msg
method add_selection_clipboard cb =
buffer#add_selection_clipboard cb
end
|