示例#1
0
static inline void
e_reflow_update_selection_row (EReflow *reflow, int row)
{
	if (reflow->items[row]) {
		g_object_set(reflow->items[row],
			     "selected", e_selection_model_is_row_selected(E_SELECTION_MODEL(reflow->selection), row),
			     NULL);
	} else if (e_selection_model_is_row_selected (E_SELECTION_MODEL (reflow->selection), row)) {
		reflow->items[row] = e_reflow_model_incarnate (reflow->model, row, GNOME_CANVAS_GROUP (reflow));
		g_object_set (reflow->items[row],
			      "selected", e_selection_model_is_row_selected(E_SELECTION_MODEL(reflow->selection), row),
			      "width", (double) reflow->column_width,
			      NULL);
	}
}
示例#2
0
static void
incarnate (EReflow *reflow)
{
	int column_width;
	int first_column;
	int last_column;
	int first_cell;
	int last_cell;
	int i;
	GtkAdjustment *adjustment = gtk_layout_get_hadjustment (GTK_LAYOUT (GNOME_CANVAS_ITEM (reflow)->canvas));

	column_width = reflow->column_width;

	first_column = adjustment->value - 1 + E_REFLOW_BORDER_WIDTH;
	first_column /= column_width + E_REFLOW_FULL_GUTTER;

	last_column = adjustment->value + adjustment->page_size + 1 - E_REFLOW_BORDER_WIDTH - E_REFLOW_DIVIDER_WIDTH;
	last_column /= column_width + E_REFLOW_FULL_GUTTER;
	last_column ++;

	if (first_column >= 0 && first_column < reflow->column_count)
		first_cell = reflow->columns[first_column];
	else
		first_cell = 0;

	if (last_column >= 0 && last_column < reflow->column_count)
		last_cell = reflow->columns[last_column];
	else
		last_cell = reflow->count;

	for (i = first_cell; i < last_cell; i++) {
		int unsorted = e_sorter_sorted_to_model (E_SORTER (reflow->sorter), i);
		if (reflow->items[unsorted] == NULL) {
			if (reflow->model) {
				reflow->items[unsorted] = e_reflow_model_incarnate (reflow->model, unsorted, GNOME_CANVAS_GROUP (reflow));
				g_object_set (reflow->items[unsorted],
					      "selected", e_selection_model_is_row_selected(E_SELECTION_MODEL(reflow->selection), unsorted),
					      "width", (double) reflow->column_width,
					      NULL);
			}
		}
	}
	reflow->incarnate_idle_id = 0;
}
示例#3
0
/**
 * e_selection_model_maybe_do_something
 * @selection: #ESelectionModel to do something to.
 * @row: The row to do something in.
 * @col: The col to do something in.
 * @state: The state in which to do something.
 *
 * If this row is selected, this routine just moves the cursor row and
 * column.  Otherwise, it does the same thing as
 * e_selection_model_do_something().  This is for being used on
 * right clicks and other events where if the user hit the selection,
 * they don't want it to change.
 */
gboolean
e_selection_model_maybe_do_something      (ESelectionModel *selection,
					   guint            row,
					   guint            col,
					   GdkModifierType  state)
{
	selection->old_selection = -1;

	if (e_selection_model_is_row_selected(selection, row)) {
		e_selection_model_change_cursor(selection, row, col);
		g_signal_emit(selection,
			      e_selection_model_signals[CURSOR_CHANGED], 0,
			      row, col);
		return FALSE;
	} else {
		e_selection_model_do_something(selection, row, col, state);
		return TRUE;
	}
}
static gboolean
table_is_row_selected (AtkTable *table,
                       gint row)
{
	ETableItem *item;
	GalA11yETableItemPrivate *priv = GET_PRIVATE (table);

	if (row < 0)
		return FALSE;

	if (atk_state_set_contains_state (priv->state_set, ATK_STATE_DEFUNCT))
		return FALSE;

	item = E_TABLE_ITEM (eti_a11y_get_gobject (ATK_OBJECT (table)));
	if (!item)
		return FALSE;

	return e_selection_model_is_row_selected (
		item->selection, view_to_model_row (item, row));
}