function print_heirarchy(show_hidden,h,s,i_am_last)
%PRINT_HEIRARCHY Show the Matlab GUI object heirarchy
%
% No arguments are required. Use print_heirarchy(1) to see even
% the hidden objects.
%
% http://splorg.org/people/tobin/projects/matlab/
%
% Tobin Fricke 2002-07-16 <tobin@splorg.org>
% Weizmann Institute of Science, Rehovot, Israel
%
% $Id: print_heirarchy.m,v 1.4 2002/07/23 05:34:50 tobin Exp tobin $
if nargin<4,
i_am_last = 1;
if nargin<3,
s = '';
if nargin<2,
h = 0;
if nargin<1,
show_hidden = 0;
end
end
end
end
if i_am_last,
branch = '\';
else
branch = '+';
end
disp([s branch '--' get(h,'type') ' (' get(h,'tag') ')']);
if show_hidden,
children = allchild(h);
else
children = get(h,'children');
end
for n=1:length(children),
x = children(n);
i_will_be_last = (n == length(children));
if i_am_last,
print_heirarchy(show_hidden,x,[s ' '],i_will_be_last);
else
print_heirarchy(show_hidden,x,[s '| '], i_will_be_last);
end
end