home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / xfe / Microline3.0 / examples / prog3.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.2 KB  |  85 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 <XmL/Progress.h>
  30.  
  31. Boolean compute();
  32.  
  33. Widget progress;
  34.  
  35. main(argc, argv)
  36. int argc;
  37. char *argv[];
  38. {
  39.     XtAppContext app;
  40.     Widget shell;
  41.  
  42.     shell =  XtAppInitialize(&app, "Prog3", NULL, 0,
  43.         &argc, argv, NULL, NULL, 0);
  44.  
  45.     progress = XtVaCreateManagedWidget("progress",
  46.         xmlProgressWidgetClass, shell,
  47.         XtVaTypedArg, XmNbackground, XmRString, "white", 6,
  48.         XtVaTypedArg, XmNforeground, XmRString, "#000080", 8,
  49.         XtVaTypedArg, XmNtopShadowColor, XmRString, "#D0D0D0", 8,
  50.         XtVaTypedArg, XmNbottomShadowColor, XmRString, "black", 6,
  51.         XmNmeterStyle, XmMETER_BOXES,
  52.         XmNnumBoxes, 20,
  53.         XmNwidth, 300,
  54.         XmNheight, 20,
  55.         XmNshadowThickness, 1,
  56.         NULL);
  57.  
  58.     XtAppAddWorkProc(app, compute, NULL);
  59.     XtRealizeWidget(shell);
  60.     XtAppMainLoop(app);
  61. }
  62.  
  63. Boolean compute(clientData)
  64. XtPointer clientData;
  65. {
  66.     int i;
  67.  
  68.     XtVaSetValues(progress,
  69.         XmNvalue, 0,
  70.         XmNcompleteValue, 7,
  71.         NULL);
  72.     for (i = 0; i < 7; i++)
  73.     {
  74.         XtVaSetValues(progress,
  75.             XmNvalue, i,
  76.             NULL);
  77.  
  78.         sleep(1);
  79.     }
  80.     XtVaSetValues(progress,
  81.         XmNvalue, i,
  82.         NULL);
  83.     return(FALSE);
  84. }
  85.