White space changes.
[obnox/wireshark/wip.git] / ui / progress_dlg.h
1 /* progress_dlg.h
2  * Definitions for progress dialog box routines
3  *
4  * $Id$
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
8  * Copyright 1998 Gerald Combs
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23  */
24
25 #ifndef __PROGRESS_DLG_H__
26 #define __PROGRESS_DLG_H__
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif /* __cplusplus */
31
32 /** @file
33  *  Progress (modal) dialog box routines.
34  *  @ingroup dialog_group
35  */
36
37 /** Progress dialog data. */
38 struct progdlg;
39
40 /** Progress dialog data. */
41 typedef struct progdlg progdlg_t;
42
43 /**
44  * Create and pop up the progress dialog. Allocates a "progdlg_t"
45  * and initialize it to contain all information the implementation
46  * needs in order to manipulate the dialog, and return a pointer to
47  * it.
48  *
49  * @param task_title the task to do, e.g. "Loading"
50  * @param item_title the item to do, e.g. "capture.cap"
51  * @param terminate_is_stop TRUE if the operation can't be cancelled, just
52  *   stopped (i.e., it has a "Stop" button and clicking it doesn't undo
53  *   anything already done), FALSE if it can
54  * @param stop_flag a pointer to a Boolean variable that will be
55  *   set to TRUE if the user hits that button
56  * @return the newly created progress dialog
57  */
58 progdlg_t *create_progress_dlg(const gchar *task_title, const gchar *item_title,
59     gboolean terminate_is_stop, gboolean *stop_flag);
60
61 /**
62  * Create a progress dialog, but only if it's not likely to disappear
63  * immediately. This can be disconcerting for the user.
64  *
65  * @param task_title the task to do, e.g. "Loading"
66  * @param item_title the item to do, e.g. "capture.cap"
67  * @param terminate_is_stop TRUE if the operation can't be cancelled, just
68  *   stopped (i.e., it has a "Stop" button and clicking it doesn't undo
69  *   anything already done), FALSE if it can
70  * @param stop_flag a pointer to a Boolean variable that will be
71  *   set to TRUE if the user hits that button
72  * @param start_time a pointer to a GTimeVal structure which holds
73  *   the time at which the caller started to process the data
74  * @param progress the current progress (0..1)
75  * @return the newly created progress dialog
76  */
77 progdlg_t *
78 delayed_create_progress_dlg(const gchar *task_title, const gchar *item_title,
79     gboolean terminate_is_stop, gboolean *stop_flag,
80     const GTimeVal *start_time, gfloat progress);
81
82 /**
83  * Update the progress information of the progress dialog box.
84  *
85  * @param dlg the progress dialog from create_progress_dlg()
86  * @param percentage the current percentage value (0..1)
87  * @param status the new status string to show, e.g. "3000KB of 6000KB"
88  */
89 void update_progress_dlg(progdlg_t *dlg, gfloat percentage, const gchar *status);
90
91 /**
92  * Destroy the progress bar.
93  *
94  * @param dlg the progress dialog from create_progress_dlg()
95  */
96 void destroy_progress_dlg(progdlg_t *dlg);
97
98 #ifdef __cplusplus
99 }
100 #endif /* __cplusplus */
101
102 #endif /* __PROGRESS_DLG_H__ */