# HG changeset patch # User John W. Eaton # Date 1216232928 14400 # Node ID 85d6296d51e12dba384a208000e3a1a104a4219d # Parent 5a156ab94dd26489cb09aa0476f0b2c8ffa52893 Add gcbo/gcbf functions. diff -r 5a156ab94dd2 -r 85d6296d51e1 scripts/ChangeLog --- a/scripts/ChangeLog Wed Jul 16 14:26:18 2008 -0400 +++ b/scripts/ChangeLog Wed Jul 16 14:28:48 2008 -0400 @@ -1,3 +1,8 @@ +2008-07-16 Michael Goffioul + + * plot/gcbo.m, plot/gcbf.m: New functions. + * plot/Makefile.in (SOURCES): Add them to the list. + 2008-07-16 John W. Eaton * deprecated/loadimage.m: New file. diff -r 5a156ab94dd2 -r 85d6296d51e1 scripts/plot/Makefile.in --- a/scripts/plot/Makefile.in Wed Jul 16 14:26:18 2008 -0400 +++ b/scripts/plot/Makefile.in Wed Jul 16 14:28:48 2008 -0400 @@ -107,6 +107,8 @@ findobj.m \ fplot.m \ gca.m \ + gcbf.m \ + gcbo.m \ gcf.m \ ginput.m \ grid.m \ diff -r 5a156ab94dd2 -r 85d6296d51e1 scripts/plot/gcbf.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/plot/gcbf.m Wed Jul 16 14:28:48 2008 -0400 @@ -0,0 +1,33 @@ +## Copyright (C) 2008 Michael Goffioul +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or (at +## your option) any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, see +## . + +## -*- texinfo -*- +## @deftypefn {Function File} {@var{fig} =} gcbf () +## Return a handle to the figure containing the object whose callback +## is currently executing. If no callback is executing, this function +## returns the empty matrix. The handle returned by this function is +## the same as the second output argument of gcbo. +## +##@seealso{gcf, gca, gcbo} +##@end deftypefn + +function fig = gcbf () + + [dummy, fig] = gcbo (); + +endfunction diff -r 5a156ab94dd2 -r 85d6296d51e1 scripts/plot/gcbo.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/plot/gcbo.m Wed Jul 16 14:28:48 2008 -0400 @@ -0,0 +1,43 @@ +## Copyright (C) 2008 Michael Goffioul +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or (at +## your option) any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, see +## . + +## -*- texinfo -*- +## @deftypefn {Function File} {@var{h} =} gcbo () +## @deftypefnx {Function File} {[@var{h}, @var{fig}] =} gcbo () +## Return a handle to the object whose callback is currently +## executing. If no callback is executing, this function returns the +## empty matrix. This handle is obtained from the root object property +## "CallbackObject". +## +## Additionally return the handle of the figure containing the +## object whose callback is currently executing. If no callback is +## executing, the second output is also set to the empty matrix. +## +##@seealso{gcf, gca, gcbf} +##@end deftypefn + +function [h, fig] = gcbo () + + h = get (0, "callbackobject"); + fig = []; + + if (! isempty (h) && nargout > 1) + fig = ancestor (h, "figure"); + endif + +endfunction