Exemplo n.º 1
0
int
clip_GTK_TREEITEMEXPAND(ClipMachine * cm)
{
	C_widget *citm = _fetch_cw_arg(cm);
	CHECKCWID(citm,GTK_IS_TREE_ITEM);
	gtk_tree_item_expand(GTK_TREE_ITEM(citm->widget));
	return 0;
err:
	return 1;
}
Exemplo n.º 2
0
Arquivo: tree.c Projeto: jimiszm/peos
GtkWidget * create_subtree(action *a_node, int n)
{
int i;
GtkWidget *new_subtree;
char *str;
new_subtree = gtk_tree_new();
  for (i = 0; i < a_node->count; i++){
  GtkWidget *item, *sub_subtree;
  GtkWidget *box;
  	if (!xmlStrcmp (a_node->action[i]->name, (const xmlChar *) "action")) {
		item = gtk_tree_item_new(); 
  		str = (char *) malloc (sizeof(char) * (2+ strlen (xmlGetProp (a_node->action[i], "name"))));
		strcpy (str, (xmlGetProp (a_node->action[i], "name")));
  		box = setpixmap (str, a_node->action[i]);
		gtk_container_add (GTK_CONTAINER (item), box);
  		gtk_tree_append (GTK_TREE(new_subtree), item);
  		free (str);
  		str = NULL;
		linklist[n][counting_action-1].next = a_node->action[i]; 
		linklist[n][counting_action].cur = a_node->action[i]; 
		linklist[n][counting_action].item = item;
		linklist[n][counting_action+1].prev = a_node->action[i]; 
		counting_action++;
  	} else if ( xmlStrcmp (a_node->action[i]->name, (const xmlChar *) "action")) {
		item = gtk_tree_item_new();
  		str = (char *) malloc (sizeof(char) * (2 +strlen(a_node->action[i]->name)));
		strcpy (str, a_node->action[i]->name);
  		box = setpixmap (str, a_node->action[i]);
		gtk_container_add (GTK_CONTAINER (item), box);
  		free (str);
  		str = NULL;
  		gtk_tree_append (GTK_TREE(new_subtree), item);
		sub_subtree = create_subtree(a_node->iterptr,  n);
		gtk_tree_item_set_subtree(GTK_TREE_ITEM(item), sub_subtree);
		gtk_tree_item_expand (GTK_TREE_ITEM (item));
	        gtk_widget_show (sub_subtree);
	} 
  gtk_signal_connect (GTK_OBJECT(item), "select", GTK_SIGNAL_FUNC(tree_select), a_node->action[i]);
  gtk_signal_connect (GTK_OBJECT(item), "deselect", GTK_SIGNAL_FUNC(tree_deselect), NULL);
  gtk_signal_connect (GTK_OBJECT(item), "toggle", GTK_SIGNAL_FUNC(tree_toggle), NULL);
  gtk_signal_connect (GTK_OBJECT(item), "expand", GTK_SIGNAL_FUNC(tree_expand),NULL);
  gtk_signal_connect (GTK_OBJECT(item), "collapse", GTK_SIGNAL_FUNC(tree_collapse), NULL);

  gtk_widget_show (item);
  }
return new_subtree;
}
Exemplo n.º 3
0
/*** sfeRebuildUI - take the structure file data and completely rebuild the
 *** user interface representation, including the treeview navigation.
 ***/
int
sfeRebuildUI(pStructInf new_data, GtkTree *treeview)
    {
    GtkWidget *treeitem, *subtree;
	
	/** Clear any existing treeview content. **/
	gtk_tree_clear_items(treeview, 0, 9999);

	/** Add a root item **/
	treeitem = sfeBuildTreeItemWithImage(new_data);
	gtk_tree_prepend(treeview, treeitem);
	gtk_widget_show(treeitem);

	/** Build the tree, recursively. **/
	sfeRebuildUI_r(new_data, GTK_TREE_ITEM(treeitem));

	/** Expand the root node **/
	gtk_tree_item_expand(GTK_TREE_ITEM(treeitem));

    return 0;
    }
Exemplo n.º 4
0
Arquivo: tree.c Projeto: jimiszm/peos
GtkWidget * create_task_tree(int n) {
  int i; /*n=Process #*/
  char *strr;
  char *str;
  counting_action = 0;
  
  GtkWidget *tree, *subtree;
  GtkWidget *treename;
  GtkWidget *box;
   
  tree = gtk_tree_new();

  strr = (char *) malloc (sizeof(char) * (strlen(xmlGetProp (table[n].process, "model")))
				+ strlen (" Pid: ")+ strlen (xmlGetProp(table[n].process, "pid")) + 256);
  strcat (strcat (strcpy (strr, xmlGetProp (table[n].process, "model")), " Pid: "), xmlGetProp(table[n].process, "pid"));
  
  treename = gtk_tree_item_new();

  box = setpixmap (strr, NULL);
  gtk_container_add (GTK_CONTAINER (treename), box);
  gtk_tree_append (GTK_TREE (tree), treename);
  free (strr);
  strr = NULL;
  
  subtree = gtk_tree_new();
  gtk_tree_item_set_subtree(GTK_TREE_ITEM(treename), subtree);
  gtk_tree_item_expand (GTK_TREE_ITEM(treename));
  linklist[n][counting_action].prev = NULL; 
  for (i = 0; i < table[n].list.count; i++) {
	GtkWidget *item, *itersubtree;
	GtkWidget *box;
  	if (!xmlStrcmp ((table[n].list.action[i])->name, (const xmlChar *) "action")) {
		item = gtk_tree_item_new(); 
  		str = (char *) malloc (sizeof(char) * (2+ strlen (xmlGetProp (table[n].list.action[i], "name"))));
		strcpy (str, xmlGetProp (table[n].list.action[i], "name"));
  		box = setpixmap (str, table[n].list.action[i]);
		gtk_container_add (GTK_CONTAINER (item), box);
  		gtk_tree_append (GTK_TREE(subtree), item);
  		free (str);
  		str = NULL;
		linklist[n][counting_action-1].next = table[n].list.action[i]; 
		linklist[n][counting_action].cur = table[n].list.action[i]; 
		linklist[n][counting_action].item = item;
		linklist[n][counting_action+1].prev = table[n].list.action[i]; 
		counting_action++;
  	}  else if ( xmlStrcmp (table[n].list.action[i]->name, (const xmlChar *) "action")) {
  		str = (char *) malloc (sizeof(char) * (2 +strlen(table[n].list.action[i]->name)));
		item = gtk_tree_item_new();
		strcpy (str, table[n].list.action[i]->name);
  		box = setpixmap (str, table[n].list.action[i]);
		gtk_container_add (GTK_CONTAINER (item), box);
  		free (str);
  		str = NULL;
 		itersubtree = create_subtree(table[n].list.iterptr, n);
  		gtk_tree_append (GTK_TREE(subtree), item);
  		gtk_tree_set_view_mode (GTK_TREE (itersubtree), GTK_TREE_VIEW_LINE);
		gtk_tree_item_set_subtree(GTK_TREE_ITEM(item), itersubtree);
		gtk_tree_item_expand (GTK_TREE_ITEM(item));
  		gtk_widget_show(itersubtree);
        } 

  gtk_signal_connect (GTK_OBJECT(item), "select", GTK_SIGNAL_FUNC(tree_select), table[n].list.action[i]);
  gtk_signal_connect (GTK_OBJECT(item), "deselect", GTK_SIGNAL_FUNC(tree_deselect), NULL);
  gtk_signal_connect (GTK_OBJECT(item), "toggle", GTK_SIGNAL_FUNC(tree_toggle), NULL);
  gtk_signal_connect (GTK_OBJECT(item), "expand", GTK_SIGNAL_FUNC(tree_expand), NULL);
  gtk_signal_connect (GTK_OBJECT(item), "collapse", GTK_SIGNAL_FUNC(tree_collapse), NULL);
  
  gtk_widget_show (item);
  }
  linklist[n][counting_action-1].next = NULL; 

  gtk_widget_show(subtree);
  gtk_widget_show(treename);
  gtk_widget_show(tree);
  return tree;
}