Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
resize_handle.c File Reference
#include "widgets/resize_handle.h"
#include "widgets/widget_settings.h"
#include "system/macros.h"
#include <math.h>
+ Include dependency graph for resize_handle.c:

Go to the source code of this file.

Data Structures

struct  dtgtk_resize_handle_t
 

Typedefs

typedef struct dtgtk_resize_handle_t dtgtk_resize_handle_t
 

Functions

static gboolean _resize_handle_cursor (GtkWidget *widget, GdkEventCrossing *event, gpointer user_data)
 
static gboolean _resize_handle_button (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
 
static gboolean _resize_handle_motion (GtkWidget *widget, GdkEventMotion *event, gpointer user_data)
 
GtkWidgetdtgtk_resize_handle_new (GtkOrientation orientation, gboolean invert, const char *tooltip, dtgtk_resize_handle_get_size_f get_size, dtgtk_resize_handle_resize_f resize, gpointer user_data)
 Create a themed handle widget driving one-dimensional resize gestures.
 

Typedef Documentation

◆ dtgtk_resize_handle_t

Function Documentation

◆ _resize_handle_button()

◆ _resize_handle_cursor()

static gboolean _resize_handle_cursor ( GtkWidget widget,
GdkEventCrossing event,
gpointer  user_data 
)
static

◆ _resize_handle_motion()

◆ dtgtk_resize_handle_new()

GtkWidget * dtgtk_resize_handle_new ( GtkOrientation  orientation,
gboolean  invert,
const char *  tooltip,
dtgtk_resize_handle_get_size_f  get_size,
dtgtk_resize_handle_resize_f  resize,
gpointer  user_data 
)

Create a themed handle widget driving one-dimensional resize gestures.

The handle owns the GTK event bookkeeping: hover state, cursor, grab lifetime, drawing and drag delta computation. The caller owns the resized target and keeps that ownership visible through get_size and resize. During pointer motion resize receives finished == FALSE; on button release it receives finished == TRUE so callers can persist the final size without writing settings at every motion sample.

Parameters
invertWhen FALSE the target grows as the pointer moves in the positive axis direction (down for vertical, right for horizontal) — the natural case for a handle sitting below/at the right of its target. Set TRUE when the target grows in the opposite direction, e.g. a right panel that grows as it is dragged left, or a bottom panel that grows as it is dragged up.

The grip is meant to be added as an overlay child on the resized widget. It pins itself to the correct edge (from orientation and invert) and tags itself with an edge CSS class (.resize-handle-{top,bottom,left,right}); its thickness and centering live in the stylesheet.

Definition at line 117 of file resize_handle.c.

References _resize_handle_button(), _resize_handle_cursor(), _resize_handle_motion(), DT_PIXEL_APPLY_DPI, get_size(), dtgtk_resize_handle_t::get_size, dtgtk_resize_handle_t::invert, IS_NULL_PTR, L, dtgtk_resize_handle_t::orientation, dtgtk_resize_handle_t::resize, tooltip, and dtgtk_resize_handle_t::user_data.

Referenced by _ui_init_panel_bottom(), _ui_init_panel_left(), _ui_init_panel_right(), dt_ui_resizable_drawing_area(), and dt_ui_scroll_wrap().