1 /*
2  *Copyright (C) 2018 Laurent Tréguier
3  *
4  *This file is part of DLS.
5  *
6  *DLS is free software: you can redistribute it and/or modify
7  *it under the terms of the GNU General Public License as published by
8  *the Free Software Foundation, either version 3 of the License, or
9  *(at your option) any later version.
10  *
11  *DLS is distributed in the hope that it will be useful,
12  *but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *GNU General Public License for more details.
15  *
16  *You should have received a copy of the GNU General Public License
17  *along with DLS.  If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 module dls.protocol.interfaces.window;
22 
23 class ShowMessageParams
24 {
25     MessageType type;
26     string message;
27 
28     @safe this(MessageType type = MessageType.init, string message = string.init) pure nothrow
29     {
30         this.type = type;
31         this.message = message;
32     }
33 }
34 
35 enum MessageType : ubyte
36 {
37     error = 1,
38     warning = 2,
39     info = 3,
40     log = 4
41 }
42 
43 final class ShowMessageRequestParams : ShowMessageParams
44 {
45     import dls.util.nullable: Nullable;
46 
47     Nullable!(MessageActionItem[]) actions;
48 
49     @safe this(MessageType type = MessageType.init, string message = string.init,
50             Nullable!(MessageActionItem[]) actions = Nullable!(MessageActionItem[]).init) pure nothrow
51     {
52         super(type, message);
53         this.actions = actions;
54     }
55 }
56 
57 final class MessageActionItem
58 {
59     string title;
60 
61     @safe this(string title = string.init) pure nothrow
62     {
63         this.title = title;
64     }
65 }
66 
67 alias LogMessageParams = ShowMessageParams;