replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later.
[metze/wireshark/wip.git] / ui / progress_dlg.h
1 /* progress_dlg.h
2  * Definitions for progress dialog box routines
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * SPDX-License-Identifier: GPL-2.0-or-later*/
9
10 #ifndef __PROGRESS_DLG_H__
11 #define __PROGRESS_DLG_H__
12
13 #ifdef __cplusplus
14 extern "C" {
15 #endif /* __cplusplus */
16
17 /** @file
18  *  Progress (modal) dialog box routines.
19  *  @ingroup dialog_group
20  */
21
22 /** Progress dialog data. */
23 struct progdlg;
24
25 /** Progress dialog data. */
26 typedef struct progdlg progdlg_t;
27
28 /**
29  * Create and pop up the progress dialog. Allocates a "progdlg_t"
30  * and initialize it to contain all information the implementation
31  * needs in order to manipulate the dialog, and return a pointer to
32  * it.
33  *
34  * @param top_level_window UI widget to associate with the progress dialog, e.g.
35  *   the main window.
36  * @param task_title The task to do, e.g. "Loading"
37  * @param item_title The item to do, e.g. "capture.cap"
38  * @param terminate_is_stop TRUE if the operation can't be cancelled, just
39  *   stopped (i.e., it has a "Stop" button and clicking it doesn't undo
40  *   anything already done), FALSE if it can
41  * @param stop_flag A pointer to a Boolean variable that will be
42  *   set to TRUE if the user hits that button
43  * @return The newly created progress dialog
44  */
45 progdlg_t *create_progress_dlg(gpointer top_level_window, const gchar *task_title, const gchar *item_title,
46     gboolean terminate_is_stop, gboolean *stop_flag);
47
48 /**
49  * Create a progress dialog, but only if it's not likely to disappear
50  * immediately. This can be disconcerting for the user.
51  *
52  * @param top_level_window The top-level window associated with the progress update.
53  *   May be NULL.
54  * @param task_title The task to do, e.g. "Loading"
55  * @param item_title The item to do, e.g. "capture.cap"
56  * @param terminate_is_stop TRUE if the operation can't be cancelled, just
57  *   stopped (i.e., it has a "Stop" button and clicking it doesn't undo
58  *   anything already done), FALSE if it can
59  * @param stop_flag A pointer to a Boolean variable that will be
60  *   set to TRUE if the user hits that button
61  * @param start_time A pointer to a GTimeVal structure which holds
62  *   the time at which the caller started to process the data
63  * @param progress The current progress (0..1)
64  * @return The newly created progress dialog
65  */
66 progdlg_t *delayed_create_progress_dlg(gpointer top_level_window, const gchar *task_title, const gchar *item_title,
67     gboolean terminate_is_stop, gboolean *stop_flag,
68     const GTimeVal *start_time, gfloat progress);
69
70 /**
71  * Update the progress information of the progress dialog box.
72  *
73  * @param dlg The progress dialog from create_progress_dlg()
74  * @param percentage The current percentage value (0..1)
75  * @param status the New status string to show, e.g. "3000KB of 6000KB"
76  */
77 void update_progress_dlg(progdlg_t *dlg, gfloat percentage, const gchar *status);
78
79 /**
80  * Destroy or hide the progress bar.
81  *
82  * @param dlg The progress dialog from create_progress_dlg()
83  */
84 void destroy_progress_dlg(progdlg_t *dlg);
85
86 #ifdef __cplusplus
87 }
88 #endif /* __cplusplus */
89
90 #endif /* __PROGRESS_DLG_H__ */
91
92 /*
93  * Editor modelines
94  *
95  * Local Variables:
96  * c-basic-offset: 4
97  * tab-width: 8
98  * indent-tabs-mode: nil
99  * End:
100  *
101  * ex: set shiftwidth=4 tabstop=8 expandtab:
102  * :indentSize=4:tabSize=8:noTabs=true:
103  */