示例#1
0
/*** sfeRebuildUI_r - recursively build the new treeview display of the
 *** parsed structure file representation.
 ***/
int
sfeRebuildUI_r(pStructInf data, GtkTreeItem *subitem)
    {
    int i;
    pStructInf subinf;
    GtkWidget *subtreeitem, *subsubtree;
    GtkWidget *subtree = NULL;

	/** Loop through the subinfs, and add items/subtrees for each. **/
	for(i=0;i<data->nSubInf;i++) if (stStructType(data->SubInf[i]) == ST_T_SUBGROUP)
	    {
	    subinf = data->SubInf[i];

	    /** Only add the subtree once, and only if we need a subtree.  This
	     ** is why we do this in here instead of outside the loop.
	     **/
	    if (!subtree)
		{
		subtree = gtk_tree_new();
		gtk_tree_item_set_subtree(GTK_TREE_ITEM(subitem), subtree);
		gtk_tree_set_view_mode(GTK_TREE(subtree), GTK_TREE_VIEW_ITEM);
		}

	    /** Add the item to the subtree **/
	    subtreeitem = sfeBuildTreeItemWithImage(subinf);
	    gtk_tree_append(GTK_TREE(subtree), subtreeitem);
	    gtk_widget_show(subtreeitem);
	    sfeRebuildUI_r(subinf, GTK_TREE_ITEM(subtreeitem));
	    }
    
    return 0;
    }
void AddMissionsToTree(char *path, GtkWidget *tree, int is_parent) {
	glob_t *search;
	unsigned int length;
	int count, max;
	char *file, *filename;
	GtkWidget *subtree, *item;

	// First we check for sub directories. stick them at the top
	// For some reason, glob(,,GLOB_ONLYDIR,) doesn't seem to only match directories,
	// so FindDirs() currently returns everything. Check the last char for a /
	// That will be the directory.

	search = FindDirs(path);
	max = search->gl_pathc - 1;	// search->gl_pathc is a uint. If there's no files, it's 0.
	for (count = 0; count <= max; count++) {
		file = search->gl_pathv[count];
		length = strlen(file);
		if (file[length-1] != SEPERATOR) { continue; }	// Verify it's a directory and not a file

		filename = strdup(file);
		filename = StripPath(filename);
		if (strcmp("CVS", filename) == 0) { continue; }	// Don't need to display this directory

		item = AddItem(tree, filename, "dir");

		subtree = gtk_tree_new();
		gtk_signal_connect(GTK_OBJECT(subtree), "select_child", GTK_SIGNAL_FUNC(cb_select_child), subtree);
		gtk_signal_connect(GTK_OBJECT(subtree), "unselect_child", GTK_SIGNAL_FUNC(cb_unselect_child), subtree);

		gtk_tree_set_selection_mode(GTK_TREE(subtree), GTK_SELECTION_SINGLE);
		gtk_tree_set_view_mode(GTK_TREE(subtree), GTK_TREE_VIEW_ITEM);
		gtk_tree_item_set_subtree(GTK_TREE_ITEM(item), subtree);		

		AddMissionsToTree(file, subtree, 0);

	}

	search = FindFiles(path, EXT_MISSION);
	max = search->gl_pathc - 1;
	for (count = 0; count <= max; count++) {
		file = search->gl_pathv[count];
		length = strlen(file);
		if (file[length-1] == SEPERATOR) { continue; }

		filename = strdup(file);
		filename = StripPath(filename);
		StripExtension(filename);

		AddItem(tree, filename, file);
	}
	return;
}
示例#3
0
文件: tree.c 项目: amery/clip-angelo
/* Removes a list of items from the GtkTree in tree.

 * If only one item is to be removed from the GtkTree,
 * gtk_container_remove() can be used instead.

 * Removing an item from a GtkTree dereferences the item, and thus
 * usually destroys the item and any subtrees it may contain. If the
 * item is not to be destroyed, use gtk_object_ref() before removing it. */
int
clip_GTK_TREEREMOVEITEMS(ClipMachine * ClipMachineMemory)
{
   C_widget *ctree = _fetch_cw_arg(ClipMachineMemory);

   ClipVar  *items = _clip_spar(ClipMachineMemory, 2);

   CHECKCWID(ctree, GTK_IS_TREE);
   CHECKOPT3(2, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType, ARRAY_type_of_ClipVarType);

   if (items->t.ClipVartype_type_of_ClipType == MAP_type_of_ClipVarType
       || items->t.ClipVartype_type_of_ClipType == NUMERIC_type_of_ClipVarType)
    {
       C_widget *citem = _fetch_cwidget(ClipMachineMemory, items);

       gtk_tree_remove_item(GTK_TREE(ctree->widget), citem->widget);
    }
   if (items->t.ClipVartype_type_of_ClipType == ARRAY_type_of_ClipVarType)
    {
       GList    *list = NULL;

       unsigned short i;

       ClipVar  *item;

       C_widget *citem;

       for (i = 0; i < items->a.count; i++)
	{
	   item = &items->a.items[i];
	   if (item->t.ClipVartype_type_of_ClipType == NUMERIC_type_of_ClipVarType
	       || item->t.ClipVartype_type_of_ClipType == MAP_type_of_ClipVarType)
	    {
	       citem = _fetch_cwidget(ClipMachineMemory, item);
	       CHECKCWID(citem, GTK_IS_TREE_ITEM);
	       list = g_list_append(list, citem->widget);
	    }
	}
       if (list)
	{
	   gtk_tree_remove_items(GTK_TREE(ctree->widget), list);
	   g_list_free(list);
	}
    }
   return 0;
 err:
   return 1;
}
void ShowMain(int run_vegastrike) {
	GtkWidget *button;
	/* A generic scrolled window */
	scrolled_win = gtk_scrolled_window_new (NULL, NULL);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
	gtk_widget_set_usize (scrolled_win, 150, 200);
	gtk_container_add (GTK_CONTAINER(main_hbox), scrolled_win);
	gtk_widget_show (scrolled_win);

	/* Create the root tree */
	tree = gtk_tree_new();

	/* connect all GtkTree:: signals */
	gtk_signal_connect (GTK_OBJECT(tree), "select_child", GTK_SIGNAL_FUNC(cb_select_child), tree);
	gtk_signal_connect (GTK_OBJECT(tree), "unselect_child", GTK_SIGNAL_FUNC(cb_unselect_child), tree);
	gtk_signal_connect (GTK_OBJECT(tree), "selection_changed", GTK_SIGNAL_FUNC(cb_selection_changed), tree);

	/* Add it to the scrolled window */
	gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW(scrolled_win), tree);

	/* Set the selection mode */
	gtk_tree_set_selection_mode (GTK_TREE(tree), GTK_SELECTION_SINGLE);

	/* Show it */
	gtk_widget_show (tree);

	AddMainLabels();

	AddMissionsToTree(DIR_MISSION, tree, 1);

	button = gtk_button_new_with_label("Run Mission");
	gtk_signal_connect(GTK_OBJECT(button), "clicked", RunMission, NULL);
	gtk_container_add(GTK_CONTAINER(main_vbox), button);
	gtk_widget_show(button);
}
示例#5
0
/*** sfeLoadFile - loads a new file into the program.
 ***/
int
sfeLoadFile(char* filename)
    {
    pFile fd;
    pStructInf new_filedata;

	/** open the file. **/
	if (strlen(filename) > 255) return -1;
	fd = fdOpen(filename, O_RDONLY, 0600);
	if (!fd) return -1;

	/** Try to parse it **/
	new_filedata = stParseMsg(fd, 0);
	fdClose(fd,0);
	if (!new_filedata) return -1;
	if (SFE_Globals.Data) stFreeInf(SFE_Globals.Data);
	SFE_Globals.Data = new_filedata;
	SFE_Globals.Modified = 0;

	/** Set the filename and title **/
	strcpy(SFE_Globals.Filename, filename);
	sfeSetTitle(GTK_WINDOW(SFE_Globals.Window), SFE_Globals.Filename);

	/** Rebuild the ui **/
	sfeRebuildUI(SFE_Globals.Data, GTK_TREE(SFE_Globals.TreeView));

    return 0;
    }
示例#6
0
文件: tree.c 项目: 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;
}
void append_data_tree()
{
	GtkWidget *subtree;
	item[4] = gtk_tree_item_new_with_label(data_buf.title);
	gtk_tree_append(GTK_TREE(tree),item[4]);
	subtree = gtk_tree_new();

	gtk_tree_set_selection_mode (GTK_TREE(subtree),GTK_SELECTION_SINGLE);
	gtk_tree_set_view_mode (GTK_TREE(subtree), GTK_TREE_VIEW_ITEM);   
	gtk_tree_item_set_subtree (GTK_TREE_ITEM(item[4]), subtree);      

	GtkWidget *subitem;                                           
	subitem = gtk_tree_item_new_with_label (data_buf.data);           
	gtk_tree_append (GTK_TREE(subtree), subitem);                 
	gtk_widget_show (subitem);                                    
	gtk_widget_show (item[4]);
}
void append_udp_tree()
{
	GtkWidget *subtree;
	gint i = 0;

	item[3] = gtk_tree_item_new_with_label(udp_buf.title);
	gtk_tree_append(GTK_TREE(tree),item[3]);
	subtree = gtk_tree_new();

	gtk_tree_set_selection_mode (GTK_TREE(subtree),GTK_SELECTION_SINGLE);
	gtk_tree_set_view_mode (GTK_TREE(subtree), GTK_TREE_VIEW_ITEM);   
	gtk_tree_item_set_subtree (GTK_TREE_ITEM(item[3]), subtree);      

	GtkWidget *subitem;                                           
	subitem = gtk_tree_item_new_with_label (udp_buf.source);           
	gtk_tree_append (GTK_TREE(subtree), subitem);                 
	gtk_widget_show (subitem);  

	subitem = gtk_tree_item_new_with_label (udp_buf.dest);           
	gtk_tree_append (GTK_TREE(subtree), subitem);                 
	gtk_widget_show (subitem);  

	subitem = gtk_tree_item_new_with_label (udp_buf.length);           
	gtk_tree_append (GTK_TREE(subtree), subitem);                 
	gtk_widget_show (subitem);  

	subitem = gtk_tree_item_new_with_label (udp_buf.check);           
	gtk_tree_append (GTK_TREE(subtree), subitem);                 
	gtk_widget_show (subitem);  
	gtk_widget_show (item[3]);
}
示例#9
0
文件: tree.cpp 项目: cpence/gtkpak
void tree_item_selected( GtkWidget* item )
{
    gchar* current_path = context.current_path;
    memset( current_path, 0, PAKFile::MAX_FILENAMESIZE );

    if( GTK_TREE( item->parent )->level != 0 ) {
	walk_up_tree( item );
    }

    build_table( );
}
示例#10
0
文件: callbacks.c 项目: jimiszm/peos
void
on_Abort_clicked                       (GtkButton       *button,
                                       gpointer         user_data)
{
  char *cmd, *name, buf[3];
  int i, size;

  name = xmlGetProp(table[cur_pid].page.curr, "name");
  size = strlen(exec_path) + strlen(" -n ") + sizeof(cur_pid) + strlen(buf) + strlen(" ")
  	+ strlen(name) + strlen(" abort ") + 1;
  cmd = (char *) malloc (size);
  size = 0;

  strcpy (cmd, exec_path);
  strcat (cmd, " -n ");
  sprintf(buf, "%d", cur_pid);
  strcat (cmd, buf);
  strcat (cmd, " ");
  strcat (cmd, name);
  strcat (cmd, " abort ");
  runPeos(cmd);
  free(cmd);
  cmd = NULL;

  freeAll_extra();

  draw_tree (cur_pid);
  /* check state of current action and highlight item in jtree */
  for ( i = 0; i < counting_action; i++) {
	if ((strcmp (xmlGetProp (linklist[cur_pid][i].cur, "state"), "NONE") == 0) 
	|| (strcmp (xmlGetProp (linklist[cur_pid][i].cur, "state"), "SUSPEND") == 0)) {
 		table[cur_pid].page.curr = linklist[cur_pid][i].cur;
		if((GTK_IS_WIDGET (table[cur_pid].page.tree1) && 
			GTK_IS_TREE (GTK_TREE (table[cur_pid].page.tree1))))
			gtk_tree_select_child ( GTK_TREE (table[cur_pid].page.tree1), linklist[cur_pid][i].item);
		break;	
	}
  }
  draw_text(table[cur_pid].page.curr);
  check_state();
}
示例#11
0
文件: callbacks.c 项目: jimiszm/peos
void
set_item_select(signed int factor, int feature)
{
  int i = 0;
  if (table[cur_pid].process != NULL ) {
  	/* find the current action page and use that index to highlight current item */
  	if (process_count > 0) while (linklist[cur_pid][i].cur != table[cur_pid].page.curr) i++;

  	if ( (linklist[cur_pid][i].prev != NULL) || (linklist[cur_pid][i].next != NULL)) {
		/* determine what feature is calling this function values are mapped in the specification file */
		if(feature == 1) table[cur_pid].page.curr = linklist[cur_pid][i].next;
		else table[cur_pid].page.curr = linklist[cur_pid][i].prev;
		/* previous uses factor -1 and next 1 */
  		table[cur_pid].page.index = i+factor;
		/* highlight the specified tree item */
  		if (GTK_IS_TREE (GTK_TREE (table[cur_pid].page.tree1)))
			gtk_tree_select_child (GTK_TREE (table[cur_pid].page.tree1), linklist[cur_pid][i+factor].item);
  	}
  	check_state();
  }
}
示例#12
0
void append_ether_tree()
{
	GtkWidget *subtree;
	gint i = 0;

	item[1] = gtk_tree_item_new_with_label(ether_buf.title);
	gtk_tree_append(GTK_TREE(tree),item[1]);
	subtree = gtk_tree_new();

	gtk_tree_set_selection_mode (GTK_TREE(subtree),GTK_SELECTION_SINGLE);
	gtk_tree_set_view_mode (GTK_TREE(subtree), GTK_TREE_VIEW_ITEM);   
	gtk_tree_item_set_subtree (GTK_TREE_ITEM(item[1]), subtree);      

	GtkWidget *subitem;                                           
	subitem = gtk_tree_item_new_with_label (ether_buf.dst_mac);           
	gtk_tree_append (GTK_TREE(subtree), subitem);                 
	gtk_widget_show (subitem);  

	subitem = gtk_tree_item_new_with_label (ether_buf.src_mac);           
	gtk_tree_append (GTK_TREE(subtree), subitem);                 
	gtk_widget_show (subitem);  

	subitem = gtk_tree_item_new_with_label (ether_buf.protocol);           
	gtk_tree_append (GTK_TREE(subtree), subitem);                 
	gtk_widget_show (subitem);  

	gtk_widget_show (item[1]);
}
示例#13
0
文件: tree.cpp 项目: cpence/gtkpak
void build_tree( void )
{
    clear_tree( );

    GtkTree* tree = GTK_TREE( context.tree );

    PAKFile* pak = context.pak;
    PAKTree& pak_tree = pak->getTree( );
    PAKTreeNode& root = pak_tree.getRoot( );

    // Construct the special root node.
    //    GtkWidget* item = gtk_tree_item_new_with_label( const_cast<char*>( pak->getPakName( ) ) );
    GtkWidget* item = gtk_tree_item_new_with_label( context.pak_filename );
    gtk_signal_connect( GTK_OBJECT( item ), "select",
			GTK_SIGNAL_FUNC( tree_item_selected ), NULL );
    gtk_tree_append( tree, item );
    gtk_widget_show( item );
    GtkWidget* root_tree = gtk_tree_new( );
    gtk_tree_item_set_subtree( GTK_TREE_ITEM( item ), root_tree );

    add_children_to_tree( GTK_TREE( root_tree ), root );
}
示例#14
0
文件: tree.cpp 项目: cpence/gtkpak
void add_children_to_tree( GtkTree* tree, PAKTreeNode& pak_node )
{

    for( int i = 0; i < pak_node.numNodes( ); ++i ) {
	PAKTreeNode& node = pak_node.getNode( i );
	char* name = node.getName( );

	GtkWidget* item = gtk_tree_item_new_with_label( name );
	gtk_signal_connect( GTK_OBJECT( item ), "select",
			    GTK_SIGNAL_FUNC( tree_item_selected ), NULL );
	gtk_tree_append( GTK_TREE( tree ), item );
	gtk_widget_show( item );

	if( node.numNodes( ) > 0 ) {
	    GtkWidget* sub_tree = gtk_tree_new( );
	    gtk_tree_item_set_subtree( GTK_TREE_ITEM( item ), sub_tree );
	    add_children_to_tree( GTK_TREE( sub_tree ), node );
	}

    }

}
示例#15
0
文件: callbacks.c 项目: jimiszm/peos
void
set_selection(int flag)
{
  int k,i;

  k = cur_pid;
  if(process_count > 0) {
  	for (i = 0; i < MAX_PID; i++) {
   		cur_pid = i;
		if((flag == 0) && (table[cur_pid].process != NULL)) {
   			if (GTK_IS_WIDGET (table[cur_pid].page.tree1) && GTK_IS_TREE(GTK_TREE(table[cur_pid].page.tree1))) {
				gtk_tree_select_child ( GTK_TREE (table[cur_pid].page.tree1), linklist[cur_pid][0].item);
			}
		} else  if((flag == 1) && table[cur_pid].process != NULL ) {
			if((GTK_IS_WIDGET (table[cur_pid].page.tree1) && GTK_IS_TREE (GTK_TREE (table[cur_pid].page.tree1))))
				gtk_tree_select_child ( GTK_TREE (table[cur_pid].page.tree1), 
				linklist[cur_pid][table[cur_pid].page.index].item);
		}
  	}
  }
  cur_pid = k;
}
示例#16
0
文件: tree.c 项目: amery/clip-itk
/* Sets whether or not the connecting lines between branches and children are drawn. */
int
clip_GTK_TREESETVIEWLINES(ClipMachine * cm)
{
	C_widget  *ctree = _fetch_cw_arg(cm);
        gboolean    flag = _clip_parl(cm,2);

        CHECKCWID(ctree,GTK_IS_TREE); CHECKOPT(2,LOGICAL_t);

	gtk_tree_set_view_lines(GTK_TREE(ctree->widget), flag);
	return 0;
err:
	return 1;
}
示例#17
0
文件: tree.c 项目: amery/clip-itk
/* Emits the unselect_item for the child at position item, and thus unselects it. */
int
clip_GTK_TREEUNSELECTITEM(ClipMachine * cm)
{
	C_widget  *ctree = _fetch_cw_arg(cm);
        gint        item = INT_OPTION(cm,2,1)-1;

        CHECKCWID(ctree,GTK_IS_TREE);
        CHECKOPT(2,NUMERIC_t);

	gtk_tree_unselect_item(GTK_TREE(ctree->widget), item);
	return 0;
err:
	return 1;
}
示例#18
0
文件: tree.c 项目: amery/clip-itk
/* Returns the position of child in the GtkTree tree.
 * If child is not a child of tree, then -1 is returned. */
int
clip_GTK_TREECHILDPOSITION(ClipMachine * cm)
{
	C_widget  *ctree = _fetch_cw_arg(cm);
	C_widget  *citem = _fetch_cwidget(cm,_clip_spar(cm,2));

        CHECKCWID(ctree,GTK_IS_TREE);
        CHECKOPT2(2,MAP_t,NUMERIC_t); CHECKCWID(citem,GTK_TREE_ITEM);

	_clip_retni(cm, gtk_tree_child_position(GTK_TREE(ctree->widget), citem->widget));
	return 0;
err:
	return 1;
}
示例#19
0
文件: tree.c 项目: amery/clip-itk
/* Sets the selection mode for the GtkTree tree.
mode can be one of
    GTK_SELECTION_SINGLE for when only one item can be selected at a time.
    GTK_SELECTION_BROWSE for when one item must be selected.
    GTK_SELECTION_MULTIPLE for when many items can be selected at once.
    GTK_SELECTION_EXTENDED Reserved for later use.
The selection mode is only defined for a root tree, as the root tree "owns" the selection.
The default mode is GTK_SELECTION_SINGLE. */
int
clip_GTK_TREESETSELECTIONMODE(ClipMachine * cm)
{
	C_widget  *ctree = _fetch_cw_arg(cm);
        GtkSelectionMode mode = _clip_parni(cm,2);

        CHECKCWID(ctree,GTK_IS_TREE);
        CHECKOPT(2,NUMERIC_t);

	gtk_tree_set_selection_mode(GTK_TREE(ctree->widget), mode);
	return 0;
err:
	return 1;
}
示例#20
0
文件: tree.c 项目: amery/clip-itk
/* Sets the 'viewmode' for the GtkTree in tree.
The 'viewmode' defines how the tree looks when an item is selected.
mode can be one of:
    GTK_TREE_VIEW_LINE : When an item is selected the entire GtkTreeItem is highlighted.
    GTK_TREE_VIEW_ITEM : When an item is selected only the selected item's child widget is highlighted.
The default mode is GTK_TREE_VIEW_LINE. */
int
clip_GTK_TREESETVIEWMODE(ClipMachine * cm)
{
	C_widget  *ctree = _fetch_cw_arg(cm);
        GtkTreeViewMode mode = _clip_parni(cm,2);

        CHECKCWID(ctree,GTK_IS_TREE);
        CHECKOPT(2,NUMERIC_t);

	gtk_tree_set_view_mode(GTK_TREE(ctree->widget), mode);
	return 0;
err:
	return 1;
}
GtkWidget *AddItem(GtkWidget *tree, char *name, char *filename) {
	GtkWidget *item;

	item = gtk_tree_item_new_with_label(name);
	gtk_signal_connect(GTK_OBJECT(item), "select", GTK_SIGNAL_FUNC(select_item), filename);
	gtk_signal_connect(GTK_OBJECT(item), "deselect", GTK_SIGNAL_FUNC(deselect_item), filename);
	
	// You can also add the following signals: toggle, expand, collapse

	gtk_tree_append(GTK_TREE(tree), item);
	gtk_widget_show(item);

	return item;
}
示例#22
0
文件: tree.c 项目: amery/clip-itk
/* Adds the GtkTreeItem in tree_item to the start of the items in tree. */
int
clip_GTK_TREEPREPEND(ClipMachine * cm)
{
	C_widget  *ctree = _fetch_cw_arg(cm);
	C_widget  *citem = _fetch_cwidget(cm,_clip_spar(cm,2));

        CHECKCWID(ctree,GTK_IS_TREE);
        CHECKOPT2(2,MAP_t,NUMERIC_t); CHECKCWID(citem,GTK_TREE_ITEM);

	gtk_tree_prepend(GTK_TREE(ctree->widget), citem->widget);
	return 0;
err:
	return 1;
}
示例#23
0
void
sfe_ui_FileNew(GtkWidget *w)
    {

	strcpy(SFE_Globals.Filename, "untitled.struct");
	SFE_Globals.Data = stCreateStruct("new","x-unknown/x-unknown");
	SFE_Globals.Modified = 0;
	sfeSetTitle(GTK_WINDOW(SFE_Globals.Window), SFE_Globals.Filename);

	/** Rebuild the ui **/
	sfeRebuildUI(SFE_Globals.Data, GTK_TREE(SFE_Globals.TreeView));

    return;
    }
示例#24
0
文件: tree.c 项目: amery/clip-angelo
/* Emits the select_item signal for the child at position item, and thus
 * selects it (unless it is unselected in a signal handler). */
int
clip_GTK_TREESELECTITEM(ClipMachine * ClipMachineMemory)
{
   C_widget *ctree = _fetch_cw_arg(ClipMachineMemory);

   gint      item = INT_OPTION(ClipMachineMemory, 2, 1) - 1;

   CHECKCWID(ctree, GTK_IS_TREE);
   CHECKOPT(2, NUMERIC_type_of_ClipVarType);

   gtk_tree_select_item(GTK_TREE(ctree->widget), item);
   return 0;
 err:
   return 1;
}
示例#25
0
文件: tree.c 项目: amery/clip-itk
/* Removes the items at positions between start and end from the GtkTree tree.

 * Removing an item from a GtkTree dereferences the item, and thus usually
 * destroys the item and any subtrees it may contain. If the item is not
 * to be destroyed, use gtk_object_ref() before removing it. */
int
clip_GTK_TREECLEARITEMS(ClipMachine * cm)
{
	C_widget  *ctree = _fetch_cw_arg(cm);
        gint       start = INT_OPTION(cm,2,1)-1;
        gint         end = INT_OPTION(cm,3,1)-1;

        CHECKCWID(ctree,GTK_IS_TREE);
        CHECKOPT(2,NUMERIC_t); CHECKOPT(3,NUMERIC_t);

	gtk_tree_clear_items(GTK_TREE(ctree->widget), start, end);
	return 0;
err:
	return 1;
}
示例#26
0
文件: tree.c 项目: amery/clip-angelo
/* Returns the position of child in the GtkTree tree.
 * If child is not a child of tree, then -1 is returned. */
int
clip_GTK_TREECHILDPOSITION(ClipMachine * ClipMachineMemory)
{
   C_widget *ctree = _fetch_cw_arg(ClipMachineMemory);

   C_widget *citem = _fetch_cwidget(ClipMachineMemory, _clip_spar(ClipMachineMemory, 2));

   CHECKCWID(ctree, GTK_IS_TREE);
   CHECKOPT2(2, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType);
   CHECKCWID(citem, GTK_TREE_ITEM);

   _clip_retni(ClipMachineMemory, gtk_tree_child_position(GTK_TREE(ctree->widget), citem->widget));
   return 0;
 err:
   return 1;
}
示例#27
0
文件: tree.c 项目: amery/clip-angelo
/* Adds the GtkTreeItem in tree_item to the end of the items in tree. */
int
clip_GTK_TREEAPPEND(ClipMachine * ClipMachineMemory)
{
   C_widget *ctree = _fetch_cw_arg(ClipMachineMemory);

   C_widget *citem = _fetch_cwidget(ClipMachineMemory, _clip_spar(ClipMachineMemory, 2));

   CHECKCWID(ctree, GTK_IS_TREE);
   CHECKOPT2(2, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType);
   CHECKCWID(citem, GTK_TREE_ITEM);

   gtk_tree_append(GTK_TREE(ctree->widget), citem->widget);
   return 0;
 err:
   return 1;
}
示例#28
0
文件: tree.c 项目: amery/clip-itk
/* Adds the GtkTreeItem in tree_item to the list of items in tree
 * at the position indicated by position. */
int
clip_GTK_TREEINSERT(ClipMachine * cm)
{
	C_widget  *ctree = _fetch_cw_arg(cm);
	C_widget  *citem = _fetch_cwidget(cm,_clip_spar(cm,2));
        gint    position = INT_OPTION(cm,3,1)-1;

        CHECKCWID(ctree,GTK_IS_TREE);
        CHECKOPT2(2,MAP_t,NUMERIC_t); CHECKCWID(citem,GTK_TREE_ITEM);
        CHECKOPT(3,NUMERIC_t);

	gtk_tree_insert(GTK_TREE(ctree->widget), citem->widget, position);
	return 0;
err:
	return 1;
}
示例#29
0
文件: tree.c 项目: amery/clip-angelo
/* Adds the GtkTreeItem in tree_item to the list of items in tree
 * at the position indicated by position. */
int
clip_GTK_TREEINSERT(ClipMachine * ClipMachineMemory)
{
   C_widget *ctree = _fetch_cw_arg(ClipMachineMemory);

   C_widget *citem = _fetch_cwidget(ClipMachineMemory, _clip_spar(ClipMachineMemory, 2));

   gint      position = INT_OPTION(ClipMachineMemory, 3, 1) - 1;

   CHECKCWID(ctree, GTK_IS_TREE);
   CHECKOPT2(2, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType);
   CHECKCWID(citem, GTK_TREE_ITEM);
   CHECKOPT(3, NUMERIC_type_of_ClipVarType);

   gtk_tree_insert(GTK_TREE(ctree->widget), citem->widget, position);
   return 0;
 err:
   return 1;
}
示例#30
0
文件: tree.cpp 项目: cpence/gtkpak
void walk_up_tree( GtkWidget* item )
{
    gchar* current_path = context.current_path;
    gchar* text;
    GtkWidget* widget = item;
    GtkTree* next_tree = GTK_TREE( widget->parent );

    if( next_tree->level > 1 ) {
	walk_up_tree( next_tree->tree_owner );
    }

    GtkLabel* label = GTK_LABEL( GTK_BIN( widget )->child );
    gtk_label_get( label, &text );
    strncat( current_path, text, PAKFileEntry::MAX_FILENAMESIZE - 1 );

    // No "/" on front of path.
    if( next_tree->level >= 1 ) {
	strcat( current_path, "/" );
    }

}