Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
scroll_wrap.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_SCROLL_WRAP_H
20#define DT_WIDGETS_SCROLL_WRAP_H
21
22/* Vertically resizable containers with a drag grip, and the height persistence behind them.
23 *
24 * Two shapes, both giving the user a grip on the bottom edge and remembering where they left
25 * it: a scrolled window around scrollable content (tree views, text views), and a bare
26 * height-request around a self-drawing area (graphs, scopes). */
27
28#include <gtk/gtk.h>
29
31
32enum
33{
36};
37
39{
40 // Auto-fit: the area shrinks to its content (up to the user/max height). Best for widgets
41 // updated rarely; their height following content is helpful, not disruptive.
43 // Fixed: the area keeps the user-set (or default) height regardless of content, so it never
44 // shifts the surrounding layout when its content changes. Best for widgets that refresh on
45 // hover/selection (tags, notes, metadata) and the collection/library list.
48
50{
51 char *config_str; // conf key persisting the user-chosen height (px); owned
52 int min_size; // minimum height floor in device pixels
53 int last_height; // last applied bare (pre-padding) height, shared with the drag handle
65
83GtkWidget *dt_ui_scroll_wrap(GtkWidget *w, gint min_size, char *config_str, dt_ui_resize_mode_t mode);
84
89
104GtkWidget *dt_ui_resizable_drawing_area(GtkWidget *area, char *config_str, int default_height, int min_height);
105
107
108#endif // DT_WIDGETS_SCROLL_WRAP_H
109
110// clang-format off
111// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
112// vim: shiftwidth=2 expandtab tabstop=2 cindent
113// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
114// clang-format on
struct _GtkWidget GtkWidget
GtkWidget, opaque, spelled exactly as GTK spells it.
Definition colorspaces.h:98
GtkWidget * dt_ui_resizable_drawing_area(GtkWidget *area, char *config_str, int default_height, int min_height)
Make a self-drawing widget (typically a GtkDrawingArea graph or scope) vertically resizable.
GtkWidget * dt_ui_scroll_wrap_get_scrolled_window(GtkWidget *wrapper)
Return the inner GtkScrolledWindow of a dt_ui_scroll_wrap() wrapper, or NULL.
@ TREE_LIST_MIN_ROWS
Definition scroll_wrap.h:34
@ TREE_LIST_MAX_ROWS
Definition scroll_wrap.h:35
dt_ui_resize_mode_t
Definition scroll_wrap.h:39
@ DT_UI_RESIZE_STATIC
Definition scroll_wrap.h:46
@ DT_UI_RESIZE_DYNAMIC
Definition scroll_wrap.h:42
GtkWidget * dt_ui_scroll_wrap(GtkWidget *w, gint min_size, char *config_str, dt_ui_resize_mode_t mode)
Wrap a scrollable widget in a recessed, vertically resizable scrolled window with a drag handle.
dt_ui_resize_mode_t mode
Definition scroll_wrap.h:54