void chanview_set_impl (chanview *cv, int type) { /* cleanup the old one */ if (cv->func_cleanup) cv->func_cleanup (cv); switch (type) { case 0: cv->func_init = cv_tabs_init; cv->func_postinit = cv_tabs_postinit; cv->func_add = cv_tabs_add; cv->func_move_focus = cv_tabs_move_focus; cv->func_change_orientation = cv_tabs_change_orientation; cv->func_remove = cv_tabs_remove; cv->func_move = cv_tabs_move; cv->func_move_family = cv_tabs_move_family; cv->func_focus = cv_tabs_focus; cv->func_set_color = cv_tabs_set_color; cv->func_rename = cv_tabs_rename; cv->func_is_collapsed = cv_tabs_is_collapsed; cv->func_get_parent = cv_tabs_get_parent; cv->func_cleanup = cv_tabs_cleanup; break; default: cv->func_init = cv_tree_init; cv->func_postinit = cv_tree_postinit; cv->func_add = cv_tree_add; cv->func_move_focus = cv_tree_move_focus; cv->func_change_orientation = cv_tree_change_orientation; cv->func_remove = cv_tree_remove; cv->func_move = cv_tree_move; cv->func_move_family = cv_tree_move_family; cv->func_focus = cv_tree_focus; cv->func_set_color = cv_tree_set_color; cv->func_rename = cv_tree_rename; cv->func_is_collapsed = cv_tree_is_collapsed; cv->func_get_parent = cv_tree_get_parent; cv->func_cleanup = cv_tree_cleanup; break; } /* now rebuild a new tabbar or tree */ cv->func_init (cv); chanview_populate (cv); cv->func_postinit (cv); /* force re-focus */ if (cv->focused) cv->func_focus (cv->focused); }
static void cv_tabs_change_orientation (chanview *cv) { /* cleanup the old one */ if (cv->func_cleanup) cv->func_cleanup (cv); /* now rebuild a new tabbar or tree */ cv->func_init (cv); chanview_populate (cv); }