home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / xfe / Microline3.0 / examples / folder2.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  3.4 KB  |  109 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 <Xm/DrawnB.h>
  30. #include <Xm/Form.h>
  31. #include <Xm/Label.h>
  32. #include <XmL/Folder.h>
  33.  
  34. main(argc, argv)
  35. int argc;
  36. char *argv[];
  37. {
  38.     XtAppContext app;
  39.     Widget shell, form, folder, tab, folderForm;
  40.     XmString str;
  41.     char pageName[20], tabName[20];
  42.     int i;
  43.  
  44.     shell =  XtAppInitialize(&app, "Folder2", NULL, 0,
  45.         &argc, argv, NULL, NULL, 0);
  46.  
  47.     form = XtVaCreateManagedWidget("form",
  48.         xmFormWidgetClass, shell,
  49.         XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
  50.         XmNmarginWidth, 8,
  51.         XmNmarginHeight, 8,
  52.         XmNshadowThickness, 0,
  53.         NULL);
  54.  
  55.     folder = XtVaCreateManagedWidget("folder",
  56.         xmlFolderWidgetClass, form,
  57.         XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
  58.         XtVaTypedArg, XmNforeground, XmRString, "black", 6,
  59.         XmNtabPlacement, XmFOLDER_RIGHT,
  60.         XmNmarginWidth, 10,
  61.         XmNtopAttachment, XmATTACH_FORM,
  62.         XmNbottomAttachment, XmATTACH_FORM,
  63.         XmNleftAttachment, XmATTACH_FORM,
  64.         XmNrightAttachment, XmATTACH_FORM,
  65.         NULL);
  66.  
  67.     for (i = 0; i < 3; i++)
  68.     {
  69.         sprintf(pageName, "Page %d", i);
  70.  
  71.         /* Add a tab (DrawnButton) to the Folder */
  72.         sprintf(tabName, "Tab %d", i);
  73.         str = XmStringCreateSimple(tabName);
  74.         tab = XtVaCreateManagedWidget("tab",
  75.             xmDrawnButtonWidgetClass, folder,
  76.             XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
  77.             XtVaTypedArg, XmNforeground, XmRString, "black", 6,
  78.             XmNlabelString, str,
  79.             XmNtabManagedName, pageName,
  80.             NULL);
  81.         XmStringFree(str);
  82.  
  83.         /* Add a Form to the Folder which will appear in the page */
  84.         /* area. This Form will be managed by the tab created above */
  85.         /* because it has the same tabManagedName as the tab widget */
  86.         folderForm = XtVaCreateManagedWidget("folderForm",
  87.             xmFormWidgetClass, folder,
  88.             XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
  89.             XmNtabManagedName, pageName,
  90.             NULL);
  91.  
  92.         /* Add a Label as a child of the Form */
  93.         XtVaCreateManagedWidget(pageName,
  94.             xmLabelWidgetClass, folderForm,
  95.             XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
  96.             XtVaTypedArg, XmNforeground, XmRString, "black", 6,
  97.             XmNmarginWidth, 100,
  98.             XmNmarginHeight, 80,
  99.             XmNtopAttachment, XmATTACH_FORM,
  100.             XmNbottomAttachment, XmATTACH_FORM,
  101.             XmNleftAttachment, XmATTACH_FORM,
  102.             XmNrightAttachment, XmATTACH_FORM,
  103.             NULL);
  104.     }
  105.  
  106.     XtRealizeWidget(shell);
  107.     XtAppMainLoop(app);
  108. }
  109.