Remove memory leaks in BeginSmartIndent()
[nedit.git] / Microline / examples / folder2.c
blob3561f087ffe043e099b0734a3c3a6143e42c05d3
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
16 * The Original Code is the Microline Widget Library, originally made available under the NPL by Neuron Data <http://www.neurondata.com>.
18 * The Initial Developer of the Original Code is
19 * Netscape Communications Corporation.
20 * Portions created by the Initial Developer are Copyright (C) 1998
21 * the Initial Developer. All Rights Reserved.
23 * Contributor(s):
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * In addition, as a special exception to the GNU GPL, the copyright holders
38 * give permission to link the code of this program with the Motif and Open
39 * Motif libraries (or with modified versions of these that use the same
40 * license), and distribute linked combinations including the two. You
41 * must obey the GNU General Public License in all respects for all of
42 * the code used other than linking with Motif/Open Motif. If you modify
43 * this file, you may extend this exception to your version of the file,
44 * but you are not obligated to do so. If you do not wish to do so,
45 * delete this exception statement from your version.
47 * ***** END LICENSE BLOCK ***** */
50 #include <Xm/Xm.h>
51 #include <Xm/DrawnB.h>
52 #include <Xm/Form.h>
53 #include <Xm/Label.h>
54 #include <XmL/Folder.h>
56 main(argc, argv)
57 int argc;
58 char *argv[];
60 XtAppContext app;
61 Widget shell, form, folder, tab, folderForm;
62 XmString str;
63 char pageName[20], tabName[20];
64 int i;
66 shell = XtAppInitialize(&app, "Folder2", NULL, 0,
67 &argc, argv, NULL, NULL, 0);
69 form = XtVaCreateManagedWidget("form",
70 xmFormWidgetClass, shell,
71 XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
72 XmNmarginWidth, 8,
73 XmNmarginHeight, 8,
74 XmNshadowThickness, 0,
75 NULL);
77 folder = XtVaCreateManagedWidget("folder",
78 xmlFolderWidgetClass, form,
79 XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
80 XtVaTypedArg, XmNforeground, XmRString, "black", 6,
81 XmNtabPlacement, XmFOLDER_RIGHT,
82 XmNmarginWidth, 10,
83 XmNtopAttachment, XmATTACH_FORM,
84 XmNbottomAttachment, XmATTACH_FORM,
85 XmNleftAttachment, XmATTACH_FORM,
86 XmNrightAttachment, XmATTACH_FORM,
87 NULL);
89 for (i = 0; i < 3; i++)
91 sprintf(pageName, "Page %d", i);
93 /* Add a tab (DrawnButton) to the Folder */
94 sprintf(tabName, "Tab %d", i);
95 str = XmStringCreateSimple(tabName);
96 tab = XtVaCreateManagedWidget("tab",
97 xmDrawnButtonWidgetClass, folder,
98 XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
99 XtVaTypedArg, XmNforeground, XmRString, "black", 6,
100 XmNlabelString, str,
101 XmNtabManagedName, pageName,
102 NULL);
103 XmStringFree(str);
105 /* Add a Form to the Folder which will appear in the page */
106 /* area. This Form will be managed by the tab created above */
107 /* because it has the same tabManagedName as the tab widget */
108 folderForm = XtVaCreateManagedWidget("folderForm",
109 xmFormWidgetClass, folder,
110 XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
111 XmNtabManagedName, pageName,
112 NULL);
114 /* Add a Label as a child of the Form */
115 XtVaCreateManagedWidget(pageName,
116 xmLabelWidgetClass, folderForm,
117 XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
118 XtVaTypedArg, XmNforeground, XmRString, "black", 6,
119 XmNmarginWidth, 100,
120 XmNmarginHeight, 80,
121 XmNtopAttachment, XmATTACH_FORM,
122 XmNbottomAttachment, XmATTACH_FORM,
123 XmNleftAttachment, XmATTACH_FORM,
124 XmNrightAttachment, XmATTACH_FORM,
125 NULL);
128 XtRealizeWidget(shell);
129 XtAppMainLoop(app);