Debian Codegraph @

xo/main.cxx

raw
1 /* main.cxx
2 $Id: main.cxx,v 1.11 1997/10/18 04:57:40 elf Exp $
3
4 written by Marc Singer
5 8 May 1997
6
7 This file is part of the project XO. See the file README for
8 more information.
9
10 Copyright (C) 1997 Marc Singer
11
12 This program is free software; you can redistribute it and/or
13 modify it under the terms of the GNU General Public License as
14 published by the Free Software Foundation; either version 2 of the
15 License, or (at your option) any later version.
16
17 This program is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 in a file called COPYING along with this program; if not, write to
24 the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
25 02139, USA.
26
27 -----------
28 DESCRIPTION
29 -----------
30
31 */
32
33
34 #include "standard.h"
35
36 #include "ldisplay.h"
37 #include "lwindow.h"
38 #include "wdialog.h"
39
40 void register_base_classes (LDisplay* pDisplay);
41
42 int g_argc;
43 char** g_argv;
44 bool g_fQuit;
45
46 void exit_error (char* sz, ...)
47 {
48 fprintf (stderr, "%s: ", g_argv[0]);
49
50 va_list ap;
51 va_start (ap, sz);
52 vfprintf (stderr, sz, ap);
53 va_end (ap);
54
55 fprintf (stderr, "\n");
56
57 exit (1);
58 }
59
60
61 int main (int argc, char** argv)
62 {
63 g_argc = argc;
64 g_argv = argv;
65
66 for (int i = 1; i < argc; ++i)
67 if (strcasecmp (argv[i], "--no-ornaments") == 0)
68 g_fNoOrnaments = true;
69
70 LDisplay display;
71 if (!display.open ())
72 exit_error ("unable to open display");
73
74 register_base_classes (&display);
75
76 LWindow* pWindow = new LWindow (display.find_template ("top-level"));
77 #if 0
78 pWindow->position (100, 100, 200, 200);
79 if (!pWindow->create (0))
80 exit_error ("unable to open window");
81 pWindow->map ();
82 #endif
83
84 LWindow* pWindowDialog = WDialog::create (pWindow, "sample.dlg", 1);
85
86 // XEvent event;
87 while (!g_fQuit) {
88 display.dispatch_next_event ();
89 }
90
91 pWindowDialog->unmap (); // Make a clean exit
92 display.flush ();
93 }