home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / xfe / Microline3.0 / examples / uil1.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.9 KB  |  99 lines

  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. /*
  20.  * The following source code is part of the Microline Widget Library.
  21.  * The Microline widget library is made available to Mozilla developers
  22.  * under the Netscape Public License (NPL) by Neuron Data.  To learn
  23.  * more about Neuron Data, please visit the Neuron Data Home Page at
  24.  * http://www.neurondata.com.
  25.  */
  26.  
  27.  
  28. #include <Xm/Xm.h>
  29. #include <Mrm/MrmPublic.h>
  30. #include <XmL/Folder.h>
  31. #include <XmL/Grid.h>
  32. #include <XmL/Progress.h>
  33. #include <XmL/Tree.h>
  34. #include <stdio.h>
  35.  
  36. main(argc, argv)
  37. int    argc;
  38. String argv[];
  39. {
  40.     Display *dpy;
  41.     XtAppContext app;
  42.     Widget toplevel, tree, shellForm;
  43.     Pixmap pixmap;
  44.     XmString str;
  45.     MrmHierarchy hier;
  46.     MrmCode clas;
  47.     static char *files[] = {
  48.         "uil1.uid"            };
  49.  
  50.     MrmInitialize ();
  51.     XtToolkitInitialize();
  52.     app = XtCreateApplicationContext();
  53.     dpy = XtOpenDisplay(app, NULL, argv[0], "Uil1",
  54.         NULL, 0, &argc, argv);
  55.     if (dpy == NULL) {
  56.         fprintf(stderr, "%s:  Can't open display\n", argv[0]);
  57.         exit(1);
  58.     }
  59.  
  60.     toplevel = XtVaAppCreateShell(argv[0], NULL,
  61.         applicationShellWidgetClass, dpy,
  62.         XmNwidth, 400,
  63.         XmNheight, 300,
  64.         NULL);
  65.  
  66.     if (MrmOpenHierarchy (1, files, NULL, &hier) != MrmSUCCESS)
  67.         printf ("can't open hierarchy\n");
  68.  
  69.     MrmRegisterClass(0, NULL, "XmLCreateFolder",
  70.         XmLCreateFolder, xmlFolderWidgetClass);
  71.     MrmRegisterClass(0, NULL, "XmLCreateGrid",
  72.         XmLCreateGrid, xmlGridWidgetClass);
  73.     MrmRegisterClass(0, NULL, "XmLCreateProgress",
  74.         XmLCreateProgress, xmlProgressWidgetClass);
  75.     MrmRegisterClass(0, NULL, "XmLCreateTree",
  76.         XmLCreateTree, xmlTreeWidgetClass);
  77.  
  78.     if (MrmFetchWidget(hier, "shellForm", toplevel, &shellForm,
  79.         &clas) != MrmSUCCESS)
  80.         printf("can't fetch shellForm\n");
  81.  
  82.     tree = XtNameToWidget(shellForm, "*tree");
  83.  
  84.     /* Add two rows to the Tree */
  85.     pixmap = XmUNSPECIFIED_PIXMAP;
  86.     str = XmStringCreateSimple("Root");
  87.     XmLTreeAddRow(tree, 0, True, True, -1, pixmap, pixmap, str);
  88.     XmStringFree(str);
  89.     str = XmStringCreateSimple("Child of Root");
  90.     XmLTreeAddRow(tree, 1, False, False, -1, pixmap, pixmap, str);
  91.     XmStringFree(str);
  92.  
  93.     XtManageChild(shellForm);
  94.     XtRealizeWidget(toplevel);
  95.     XtAppMainLoop(app);
  96.  
  97.     return (0);
  98. }
  99.