summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/gtkui/gtkplaylist.c14
-rw-r--r--plugins/gtkui/gtkplaylist.h3
2 files changed, 17 insertions, 0 deletions
diff --git a/plugins/gtkui/gtkplaylist.c b/plugins/gtkui/gtkplaylist.c
index b3984481..272246d6 100644
--- a/plugins/gtkui/gtkplaylist.c
+++ b/plugins/gtkui/gtkplaylist.c
@@ -1476,6 +1476,20 @@ on_header_motion_notify_event (GtkWidget *widget,
return FALSE;
}
+int
+gtkpl_get_column_for_click (gtkplaylist_t *pl, int click_x) {
+ int x = -pl->hscrollpos;
+ int i = 0;
+ gtkpl_column_t *c;
+ for (c = pl->columns; c; c = c->next, i++) {
+ int w = c->width;
+ if (click_x >= x && click_x < x + w) {
+ return i;
+ }
+ }
+ return -1;
+}
+
gboolean
on_header_button_press_event (GtkWidget *widget,
GdkEventButton *event,
diff --git a/plugins/gtkui/gtkplaylist.h b/plugins/gtkui/gtkplaylist.h
index 208a19ef..07c1dd94 100644
--- a/plugins/gtkui/gtkplaylist.h
+++ b/plugins/gtkui/gtkplaylist.h
@@ -254,4 +254,7 @@ gtk_pl_redraw_item_everywhere (DB_playItem_t *it);
void
gtkpl_set_cursor (int iter, int cursor);
+int
+gtkpl_get_column_for_click (gtkplaylist_t *pl, int click_x);
+
#endif // __GTKPLAYLIST_H