Mercurial > hg > octave-nkf
annotate scripts/plot/allchild.m @ 13327:f81fcceb394c
axes: only update the currentaxes property of the parent figure if the axes object is visible
* graphics.cc (F__is_handle_visible__): New function.
is_handle_visible (const graphics_handle&)): New function.
is_handle_visible (double): New function.
is_handle_visible (const octave_valueu&)): New function.
* axes.m: Only set currentaxes property in parent and currentfigure
property in root if axes object is visible.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 12 Oct 2011 11:18:12 -0400 |
parents | e81ddf9cacd5 |
children | 08ae07e40d4f |
rev | line source |
---|---|
11523 | 1 ## Copyright (C) 2008-2011 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 ## |
23 ## This function is similar to @code{get (h, "children")}, but also | |
11469
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
9316
diff
changeset
|
24 ## returns hidden objects. If @var{handles} is a scalar, |
9316
c539ec5726e7
Update some of Advanced Plotting documentation.
Rik <rdrider0-list@yahoo.com>
parents:
8262
diff
changeset
|
25 ## @var{h} will be a vector. Otherwise, @var{h} will be a cell matrix |
c539ec5726e7
Update some of Advanced Plotting documentation.
Rik <rdrider0-list@yahoo.com>
parents:
8262
diff
changeset
|
26 ## of the same size as @var{handles} and each cell will contain a |
7557 | 27 ## vector of handles. |
28 ## @seealso{get, set, findall, findobj} | |
29 ## @end deftypefn | |
30 | |
31 ## Author: Bill Denney <bill@denney.ws> | |
32 | |
11469
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
9316
diff
changeset
|
33 function h = allchild (handles) |
7557 | 34 |
8262
c44db9bad841
allchild.m: move get showhiddenhandles outside of unwind_protect block
John W. Eaton <jwe@octave.org>
parents:
7557
diff
changeset
|
35 shh = get (0, "showhiddenhandles"); |
7557 | 36 unwind_protect |
37 set (0, "showhiddenhandles", "on"); | |
11469
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
9316
diff
changeset
|
38 if (isscalar (handles)) |
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
9316
diff
changeset
|
39 h = get (handles, "children"); |
7557 | 40 else |
11469
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
9316
diff
changeset
|
41 h = cell (size (handles)); |
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
9316
diff
changeset
|
42 for i = 1:numel (handles) |
c776f063fefe
Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents:
9316
diff
changeset
|
43 h{i} = get (handles, "children"); |
7557 | 44 endfor |
45 endif | |
46 unwind_protect_cleanup | |
47 set (0, "showhiddenhandles", shh); | |
48 end_unwind_protect | |
49 | |
50 endfunction | |
13096 | 51 |
52 %!test | |
13124
2ea1658ad049
Don't use explicit figure number for tests to avoid interference with any figures opened by user.
Kai Habel <kai.habel@gmx.de>
parents:
13096
diff
changeset
|
53 %! 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
|
54 %! unwind_protect |
13096 | 55 %! l = line; |
56 %! assert(get(allchild(hf),'type'),{'axes'; 'uimenu'; 'uimenu'; 'uimenu'}) | |
57 %! unwind_protect_cleanup | |
58 %! close (hf); | |
59 %! end_unwind_protect |