annotate scripts/gui/private/__uiobject_split_args__.m @ 27919:1891570abac8

update Octave Project Developers copyright for the new year In files that have the "Octave Project Developers" copyright notice, update for 2020.
author John W. Eaton <jwe@octave.org>
date Mon, 06 Jan 2020 22:29:51 -0500
parents b442ec6dda5c
children bd51beb6205e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27919
1891570abac8 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 27918
diff changeset
1 ## Copyright (C) 2012-2020 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
2 ##
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
3 ## See the file COPYRIGHT.md in the top-level directory of this distribution
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
4 ## or <https://octave.org/COPYRIGHT.html/>.
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
5 ##
13284
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
6 ##
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
7 ## This file is part of Octave.
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
8 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24423
diff changeset
9 ## Octave is free software: you can redistribute it and/or modify it
13284
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
10 ## 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: 24423
diff changeset
11 ## 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
12 ## (at your option) any later version.
13284
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
13 ##
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
14 ## Octave is distributed in the hope that it will be useful, but
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
15 ## WITHOUT ANY WARRANTY; without even the implied warranty of
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
16 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
17 ## GNU General Public License for more details.
13284
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
18 ##
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
19 ## You should have received a copy of the GNU General Public License
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
20 ## 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: 24423
diff changeset
21 ## <https://www.gnu.org/licenses/>.
13284
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
22
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
23 ## -*- texinfo -*-
25039
40a65b30fadf maint: Match variable names in documentation to those in function prototype.
Rik <rik@octave.org>
parents: 24534
diff changeset
24 ## @deftypefn {} {[@var{p}, @var{args}] =} __uiobject_split_args__ (@var{who}, @var{in_args}, @var{parent_type}, @var{use_gcf})
20173
777f26aa8e3e doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
25 ## Undocumented internal function.
13284
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
26 ## @end deftypefn
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
27
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
28 ## Author: goffioul
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
29
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13284
diff changeset
30 function [parent, args] = __uiobject_split_args__ (who, in_args, parent_type = {}, use_gcf = 1)
13284
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
31
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
32 parent = [];
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
33 args = {};
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
34 offset = 1;
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
35
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13284
diff changeset
36 if (! isempty (in_args))
24423
1d52db450db4 Change ishandle to return true for Java objects for Matlab compatibility.
Rik <rik@octave.org>
parents: 23220
diff changeset
37 if (ishghandle (in_args{1}))
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13284
diff changeset
38 parent = in_args{1};
13284
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
39 offset = 2;
26005
68350e746ff2 Allow a struct of PROP/VALUE pairs as input to uiXXX functions (bug #44672).
Rik <rik@octave.org>
parents: 25054
diff changeset
40 elseif (! ischar (in_args{1}) && ! isstruct (in_args{1}))
13284
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
41 error ("%s: invalid parent handle.", who);
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
42 endif
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
43
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13284
diff changeset
44 args = in_args(offset:end);
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13284
diff changeset
45 endif
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13284
diff changeset
46
13284
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
47 if (! isempty (args))
26005
68350e746ff2 Allow a struct of PROP/VALUE pairs as input to uiXXX functions (bug #44672).
Rik <rik@octave.org>
parents: 25054
diff changeset
48 i = find (strcmpi (args, "parent"), 1, "first");
68350e746ff2 Allow a struct of PROP/VALUE pairs as input to uiXXX functions (bug #44672).
Rik <rik@octave.org>
parents: 25054
diff changeset
49 if (! isempty (i) && numel (args) > i)
68350e746ff2 Allow a struct of PROP/VALUE pairs as input to uiXXX functions (bug #44672).
Rik <rik@octave.org>
parents: 25054
diff changeset
50 parent = args{i+1};
24423
1d52db450db4 Change ishandle to return true for Java objects for Matlab compatibility.
Rik <rik@octave.org>
parents: 23220
diff changeset
51 if (! ishghandle (parent))
13284
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
52 error ("%s: invalid parent handle.", who);
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
53 endif
26005
68350e746ff2 Allow a struct of PROP/VALUE pairs as input to uiXXX functions (bug #44672).
Rik <rik@octave.org>
parents: 25054
diff changeset
54 args(i:i+1) = [];
13284
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
55 endif
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
56 endif
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
57
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
58 if (! isempty (parent))
19833
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
59 if (! isempty (parent_type)
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
60 && isempty (find (strcmpi (get (parent, "type"), parent_type))))
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13284
diff changeset
61 error ("%s: invalid parent, the parent type must be: %s", ...
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13284
diff changeset
62 who, sprintf ("%s, ", parent_type{:})(1:end-2));
13284
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
63 endif
13703
22ce748da25f Add missing UI objects: uicontextmenu, uitoolbar, uipushtool and uitoggletool.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13284
diff changeset
64 elseif (use_gcf)
13284
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
65 parent = gcf ();
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
66 endif
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
67
5ab9c721ce59 Add uicontrol and uipanel m-scripts.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
diff changeset
68 endfunction