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 * Copyright (C) 2026 Guillaume Stutin.
5 *
6 * Ansel is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU 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 * Ansel 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 General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with Ansel. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef DT_WIDGETS_SCROLL_WRAP_H
21#define DT_WIDGETS_SCROLL_WRAP_H
22
23/* Vertically resizable containers with a drag grip, and the height persistence behind them.
24 *
25 * Two shapes, both giving the user a grip on the bottom edge and remembering where they left
26 * it: a scrolled window around scrollable content (tree views, text views), and a bare
27 * height-request around a self-drawing area (graphs, scopes). */
28
29#include <gtk/gtk.h>
30
31G_BEGIN_DECLS
32
33enum
34{
37};
38
40{
41 // Auto-fit: the area shrinks to its content (up to the user/max height). Best for widgets
42 // updated rarely; their height following content is helpful, not disruptive.
44 // Fixed: the area keeps the user-set (or default) height regardless of content, so it never
45 // shifts the surrounding layout when its content changes. Best for widgets that refresh on
46 // hover/selection (tags, notes) and the collection/library list.
49
51{
52 char *config_str; // conf key persisting the user-chosen height (px); owned
53 int min_size; // minimum height floor in device pixels
54 int last_height; // last applied bare (pre-padding) height, shared with the drag handle
56 gboolean trailing_row; // one blank row past the content, see dt_ui_scroll_wrap_reserve_trailing_row()
57 GtkTreeModel *model;
58 GtkTextBuffer *buffer;
67
87GtkWidget *dt_ui_scroll_wrap(GtkWidget *w, gint min_size, const char *config_str, dt_ui_resize_mode_t mode);
88
93
105
120GtkWidget *dt_ui_resizable_drawing_area(GtkWidget *area, char *config_str, int default_height, int min_height);
121
122G_END_DECLS
123
124#endif // DT_WIDGETS_SCROLL_WRAP_H
125
126// clang-format off
127// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
128// vim: shiftwidth=2 expandtab tabstop=2 cindent
129// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
130// clang-format on
struct _GtkWidget GtkWidget
GtkWidget, opaque, spelled exactly as GTK spells it.
Definition colorspaces.h:98
void dt_ui_scroll_wrap_reserve_trailing_row(GtkWidget *content_widget)
Make a DT_UI_RESIZE_DYNAMIC list or text view ask for one blank row past its content.
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:35
@ TREE_LIST_MAX_ROWS
Definition scroll_wrap.h:36
GtkWidget * dt_ui_scroll_wrap(GtkWidget *w, gint min_size, const 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
Definition scroll_wrap.h:40
@ DT_UI_RESIZE_STATIC
Definition scroll_wrap.h:47
@ DT_UI_RESIZE_DYNAMIC
Definition scroll_wrap.h:43
dt_ui_resize_mode_t mode
Definition scroll_wrap.h:55