home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / xfe / Microline3.0 / examples / folder3.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  3.5 KB  |  126 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/Form.h>
  30. #include <Xm/Label.h>
  31. #include <Xm/PushB.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, shellForm, label, button;
  40.     XmString str;
  41.     char buf[20];
  42.     int i;
  43.     static char tabName[6][20] =
  44.     {
  45.         "Standard",
  46.         "PTEL Server",
  47.         "NTEL Server",
  48.         "Advanced",
  49.         "Transfer Address",
  50.         "Multimedia"
  51.     };
  52.  
  53.     shell =  XtAppInitialize(&app, "Folder3", NULL, 0,
  54.         &argc, argv, NULL, NULL, 0);
  55.  
  56.     form = XtVaCreateManagedWidget("form",
  57.         xmFormWidgetClass, shell,
  58.         XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
  59.         XmNmarginWidth, 10,
  60.         XmNmarginHeight, 10,
  61.         XmNshadowThickness, 0,
  62.         NULL);
  63.  
  64.     folder = XtVaCreateManagedWidget("folder",
  65.         xmlFolderWidgetClass, form,
  66.         XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
  67.         XtVaTypedArg, XmNforeground, XmRString, "black", 6,
  68.         XmNtabsPerRow, 3,
  69.         XmNmarginWidth, 10,
  70.         XmNtopAttachment, XmATTACH_FORM,
  71.         XmNbottomAttachment, XmATTACH_FORM,
  72.         XmNleftAttachment, XmATTACH_FORM,
  73.         XmNrightAttachment, XmATTACH_FORM,
  74.         NULL);
  75.  
  76.     for (i = 0; i < 6; i++)
  77.     {
  78.         /* Add a tab and Form managed by the tab to the Folder */
  79.         str = XmStringCreateSimple(tabName[i]);
  80.         shellForm = XmLFolderAddTabForm(folder, str);
  81.         XmStringFree(str);
  82.  
  83.         XtVaSetValues(shellForm,
  84.             XmNmarginWidth, 8,
  85.             XmNmarginHeight, 8,
  86.             NULL);
  87.  
  88.         /* Add a Label as a child of the Form */
  89.         sprintf(buf, "Label For Page %d", i);
  90.         label = XtVaCreateManagedWidget(buf,
  91.             xmLabelWidgetClass, shellForm,
  92.             XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
  93.             XtVaTypedArg, XmNforeground, XmRString, "black", 6,
  94.             XmNmarginWidth, 100,
  95.             XmNmarginHeight, 80,
  96.             XmNtopAttachment, XmATTACH_FORM,
  97.             XmNleftAttachment, XmATTACH_FORM,
  98.             XmNrightAttachment, XmATTACH_FORM,
  99.             NULL);
  100.  
  101.         /* Add a Button to pages 0 and 1 */
  102.         if (i < 2)
  103.         {
  104.             button = XtVaCreateManagedWidget("Sample Button",
  105.                 xmPushButtonWidgetClass, shellForm,
  106.                 XtVaTypedArg, XmNbackground, XmRString, "#C0C0C0", 8,
  107.                 XtVaTypedArg, XmNforeground, XmRString, "black", 6,
  108.                 XmNbottomAttachment, XmATTACH_FORM,
  109.                 XmNrightAttachment, XmATTACH_FORM,
  110.                 XmNmarginWidth, 5,
  111.                 NULL);
  112.             XtVaSetValues(label,
  113.                 XmNbottomAttachment, XmATTACH_WIDGET,
  114.                 XmNbottomWidget, button,
  115.                 NULL);
  116.         }
  117.         else
  118.             XtVaSetValues(label,
  119.                 XmNbottomAttachment, XmATTACH_FORM,
  120.                 NULL);
  121.     }
  122.  
  123.     XtRealizeWidget(shell);
  124.     XtAppMainLoop(app);
  125. }
  126.