Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
popup.c File Reference
+ Include dependency graph for popup.c:

Go to the source code of this file.

Functions

GtkWidgetdt_gui_get_popup_relative_widget (GtkWidget *widget, GdkRectangle *rect)
 Resolve the widget to use as parent for a nested popup on Wayland.
 
void dt_gui_menu_popup (GtkMenu *menu, GtkWidget *button, GdkGravity widget_anchor, GdkGravity menu_anchor)
 
static void _popover_set_relative_to_topmost_parent (GtkPopover *popover, GtkWidget *button)
 
GtkBox * attach_popover (GtkWidget *widget, const char *icon, GtkWidget *content)
 
GtkBox * attach_help_popover (GtkWidget *widget, const char *label)
 

Function Documentation

◆ _popover_set_relative_to_topmost_parent()

static void _popover_set_relative_to_topmost_parent ( GtkPopover popover,
GtkWidget button 
)
static

Definition at line 83 of file popup.c.

References dt_gui_get_popup_relative_widget(), and L.

Referenced by attach_popover().

◆ attach_help_popover()

GtkBox * attach_help_popover ( GtkWidget widget,
const char *  label 
)

Add a help button triggering a popover label next to an arbitrary widget, to document its action. This is a better take at help tooltips that most people don't see unless they know about them. Tooltip window positioning is also wonky (can easily overflow the viewport), line breaks are added manually (ugly hack), and they appear and disappear on hover (not available on touch screens), so it's flimsy UI.

Parameters
widgetthe original widget to document. DON'T add it to a container.
labelthe in-app "docstring" for the widget
Returns
the GtkBox containing both the original widget and its popover button.

Definition at line 122 of file popup.c.

References attach_popover(), L, and TRUE.

Referenced by gui_init().

◆ attach_popover()

GtkBox * attach_popover ( GtkWidget widget,
const char *  icon,
GtkWidget content 
)

Add an arbitrary button next to the widget that opens a popover with arbitrary content.

Parameters
widgetthe original widget next to which the popover button will be added. DON'T add it to a container.
iconthe Freedesktop icon name to put in the button
contentthe widget that will fit inside the popover
Returns
the GtkBox containing both the original widget and its popover button. That's what you will need to add to your container.

Definition at line 91 of file popup.c.

References _popover_set_relative_to_topmost_parent(), dt_gui_add_class(), DT_GUI_BOX_SPACING, DT_PIXEL_APPLY_DPI, FALSE, and L.

Referenced by attach_help_popover(), gui_init(), and gui_init().

◆ 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.

Walks the parent chain to the top-most enclosing popup while leaving the caller in charge of the popup logic. When rect is not NULL, it receives the position and size of widget in the returned anchor's coordinate system.

Parameters
widgetthe widget the popup should visually point to.
rectoptional output rectangle receiving the geometry of widget.
Returns
the widget to use as popup parent, or NULL when widget is NULL.

Definition at line 25 of file popup.c.

References IS_NULL_PTR, L, MAX, rect::width, rect::x, and rect::y.

Referenced by _completion_update(), _popover_set_relative_to_topmost_parent(), _setup_completion(), dt_dev_toolbox_show_popup(), and dt_gui_menu_popup().

◆ dt_gui_menu_popup()

void dt_gui_menu_popup ( GtkMenu menu,
GtkWidget button,
GdkGravity  widget_anchor,
GdkGravity  menu_anchor 
)