home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / xfe / Microline3.0 / examples / tree1.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.8 KB  |  88 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 <XmL/Tree.h>
  30.  
  31. main(argc, argv)
  32. int argc;
  33. char *argv[];
  34. {
  35.     XtAppContext app;
  36.     Widget shell, tree;
  37.     Pixmap pixmap, pixmask;
  38.     XmString str;
  39.  
  40.     shell =  XtAppInitialize(&app, "Tree1", NULL, 0,
  41.         &argc, argv, NULL, NULL, 0);
  42.  
  43.     tree = XtVaCreateManagedWidget("tree",
  44.         xmlTreeWidgetClass, shell,
  45.         XmNvisibleRows, 10,
  46.         XmNwidth, 250,
  47.         NULL);
  48.  
  49.     XtVaSetValues(tree,
  50.         XmNlayoutFrozen, True,
  51.         NULL);
  52.  
  53.     pixmap = XmUNSPECIFIED_PIXMAP;
  54.     pixmask = XmUNSPECIFIED_PIXMAP;
  55.  
  56.     str = XmStringCreateSimple("Root");
  57.     XmLTreeAddRow(tree, 0, True, True, -1, pixmap, pixmask, str);
  58.     XmStringFree(str);
  59.     str = XmStringCreateSimple("Level 1 Parent");
  60.     XmLTreeAddRow(tree, 1, True, True, -1, pixmap, pixmask, str);
  61.     XmStringFree(str);
  62.     str = XmStringCreateSimple("1st Child of Level 1 Parent");
  63.     XmLTreeAddRow(tree, 2, False, False, -1, pixmap, pixmask, str);
  64.     XmStringFree(str);
  65.     str = XmStringCreateSimple("2nd Child of Level 1 Parent");
  66.     XmLTreeAddRow(tree, 2, False, False, -1, pixmap, pixmask, str);
  67.     XmStringFree(str);
  68.     str = XmStringCreateSimple("Level 2 Parent");
  69.     XmLTreeAddRow(tree, 2, True, True, -1, pixmap, pixmask, str);
  70.     XmStringFree(str);
  71.     str = XmStringCreateSimple("Child of Level 2 Parent");
  72.     XmLTreeAddRow(tree, 3, False, False, -1, pixmap, pixmask, str);
  73.     XmStringFree(str);
  74.     str = XmStringCreateSimple("Level 1 Parent");
  75.     XmLTreeAddRow(tree, 1, True, True, -1, pixmap, pixmask, str);
  76.     XmStringFree(str);
  77.     str = XmStringCreateSimple("Child of Level 1 Parent");
  78.     XmLTreeAddRow(tree, 2, False, False, -1, pixmap, pixmask, str);
  79.     XmStringFree(str);
  80.  
  81.     XtVaSetValues(tree,
  82.         XmNlayoutFrozen, False,
  83.         NULL);
  84.  
  85.     XtRealizeWidget(shell);
  86.     XtAppMainLoop(app);
  87. }
  88.