src/node_editor/gui.c
static BBox update_widget_bounds( Widget *parent, Widget *w, BBox box, const BBox *view )
{
	BBox parent_box = box;
	int total_com = 0;
	Widget *prev_w = NULL;
	const WidgetLayout *parent_layout = parent ? &parent->layout : &ROOT_LAYOUT;
	int parent_x0 = parent_box.x0;
	int parent_y0 = parent_box.y0;
	
	for( ; !w->is_terminator; prev_w=w, w=NEXT_WIDGET(w) )
	{
		if ( w->com & UI_DISABLED )
			continue;
		
		box = get_child_box( w, prev_w, &box, parent_layout, parent_x0, parent_y0 );
		
		w->tree_com = w->com;
		w->bounds = w->son ? update_widget_bounds( w, w->son, box, view ) : box;
		w->on_screen = !view || !box_outside_view( &w->bounds, view );
		total_com |= w->tree_com;
		
		if ( !( w->com & UI_NO_MERGE ) )
			merge_bounds( &parent_box, &parent_box, &w->bounds );
	}
	
	if ( parent ) {
		grow_bounds( &parent_box, parent_layout->edge_margin );
		parent->tree_com |= total_com;
	}
	
	return parent_box;
}
/* Generates the layout for the widget tree. assumes w != NULL */
Generates the layout for the widget tree. assumes w != NULL
Generates the layout for the widget tree . assumes w ! = NULL
static BBox update_widget_bounds( Widget *parent, Widget *w, BBox box, const BBox *view )
{
	BBox parent_box = box;
	int total_com = 0;
	Widget *prev_w = NULL;
	const WidgetLayout *parent_layout = parent ? &parent->layout : &ROOT_LAYOUT;
	int parent_x0 = parent_box.x0;
	int parent_y0 = parent_box.y0;
	for( ; !w->is_terminator; prev_w=w, w=NEXT_WIDGET(w) )
	{
		if ( w->com & UI_DISABLED )
			continue;
		box = get_child_box( w, prev_w, &box, parent_layout, parent_x0, parent_y0 );
		w->tree_com = w->com;
		w->bounds = w->son ? update_widget_bounds( w, w->son, box, view ) : box;
		w->on_screen = !view || !box_outside_view( &w->bounds, view );
		total_com |= w->tree_com;
		if ( !( w->com & UI_NO_MERGE ) )
			merge_bounds( &parent_box, &parent_box, &w->bounds );
	}
	if ( parent ) {
		grow_bounds( &parent_box, parent_layout->edge_margin );
		parent->tree_com |= total_com;
	}
	return parent_box;
}
static BBox update_widget_bounds ( Widget * parent , Widget * w , BBox box , const BBox * view ) { BBox parent_box = box ; int total_com = 0 ; Widget * prev_w = NULL ; const WidgetLayout * parent_layout = parent ? & parent -> layout : & ROOT_LAYOUT ; int parent_x0 = parent_box . x0 ; int parent_y0 = parent_box . y0 ; for ( ; ! w -> is_terminator ; prev_w = w , w = NEXT_WIDGET ( w ) ) { if ( w -> com & UI_DISABLED ) continue ; box = get_child_box ( w , prev_w , & box , parent_layout , parent_x0 , parent_y0 ) ; w -> tree_com = w -> com ; w -> bounds = w -> son ? update_widget_bounds ( w , w -> son , box , view ) : box ; w -> on_screen = ! view || ! box_outside_view ( & w -> bounds , view ) ; total_com |= w -> tree_com ; if ( ! ( w -> com & UI_NO_MERGE ) ) merge_bounds ( & parent_box , & parent_box , & w -> bounds ) ; } if ( parent ) { grow_bounds ( & parent_box , parent_layout -> edge_margin ) ; parent -> tree_com |= total_com ; } return parent_box ; }
Generates the layout for the widget tree.
Generates the layout for the widget tree .