gecko-dev/cmd/xfe/Microline3.0/examples/tree1.c
1999-11-02 22:43:10 +00:00

92 lines
2.8 KiB
C

/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/*
* The following source code is part of the Microline Widget Library.
* The Microline widget library is made available to Mozilla developers
* under the Netscape Public License (NPL) by Neuron Data. To learn
* more about Neuron Data, please visit the Neuron Data Home Page at
* http://www.neurondata.com.
*/
#include <Xm/Xm.h>
#include <XmL/Tree.h>
main(argc, argv)
int argc;
char *argv[];
{
XtAppContext app;
Widget shell, tree;
Pixmap pixmap, pixmask;
XmString str;
shell = XtAppInitialize(&app, "Tree1", NULL, 0,
&argc, argv, NULL, NULL, 0);
tree = XtVaCreateManagedWidget("tree",
xmlTreeWidgetClass, shell,
XmNvisibleRows, 10,
XmNwidth, 250,
NULL);
XtVaSetValues(tree,
XmNlayoutFrozen, True,
NULL);
pixmap = XmUNSPECIFIED_PIXMAP;
pixmask = XmUNSPECIFIED_PIXMAP;
str = XmStringCreateSimple("Root");
XmLTreeAddRow(tree, 0, True, True, -1, pixmap, pixmask, str);
XmStringFree(str);
str = XmStringCreateSimple("Level 1 Parent");
XmLTreeAddRow(tree, 1, True, True, -1, pixmap, pixmask, str);
XmStringFree(str);
str = XmStringCreateSimple("1st Child of Level 1 Parent");
XmLTreeAddRow(tree, 2, False, False, -1, pixmap, pixmask, str);
XmStringFree(str);
str = XmStringCreateSimple("2nd Child of Level 1 Parent");
XmLTreeAddRow(tree, 2, False, False, -1, pixmap, pixmask, str);
XmStringFree(str);
str = XmStringCreateSimple("Level 2 Parent");
XmLTreeAddRow(tree, 2, True, True, -1, pixmap, pixmask, str);
XmStringFree(str);
str = XmStringCreateSimple("Child of Level 2 Parent");
XmLTreeAddRow(tree, 3, False, False, -1, pixmap, pixmask, str);
XmStringFree(str);
str = XmStringCreateSimple("Level 1 Parent");
XmLTreeAddRow(tree, 1, True, True, -1, pixmap, pixmask, str);
XmStringFree(str);
str = XmStringCreateSimple("Child of Level 1 Parent");
XmLTreeAddRow(tree, 2, False, False, -1, pixmap, pixmask, str);
XmStringFree(str);
XtVaSetValues(tree,
XmNlayoutFrozen, False,
NULL);
XtRealizeWidget(shell);
XtAppMainLoop(app);
}