Commit 93460327 authored by Christopher James Lahey's avatar Christopher James Lahey Committed by Chris Lahey
Browse files

Added a function to get the next row with sorting taken into account.

2000-08-05  Christopher James Lahey  <clahey@helixcode.com>

	* e-table.c: Added a function to get the next row with sorting
	taken into account.

svn path=/trunk/; revision=4549
parent cab78cd0
2000-08-05 Christopher James Lahey <clahey@helixcode.com>
* e-table.c: Added a function to get the next row with sorting
taken into account.
2000-08-05 Christopher James Lahey <clahey@helixcode.com>
* e-table-sorter.c: Made it so that selection ranges work even if
......
......@@ -925,6 +925,41 @@ set_scroll_adjustments (ETable *table,
hadjustment);
}
gint
e_table_get_next_row_sorted (ETable *e_table,
gint model_row)
{
if (e_table->sorter) {
int i;
i = e_table_sorter_model_to_sorted(e_table->sorter, model_row);
if (i < e_table_model_row_count(e_table->model)) {
i++;
return e_table_sorter_sorted_to_model(e_table->sorter, model_row);
} else
return -1;
} else
if (model_row < e_table_model_row_count(e_table->model))
return model_row + 1;
else
return -1;
}
gint
e_table_get_prev_row_sorted (ETable *e_table,
gint model_row)
{
if (e_table->sorter) {
int i;
i = e_table_sorter_model_to_sorted(e_table->sorter, model_row);
i--;
if (i >= 0)
return e_table_sorter_sorted_to_model(e_table->sorter, model_row);
else
return -1;
} else
return model_row - 1;
}
struct _ETableDragSourceSite
{
GdkModifierType start_button_mask;
......
......@@ -182,6 +182,11 @@ void e_table_selected_row_foreach (ETable *e_table,
gpointer closure);
EPrintable *e_table_get_printable (ETable *e_table);
gint e_table_get_next_row_sorted (ETable *e_table,
gint model_row);
gint e_table_get_prev_row_sorted (ETable *e_table,
gint model_row);
/* Drag & drop stuff. */
/* Target */
......
......@@ -925,6 +925,41 @@ set_scroll_adjustments (ETable *table,
hadjustment);
}
gint
e_table_get_next_row_sorted (ETable *e_table,
gint model_row)
{
if (e_table->sorter) {
int i;
i = e_table_sorter_model_to_sorted(e_table->sorter, model_row);
if (i < e_table_model_row_count(e_table->model)) {
i++;
return e_table_sorter_sorted_to_model(e_table->sorter, model_row);
} else
return -1;
} else
if (model_row < e_table_model_row_count(e_table->model))
return model_row + 1;
else
return -1;
}
gint
e_table_get_prev_row_sorted (ETable *e_table,
gint model_row)
{
if (e_table->sorter) {
int i;
i = e_table_sorter_model_to_sorted(e_table->sorter, model_row);
i--;
if (i >= 0)
return e_table_sorter_sorted_to_model(e_table->sorter, model_row);
else
return -1;
} else
return model_row - 1;
}
struct _ETableDragSourceSite
{
GdkModifierType start_button_mask;
......
......@@ -182,6 +182,11 @@ void e_table_selected_row_foreach (ETable *e_table,
gpointer closure);
EPrintable *e_table_get_printable (ETable *e_table);
gint e_table_get_next_row_sorted (ETable *e_table,
gint model_row);
gint e_table_get_prev_row_sorted (ETable *e_table,
gint model_row);
/* Drag & drop stuff. */
/* Target */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment