annotate scripts/gui/uitoggletool.m @ 30564:796f54d4ddbf stable

update Octave Project Developers copyright for the new year In files that have the "Octave Project Developers" copyright notice, update for 2021. In all .txi and .texi files except gpl.txi and gpl.texi in the doc/liboctave and doc/interpreter directories, change the copyright to "Octave Project Developers", the same as used for other source files. Update copyright notices for 2022 (not done since 2019). For gpl.txi and gpl.texi, change the copyright notice to be "Free Software Foundation, Inc." and leave the date at 2007 only because this file only contains the text of the GPL, not anything created by the Octave Project Developers. Add Paul Thomas to contributors.in.
author John W. Eaton <jwe@octave.org>
date Tue, 28 Dec 2021 18:22:40 -0500
parents 0a5b15007766
children 5d3faba0342e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ########################################################################
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 ##
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
3 ## Copyright (C) 2012-2022 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26877
diff changeset
4 ##
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 ## See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 ## distribution or <https://octave.org/copyright/>.
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
7 ##
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
8 ## This file is part of Octave.
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
9 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23396
diff changeset
10 ## Octave is free software: you can redistribute it and/or modify it
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
11 ## under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23396
diff changeset
12 ## the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
13 ## (at your option) any later version.
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
14 ##
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
15 ## Octave is distributed in the hope that it will be useful, but
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
18 ## GNU General Public License for more details.
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
19 ##
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
20 ## You should have received a copy of the GNU General Public License
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
21 ## along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23396
diff changeset
22 ## <https://www.gnu.org/licenses/>.
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 ##
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ########################################################################
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
25
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
26 ## -*- texinfo -*-
23271
cc9dcadcef6b Only return a handle from ui* functions if nargout > 0 (bug #49751).
Rik <rik@octave.org>
parents: 23220
diff changeset
27 ## @deftypefn {} {} uitoggletool (@var{property}, @var{value}, @dots{})
cc9dcadcef6b Only return a handle from ui* functions if nargout > 0 (bug #49751).
Rik <rik@octave.org>
parents: 23220
diff changeset
28 ## @deftypefnx {} {} uitoggletool (@var{parent}, @var{property}, @var{value}, @dots{})
cc9dcadcef6b Only return a handle from ui* functions if nargout > 0 (bug #49751).
Rik <rik@octave.org>
parents: 23220
diff changeset
29 ## @deftypefnx {} {@var{hui} =} uitoggletool (@dots{})
20597
7890893a0e69 Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents: 19833
diff changeset
30 ##
23271
cc9dcadcef6b Only return a handle from ui* functions if nargout > 0 (bug #49751).
Rik <rik@octave.org>
parents: 23220
diff changeset
31 ## Create a uitoggletool object.
20597
7890893a0e69 Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents: 19833
diff changeset
32 ##
20716
1ecee53513d7 doc: Peridodic grammar check of documentation.
Rik <rik@octave.org>
parents: 20715
diff changeset
33 ## uitoggletool are togglebuttons that appear on a figure toolbar. The
1ecee53513d7 doc: Peridodic grammar check of documentation.
Rik <rik@octave.org>
parents: 20715
diff changeset
34 ## button is created with a border that is shown when the user hovers over
1ecee53513d7 doc: Peridodic grammar check of documentation.
Rik <rik@octave.org>
parents: 20715
diff changeset
35 ## the button. An image can be set using the cdata property.
20597
7890893a0e69 Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents: 19833
diff changeset
36 ##
7890893a0e69 Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents: 19833
diff changeset
37 ## If @var{parent} is omitted then a uitoggletool for the current figure is
20716
1ecee53513d7 doc: Peridodic grammar check of documentation.
Rik <rik@octave.org>
parents: 20715
diff changeset
38 ## created. If no figure is available, a new figure is created first. If a
1ecee53513d7 doc: Peridodic grammar check of documentation.
Rik <rik@octave.org>
parents: 20715
diff changeset
39 ## figure is available, but does not contain a uitoolbar, a uitoolbar will be
1ecee53513d7 doc: Peridodic grammar check of documentation.
Rik <rik@octave.org>
parents: 20715
diff changeset
40 ## created.
20597
7890893a0e69 Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents: 19833
diff changeset
41 ##
20716
1ecee53513d7 doc: Peridodic grammar check of documentation.
Rik <rik@octave.org>
parents: 20715
diff changeset
42 ## If @var{parent} is given then a uitoggletool is created on the
1ecee53513d7 doc: Peridodic grammar check of documentation.
Rik <rik@octave.org>
parents: 20715
diff changeset
43 ## @var{parent} uitoolbar.
20715
5b7643257978 Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents: 20615
diff changeset
44 ##
20716
1ecee53513d7 doc: Peridodic grammar check of documentation.
Rik <rik@octave.org>
parents: 20715
diff changeset
45 ## Any provided property value pairs will override the default values of the
1ecee53513d7 doc: Peridodic grammar check of documentation.
Rik <rik@octave.org>
parents: 20715
diff changeset
46 ## created uitoggletool object.
20597
7890893a0e69 Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents: 19833
diff changeset
47 ##
26877
83774c2a1b92 doc: Place cross-reference from list of graphics object properties back to object (bug #46076).
Rik <rik@octave.org>
parents: 26376
diff changeset
48 ## The full list of properties is documented at @ref{Uitoggletool Properties}.
20615
93d96da9ff3e Update uiXXXXX documentation for autogenerated properties
John Donoghue
parents: 20597
diff changeset
49 ##
23271
cc9dcadcef6b Only return a handle from ui* functions if nargout > 0 (bug #49751).
Rik <rik@octave.org>
parents: 23220
diff changeset
50 ## The optional return value @var{hui} is a graphics handle to the created
cc9dcadcef6b Only return a handle from ui* functions if nargout > 0 (bug #49751).
Rik <rik@octave.org>
parents: 23220
diff changeset
51 ## uitoggletool object.
cc9dcadcef6b Only return a handle from ui* functions if nargout > 0 (bug #49751).
Rik <rik@octave.org>
parents: 23220
diff changeset
52 ##
20597
7890893a0e69 Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents: 19833
diff changeset
53 ## Examples:
7890893a0e69 Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents: 19833
diff changeset
54 ##
7890893a0e69 Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents: 19833
diff changeset
55 ## @example
7890893a0e69 Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents: 19833
diff changeset
56 ## @group
7890893a0e69 Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents: 19833
diff changeset
57 ## % create figure without a default toolbar
7890893a0e69 Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents: 19833
diff changeset
58 ## f = figure ("toolbar", "none");
7890893a0e69 Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents: 19833
diff changeset
59 ## % create empty toolbar
7890893a0e69 Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents: 19833
diff changeset
60 ## t = uitoolbar (f);
7890893a0e69 Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents: 19833
diff changeset
61 ## % create a 19x19x3 black square
7890893a0e69 Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents: 19833
diff changeset
62 ## img=zeros(19,19,3);
7890893a0e69 Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents: 19833
diff changeset
63 ## % add uitoggletool button to toolbar
7890893a0e69 Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents: 19833
diff changeset
64 ## b = uitoggletool (t, "cdata", img);
7890893a0e69 Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents: 19833
diff changeset
65 ## @end group
7890893a0e69 Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents: 19833
diff changeset
66 ## @end example
7890893a0e69 Add uiXXXX documentation (Bug #46076)
John Donoghue <john.donoghue@ieee.org>
parents: 19833
diff changeset
67 ## @seealso{figure, uitoolbar, uipushtool}
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
68 ## @end deftypefn
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
69
19833
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
70 function hui = uitoggletool (varargin)
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
71
19833
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
72 [h, args] = __uiobject_split_args__ ("uitoggletool", varargin,
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
73 {"uitoolbar"}, 0);
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
74 if (isempty (h))
13726
5a2734f26dbc Create uitoolbar only when necessary.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
75 h = findobj (gcf, "-depth", 1, "type", "uitoolbar");
5a2734f26dbc Create uitoolbar only when necessary.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
76 if (isempty (h))
5a2734f26dbc Create uitoolbar only when necessary.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
77 h = uitoolbar ();
5a2734f26dbc Create uitoolbar only when necessary.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
78 else
5a2734f26dbc Create uitoolbar only when necessary.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
79 h = h(1);
5a2734f26dbc Create uitoolbar only when necessary.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13703
diff changeset
80 endif
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
81 endif
23396
945b53af4655 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 23271
diff changeset
82
23271
cc9dcadcef6b Only return a handle from ui* functions if nargout > 0 (bug #49751).
Rik <rik@octave.org>
parents: 23220
diff changeset
83 htmp = __go_uitoggletool__ (h, args{:});
23396
945b53af4655 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 23271
diff changeset
84
23271
cc9dcadcef6b Only return a handle from ui* functions if nargout > 0 (bug #49751).
Rik <rik@octave.org>
parents: 23220
diff changeset
85 if (nargout > 0)
cc9dcadcef6b Only return a handle from ui* functions if nargout > 0 (bug #49751).
Rik <rik@octave.org>
parents: 23220
diff changeset
86 hui = htmp;
cc9dcadcef6b Only return a handle from ui* functions if nargout > 0 (bug #49751).
Rik <rik@octave.org>
parents: 23220
diff changeset
87 endif
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
88
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
89 endfunction