1 /*
2  * Copyright (C) 2020 Alexandros Theodotou <alex at zrythm dot org>
3  *
4  * This file is part of Zrythm
5  *
6  * Zrythm is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Affero General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Zrythm is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU Affero General Public License for more details.
15  *
16  * You should have received a copy of the GNU Affero General Public License
17  * along with Zrythm.  If not, see <https://www.gnu.org/licenses/>.
18  */
19 
20 /**
21  * \file
22  *
23  * Objejct color chooser dialog.
24  */
25 
26 #ifndef __GUI_WIDGETS_OBJECT_COLOR_CHOOSER_DIALOG_H__
27 #define __GUI_WIDGETS_OBJECT_COLOR_CHOOSER_DIALOG_H__
28 
29 #include <gtk/gtk.h>
30 
31 #define OBJECT_COLOR_CHOOSER_DIALOG_WIDGET_TYPE \
32   (object_color_chooser_dialog_widget_get_type ())
33 G_DECLARE_FINAL_TYPE (
34   ObjectColorChooserDialogWidget,
35   object_color_chooser_dialog_widget,
36   Z, OBJECT_COLOR_CHOOSER_DIALOG_WIDGET,
37   GtkColorChooserDialog)
38 
39 typedef struct Track Track;
40 typedef struct ZRegion ZRegion;
41 typedef struct TracklistSelections
42   TracklistSelections;
43 
44 /**
45  * @addtogroup widgets
46  *
47  * @{
48  */
49 
50 /**
51  * Dialog for choosing colors of objects like tracks
52  * and regions.
53  */
54 typedef struct _ObjectColorChooserDialogWidget
55 {
56   GtkColorChooserDialog parent_instance;
57 
58   /** Track, if for track. */
59   Track *               track;
60 
61   /* Region, if for region. */
62   ZRegion *             region;
63 
64   /** Tracklist selections, if for tracklist
65    * selections. */
66   TracklistSelections * tracklist_selections;
67 } ObjectColorChooserDialogWidget;
68 
69 /**
70  * Creates a new dialog.
71  */
72 ObjectColorChooserDialogWidget *
73 object_color_chooser_dialog_widget_new_for_track (
74   Track * track);
75 
76 /**
77  * Creates a new dialog.
78  */
79 NONNULL
80 ObjectColorChooserDialogWidget *
81 object_color_chooser_dialog_widget_new_for_tracklist_selections (
82   TracklistSelections * sel);
83 
84 /**
85  * Creates a new dialog.
86  */
87 ObjectColorChooserDialogWidget *
88 object_color_chooser_dialog_widget_new_for_region (
89   ZRegion * region);
90 
91 /**
92  * Runs the widget and processes the result, then
93  * closes the dialog.
94  *
95  * @return Whether the color was set or not.
96  */
97 bool
98 object_color_chooser_dialog_widget_run (
99   ObjectColorChooserDialogWidget * self);
100 
101 /**
102  * @}
103  */
104 
105 #endif
106