2 * Copyright (c) 2002, Adam Dunkels.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following
12 * disclaimer in the documentation and/or other materials provided
13 * with the distribution.
14 * 3. The name of the author may not be used to endorse or promote
15 * products derived from this software without specific prior
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
19 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
24 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 * This file is part of the Contiki desktop environment
32 * $Id: about.c,v 1.4 2008/02/08 22:48:28 oliverschmidt Exp $
40 #include "lib/petsciiconv.h"
42 static struct ctk_window aboutdialog
;
43 static struct ctk_label aboutlabel1
=
44 {CTK_LABEL(2, 0, 28, 1, "The Contiki Operating System")};
45 static struct ctk_label aboutlabel2
=
46 {CTK_LABEL(3, 2, 28, 1, "A modern, Internet-enabled")};
47 static struct ctk_label aboutlabel3
=
48 {CTK_LABEL(6, 3, 20, 1, "operating system and")};
49 static struct ctk_label aboutlabel4
=
50 {CTK_LABEL(6, 4, 20, 1, "desktop environment.")};
52 static char abouturl_petscii
[] = "http://www.sics.se/~adam/contiki/";
53 static char abouturl_ascii
[40];
54 static struct ctk_hyperlink abouturl
=
55 {CTK_HYPERLINK(0, 6, 32, "http://www.sics.se/~adam/contiki/",
57 static struct ctk_button aboutclose
=
58 {CTK_BUTTON(12, 8, 5, "Close")};
61 PROCESS(about_process
, "About Contiki");
63 AUTOSTART_PROCESSES(&about_process
);
65 /*-----------------------------------------------------------------------------------*/
70 process_exit(&about_process
);
73 /*-----------------------------------------------------------------------------------*/
74 PROCESS_THREAD(about_process
, ev
, data
)
80 width
= ctk_desktop_width(NULL
);
82 strcpy(abouturl_ascii
, abouturl_petscii
);
83 petsciiconv_toascii(abouturl_ascii
, sizeof(abouturl_ascii
));
86 ctk_dialog_new(&aboutdialog
, 32, 9);
88 ctk_dialog_new(&aboutdialog
, width
- 2, 9);
90 CTK_WIDGET_ADD(&aboutdialog
, &aboutlabel1
);
91 CTK_WIDGET_ADD(&aboutdialog
, &aboutlabel2
);
92 CTK_WIDGET_ADD(&aboutdialog
, &aboutlabel3
);
93 CTK_WIDGET_ADD(&aboutdialog
, &aboutlabel4
);
95 CTK_WIDGET_ADD(&aboutdialog
, &abouturl
);
96 CTK_WIDGET_SET_FLAG(&abouturl
, CTK_WIDGET_FLAG_MONOSPACE
);
98 CTK_WIDGET_SET_XPOS(&aboutlabel1
, 0);
99 CTK_WIDGET_SET_XPOS(&aboutlabel2
, 0);
100 CTK_WIDGET_SET_XPOS(&aboutlabel3
, 0);
101 CTK_WIDGET_SET_XPOS(&aboutlabel4
, 0);
103 CTK_WIDGET_SET_XPOS(&aboutclose
, 0);
105 CTK_WIDGET_ADD(&aboutdialog
, &aboutclose
);
106 CTK_WIDGET_FOCUS(&aboutdialog
, &aboutclose
);
108 ctk_dialog_open(&aboutdialog
);
111 PROCESS_WAIT_EVENT();
112 if(ev
== PROCESS_EVENT_EXIT
) {
115 } else if(ev
== ctk_signal_button_activate
) {
116 if(data
== (process_data_t
)&aboutclose
) {
120 } else if(ev
== ctk_signal_hyperlink_activate
) {
121 if((struct ctk_widget
*)data
== (struct ctk_widget
*)&abouturl
) {
130 /*-----------------------------------------------------------------------------------*/