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