Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
dialog.h
Go to the documentation of this file.
1/*
2 * This file is part of Ansel,
3 * Copyright (C) 2026 Aurélien PIERRE.
4 *
5 * Ansel is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * Ansel is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with Ansel. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef DT_WIDGETS_DIALOG_H
20#define DT_WIDGETS_DIALOG_H
21
22/* Modal dialogs that can run before the application GUI exists.
23 *
24 * These only require gtk_init(), not a built main window, which is what makes them usable
25 * during startup -- picking a library file, confirming a database upgrade. They anchor to
26 * whatever the host registered as its root window, or to nothing at all if it has none yet. */
27
28#include <gtk/gtk.h>
29
31
32// show a dialog box with 2 buttons in case some user interaction is required BEFORE the gui is
33// initialised. This expects gtk_init() to have been called already, which is the case during
34// most of the init phase.
35gboolean dt_gui_show_standalone_yes_no_dialog(const char *title, const char *markup, const char *no_text,
36 const char *yes_text);
37
38// same as above, but with 3 buttons: returns 0 for first_text, 1 for second_text, 2 for third_text.
39int dt_gui_show_standalone_three_choice_dialog(const char *title, const char *markup, const char *first_text,
40 const char *second_text, const char *third_text);
41
42// similar to the one above. this one asks the user for some string. the hint is shown in the
43// empty entry box
44char *dt_gui_show_standalone_string_dialog(const char *title, const char *markup, const char *placeholder,
45 const char *no_text, const char *yes_text);
46
47// Explicitly return keyboard focus to a just-closed modal/dialog window's parent, falling back
48// to the root window if @p parent is NULL or not a window. Call right after destroying a dialog
49// (gtk_widget_destroy / gtk_dialog_run's caller): the transient-for hint is not enough to get
50// focus back reliably on every platform (macOS/quartz in particular).
52
54
55#endif // DT_WIDGETS_DIALOG_H
56
57// clang-format off
58// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
59// vim: shiftwidth=2 expandtab tabstop=2 cindent
60// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
61// clang-format on
G_BEGIN_DECLS gboolean dt_gui_show_standalone_yes_no_dialog(const char *title, const char *markup, const char *no_text, const char *yes_text)
Definition dialog.c:79
char * dt_gui_show_standalone_string_dialog(const char *title, const char *markup, const char *placeholder, const char *no_text, const char *yes_text)
Definition dialog.c:266
int dt_gui_show_standalone_three_choice_dialog(const char *title, const char *markup, const char *first_text, const char *second_text, const char *third_text)
Definition dialog.c:176
void dt_gui_refocus_parent(GtkWindow *parent)
Definition dialog.c:64