17a84e134Smrg/*
27a84e134Smrg *
37a84e134SmrgCopyright 1989, 1998  The Open Group
47a84e134SmrgCopyright 2003-2004 Roland Mainz <roland.mainz@nrubsig.org>
57a84e134Smrg
67a84e134SmrgPermission to use, copy, modify, distribute, and sell this software and its
77a84e134Smrgdocumentation for any purpose is hereby granted without fee, provided that
87a84e134Smrgthe above copyright notice appear in all copies and that both that
97a84e134Smrgcopyright notice and this permission notice appear in supporting
107a84e134Smrgdocumentation.
117a84e134Smrg
127a84e134SmrgThe above copyright notice and this permission notice shall be included in
137a84e134Smrgall copies or substantial portions of the Software.
147a84e134Smrg
157a84e134SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
167a84e134SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
177a84e134SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
187a84e134SmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
197a84e134SmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
207a84e134SmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
217a84e134Smrg
227a84e134SmrgExcept as contained in this notice, the name of The Open Group shall not be
237a84e134Smrgused in advertising or otherwise to promote the sale, use or other dealings
247a84e134Smrgin this Software without prior written authorization from The Open Group.
25421c997bSmrg *
26421c997bSmrg *
27421c997bSmrg *			    XawInitializeWidgetSet
28421c997bSmrg *
297a84e134Smrg * This routine forces a reference to vendor shell so that the one in this
307a84e134Smrg * widget is installed.  Any other cross-widget set initialization should be
317a84e134Smrg * done here as well.  All Athena widgets should include "XawInit.h" and
327a84e134Smrg * call this routine from their ClassInitialize procs (this routine may be
337a84e134Smrg * used as the class init proc).
347a84e134Smrg */
357a84e134Smrg#ifdef HAVE_CONFIG_H
367a84e134Smrg#include <config.h>
377a84e134Smrg#endif
387a84e134Smrg#include <X11/Intrinsic.h>
397a84e134Smrg#include <X11/Vendor.h>
407a84e134Smrg#include <X11/Xaw/XawInit.h>
417a84e134Smrg#include <X11/IntrinsicP.h>
427a84e134Smrg#include <X11/StringDefs.h>
437a84e134Smrg#include "Private.h"
447a84e134Smrg
457a84e134Smrgvoid
467a84e134SmrgXawInitializeWidgetSet(void)
477a84e134Smrg{
487a84e134Smrg    static Boolean firsttime = True;
497a84e134Smrg
507a84e134Smrg    if (firsttime) {
517a84e134Smrg	firsttime = False;
527a84e134Smrg#ifndef OLDXAW
537a84e134Smrg	XawPixmapsInitialize();
547a84e134Smrg	XawInitializeDefaultConverters();
557a84e134Smrg#endif
567a84e134Smrg	XtInitializeWidgetClass(vendorShellWidgetClass);
577a84e134Smrg    }
587a84e134Smrg}
597a84e134Smrg
607a84e134Smrg/* XawOpenApplication() - mainly identical to XtOpenApplication() but
617a84e134Smrg * takes a |Display *| and |Screen *| as arguments, too... */
627a84e134SmrgWidget XawOpenApplication(XtAppContext *app_context_return,
637a84e134Smrg                          Display      *dpy,
647a84e134Smrg                          Screen       *screen,
657a84e134Smrg                          String        application_name,
667a84e134Smrg                          String        application_class,
677a84e134Smrg                          WidgetClass   widget_class,
687a84e134Smrg                          int          *argc,
695ec34c4cSmrg                          _XtString    *argv)
707a84e134Smrg{
717a84e134Smrg    Widget   toplevel;
727a84e134Smrg    Cardinal n;
737a84e134Smrg    Arg      args[2];
747a84e134Smrg
757a84e134Smrg    XtToolkitInitialize();
767a84e134Smrg    *app_context_return = XtCreateApplicationContext();
777a84e134Smrg    if( *app_context_return == NULL )
787a84e134Smrg        return NULL;
79421c997bSmrg
807a84e134Smrg    XtDisplayInitialize(*app_context_return, dpy,
817a84e134Smrg                        application_name, application_class,
827a84e134Smrg                        NULL, 0,
837a84e134Smrg                        argc, argv);
847a84e134Smrg
857a84e134Smrg    n = 0;
867a84e134Smrg    if (screen) {
877a84e134Smrg        XtSetArg(args[n], XtNscreen, screen); n++;
887a84e134Smrg    }
89421c997bSmrg    toplevel = XtAppCreateShell(application_name,
907a84e134Smrg                                application_class,
917a84e134Smrg                                widget_class,
927a84e134Smrg                                dpy,
937a84e134Smrg                                args, n);
947a84e134Smrg
957a84e134Smrg    return toplevel;
967a84e134Smrg}
977a84e134Smrg
98