diff --git a/src/list_window.h b/src/list_window.h
index eef6b9a7c43c1d8739971bfe3470e8041f65056a..a61d24b4e9b3c0cdd0ee7640e673e4dadc2f8966 100644 (file)
--- a/src/list_window.h
+++ b/src/list_window.h
/* ncmpc (Ncurses MPD Client)
- * (c) 2004-2009 The Music Player Daemon Project
+ * (c) 2004-2010 The Music Player Daemon Project
* Project homepage: http://musicpd.org
* This program is free software; you can redistribute it and/or modify
#include "config.h"
#include "command.h"
+#include "colors.h"
#include <glib.h>
#include <stdbool.h>
#include <ncurses.h>
#endif
-typedef const char *(*list_window_callback_fn_t)(unsigned index,
- bool *highlight,
- char **second_column,
- void *data);
+typedef const char *
+(*list_window_callback_fn_t)(unsigned i, void *data);
+
+typedef void
+(*list_window_paint_callback_t)(WINDOW *w, unsigned i,
+ unsigned y, unsigned width,
+ bool selected,
+ void *data);
struct list_window {
WINDOW *w;
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);
list_window_callback_fn_t callback,
void *callback_data);
+void
+list_window_paint2(const struct list_window *lw,
+ list_window_paint_callback_t paint_callback,
+ void *callback_data);
+
/* perform basic list window commands (movement) */
bool
list_window_cmd(struct list_window *lw, command_t cmd);
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,