home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / xfe / Microline3.0 / examples / util1.c < prev   
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.3 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 <Xm/Form.h>
  30. #include <Xm/DrawnB.h>
  31. #include <XmL/XmL.h>
  32.  
  33. main(argc, argv)
  34. int argc;
  35. char *argv[];
  36. {
  37.     XtAppContext app;
  38.     Widget shell, form, button[4][5];
  39.     int i, j;
  40.     static int types[5] =
  41.     {
  42.         XmDRAWNB_ARROW,
  43.         XmDRAWNB_ARROWLINE,
  44.         XmDRAWNB_DOUBLEARROW,
  45.         XmDRAWNB_SQUARE,
  46.         XmDRAWNB_DOUBLEBAR
  47.     };
  48.     static int dirs[4] = 
  49.     {
  50.         XmDRAWNB_RIGHT,
  51.         XmDRAWNB_LEFT,
  52.         XmDRAWNB_UP,
  53.         XmDRAWNB_DOWN
  54.     };
  55.  
  56.     shell =  XtAppInitialize(&app, "Grid1", NULL, 0,
  57.         &argc, argv, NULL, NULL, 0);
  58.  
  59.     form = XtVaCreateManagedWidget("form",
  60.         xmFormWidgetClass, shell,
  61.         XmNfractionBase, 5,
  62.         XmNshadowThickness, 0,
  63.         NULL);
  64.  
  65.     for (i = 0 ; i < 4; i++)
  66.         for (j = 0; j < 5; j++)
  67.         {
  68.             button[i][j] = XtVaCreateManagedWidget("drawnB",
  69.                 xmDrawnButtonWidgetClass, form,
  70.                 XmNtopAttachment, XmATTACH_POSITION,
  71.                 XmNtopPosition, i,
  72.                 XmNbottomAttachment, XmATTACH_POSITION,
  73.                 XmNbottomPosition, i + 1,
  74.                 XmNleftAttachment, XmATTACH_POSITION,
  75.                 XmNleftPosition, j,
  76.                 XmNrightAttachment, XmATTACH_POSITION,
  77.                 XmNrightPosition, j + 1,
  78.                 XmNwidth, 30,
  79.                 XmNheight, 30,
  80.                 NULL);
  81.             XmLDrawnButtonSetType(button[i][j], types[j], dirs[i]);
  82.         }
  83.  
  84.     XtRealizeWidget(shell);
  85.     XtAppMainLoop(app);
  86. }
  87.  
  88.