Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
generic_progress_dialog.h
1// SPDX-FileCopyrightText: © 2019-2022, 2024 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#ifndef __GUI_WIDGETS_GENERIC_PROGRESS_DIALOG_H__
5#define __GUI_WIDGETS_GENERIC_PROGRESS_DIALOG_H__
6
7#include "common/utils/types.h"
8#include "gui/backend/gtk_widgets/libadwaita_wrapper.h"
9
10#define GENERIC_PROGRESS_DIALOG_WIDGET_TYPE \
11 (generic_progress_dialog_widget_get_type ())
12G_DECLARE_DERIVABLE_TYPE (
13 GenericProgressDialogWidget,
14 generic_progress_dialog_widget,
15 Z,
16 GENERIC_PROGRESS_DIALOG_WIDGET,
17 AdwAlertDialog)
18
19class ProgressInfo;
20
26
28{
29 std::string response;
30
35
37 std::optional<GenericCallback> cb;
38};
39
44{
45 GtkProgressBar * progress_bar;
46
52 bool autoclose;
53
59 bool cancelable;
60
61 ProgressInfo * progress_info;
62
66 std::vector<GenericProgressDialogButton> extra_buttons;
67
69 std::optional<GenericCallback> close_cb;
70};
71
72using GenericProgressDialogWidgetClass = struct _GenericProgressDialogWidgetClass
73{
74 AdwAlertDialogClass parent_class;
75};
76
80void
82 GenericProgressDialogWidget * self,
83 const char * title,
84 ProgressInfo * progress_info,
85 const char * initial_label,
86 bool autoclose,
87 std::optional<GenericCallback> close_callback,
88 bool cancelable);
89
93void
95 GenericProgressDialogWidget * self,
96 const char * response,
97 const char * response_label,
98 std::optional<GenericCallback> callback,
99 bool only_on_finish);
100
101GenericProgressDialogWidget *
102generic_progress_dialog_widget_new (void);
103
107
108#endif
Generic progress info.
struct { GtkProgressBar *progress_bar; bool autoclose; bool cancelable; ProgressInfo *progress_info; std::vector< GenericProgressDialogButton > extra_buttons; std::optional< GenericCallback > close_cb;} GenericProgressDialogWidgetPrivate
A generic progress dialog.
void generic_progress_dialog_widget_setup(GenericProgressDialogWidget *self, const char *title, ProgressInfo *progress_info, const char *initial_label, bool autoclose, std::optional< GenericCallback > close_callback, bool cancelable)
Sets up a progress dialog widget.
void generic_progress_dialog_add_response(GenericProgressDialogWidget *self, const char *response, const char *response_label, std::optional< GenericCallback > callback, bool only_on_finish)
Adds a response to the dialog.
std::optional< GenericCallback > cb
Callback when this response is made.
bool only_on_finish
Only show the button when the action is finished.