Fixed ZDE build - missing header file
[ZeXOS.git] / apps / zde / main.c
blob8c7dc6750333d693a590dc1653d6ba76352aac8e
1 /*
2 * ZeX/OS
3 * Copyright (C) 2008 Tomas 'ZeXx86' Jedrzejek (zexx86@zexos.org)
4 * Copyright (C) 2009 Tomas 'ZeXx86' Jedrzejek (zexx86@zexos.org)
5 * Copyright (C) 2010 Tomas 'ZeXx86' Jedrzejek (zexx86@zexos.org)
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include <stdio.h>
23 #include <string.h>
24 #include <stdlib.h>
25 #include <libx/base.h>
26 #include <libx/object.h>
27 #include <libx/image.h>
28 #include <libx/cursor.h>
29 #include <libx/text.h>
31 #include "dialog.h"
32 #include "window.h"
33 #include "cursor.h"
34 #include "appsrv.h"
35 #include "button.h"
36 #include "icon.h"
37 #include "kbd.h"
38 #include "bg.h"
40 #define ESC 1
41 #define ARROWLEFT 75
42 #define ARROWRIGHT 77
43 #define ARROWUP 72
44 #define ARROWDOWN 80
46 int lock;
48 int zde_drawlock ()
50 lock = 1;
52 return 0;
55 int zde_drawunlock ()
57 lock = 0;
59 return 0;
62 int error_print (char *err)
64 printf ("ERROR - ZDE -> init of %s failed !\n", err);
66 return 0;
69 int init_zde ()
71 if (init_background ())
72 return error_print ("background");
73 if (init_cursor ())
74 return error_print ("cursor");
75 if (init_icon ())
76 return error_print ("icon");
77 if (init_button ())
78 return error_print ("button");
79 if (init_dialog ())
80 return error_print ("dialog");
81 if (init_window ())
82 return error_print ("window");
83 if (init_appsrv ())
84 return error_print ("appsrv");
85 if (init_kbd ())
86 return error_print ("kbd");
88 return 1;
91 int draw_zde ()
93 draw_background ();
94 draw_icon_desktop ();
95 draw_window ();
96 draw_cursor ();
98 return 0;
101 int main (int argc, char **argv)
103 /* Switch to VGA graphics mode */
104 if (!xinit ()) {
105 printf ("Something is already using VGA !\n");
106 return -1;
109 /* Clean screen */
110 xcls (0);
112 if (!init_zde ())
113 return -1;
115 zde_drawunlock ();
117 for (;;) {
118 kbd_update ();
119 draw_zde ();
121 if (!lock)
122 xfbswap ();
125 /* Go back to textual mode */
126 xexit ();
128 /* Exit app */
129 return 0;