1 ## Copyright (C) 2010-2012 David Bateman
3 ## This file is part of Octave.
5 ## Octave is free software; you can redistribute it and/or modify it
6 ## under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 3 of the License, or (at
8 ## your option) any later version.
10 ## Octave is distributed in the hope that it will be useful, but
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ## General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with Octave; see the file COPYING. If not, see
17 ## <http://www.gnu.org/licenses/>.
20 ## @deftypefn {Function File} {[@var{hplots}, @var{strings}]} = __getlegenddata__ (@var{h})
21 ## Undocumented internal function.
24 function [hplots, text_strings] = __getlegenddata__ (hlegend)
27 ca = getfield (get (hlegend, "userdata"), "handle");
30 kids = [kids; get(ca(i), "children")];
33 for i = numel (kids):-1:1
34 typ = get (kids(i), "type");
35 if (strcmp (typ, "line") || strcmp (typ, "surface")
36 || strcmp (typ, "patch") || strcmp (typ, "hggroup"))
38 if (strcmp (typ, "hggroup"))
39 hgkids = get (kids(i), "children");
40 for j = 1 : length (hgkids)
41 hgobj = get (hgkids (j));
42 if (isfield (hgobj, "displayname") && ! isempty (hgobj.displayname))
43 hplots = [hplots, hgkids(j)];
44 text_strings = {text_strings{:}, hgobj.displayname};
49 if (! isempty (get (kids (i), "displayname")))
50 hplots = [hplots, kids(i)];
51 text_strings = {text_strings{:}, get(kids (i), "displayname")};