diff options
-rw-r--r-- | widgets/shortcut-bar/ChangeLog | 7 | ||||
-rw-r--r-- | widgets/shortcut-bar/e-icon-bar-bg-item.c | 3 | ||||
-rw-r--r-- | widgets/shortcut-bar/e-icon-bar.c | 19 | ||||
-rw-r--r-- | widgets/shortcut-bar/e-icon-bar.h | 3 | ||||
-rw-r--r-- | widgets/shortcut-bar/e-vscrolled-bar.c | 55 |
5 files changed, 87 insertions, 0 deletions
diff --git a/widgets/shortcut-bar/ChangeLog b/widgets/shortcut-bar/ChangeLog index 76c46fabea..7f45553be3 100644 --- a/widgets/shortcut-bar/ChangeLog +++ b/widgets/shortcut-bar/ChangeLog @@ -1,3 +1,10 @@ +2000-06-19 Damon Chaplin <damon@helixcode.com> + + * e-icon-bar-bg-item.c: + * e-icon-bar.c: + * e-icon-bar.h: + * e-vscrolled-bar.c: added support for scroll-wheels. + 2000-06-02 Christopher James Lahey <clahey@helixcode.com> * e-icon-bar.c: Free all the item data. diff --git a/widgets/shortcut-bar/e-icon-bar-bg-item.c b/widgets/shortcut-bar/e-icon-bar-bg-item.c index b3a62bbf5b..025bd6f467 100644 --- a/widgets/shortcut-bar/e-icon-bar-bg-item.c +++ b/widgets/shortcut-bar/e-icon-bar-bg-item.c @@ -323,6 +323,9 @@ e_icon_bar_bg_item_button_press (EIconBarBgItem *ibitem, { gint item_num; + if (event->button.button == 4 || event->button.button == 5) + return FALSE; + item_num = e_icon_bar_find_item_at_position (ibitem->icon_bar, event->button.x, event->button.y, diff --git a/widgets/shortcut-bar/e-icon-bar.c b/widgets/shortcut-bar/e-icon-bar.c index 731c584fbe..dae19b6590 100644 --- a/widgets/shortcut-bar/e-icon-bar.c +++ b/widgets/shortcut-bar/e-icon-bar.c @@ -123,6 +123,8 @@ static void e_icon_bar_on_editing_stopped (EIconBar *icon_bar, GnomeCanvasItem *item); static void e_icon_bar_ensure_edited_item_visible (EIconBar *icon_bar); static void e_icon_bar_update_highlight (EIconBar *icon_bar); +static void e_icon_bar_vadjustment_value_changed (GtkAdjustment *adjustment, + EIconBar *icon_bar); enum { @@ -232,6 +234,7 @@ e_icon_bar_init (EIconBar *icon_bar) icon_bar->text_x = 0; icon_bar->text_w = 5; icon_bar->auto_scroll_timeout_id = 0; + icon_bar->vadjustment_value_changed_id = 0; /* Create the background item in the canvas, which handles selections and drag-and-drop. */ @@ -338,6 +341,8 @@ e_icon_bar_size_allocate (GtkWidget *widget, GtkAllocation *allocation) e_icon_bar_ensure_edited_item_visible (icon_bar); GTK_LAYOUT (widget)->vadjustment->step_increment = 16; + if (icon_bar->vadjustment_value_changed_id == 0) + icon_bar->vadjustment_value_changed_id = gtk_signal_connect (GTK_OBJECT (GTK_LAYOUT (widget)->vadjustment), "value_changed", GTK_SIGNAL_FUNC (e_icon_bar_vadjustment_value_changed), icon_bar); e_icon_bar_update_highlight (icon_bar); } @@ -957,6 +962,9 @@ e_icon_bar_on_item_event (GnomeCanvasItem *item, switch (event->type) { case GDK_BUTTON_PRESS: + if (event->button.button == 4 || event->button.button == 5) + return FALSE; + item_num = e_icon_bar_find_item_at_position (icon_bar, event->button.x, event->button.y, @@ -1448,6 +1456,8 @@ e_icon_bar_update_highlight (EIconBar *icon_bar) || x > widget->allocation.width || y > widget->allocation.height) return; + x += icon_bar->canvas.parent.layout.hadjustment->value; + y += icon_bar->canvas.parent.layout.vadjustment->value; item_num = e_icon_bar_find_item_at_position (icon_bar, x, y, NULL); e_icon_bar_item_motion (icon_bar, item_num, NULL); } @@ -1577,3 +1587,12 @@ e_icon_bar_timeout_handler (gpointer data) GDK_THREADS_LEAVE (); return TRUE; } + + +static void +e_icon_bar_vadjustment_value_changed (GtkAdjustment *adjustment, + EIconBar *icon_bar) +{ + e_icon_bar_update_highlight (icon_bar); +} + diff --git a/widgets/shortcut-bar/e-icon-bar.h b/widgets/shortcut-bar/e-icon-bar.h index 8ca458410a..72d64ad890 100644 --- a/widgets/shortcut-bar/e-icon-bar.h +++ b/widgets/shortcut-bar/e-icon-bar.h @@ -144,6 +144,9 @@ struct _EIconBar /* Colors for drawing. */ GdkColor colors[E_ICON_BAR_COLOR_LAST]; + + /* Signal connection id for "value_changed" signal of vadjustment. */ + guint vadjustment_value_changed_id; }; struct _EIconBarClass diff --git a/widgets/shortcut-bar/e-vscrolled-bar.c b/widgets/shortcut-bar/e-vscrolled-bar.c index af23b38a21..ed574f5cbf 100644 --- a/widgets/shortcut-bar/e-vscrolled-bar.c +++ b/widgets/shortcut-bar/e-vscrolled-bar.c @@ -53,6 +53,10 @@ static void e_vscrolled_bar_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static void e_vscrolled_bar_draw (GtkWidget *widget, GdkRectangle *area); +static gint e_vscrolled_bar_button_press (GtkWidget *widget, + GdkEventButton *event); +static gint e_vscrolled_bar_button_release (GtkWidget *widget, + GdkEventButton *event); static void e_vscrolled_bar_add (GtkContainer *container, GtkWidget *child); static void e_vscrolled_bar_remove (GtkContainer *container, @@ -121,6 +125,8 @@ e_vscrolled_bar_class_init (EVScrolledBarClass *class) widget_class->size_request = e_vscrolled_bar_size_request; widget_class->size_allocate = e_vscrolled_bar_size_allocate; widget_class->draw = e_vscrolled_bar_draw; + widget_class->button_press_event = e_vscrolled_bar_button_press; + widget_class->button_release_event = e_vscrolled_bar_button_release; container_class->add = e_vscrolled_bar_add; container_class->remove = e_vscrolled_bar_remove; @@ -399,6 +405,55 @@ e_vscrolled_bar_draw (GtkWidget *widget, } +static gint +e_vscrolled_bar_button_press (GtkWidget *widget, + GdkEventButton *event) +{ + EVScrolledBar *vscrolled_bar; + GtkAdjustment *adjustment; + gfloat new_value, step; + + g_print ("In e_vscrolled_bar_button_press\n"); + + vscrolled_bar = E_VSCROLLED_BAR (widget); + adjustment = vscrolled_bar->adjustment; + + step = adjustment->page_size; + + if (event->button == 4) { + new_value = adjustment->value - step; + if (new_value <= adjustment->lower) { + new_value = adjustment->lower; + } + } else if (event->button == 5) { + new_value = adjustment->value + step; + if (new_value >= adjustment->upper - adjustment->page_size) { + new_value = adjustment->upper - adjustment->page_size; + } + } else + return FALSE; + + if (adjustment->value != new_value) { + adjustment->value = new_value; + gtk_signal_emit_by_name (GTK_OBJECT (adjustment), + "value_changed"); + return TRUE; + } + + return FALSE; +} + +static gint +e_vscrolled_bar_button_release (GtkWidget *widget, + GdkEventButton *event) +{ + g_print ("In e_vscrolled_bar_button_release\n"); + + return FALSE; +} + + + static void e_vscrolled_bar_add (GtkContainer *container, GtkWidget *child) |