XawInit.c revision 7a84e134
1/*
2 * $Xorg: XawInit.c,v 1.4 2001/02/09 02:03:47 xorgcvs Exp $
3 *
4Copyright 1989, 1998  The Open Group
5Copyright 2003-2004 Roland Mainz <roland.mainz@nrubsig.org>
6
7Permission to use, copy, modify, distribute, and sell this software and its
8documentation for any purpose is hereby granted without fee, provided that
9the above copyright notice appear in all copies and that both that
10copyright notice and this permission notice appear in supporting
11documentation.
12
13The above copyright notice and this permission notice shall be included in
14all copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
19OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
23Except as contained in this notice, the name of The Open Group shall not be
24used in advertising or otherwise to promote the sale, use or other dealings
25in this Software without prior written authorization from The Open Group.
26 *
27 *
28 * 			    XawInitializeWidgetSet
29 *
30 * This routine forces a reference to vendor shell so that the one in this
31 * widget is installed.  Any other cross-widget set initialization should be
32 * done here as well.  All Athena widgets should include "XawInit.h" and
33 * call this routine from their ClassInitialize procs (this routine may be
34 * used as the class init proc).
35 */
36/* $XFree86: xc/lib/Xaw/XawInit.c,v 1.9 2001/01/17 19:42:36 dawes Exp $ */
37
38#ifdef HAVE_CONFIG_H
39#include <config.h>
40#endif
41#include <X11/Intrinsic.h>
42#include <X11/Vendor.h>
43#include <X11/Xaw/XawInit.h>
44#include <X11/IntrinsicP.h>
45#include <X11/StringDefs.h>
46#include "Private.h"
47
48void
49XawInitializeWidgetSet(void)
50{
51    static Boolean firsttime = True;
52
53    if (firsttime) {
54	firsttime = False;
55#ifndef OLDXAW
56	XawPixmapsInitialize();
57	XawInitializeDefaultConverters();
58#endif
59	XtInitializeWidgetClass(vendorShellWidgetClass);
60    }
61}
62
63/* XawOpenApplication() - mainly identical to XtOpenApplication() but
64 * takes a |Display *| and |Screen *| as arguments, too... */
65Widget XawOpenApplication(XtAppContext *app_context_return,
66                          Display      *dpy,
67                          Screen       *screen,
68                          String        application_name,
69                          String        application_class,
70                          WidgetClass   widget_class,
71                          int          *argc,
72                          String       *argv)
73{
74    Widget   toplevel;
75    Cardinal n;
76    Arg      args[2];
77
78    XtToolkitInitialize();
79    *app_context_return = XtCreateApplicationContext();
80    if( *app_context_return == NULL )
81        return NULL;
82
83    XtDisplayInitialize(*app_context_return, dpy,
84                        application_name, application_class,
85                        NULL, 0,
86                        argc, argv);
87
88    n = 0;
89    if (screen) {
90        XtSetArg(args[n], XtNscreen, screen); n++;
91    }
92    toplevel = XtAppCreateShell(application_name,
93                                application_class,
94                                widget_class,
95                                dpy,
96                                args, n);
97
98    return toplevel;
99}
100
101