Commit 013bb4d8 authored by Michael Natterer's avatar Michael Natterer 😴

app: add signal GimpToolWidget::snap_offsets() and API to emit it

so widgets can notify their handling tool of snap offsets.
parent 495f90e6
......@@ -25,6 +25,8 @@
#include "display-types.h"
#include "core/gimpmarshal.h"
#include "gimpcanvasgroup.h"
#include "gimpcanvashandle.h"
#include "gimpcanvasline.h"
......@@ -43,6 +45,7 @@ enum
enum
{
CHANGED,
SNAP_OFFSETS,
STATUS,
LAST_SIGNAL
};
......@@ -99,6 +102,19 @@ gimp_tool_widget_class_init (GimpToolWidgetClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
widget_signals[SNAP_OFFSETS] =
g_signal_new ("snap-offsets",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpToolWidgetClass, snap_offsets),
NULL, NULL,
gimp_marshal_VOID__INT_INT_INT_INT,
G_TYPE_NONE, 4,
G_TYPE_INT,
G_TYPE_INT,
G_TYPE_INT,
G_TYPE_INT);
widget_signals[STATUS] =
g_signal_new ("status",
G_TYPE_FROM_CLASS (klass),
......@@ -234,6 +250,19 @@ gimp_tool_widget_get_item (GimpToolWidget *widget)
return widget->private->item;
}
void
gimp_tool_widget_snap_offsets (GimpToolWidget *widget,
gint offset_x,
gint offset_y,
gint width,
gint height)
{
g_return_if_fail (GIMP_IS_TOOL_WIDGET (widget));
g_signal_emit (widget, widget_signals[SNAP_OFFSETS], 0,
offset_x, offset_y, width, height);
}
void
gimp_tool_widget_status (GimpToolWidget *widget,
const gchar *status)
......
......@@ -49,6 +49,11 @@ struct _GimpToolWidgetClass
/* signals */
void (* changed) (GimpToolWidget *widget);
void (* snap_offsets) (GimpToolWidget *widget,
gint offset_x,
gint offset_y,
gint width,
gint height);
void (* status) (GimpToolWidget *widget,
const gchar *status);
......@@ -96,8 +101,13 @@ GType gimp_tool_widget_get_type (void) G_GNUC_CONST;
GimpDisplayShell * gimp_tool_widget_get_shell (GimpToolWidget *widget);
GimpCanvasItem * gimp_tool_widget_get_item (GimpToolWidget *widget);
/* for subclasses, to add emit status messages
/* for subclasses, to notify the handling tool
*/
void gimp_tool_widget_snap_offsets (GimpToolWidget *widget,
gint offset_x,
gint offset_y,
gint width,
gint height);
void gimp_tool_widget_status (GimpToolWidget *widget,
const gchar *status);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment