1######################################################################## 2## 3## Copyright (C) 2012-2021 The Octave Project Developers 4## 5## See the file COPYRIGHT.md in the top-level directory of this 6## distribution or <https://octave.org/copyright/>. 7## 8## This file is part of Octave. 9## 10## Octave is free software: you can redistribute it and/or modify it 11## under the terms of the GNU General Public License as published by 12## the Free Software Foundation, either version 3 of the License, or 13## (at your option) any later version. 14## 15## Octave is distributed in the hope that it will be useful, but 16## WITHOUT ANY WARRANTY; without even the implied warranty of 17## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18## GNU General Public License for more details. 19## 20## You should have received a copy of the GNU General Public License 21## along with Octave; see the file COPYING. If not, see 22## <https://www.gnu.org/licenses/>. 23## 24######################################################################## 25 26## -*- texinfo -*- 27## @deftypefn {} {} uitoggletool (@var{property}, @var{value}, @dots{}) 28## @deftypefnx {} {} uitoggletool (@var{parent}, @var{property}, @var{value}, @dots{}) 29## @deftypefnx {} {@var{hui} =} uitoggletool (@dots{}) 30## 31## Create a uitoggletool object. 32## 33## uitoggletool are togglebuttons that appear on a figure toolbar. The 34## button is created with a border that is shown when the user hovers over 35## the button. An image can be set using the cdata property. 36## 37## If @var{parent} is omitted then a uitoggletool for the current figure is 38## created. If no figure is available, a new figure is created first. If a 39## figure is available, but does not contain a uitoolbar, a uitoolbar will be 40## created. 41## 42## If @var{parent} is given then a uitoggletool is created on the 43## @var{parent} uitoolbar. 44## 45## Any provided property value pairs will override the default values of the 46## created uitoggletool object. 47## 48## The full list of properties is documented at @ref{Uitoggletool Properties}. 49## 50## The optional return value @var{hui} is a graphics handle to the created 51## uitoggletool object. 52## 53## Examples: 54## 55## @example 56## @group 57## % create figure without a default toolbar 58## f = figure ("toolbar", "none"); 59## % create empty toolbar 60## t = uitoolbar (f); 61## % create a 19x19x3 black square 62## img=zeros(19,19,3); 63## % add uitoggletool button to toolbar 64## b = uitoggletool (t, "cdata", img); 65## @end group 66## @end example 67## @seealso{figure, uitoolbar, uipushtool} 68## @end deftypefn 69 70function hui = uitoggletool (varargin) 71 72 [h, args] = __uiobject_split_args__ ("uitoggletool", varargin, 73 {"uitoolbar"}, 0); 74 if (isempty (h)) 75 h = findobj (gcf, "-depth", 1, "type", "uitoolbar"); 76 if (isempty (h)) 77 h = uitoolbar (); 78 else 79 h = h(1); 80 endif 81 endif 82 83 htmp = __go_uitoggletool__ (h, args{:}); 84 85 if (nargout > 0) 86 hui = htmp; 87 endif 88 89endfunction 90