Ansel
0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
popup.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_POPUP_H
20
#define DT_WIDGETS_POPUP_H
21
22
/* Menus and popovers, and the Wayland rule that governs where they may be anchored.
23
*
24
* Wayland compositors only accept the top-most enclosing popup as a popup's parent. Anchoring
25
* to the widget the user actually clicked -- which is what every naive call does -- produces a
26
* popup placed at the wrong end of the screen, or none at all. Every popup in the application
27
* goes through here so that rule is applied once. */
28
29
#include <gtk/gtk.h>
30
31
G_BEGIN_DECLS
32
34
static
inline
GtkWindow
*
dt_gtk_get_window
(
GtkWidget
*widget)
35
{
36
if
(!widget)
return
NULL
;
37
GtkWidget
*
toplevel
=
gtk_widget_get_toplevel
(widget);
38
if
(
toplevel
&&
gtk_widget_is_toplevel
(
toplevel
))
return
GTK_WINDOW
(
toplevel
);
39
return
NULL
;
40
}
41
53
GtkWidget
*
dt_gui_get_popup_relative_widget
(
GtkWidget
*widget,
GdkRectangle
*
rect
);
54
57
void
dt_gui_menu_popup
(
GtkMenu
*menu,
GtkWidget
*button,
GdkGravity
widget_anchor
,
GdkGravity
menu_anchor
);
58
68
GtkBox *
attach_popover
(
GtkWidget
*widget,
const
char
*icon,
GtkWidget
*content);
69
80
GtkBox *
attach_help_popover
(
GtkWidget
*widget,
const
char
*label);
81
82
G_END_DECLS
83
84
#endif
// DT_WIDGETS_POPUP_H
85
86
// clang-format off
87
// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
88
// vim: shiftwidth=2 expandtab tabstop=2 cindent
89
// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
90
// clang-format on
GtkWidget
struct _GtkWidget GtkWidget
GtkWidget, opaque, spelled exactly as GTK spells it.
Definition
colorspaces.h:98
L
const float L
Definition
colorspaces_inline_conversions.h:494
attach_help_popover
GtkBox * attach_help_popover(GtkWidget *widget, const char *label)
Definition
popup.c:122
dt_gui_menu_popup
void dt_gui_menu_popup(GtkMenu *menu, GtkWidget *button, GdkGravity widget_anchor, GdkGravity menu_anchor)
Definition
popup.c:53
dt_gtk_get_window
static G_BEGIN_DECLS GtkWindow * dt_gtk_get_window(GtkWidget *widget)
Definition
popup.h:34
dt_gui_get_popup_relative_widget
GtkWidget * dt_gui_get_popup_relative_widget(GtkWidget *widget, GdkRectangle *rect)
Resolve the widget to use as parent for a nested popup on Wayland.
Definition
popup.c:25
attach_popover
GtkBox * attach_popover(GtkWidget *widget, const char *icon, GtkWidget *content)
Definition
popup.c:91
rect
Definition
ashift_lsd.c:1229
src
widgets
popup.h
Generated by
1.9.8