1## Copyright (C) 2002, 2005, 2006, 2007, 2008, 2009 John W. Eaton
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 {Command} {} close
21## @deftypefnx {Command} {} close (@var{n})
22## @deftypefnx {Command} {} close all
23## @deftypefnx {Command} {} close all hidden
24## Close figure window(s) by calling the function specified by the
25## @code{"closerequestfcn"} property for each figure. By default, the
26## function @code{closereq} is used.
32function retval = close (arg1, arg2)
37 ## Close current figure. Don't use gcf because that will open a new
38 ## plot window if one doesn't exist.
39 figs = get (0, "currentfigure");
40 if (! isempty (figs) && figs == 0)
44 if (ischar (arg1) && strcmpi (arg1, "all"))
45 close_all_figures (false);
46 elseif (isfigure (arg1))
49 error ("close: expecting argument to be \"all\" or a figure handle");
52 && ischar (arg1) && strcmpi (arg1, "all")
53 && ischar (arg2) && strcmpi (arg2, "hidden"))
54 close_all_figures (true);
60 __go_execute_callback__ (h, "closerequestfcn");
69function close_all_figures (close_hidden_figs)
71 while (! isempty (fig = get (0, "currentfigure")))
72 ## handlevisibility = get (fig, "handlevisibility")
73 ## if (close_hidden_figs || ! strcmpi (handlevisibility, "off"))