summaryrefslogtreecommitdiffstats
path: root/include/widgets
diff options
context:
space:
mode:
authorQuentin Glidic <sardemff7+git@sardemff7.net>2017-05-30 12:37:11 +0200
committerQuentin Glidic <sardemff7+git@sardemff7.net>2017-05-30 13:44:05 +0200
commit30da7e587a2a1e90c4338af4d07e5bd3be77ecc3 (patch)
tree0604ead2dbca852f42818679a2fd72f0c0fa2f69 /include/widgets
parent6a750669d7b4bcdc3758a2308cc35a7bd4ab97e3 (diff)
widget: Add widget_xy_to_relative helper
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Diffstat (limited to 'include/widgets')
-rw-r--r--include/widgets/widget.h23
1 files changed, 15 insertions, 8 deletions
diff --git a/include/widgets/widget.h b/include/widgets/widget.h
index 3d2d0524..dcfe593d 100644
--- a/include/widgets/widget.h
+++ b/include/widgets/widget.h
@@ -72,15 +72,14 @@ typedef enum
/**
* @param widget The container widget itself
* @param type The widget type searched for
- * @param x A pointer to the X coordination of the mouse event relative to @widget
- * @param y A pointer to the Y coordination of the mouse event relative to @widget
+ * @param x The X coordination of the mouse event relative to @widget
+ * @param y The Y coordination of the mouse event relative to @widget
*
* This callback must only iterate over the children of a Widget, and return NULL if none of them is relevant.
- * If one was found, @x and @y must be adjusted to be relative to this child.
*
* @returns A child widget if found, NULL otherwise
*/
-typedef widget * ( *widget_find_mouse_target_cb )( widget *widget, WidgetType type, gint *x, gint *y );
+typedef widget * ( *widget_find_mouse_target_cb )( widget *widget, WidgetType type, gint x, gint y );
/**
* @param widget The target widget
@@ -200,6 +199,15 @@ int widget_get_x_pos ( widget *widget );
/**
* @param widget The widget handle
+ * @param x A pointer to the absolute X coordinates
+ * @param y A pointer to the absolute Y coordinates
+ *
+ * Will modify @x and @y to make them relative to @widget.
+ */
+void widget_xy_to_relative ( widget *widget, gint *x, gint *y );
+
+/**
+ * @param widget The widget handle
*
* Update the widget, and its parent recursively.
* This should be called when size of widget changes.
@@ -221,15 +229,14 @@ gboolean widget_need_redraw ( widget *wid );
/**
* @param wid The widget handle
- * @param x A pointer to the x coordinate of the mouse event
- * @param y A pointer to the y coordinate of the mouse event
+ * @param x The x coordinate of the mouse event
+ * @param y The y coordinate of the mouse event
*
* Get the widget that should handle a mouse event.
- * @x and @y are adjusted to be relative to the widget.
*
* @returns returns the widget that should handle the mouse event.
*/
-widget *widget_find_mouse_target ( widget *wid, WidgetType type, gint *x, gint *y );
+widget *widget_find_mouse_target ( widget *wid, WidgetType type, gint x, gint y );
/**
* @param wid The widget handle