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
30
G_BEGIN_DECLS
31
32
enum
33
{
34
TREE_LIST_MIN_ROWS
= 3,
35
TREE_LIST_MAX_ROWS
= 11
36
};
37
38
typedef
enum
dt_ui_resize_mode_t
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.
42
DT_UI_RESIZE_DYNAMIC
= 0,
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.
46
DT_UI_RESIZE_STATIC
47
}
dt_ui_resize_mode_t
;
48
49
typedef
struct
dt_gui_widget_auto_height_t
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
54
dt_ui_resize_mode_t
mode
;
55
GtkTreeModel
*
model
;
56
GtkTextBuffer
*
buffer
;
57
gulong
model_row_inserted
;
58
gulong
model_row_deleted
;
59
gulong
model_row_changed
;
60
gulong
model_rows_reordered
;
61
gulong
model_row_expanded
;
62
gulong
model_row_collapsed
;
63
gulong
buffer_changed
;
64
}
dt_gui_widget_auto_height_t
;
65
83
GtkWidget
*
dt_ui_scroll_wrap
(
GtkWidget
*w, gint min_size,
char
*config_str,
dt_ui_resize_mode_t
mode);
84
88
GtkWidget
*
dt_ui_scroll_wrap_get_scrolled_window
(
GtkWidget
*
wrapper
);
89
104
GtkWidget
*
dt_ui_resizable_drawing_area
(
GtkWidget
*area,
char
*config_str,
int
default_height
,
int
min_height);
105
106
G_END_DECLS
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
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
dt_ui_resizable_drawing_area
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.
Definition
scroll_wrap.c:573
dt_ui_scroll_wrap_get_scrolled_window
GtkWidget * dt_ui_scroll_wrap_get_scrolled_window(GtkWidget *wrapper)
Return the inner GtkScrolledWindow of a dt_ui_scroll_wrap() wrapper, or NULL.
Definition
scroll_wrap.c:527
TREE_LIST_MIN_ROWS
@ TREE_LIST_MIN_ROWS
Definition
scroll_wrap.h:34
TREE_LIST_MAX_ROWS
@ TREE_LIST_MAX_ROWS
Definition
scroll_wrap.h:35
dt_ui_resize_mode_t
dt_ui_resize_mode_t
Definition
scroll_wrap.h:39
DT_UI_RESIZE_STATIC
@ DT_UI_RESIZE_STATIC
Definition
scroll_wrap.h:46
DT_UI_RESIZE_DYNAMIC
@ DT_UI_RESIZE_DYNAMIC
Definition
scroll_wrap.h:42
dt_ui_scroll_wrap
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.
Definition
scroll_wrap.c:465
dt_gui_widget_auto_height_t
Definition
scroll_wrap.h:50
dt_gui_widget_auto_height_t::config_str
char * config_str
Definition
scroll_wrap.h:51
dt_gui_widget_auto_height_t::last_height
int last_height
Definition
scroll_wrap.h:53
dt_gui_widget_auto_height_t::model_row_expanded
gulong model_row_expanded
Definition
scroll_wrap.h:61
dt_gui_widget_auto_height_t::mode
dt_ui_resize_mode_t mode
Definition
scroll_wrap.h:54
dt_gui_widget_auto_height_t::min_size
int min_size
Definition
scroll_wrap.h:52
dt_gui_widget_auto_height_t::model_row_collapsed
gulong model_row_collapsed
Definition
scroll_wrap.h:62
dt_gui_widget_auto_height_t::buffer_changed
gulong buffer_changed
Definition
scroll_wrap.h:63
dt_gui_widget_auto_height_t::model_row_inserted
gulong model_row_inserted
Definition
scroll_wrap.h:57
dt_gui_widget_auto_height_t::model
GtkTreeModel * model
Definition
scroll_wrap.h:55
dt_gui_widget_auto_height_t::model_row_changed
gulong model_row_changed
Definition
scroll_wrap.h:59
dt_gui_widget_auto_height_t::model_rows_reordered
gulong model_rows_reordered
Definition
scroll_wrap.h:60
dt_gui_widget_auto_height_t::model_row_deleted
gulong model_row_deleted
Definition
scroll_wrap.h:58
dt_gui_widget_auto_height_t::buffer
GtkTextBuffer * buffer
Definition
scroll_wrap.h:56
src
widgets
scroll_wrap.h
Generated by
1.9.8