-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnichrome-message.5c
50 lines (46 loc) · 1.67 KB
/
nichrome-message.5c
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
40
41
42
43
44
45
46
47
48
49
50
/*
* Copyright © 2012 Keith Packard <[email protected]>
*
* 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; version 2 of the License.
*
* 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.
*/
autoload Nichrome;
autoload Nichrome::Button;
autoload Nichrome::Box;
autoload Nichrome::Label;
autoload Nichrome::Toggle;
autoload Nichrome::Textline;
autoload Nichrome::RRboard;
autoload Nichrome::Solid;
extend namespace Nichrome {
public namespace Message {
public typedef struct {
*nichrome_t ui;
} message_t;
protected message_t new (string title, string contents) {
*message_t message = &(message_t) {};
message->ui = Nichrome::new(title, 100, 100);
*Box::box_t box = Box::new(Box::dir_t.vertical,
Box::widget_item(Label::new(message->ui, contents), 1, 1),
Box::box_item(Box::new(Box::dir_t.horizontal,
Box::glue_item(1),
Box::widget_item(Button::new(message->ui,
"OK",
void func (*widget_t w, bool state) {
Nichrome::destroy(message->ui);
}), 0, 0))));
Nichrome::set_box(message->ui, box);
main_loop(message->ui);
}
}
}