Exemplo n.º 1
0
static void
select_or_unselect_range(GtkTreeSelection *selection,
                         guint from, guint to,
                         gboolean select)
{
    if (from == to)
        return;

    GtkTreePath *pathfrom = gtk_tree_path_new();
    gtk_tree_path_append_index(pathfrom, from);
    if (from+1 == to) {
        if (select)
            gtk_tree_selection_select_path(selection, pathfrom);
        else
            gtk_tree_selection_unselect_path(selection, pathfrom);
    }
    else {
        GtkTreePath *pathto = gtk_tree_path_new();
        gtk_tree_path_append_index(pathto, to);
        if (select)
            gtk_tree_selection_select_range(selection, pathfrom, pathto);
        else
            gtk_tree_selection_unselect_range(selection, pathfrom, pathto);
        gtk_tree_path_free(pathto);
    }
    gtk_tree_path_free(pathfrom);
}
Exemplo n.º 2
0
void GtkTreeSelection_::unselect_range(Php::Parameters &parameters)
{
	std::string param_start_path = parameters[0];
	GtkTreePath *start_path = gtk_tree_path_new_from_string(param_start_path.c_str());

	std::string param_end_path = parameters[0];
	GtkTreePath *end_path = gtk_tree_path_new_from_string(param_end_path.c_str());

	gtk_tree_selection_unselect_range (GTK_TREE_SELECTION(instance), start_path, end_path);

}
Exemplo n.º 3
0
int
clip_GTK_TREESELECTIONUNSELECTRANGE(ClipMachine * cm)
{
	C_object *ctreesel = _fetch_co_arg(cm);
        C_object   *cpath1 = _fetch_cobject(cm, _clip_spar(cm, 2));
        C_object   *cpath2 = _fetch_cobject(cm, _clip_spar(cm, 3));

	CHECKOPT2(1, MAP_t, NUMERIC_t); CHECKCOBJ(ctreesel,GTK_IS_TREE_SELECTION(ctreesel->object));
	CHECKCOBJ(cpath1,GTK_IS_TREE_PATH(cpath1->object)); CHECKCOBJ(cpath2,GTK_IS_TREE_PATH(cpath2->object));

	gtk_tree_selection_unselect_range(GTK_TREE_SELECTION(ctreesel->object),
		GTK_TREE_PATH(cpath1->object), GTK_TREE_PATH(cpath2->object));

	return 0;
err:
	return 1;
}
Exemplo n.º 4
0
void ctree_select_vars(gint action)
{
	GtkTreeView *view;
	GtkTreeModel *model;
	GtkTreePath *path = path_to_drag;
	GtkTreeIter parent, start_iter, end_iter, iter;
	view = GTK_TREE_VIEW(ctree_wnd);
	model = gtk_tree_view_get_model(view);

	// select var beneath a folder
	gtk_tree_model_get_iter(model, &parent, path);

	if (gtk_tree_model_iter_has_child(model, &parent)) 
	{
		GtkTreeSelection *sel;
		GtkTreePath *start_path, *end_path;
		gint n;
		gboolean valid;

		sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(ctree_wnd));
		n = gtk_tree_model_iter_n_children(model, &parent);

		valid = gtk_tree_model_iter_children(model, &start_iter, &parent);
		start_path = gtk_tree_model_get_path(model, &start_iter);

		valid = gtk_tree_model_iter_nth_child(model, &end_iter, &parent, n - 1);
		if(gtk_tree_model_iter_has_child(model, &end_iter))
		{
			n = gtk_tree_model_iter_n_children(model, &end_iter);
			valid = gtk_tree_model_iter_nth_child(model, &iter, &end_iter, n - 1);
			memcpy(&end_iter, &iter, sizeof(GtkTreeIter));
		}
		end_path = gtk_tree_model_get_path(model, &end_iter);

		if (!action)
			gtk_tree_selection_unselect_range(sel, start_path, end_path);
		else
		{
			gtk_tree_selection_select_range(sel, start_path, end_path);
		}

		gtk_tree_path_free(start_path);
		gtk_tree_path_free(end_path);
	}
}
Exemplo n.º 5
0
int
clip_GTK_TREESELECTIONUNSELECTRANGE(ClipMachine * ClipMachineMemory)
{
   C_object *ctreesel = _fetch_co_arg(ClipMachineMemory);

   C_object *cpath1 = _fetch_cobject(ClipMachineMemory, _clip_spar(ClipMachineMemory, 2));

   C_object *cpath2 = _fetch_cobject(ClipMachineMemory, _clip_spar(ClipMachineMemory, 3));

   CHECKOPT2(1, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType);
   CHECKCOBJ(ctreesel, GTK_IS_TREE_SELECTION(ctreesel->object));
   CHECKCOBJ(cpath1, GTK_IS_TREE_PATH(cpath1->object));
   CHECKCOBJ(cpath2, GTK_IS_TREE_PATH(cpath2->object));

   gtk_tree_selection_unselect_range(GTK_TREE_SELECTION(ctreesel->object),
				     GTK_TREE_PATH(cpath1->object), GTK_TREE_PATH(cpath2->object));

   return 0;
 err:
   return 1;
}