diff options
author | Lars Hamann <lars@gtk.org> | 1999-01-11 23:24:41 +0000 |
---|---|---|
committer | Lars Hamann <lars@src.gnome.org> | 1999-01-11 23:24:41 +0000 |
commit | 8b0955954ccd6147f8031cc4bd07e7d92bbbc74d (patch) | |
tree | 675521400ba08b28a4601f8ba911ee36259bc2d9 /gtk | |
parent | d2e69a89d4b8a0f9ceedbe87362cf9609e5b7c52 (diff) | |
download | gtk+-8b0955954ccd6147f8031cc4bd07e7d92bbbc74d.tar.gz |
end drag selections if necessary.
Mon Jan 11 23:52:58 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklist.c (gtk_list_signal_drag_begin)
(gtk_list_drag_begin): end drag selections if necessary.
* gtk/gtkspinbutton.c/h (gtk_spin_button_update): made function
public. Manually force synchronization of spin button text and
adjustment value.
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtklist.c | 59 | ||||
-rw-r--r-- | gtk/gtkspinbutton.c | 3 | ||||
-rw-r--r-- | gtk/gtkspinbutton.h | 2 |
3 files changed, 59 insertions, 5 deletions
diff --git a/gtk/gtklist.c b/gtk/gtklist.c index 2d4f3ccbb6..45527aa94a 100644 --- a/gtk/gtklist.c +++ b/gtk/gtklist.c @@ -103,6 +103,9 @@ static void gtk_list_update_extended_selection (GtkList *list, gint row); /** GtkListItem Signal Functions **/ +static void gtk_list_signal_drag_begin (GtkWidget *widget, + GdkDragContext *context, + GtkList *list); static void gtk_list_signal_focus_lost (GtkWidget *item, GdkEventKey *event, GtkList *list); @@ -141,6 +144,10 @@ static void gtk_list_signal_item_toggle (GtkListItem *list_item, GtkList *list); +static void gtk_list_drag_begin (GtkWidget *widget, + GdkDragContext *context); + + static GtkContainerClass *parent_class = NULL; static guint list_signals[LAST_SIGNAL] = { 0 }; @@ -229,6 +236,7 @@ gtk_list_class_init (GtkListClass *class) widget_class->motion_notify_event = gtk_list_motion_notify; widget_class->size_request = gtk_list_size_request; widget_class->size_allocate = gtk_list_size_allocate; + widget_class->drag_begin = gtk_list_drag_begin; container_class->add = gtk_list_add; container_class->remove = gtk_list_remove; @@ -542,17 +550,15 @@ gtk_list_motion_notify (GtkWidget *widget, if (row != focus_row) gtk_widget_grab_focus (item); - + switch (list->selection_mode) { case GTK_SELECTION_BROWSE: gtk_list_select_child (list, item); break; - case GTK_SELECTION_EXTENDED: gtk_list_update_extended_selection (list, row); break; - default: break; } @@ -1014,6 +1020,9 @@ gtk_list_insert_items (GtkList *list, tmp_list = tmp_list->next; gtk_widget_set_parent (widget, GTK_WIDGET (list)); + gtk_signal_connect (GTK_OBJECT (widget), "drag_begin", + GTK_SIGNAL_FUNC (gtk_list_signal_drag_begin), + list); gtk_signal_connect (GTK_OBJECT (widget), "focus_out_event", GTK_SIGNAL_FUNC (gtk_list_signal_focus_lost), list); @@ -2613,3 +2622,47 @@ gtk_list_signal_item_toggle (GtkListItem *list_item, break; } } + +static void +gtk_list_signal_drag_begin (GtkWidget *widget, + GdkDragContext *context, + GtkList *list) +{ + g_return_if_fail (widget != NULL); + g_return_if_fail (GTK_IS_LIST_ITEM (widget)); + g_return_if_fail (list != NULL); + g_return_if_fail (GTK_IS_LIST (list)); + + gtk_list_drag_begin (GTK_WIDGET (list), context); +} + +static void +gtk_list_drag_begin (GtkWidget *widget, + GdkDragContext *context) +{ + GtkList *list; + + g_return_if_fail (widget != NULL); + g_return_if_fail (GTK_IS_LIST (widget)); + g_return_if_fail (context != NULL); + + list = GTK_LIST (widget); + + if (list->drag_selection) + { + gtk_list_end_drag_selection (list); + + switch (list->selection_mode) + { + case GTK_SELECTION_EXTENDED: + gtk_list_end_selection (list); + break; + case GTK_SELECTION_SINGLE: + case GTK_SELECTION_MULTIPLE: + list->undo_focus_child = NULL; + break; + default: + break; + } + } +} diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c index 7752b5578e..0d9714540b 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -97,7 +97,6 @@ static gint gtk_spin_button_key_press (GtkWidget *widget, GdkEventKey *event); static gint gtk_spin_button_key_release (GtkWidget *widget, GdkEventKey *event); -static void gtk_spin_button_update (GtkSpinButton *spin_button); static void gtk_spin_button_activate (GtkEditable *editable); static void gtk_spin_button_snap (GtkSpinButton *spin_button, gfloat val); @@ -1115,7 +1114,7 @@ gtk_spin_button_snap (GtkSpinButton *spin_button, } } -static void +void gtk_spin_button_update (GtkSpinButton *spin_button) { gfloat val; diff --git a/gtk/gtkspinbutton.h b/gtk/gtkspinbutton.h index abef75f1a7..99a1b09298 100644 --- a/gtk/gtkspinbutton.h +++ b/gtk/gtkspinbutton.h @@ -141,6 +141,8 @@ void gtk_spin_button_set_shadow_type (GtkSpinButton *spin_button, void gtk_spin_button_set_snap_to_ticks (GtkSpinButton *spin_button, gboolean snap_to_ticks); +void gtk_spin_button_update (GtkSpinButton *spin_button); + /* deprecated */ void gtk_spin_button_construct (GtkSpinButton *spin_button, GtkAdjustment *adjustment, |