diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-02-10 20:05:01 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-02-10 20:05:01 +0800 |
commit | 11a8bba27ea6fd7dc37b478be03831ddc561f28a (patch) | |
tree | 2bb67fa483ea10ee89cc1f658c623800d1d8d19e | |
parent | 4a2a09a7bae99778d6e11df7da7d0a166815030f (diff) | |
download | gsoc2013-evolution-11a8bba27ea6fd7dc37b478be03831ddc561f28a.tar gsoc2013-evolution-11a8bba27ea6fd7dc37b478be03831ddc561f28a.tar.gz gsoc2013-evolution-11a8bba27ea6fd7dc37b478be03831ddc561f28a.tar.bz2 gsoc2013-evolution-11a8bba27ea6fd7dc37b478be03831ddc561f28a.tar.lz gsoc2013-evolution-11a8bba27ea6fd7dc37b478be03831ddc561f28a.tar.xz gsoc2013-evolution-11a8bba27ea6fd7dc37b478be03831ddc561f28a.tar.zst gsoc2013-evolution-11a8bba27ea6fd7dc37b478be03831ddc561f28a.zip |
Handle button releases properly.
2000-02-10 Christopher James Lahey <clahey@helixcode.com>
* e-cell-text.c: Handle button releases properly.
* e-table-header-item.c (ethi_start_drag): Added a drag icon.
svn path=/trunk/; revision=1724
-rw-r--r-- | widgets/e-table/ChangeLog | 6 | ||||
-rw-r--r-- | widgets/e-table/e-cell-text.c | 31 | ||||
-rw-r--r-- | widgets/e-table/e-table-header-item.c | 23 | ||||
-rw-r--r-- | widgets/table/e-cell-text.c | 31 | ||||
-rw-r--r-- | widgets/table/e-table-header-item.c | 23 |
5 files changed, 108 insertions, 6 deletions
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog index a2b4ad111b..71ced91a19 100644 --- a/widgets/e-table/ChangeLog +++ b/widgets/e-table/ChangeLog @@ -1,3 +1,9 @@ +2000-02-10 Christopher James Lahey <clahey@helixcode.com> + + * e-cell-text.c: Handle button releases properly. + + * e-table-header-item.c (ethi_start_drag): Added a drag icon. + 2000-02-09 Christopher James Lahey <clahey@helixcode.com> * e-cell-text.c: Tweaked e-cell-text. Added a white background diff --git a/widgets/e-table/e-cell-text.c b/widgets/e-table/e-cell-text.c index 6fe8e2ddfb..5cec90a536 100644 --- a/widgets/e-table/e-cell-text.c +++ b/widgets/e-table/e-cell-text.c @@ -817,6 +817,34 @@ ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, break; case GDK_BUTTON_PRESS: /* Fall Through */ case GDK_BUTTON_RELEASE: + if (!edit_display && event->type == GDK_BUTTON_RELEASE && event->button.button == 1) { + GdkEventButton button = event->button; + + e_table_item_enter_edit (text_view->cell_view.e_table_item_view, view_col, row); + edit = text_view->edit; + cellptr = CURRENT_CELL(edit); + edit_display = TRUE; + + e_tep_event.button.type = GDK_BUTTON_PRESS; + e_tep_event.button.time = button.time; + e_tep_event.button.state = button.state; + e_tep_event.button.button = button.button; + e_tep_event.button.position = _get_position_from_xy(cellptr, button.x, button.y); + _get_tep(edit); + return_val = e_text_event_processor_handle_event (edit->tep, + &e_tep_event); + if (event->button.button == 1) { + if (event->type == GDK_BUTTON_PRESS) + edit->button_down = TRUE; + else + edit->button_down = FALSE; + } + edit->lastx = button.x; + edit->lasty = button.y; + edit->last_state = button.state; + + e_tep_event.button.type = GDK_BUTTON_RELEASE; + } if (edit_display) { GdkEventButton button = event->button; e_tep_event.button.time = button.time; @@ -835,9 +863,6 @@ ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, edit->lastx = button.x; edit->lasty = button.y; edit->last_state = button.state; - } else if (ect->editable && event->type == GDK_BUTTON_RELEASE && event->button.button == 1) { - e_table_item_enter_edit (text_view->cell_view.e_table_item_view, view_col, row); - return 1; } break; case GDK_MOTION_NOTIFY: diff --git a/widgets/e-table/e-table-header-item.c b/widgets/e-table/e-table-header-item.c index e8f73fc432..ad4d12395c 100644 --- a/widgets/e-table/e-table-header-item.c +++ b/widgets/e-table/e-table-header-item.c @@ -592,6 +592,10 @@ ethi_start_drag (ETableHeaderItem *ethi, GdkEvent *event) GtkWidget *widget = GTK_WIDGET (GNOME_CANVAS_ITEM (ethi)->canvas); GtkTargetList *list; GdkDragContext *context; + ETableCol *ecol; + int col_width; + GdkPixmap *pixmap; + GdkGC *gc; ethi->drag_col = ethi_find_col_by_x (ethi, event->motion.x); if (ethi->drag_col == -1) @@ -599,6 +603,25 @@ ethi_start_drag (ETableHeaderItem *ethi, GdkEvent *event) list = gtk_target_list_new (ethi_drag_types, ELEMENTS (ethi_drag_types)); context = gtk_drag_begin (widget, list, GDK_ACTION_MOVE, 1, event); + + ecol = e_table_header_get_column (ethi->eth, ethi->drag_col); + if (ethi->drag_col == ethi->resize_col) + col_width = ethi->resize_width; + else + col_width = ecol->width; + pixmap = gdk_pixmap_new(widget->window, col_width, ethi->height, -1); + gc = widget->style->bg_gc [GTK_STATE_ACTIVE]; + draw_button (ethi, ecol, pixmap, gc, + widget->style, + 0, 0, col_width, ethi->height); + gtk_drag_set_icon_pixmap (context, + gdk_window_get_colormap(widget->window), + pixmap, + NULL, + col_width / 2, + ethi->height / 2); + gdk_pixmap_unref(pixmap); + ethi->maybe_drag = FALSE; } diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c index 6fe8e2ddfb..5cec90a536 100644 --- a/widgets/table/e-cell-text.c +++ b/widgets/table/e-cell-text.c @@ -817,6 +817,34 @@ ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, break; case GDK_BUTTON_PRESS: /* Fall Through */ case GDK_BUTTON_RELEASE: + if (!edit_display && event->type == GDK_BUTTON_RELEASE && event->button.button == 1) { + GdkEventButton button = event->button; + + e_table_item_enter_edit (text_view->cell_view.e_table_item_view, view_col, row); + edit = text_view->edit; + cellptr = CURRENT_CELL(edit); + edit_display = TRUE; + + e_tep_event.button.type = GDK_BUTTON_PRESS; + e_tep_event.button.time = button.time; + e_tep_event.button.state = button.state; + e_tep_event.button.button = button.button; + e_tep_event.button.position = _get_position_from_xy(cellptr, button.x, button.y); + _get_tep(edit); + return_val = e_text_event_processor_handle_event (edit->tep, + &e_tep_event); + if (event->button.button == 1) { + if (event->type == GDK_BUTTON_PRESS) + edit->button_down = TRUE; + else + edit->button_down = FALSE; + } + edit->lastx = button.x; + edit->lasty = button.y; + edit->last_state = button.state; + + e_tep_event.button.type = GDK_BUTTON_RELEASE; + } if (edit_display) { GdkEventButton button = event->button; e_tep_event.button.time = button.time; @@ -835,9 +863,6 @@ ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, edit->lastx = button.x; edit->lasty = button.y; edit->last_state = button.state; - } else if (ect->editable && event->type == GDK_BUTTON_RELEASE && event->button.button == 1) { - e_table_item_enter_edit (text_view->cell_view.e_table_item_view, view_col, row); - return 1; } break; case GDK_MOTION_NOTIFY: diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c index e8f73fc432..ad4d12395c 100644 --- a/widgets/table/e-table-header-item.c +++ b/widgets/table/e-table-header-item.c @@ -592,6 +592,10 @@ ethi_start_drag (ETableHeaderItem *ethi, GdkEvent *event) GtkWidget *widget = GTK_WIDGET (GNOME_CANVAS_ITEM (ethi)->canvas); GtkTargetList *list; GdkDragContext *context; + ETableCol *ecol; + int col_width; + GdkPixmap *pixmap; + GdkGC *gc; ethi->drag_col = ethi_find_col_by_x (ethi, event->motion.x); if (ethi->drag_col == -1) @@ -599,6 +603,25 @@ ethi_start_drag (ETableHeaderItem *ethi, GdkEvent *event) list = gtk_target_list_new (ethi_drag_types, ELEMENTS (ethi_drag_types)); context = gtk_drag_begin (widget, list, GDK_ACTION_MOVE, 1, event); + + ecol = e_table_header_get_column (ethi->eth, ethi->drag_col); + if (ethi->drag_col == ethi->resize_col) + col_width = ethi->resize_width; + else + col_width = ecol->width; + pixmap = gdk_pixmap_new(widget->window, col_width, ethi->height, -1); + gc = widget->style->bg_gc [GTK_STATE_ACTIVE]; + draw_button (ethi, ecol, pixmap, gc, + widget->style, + 0, 0, col_width, ethi->height); + gtk_drag_set_icon_pixmap (context, + gdk_window_get_colormap(widget->window), + pixmap, + NULL, + col_width / 2, + ethi->height / 2); + gdk_pixmap_unref(pixmap); + ethi->maybe_drag = FALSE; } |