annotate scripts/gui/warndlg.m @ 26376:00f796120a6d stable

maint: Update copyright dates in all source files.
author John W. Eaton <jwe@octave.org>
date Wed, 02 Jan 2019 16:32:43 -0500
parents 0a39db17170c
children b442ec6dda5c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26376
00f796120a6d maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents: 26035
diff changeset
1 ## Copyright (C) 2010-2019 Martin Hepperle
15625
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
2 ##
15746
da26f72408a7 update copyright statements in newly added java files
John W. Eaton <jwe@octave.org>
parents: 15709
diff changeset
3 ## This file is part of Octave.
15625
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
4 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
5 ## Octave is free software: you can redistribute it and/or modify it
15746
da26f72408a7 update copyright statements in newly added java files
John W. Eaton <jwe@octave.org>
parents: 15709
diff changeset
6 ## 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: 23220
diff changeset
7 ## 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
8 ## (at your option) any later version.
15746
da26f72408a7 update copyright statements in newly added java files
John W. Eaton <jwe@octave.org>
parents: 15709
diff changeset
9 ##
da26f72408a7 update copyright statements in newly added java files
John W. Eaton <jwe@octave.org>
parents: 15709
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
da26f72408a7 update copyright statements in newly added java files
John W. Eaton <jwe@octave.org>
parents: 15709
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
13 ## GNU General Public License for more details.
15625
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
14 ##
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
15746
da26f72408a7 update copyright statements in newly added java files
John W. Eaton <jwe@octave.org>
parents: 15709
diff changeset
16 ## 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: 23220
diff changeset
17 ## <https://www.gnu.org/licenses/>.
15625
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
18
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
19 ## -*- texinfo -*-
25921
9c47eedc44e2 msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
20 ## @deftypefn {} {} warndlg ()
9c47eedc44e2 msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
21 ## @deftypefnx {} {} warndlg (@var{msg})
9c47eedc44e2 msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
22 ## @deftypefnx {} {} warndlg (@var{msg}, @var{title})
9c47eedc44e2 msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
23 ## @deftypefnx {} {} warndlg (@var{msg}, @var{title}, @var{opt})
9c47eedc44e2 msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
24 ## @deftypefnx {} {@var{h} =} warndlg (@dots{})
21637
59ebef9680ef More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents: 21630
diff changeset
25 ## Display a warning dialog box with warning message @var{msg} and caption
59ebef9680ef More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents: 21630
diff changeset
26 ## @var{title}.
59ebef9680ef More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents: 21630
diff changeset
27 ##
26035
0a39db17170c doc: Clean up docstrings for XXXdlg.m functions
Rik <rik@octave.org>
parents: 25948
diff changeset
28 ## The default warning message is
0a39db17170c doc: Clean up docstrings for XXXdlg.m functions
Rik <rik@octave.org>
parents: 25948
diff changeset
29 ## @qcode{"This is the default warning string.@:"} and the default caption is
0a39db17170c doc: Clean up docstrings for XXXdlg.m functions
Rik <rik@octave.org>
parents: 25948
diff changeset
30 ## @qcode{"Warning Dialog"}.
20173
777f26aa8e3e doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 20071
diff changeset
31 ##
21630
b5d9b95d1e1a Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 21005
diff changeset
32 ## The warning message may have multiple lines separated by newline characters
b5d9b95d1e1a Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 21005
diff changeset
33 ## ("\n"), or it may be a cellstr array with one element for each line.
15625
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
34 ##
26035
0a39db17170c doc: Clean up docstrings for XXXdlg.m functions
Rik <rik@octave.org>
parents: 25948
diff changeset
35 ## The third optional argument @var{opt} controls the behavior of the dialog.
25921
9c47eedc44e2 msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
36 ## See @code{msgbox} for details.
20071
98d10871018a Accept CREATEMODE argument for errordlg, warndlg, msgbox (bug #44775).
Rik <rik@octave.org>
parents: 19596
diff changeset
37 ##
25921
9c47eedc44e2 msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
38 ## The return value @var{h} is a handle to the figure object used for
9c47eedc44e2 msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
39 ## building the dialog.
21630
b5d9b95d1e1a Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 21005
diff changeset
40 ##
b5d9b95d1e1a Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 21005
diff changeset
41 ## Examples:
20071
98d10871018a Accept CREATEMODE argument for errordlg, warndlg, msgbox (bug #44775).
Rik <rik@octave.org>
parents: 19596
diff changeset
42 ##
21630
b5d9b95d1e1a Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 21005
diff changeset
43 ## @example
b5d9b95d1e1a Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 21005
diff changeset
44 ## @group
b5d9b95d1e1a Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 21005
diff changeset
45 ## warndlg ("Some warning text for the user.");
b5d9b95d1e1a Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 21005
diff changeset
46 ## warndlg ("Some warning text\nwith two lines.");
b5d9b95d1e1a Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 21005
diff changeset
47 ## warndlg (@{"Some warning text", "with two lines."@});
b5d9b95d1e1a Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 21005
diff changeset
48 ## warndlg ("Some warning text for the user.", "Fancy caption");
b5d9b95d1e1a Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 21005
diff changeset
49 ## @end group
b5d9b95d1e1a Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 21005
diff changeset
50 ## @end example
b5d9b95d1e1a Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 21005
diff changeset
51 ##
25921
9c47eedc44e2 msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
52 ## @seealso{errordlg, helpdlg, msgbox, inputdlg, listdlg, questdlg}
15625
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
53 ## @end deftypefn
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
54
25921
9c47eedc44e2 msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
55 function h = warndlg (varargin)
21630
b5d9b95d1e1a Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 21005
diff changeset
56
25921
9c47eedc44e2 msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
57 msg = "This is the default warning.";
9c47eedc44e2 msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
58 tit = "Warning Dialog";
9c47eedc44e2 msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
59 opt = "non-modal";
15772
0f1a143e5002 Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents: 15749
diff changeset
60
25921
9c47eedc44e2 msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
61 nargs = numel (varargin);
25948
700b3f415ebe maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 25924
diff changeset
62
25921
9c47eedc44e2 msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
63 if (nargs > 3)
9c47eedc44e2 msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
64 print_usage ();
9c47eedc44e2 msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
65 elseif (nargs == 1)
21637
59ebef9680ef More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents: 21630
diff changeset
66 msg = varargin{1};
25921
9c47eedc44e2 msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
67 elseif (nargs == 2)
9c47eedc44e2 msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
68 msg = varargin{1};
9c47eedc44e2 msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
69 tit = varargin{2};
9c47eedc44e2 msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
70 elseif (nargs == 3)
9c47eedc44e2 msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
71 msg = varargin{1};
9c47eedc44e2 msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
72 tit = varargin{2};
9c47eedc44e2 msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
73 opt = varargin{3};
21630
b5d9b95d1e1a Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 21005
diff changeset
74 endif
25948
700b3f415ebe maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 25924
diff changeset
75
25924
2d5f48a39b7e Fix copy-paste errors from cset 9c47eedc44e2 (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25921
diff changeset
76 htmp = msgbox (msg, tit, "warn", opt);
15709
9fee0b741de6 Update Java dialog scrips to latest octave-forge status
Philip Nienhuis <prnienhuis@users.sf.net>
parents: 15625
diff changeset
77
25921
9c47eedc44e2 msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
78 if (nargout)
9c47eedc44e2 msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
79 h = htmp;
21630
b5d9b95d1e1a Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 21005
diff changeset
80 endif
15625
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
81
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
82 endfunction
15772
0f1a143e5002 Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents: 15749
diff changeset
83
25921
9c47eedc44e2 msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
84 ## No BIST tests. This function just dispatches to msgbox().
9c47eedc44e2 msgbox.m: use graphics objects to build dialog (bug #42490)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
85 %!assert (1)