forked from AuroraMiddleware/gtk
Small tweaks to the DND docs
As pointed out by Columban Wendling in https://bugzilla.gnome.org/show_bug.cgi?id=684096, the GtkWidget DND docs were referring to several drag context members that are private, nowadays.
This commit is contained in:
parent
98ca019c74
commit
78c44d31d3
@ -2516,7 +2516,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
|||||||
/**
|
/**
|
||||||
* GtkWidget::drag-leave:
|
* GtkWidget::drag-leave:
|
||||||
* @widget: the object which received the signal.
|
* @widget: the object which received the signal.
|
||||||
* @drag_context: the drag context
|
* @context: the drag context
|
||||||
* @time: the timestamp of the motion event
|
* @time: the timestamp of the motion event
|
||||||
*
|
*
|
||||||
* The ::drag-leave signal is emitted on the drop site when the cursor
|
* The ::drag-leave signal is emitted on the drop site when the cursor
|
||||||
@ -2538,7 +2538,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
|||||||
/**
|
/**
|
||||||
* GtkWidget::drag-begin:
|
* GtkWidget::drag-begin:
|
||||||
* @widget: the object which received the signal
|
* @widget: the object which received the signal
|
||||||
* @drag_context: the drag context
|
* @context: the drag context
|
||||||
*
|
*
|
||||||
* The ::drag-begin signal is emitted on the drag source when a drag is
|
* The ::drag-begin signal is emitted on the drag source when a drag is
|
||||||
* started. A typical reason to connect to this signal is to set up a
|
* started. A typical reason to connect to this signal is to set up a
|
||||||
@ -2561,7 +2561,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
|||||||
/**
|
/**
|
||||||
* GtkWidget::drag-end:
|
* GtkWidget::drag-end:
|
||||||
* @widget: the object which received the signal
|
* @widget: the object which received the signal
|
||||||
* @drag_context: the drag context
|
* @context: the drag context
|
||||||
*
|
*
|
||||||
* The ::drag-end signal is emitted on the drag source when a drag is
|
* The ::drag-end signal is emitted on the drag source when a drag is
|
||||||
* finished. A typical reason to connect to this signal is to undo
|
* finished. A typical reason to connect to this signal is to undo
|
||||||
@ -2580,7 +2580,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
|||||||
/**
|
/**
|
||||||
* GtkWidget::drag-data-delete:
|
* GtkWidget::drag-data-delete:
|
||||||
* @widget: the object which received the signal
|
* @widget: the object which received the signal
|
||||||
* @drag_context: the drag context
|
* @context: the drag context
|
||||||
*
|
*
|
||||||
* The ::drag-data-delete signal is emitted on the drag source when a drag
|
* The ::drag-data-delete signal is emitted on the drag source when a drag
|
||||||
* with the action %GDK_ACTION_MOVE is successfully completed. The signal
|
* with the action %GDK_ACTION_MOVE is successfully completed. The signal
|
||||||
@ -2600,7 +2600,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
|||||||
/**
|
/**
|
||||||
* GtkWidget::drag-failed:
|
* GtkWidget::drag-failed:
|
||||||
* @widget: the object which received the signal
|
* @widget: the object which received the signal
|
||||||
* @drag_context: the drag context
|
* @context: the drag context
|
||||||
* @result: the result of the drag operation
|
* @result: the result of the drag operation
|
||||||
*
|
*
|
||||||
* The ::drag-failed signal is emitted on the drag source when a drag has
|
* The ::drag-failed signal is emitted on the drag source when a drag has
|
||||||
@ -2627,12 +2627,12 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
|||||||
/**
|
/**
|
||||||
* GtkWidget::drag-motion:
|
* GtkWidget::drag-motion:
|
||||||
* @widget: the object which received the signal
|
* @widget: the object which received the signal
|
||||||
* @drag_context: the drag context
|
* @context: the drag context
|
||||||
* @x: the x coordinate of the current cursor position
|
* @x: the x coordinate of the current cursor position
|
||||||
* @y: the y coordinate of the current cursor position
|
* @y: the y coordinate of the current cursor position
|
||||||
* @time: the timestamp of the motion event
|
* @time: the timestamp of the motion event
|
||||||
*
|
*
|
||||||
* The drag-motion signal is emitted on the drop site when the user
|
* The ::drag-motion signal is emitted on the drop site when the user
|
||||||
* moves the cursor over the widget during a drag. The signal handler
|
* moves the cursor over the widget during a drag. The signal handler
|
||||||
* must determine whether the cursor position is in a drop zone or not.
|
* must determine whether the cursor position is in a drop zone or not.
|
||||||
* If it is not in a drop zone, it returns %FALSE and no further processing
|
* If it is not in a drop zone, it returns %FALSE and no further processing
|
||||||
@ -2655,11 +2655,11 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
|||||||
* the drop site with gtk_drag_highlight().
|
* the drop site with gtk_drag_highlight().
|
||||||
* |[
|
* |[
|
||||||
* static void
|
* static void
|
||||||
* drag_motion (GtkWidget *widget,
|
* drag_motion (GtkWidget *widget,
|
||||||
* GdkDragContext *context,
|
* GdkDragContext *context,
|
||||||
* gint x,
|
* gint x,
|
||||||
* gint y,
|
* gint y,
|
||||||
* guint time)
|
* guint time)
|
||||||
* {
|
* {
|
||||||
* GdkAtom target;
|
* GdkAtom target;
|
||||||
*
|
*
|
||||||
@ -2676,7 +2676,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
|||||||
* gdk_drag_status (context, 0, time);
|
* gdk_drag_status (context, 0, time);
|
||||||
* else
|
* else
|
||||||
* {
|
* {
|
||||||
* private_data->pending_status = context->suggested_action;
|
* private_data->pending_status = gdk_drag_context_get_suggested_action (context);
|
||||||
* gtk_drag_get_data (widget, context, target, time);
|
* gtk_drag_get_data (widget, context, target, time);
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
@ -2698,11 +2698,11 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
|||||||
* {
|
* {
|
||||||
* private_data->suggested_action = 0;
|
* private_data->suggested_action = 0;
|
||||||
*
|
*
|
||||||
* /* We are getting this data due to a request in drag_motion,
|
* /* We are getting this data due to a request in drag_motion,
|
||||||
* * rather than due to a request in drag_drop, so we are just
|
* * rather than due to a request in drag_drop, so we are just
|
||||||
* * supposed to call gdk_drag_status (), not actually paste in
|
* * supposed to call gdk_drag_status(), not actually paste in
|
||||||
* * the data.
|
* * the data.
|
||||||
* */
|
* */
|
||||||
* str = gtk_selection_data_get_text (selection_data);
|
* str = gtk_selection_data_get_text (selection_data);
|
||||||
* if (!data_is_acceptable (str))
|
* if (!data_is_acceptable (str))
|
||||||
* gdk_drag_status (context, 0, time);
|
* gdk_drag_status (context, 0, time);
|
||||||
@ -2734,7 +2734,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
|||||||
/**
|
/**
|
||||||
* GtkWidget::drag-drop:
|
* GtkWidget::drag-drop:
|
||||||
* @widget: the object which received the signal
|
* @widget: the object which received the signal
|
||||||
* @drag_context: the drag context
|
* @context: the drag context
|
||||||
* @x: the x coordinate of the current cursor position
|
* @x: the x coordinate of the current cursor position
|
||||||
* @y: the y coordinate of the current cursor position
|
* @y: the y coordinate of the current cursor position
|
||||||
* @time: the timestamp of the motion event
|
* @time: the timestamp of the motion event
|
||||||
@ -2768,7 +2768,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
|||||||
/**
|
/**
|
||||||
* GtkWidget::drag-data-get:
|
* GtkWidget::drag-data-get:
|
||||||
* @widget: the object which received the signal
|
* @widget: the object which received the signal
|
||||||
* @drag_context: the drag context
|
* @context: the drag context
|
||||||
* @data: the #GtkSelectionData to be filled with the dragged data
|
* @data: the #GtkSelectionData to be filled with the dragged data
|
||||||
* @info: the info that has been registered with the target in the
|
* @info: the info that has been registered with the target in the
|
||||||
* #GtkTargetList
|
* #GtkTargetList
|
||||||
@ -2796,7 +2796,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
|||||||
/**
|
/**
|
||||||
* GtkWidget::drag-data-received:
|
* GtkWidget::drag-data-received:
|
||||||
* @widget: the object which received the signal
|
* @widget: the object which received the signal
|
||||||
* @drag_context: the drag context
|
* @context: the drag context
|
||||||
* @x: where the drop happened
|
* @x: where the drop happened
|
||||||
* @y: where the drop happened
|
* @y: where the drop happened
|
||||||
* @data: the received data
|
* @data: the received data
|
||||||
@ -2811,16 +2811,17 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
|||||||
* If the data was received in response to a #GtkWidget::drag-drop signal
|
* If the data was received in response to a #GtkWidget::drag-drop signal
|
||||||
* (and this is the last target to be received), the handler for this
|
* (and this is the last target to be received), the handler for this
|
||||||
* signal is expected to process the received data and then call
|
* signal is expected to process the received data and then call
|
||||||
* gtk_drag_finish(), setting the @success parameter depending on whether
|
* gtk_drag_finish(), setting the @success parameter depending on
|
||||||
* the data was processed successfully.
|
* whether the data was processed successfully.
|
||||||
*
|
*
|
||||||
* The handler may inspect and modify @drag_context->action before calling
|
* The handler may inspect the selected action with
|
||||||
* gtk_drag_finish(), e.g. to implement %GDK_ACTION_ASK as shown in the
|
* gdk_drag_context_get_selected_action() before calling
|
||||||
* following example:
|
* gtk_drag_finish(), e.g. to implement %GDK_ACTION_ASK as
|
||||||
|
* shown in the following example:
|
||||||
* |[
|
* |[
|
||||||
* void
|
* void
|
||||||
* drag_data_received (GtkWidget *widget,
|
* drag_data_received (GtkWidget *widget,
|
||||||
* GdkDragContext *drag_context,
|
* GdkDragContext *context,
|
||||||
* gint x,
|
* gint x,
|
||||||
* gint y,
|
* gint y,
|
||||||
* GtkSelectionData *data,
|
* GtkSelectionData *data,
|
||||||
@ -2829,7 +2830,12 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
|||||||
* {
|
* {
|
||||||
* if ((data->length >= 0) && (data->format == 8))
|
* if ((data->length >= 0) && (data->format == 8))
|
||||||
* {
|
* {
|
||||||
* if (drag_context->action == GDK_ACTION_ASK)
|
* GdkDragAction action;
|
||||||
|
*
|
||||||
|
* /* handle data here */
|
||||||
|
*
|
||||||
|
* action = gdk_drag_context_get_selected_action (context);
|
||||||
|
* if (action == GDK_ACTION_ASK)
|
||||||
* {
|
* {
|
||||||
* GtkWidget *dialog;
|
* GtkWidget *dialog;
|
||||||
* gint response;
|
* gint response;
|
||||||
@ -2844,16 +2850,15 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
|||||||
* gtk_widget_destroy (dialog);
|
* gtk_widget_destroy (dialog);
|
||||||
*
|
*
|
||||||
* if (response == GTK_RESPONSE_YES)
|
* if (response == GTK_RESPONSE_YES)
|
||||||
* drag_context->action = GDK_ACTION_MOVE;
|
* action = GDK_ACTION_MOVE;
|
||||||
* else
|
* else
|
||||||
* drag_context->action = GDK_ACTION_COPY;
|
* action = GDK_ACTION_COPY;
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* gtk_drag_finish (drag_context, TRUE, FALSE, time);
|
* gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
|
||||||
* return;
|
|
||||||
* }
|
* }
|
||||||
*
|
* else
|
||||||
* gtk_drag_finish (drag_context, FALSE, FALSE, time);
|
* gtk_drag_finish (context, FALSE, FALSE, time);
|
||||||
* }
|
* }
|
||||||
* ]|
|
* ]|
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user