home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / xfe / Microline3.0 / examples / prog2.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.0 KB  |  82 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, "Prog2", NULL, 0,
  43.         &argc, argv, NULL, NULL, 0);
  44.  
  45.     progress = XtVaCreateManagedWidget("progress",
  46.         xmlProgressWidgetClass, shell,
  47.         XmNshowTime, True,
  48.         XtVaTypedArg, XmNbackground, XmRString, "white", 6,
  49.         XtVaTypedArg, XmNforeground, XmRString, "#800000", 8,
  50.         XmNwidth, 300,
  51.         XmNheight, 25,
  52.         NULL);
  53.  
  54.     XtAppAddWorkProc(app, compute, NULL);
  55.     XtRealizeWidget(shell);
  56.     XtAppMainLoop(app);
  57. }
  58.  
  59. Boolean compute(clientData)
  60. XtPointer clientData;
  61. {
  62.     int i;
  63.  
  64.     XtVaSetValues(progress,
  65.         XmNvalue, 0,
  66.         XmNcompleteValue, 7,
  67.         NULL);
  68.     for (i = 0; i < 7; i++)
  69.     {
  70.         XtVaSetValues(progress,
  71.             XmNvalue, i,
  72.             NULL);
  73.  
  74.         /* perform processing */
  75.         sleep(1);
  76.     }
  77.     XtVaSetValues(progress,
  78.         XmNvalue, i,
  79.         NULL);
  80.     return(FALSE);
  81. }
  82.