Code

list_window: removed selected_start, selected_end
[ncmpc.git] / src / list_window.h
index edb3e260bd3f13a4205a0378516b38b20df3d84e..98fcfbef7fc44327cd7ab07f704f51154b2b5d06 100644 (file)
@@ -48,14 +48,28 @@ struct list_window {
 
        unsigned start;
        unsigned selected;
-       unsigned selected_start;     /* for range selection, first selected item */
-       unsigned selected_end;       /* for range selection, last selected item */
        unsigned range_base;        /* represents the base item. */
        bool range_selection;       /* range selection activated */
 
        bool hide_cursor;
 };
 
+/**
+ * The bounds of a range selection, see list_window_get_range().
+ */
+struct list_window_range {
+       /**
+        * The index of the first selected item.
+        */
+       unsigned start;
+
+       /**
+        * The index after the last selected item.  The selection is
+        * empty when this is the same as "start".
+        */
+       unsigned end;
+};
+
 /* create a new list window */
 struct list_window *list_window_init(WINDOW *w,
                                     unsigned width, unsigned height);
@@ -73,7 +87,7 @@ void
 list_window_set_length(struct list_window *lw, unsigned length);
 
 /* paint a list window */
-void list_window_paint(struct list_window *lw,
+void list_window_paint(const struct list_window *lw,
                       list_window_callback_fn_t callback,
                       void *callback_data);
 
@@ -120,6 +134,15 @@ list_window_move_cursor(struct list_window *lw, unsigned n);
 void
 list_window_fetch_cursor(struct list_window *lw);
 
+/**
+ * Determines the lower and upper bound of the range selection.  If
+ * range selection is disabled, it returns the cursor position (range
+ * length is 1).
+ */
+void
+list_window_get_range(const struct list_window *lw,
+                     struct list_window_range *range);
+
 /* find a string in a list window */
 bool
 list_window_find(struct list_window *lw,