Mercurial > hg > octave-lyh
annotate scripts/plot/allchild.m @ 17137:04c3d56e007a
allchild.m: Add input validation, %!test blocks, and more documentation.
* scripts/plot/allchild.m: Add input validation, %!test blocks, and more
documentation.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 01 Aug 2013 08:17:24 -0700 |
parents | eaab03308c0b |
children | bc924baa2c4e |
rev | line source |
---|---|
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
13977
diff
changeset
|
1 ## Copyright (C) 2008-2012 Bill Denney |
7557 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
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. | |
9 ## | |
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. | |
14 ## | |
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/>. | |
18 | |
19 ## -*- texinfo -*- | |
20 ## @deftypefn {Function File} {@var{h} =} allchild (@var{handles}) | |
9316
c539ec5726e7
Update some of Advanced Plotting documentation.
Rik <rdrider0-list@yahoo.com>
parents:
8262
diff
changeset
|
21 ## Find all children, including hidden children, of a graphics object. |
7557 | 22 ## |
17137
04c3d56e007a
allchild.m: Add input validation, %!test blocks, and more documentation.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
23 ## This function is similar to @code{get (h, "children")}, but also returns |
04c3d56e007a
allchild.m: Add input validation, %!test blocks, and more documentation.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
24 ## hidden objects ("HandleVisibility" = "off"). If @var{handles} is a scalar, |
04c3d56e007a
allchild.m: Add input validation, %!test blocks, and more documentation.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
25 ## @var{h} will be a vector. Otherwise, @var{h} will be a cell matrix of the |
04c3d56e007a
allchild.m: Add input validation, %!test blocks, and more documentation.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
26 ## same size as @var{handles} and each cell will contain a vector of handles. |
17126
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17123
diff
changeset
|
27 ## @seealso{findall, findobj, get, set} |
7557 | 28 ## @end deftypefn |
29 | |
30 ## Author: Bill Denney <bill@denney.ws> | |
31 | |
11469
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
9316
diff
changeset
|
32 function h = allchild (handles) |
7557 | 33 |
17137
04c3d56e007a
allchild.m: Add input validation, %!test blocks, and more documentation.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
34 if (nargin != 1) |
04c3d56e007a
allchild.m: Add input validation, %!test blocks, and more documentation.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
35 print_usage (); |
04c3d56e007a
allchild.m: Add input validation, %!test blocks, and more documentation.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
36 endif |
04c3d56e007a
allchild.m: Add input validation, %!test blocks, and more documentation.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
37 |
8262
c44db9bad841
allchild.m: move get showhiddenhandles outside of unwind_protect block
John W. Eaton <jwe@octave.org>
parents:
7557
diff
changeset
|
38 shh = get (0, "showhiddenhandles"); |
7557 | 39 unwind_protect |
40 set (0, "showhiddenhandles", "on"); | |
13977
08ae07e40d4f
Only run uimenu tests if FLTK toolkit is available (Bug #34908)
Rik <octave@nomad.inbox5.com>
parents:
13141
diff
changeset
|
41 h = get (handles, "children"); |
7557 | 42 unwind_protect_cleanup |
43 set (0, "showhiddenhandles", shh); | |
44 end_unwind_protect | |
45 | |
46 endfunction | |
13096 | 47 |
13977
08ae07e40d4f
Only run uimenu tests if FLTK toolkit is available (Bug #34908)
Rik <octave@nomad.inbox5.com>
parents:
13141
diff
changeset
|
48 |
08ae07e40d4f
Only run uimenu tests if FLTK toolkit is available (Bug #34908)
Rik <octave@nomad.inbox5.com>
parents:
13141
diff
changeset
|
49 %!testif HAVE_FLTK |
17111
dbd64c9a16da
Restore graphics toolkit after %!tests that alter it.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
50 %! toolkit = graphics_toolkit ("fltk"); |
17123
bd50e0660545
test: Add missing semicolons to suppress output in some plot %!tests.
Rik <rik@octave.org>
parents:
17111
diff
changeset
|
51 %! hf = figure ("visible", "off"); |
13141
e81ddf9cacd5
maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
13124
diff
changeset
|
52 %! unwind_protect |
13096 | 53 %! l = line; |
17137
04c3d56e007a
allchild.m: Add input validation, %!test blocks, and more documentation.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
54 %! kids = allchild (hf); |
04c3d56e007a
allchild.m: Add input validation, %!test blocks, and more documentation.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
55 %! assert (get (kids, "type"), {"axes"; "uimenu"; "uimenu"; "uimenu"}); |
13096 | 56 %! unwind_protect_cleanup |
57 %! close (hf); | |
13977
08ae07e40d4f
Only run uimenu tests if FLTK toolkit is available (Bug #34908)
Rik <octave@nomad.inbox5.com>
parents:
13141
diff
changeset
|
58 %! graphics_toolkit (toolkit); |
13096 | 59 %! end_unwind_protect |
13977
08ae07e40d4f
Only run uimenu tests if FLTK toolkit is available (Bug #34908)
Rik <octave@nomad.inbox5.com>
parents:
13141
diff
changeset
|
60 |
17137
04c3d56e007a
allchild.m: Add input validation, %!test blocks, and more documentation.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
61 %!error allchild () |
04c3d56e007a
allchild.m: Add input validation, %!test blocks, and more documentation.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
62 %!error allchild (1, 2) |
04c3d56e007a
allchild.m: Add input validation, %!test blocks, and more documentation.
Rik <rik@octave.org>
parents:
17126
diff
changeset
|
63 |