home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / modules / progress / public / pw_public.h < prev   
Encoding:
C/C++ Source or Header  |  1998-04-08  |  3.7 KB  |  128 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. /* pw_public.h
  19.  * public progress module interface
  20.  * Progress module has two main parts:
  21.  * progress window
  22.  *    you can create a standard progress window
  23.  *    that monitors the progress of a download
  24.  * progress context
  25.  *    you can create an MWContext suitable for downloading
  26.  *    with NET_GetURL
  27.  * progress context can be 'attached' to progress window and
  28.  * will display standard progress messages during download while
  29.  * it is attached
  30.  */
  31.  
  32. #ifndef _PW_PUBLIC_H_
  33. #define _PW_PUBLIC_H_
  34.  
  35. #include "structs.h"
  36.  
  37. XP_BEGIN_PROTOS
  38.  
  39. /***************************************************************
  40.  * PW window interface
  41.  ***************************************************************/
  42.  
  43. typedef void *  pw_ptr;
  44.  
  45. typedef enum PW_WindowType {
  46.     pwApplicationModal,
  47.     pwStandard
  48. };
  49.  
  50. typedef void(*PW_CancelCallback) (void * closure);
  51.  
  52. /* Creates the progress window */
  53. /* The window is invisible until you call PW_Show */
  54.  
  55. pw_ptr PW_Create( MWContext * parent,         /* Parent window, can be NULL */
  56.                 PW_WindowType type            /* What kind of window ? Modality, etc */
  57.                 );
  58.  
  59. /* Setup */
  60.  
  61. void PW_SetCancelCallback(pw_ptr pw,
  62.                 PW_CancelCallback cancelcb,    /* Callback function for cancel */
  63.                 void * cancelClosure);        /* closure for cancel callback */
  64.  
  65. /*
  66.  * Window visibility
  67.  */
  68.  
  69. /* Show the window */
  70. /* brings the window to front if already visible */
  71. void PW_Show(pw_ptr pw);
  72.  
  73. /* Hide the window. Does NOT destroy it */
  74. void PW_Hide(pw_ptr pw);
  75.  
  76. /* Destroys the window */
  77. void PW_Destroy(pw_ptr pw);
  78.  
  79.  
  80. /**
  81.  * Text progress display
  82.  * all char * arguments can be NULL to erase
  83.  **/
  84.  
  85. void PW_SetWindowTitle(pw_ptr pw, const char * title);
  86.  
  87. void PW_SetLine1(pw_ptr pw, const char * text);
  88.  
  89. void PW_SetLine2(pw_ptr pw, const char * text);
  90.  
  91. /* aka SetLine3, named SetProgressText because this is where the
  92.  * usual "23K of 1235K (5 seconds remaining)" line goes
  93.  */
  94. void PW_SetProgressText(pw_ptr pw, const char * text);
  95.  
  96. /**
  97.  * Progress bar display
  98.  **/
  99.  
  100. /* if !(maximum > minimum) displays rotating pylon */
  101. void PW_SetProgressRange(pw_ptr pw, int32 minimum, int32 maximum);
  102.  
  103. void PW_SetProgressValue(pw_ptr pw, int32 value);
  104.  
  105. /***************************************************************
  106.  * PW context interface
  107.  ***************************************************************/
  108.  
  109. /* Purpose: create a downloading context anyone can use and destroy */
  110. /* You can associate it with progress window to automatically display */
  111. /* progress window text */
  112.  
  113. MWContext * PW_CreateProgressContext();
  114.  
  115. void PW_DestroyProgressContext(MWContext * context);
  116.  
  117. /* Associates MWContextProgressModule context with a downloading window */
  118. /* If done so, the xp_thermo progress stuff will be displayed in the */
  119. /* ProgressLine */
  120. /* Make sure that you disassociate window from the context when window is */
  121. /* destroyed by passing NULL as pw_ptr */
  122.  
  123. void PW_AssociateWindowWithContext(MWContext * context, pw_ptr pw);
  124.  
  125. XP_END_PROTOS
  126.  
  127. #endif
  128.