/usr/share/octave/packages/java-1.2.8/questdlg.m is in octave-java 1.2.8-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | ## Copyright (C) 2010 Martin Hepperle
##
## This program 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 2 of the License, or
## (at your option) any later version.
##
## This program 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 this program; If not, see <http://www.gnu.org/licenses/>.
## -*- texinfo -*-
## @deftypefn {Function file} {@var{P} =} questdlg (@var{MESSAGE}, @var{TITLE})
## @deftypefnx {Function file} @var{P} = questdlg (@var{MESSAGE}, @var{TITLE}, @var{DEFAULT})
## @deftypefnx {Function file} @var{P} = questdlg (@var{MESSAGE}, @var{TITLE}, @var{BTN1}, @var{BTN2}, @var{DEFAULT})
## @deftypefnx {Function file} @var{P} = questdlg (@var{MESSAGE}, @var{TITLE}, @var{BTN1}, @var{BTN2}, @var{BTN3}, @var{DEFAULT})
##
## Displays the @var{MESSAGE} using a question dialog box.
## The dialog contains two or three buttons which all close the dialog.
## It returns the caption of the activated button.
##
## The @var{TITLE} can be used optionally to decorate the dialog caption.
## The string @var{DEFAULT} identifies the default button,
## which is activated by pressing the ENTER key.
## It must match one of the strings given in @var{BTN1}, @var{BTN2} or @var{BTN3}.
##
## If only @var{MESSAGE} and @var{TITLE} are specified, three buttons with
## the default captions "Yes", "No", "Cancel" are used.
##
## If only two button captions @var{BTN1} and @var{BTN2} are specified,
## the dialog will have only these two buttons.
##
## @end deftypefn
## @seealso{errordlg, helpdlg, inputdlg, listdlg, warndlg}
function ret = questdlg(question,varargin)
if length(varargin) < 1
print_usage();
end
options{1} = 'Yes'; % button1
options{2} = 'No'; % button2
options{3} = 'Cancel'; % button3
options{4} = 'Yes'; % default
switch length(varargin)
case 1
% title was given
title = varargin{1};
case 2
% title and default button string
title = varargin{1};
options{4} = varargin{2}; % default
case 4
% title, two buttons and default button string
title = varargin{1};
options{1} = varargin{2}; % button1
options{2} = ''; % not used, no middle button
options{3} = varargin{3}; % button3
options{4} = varargin{4}; % default
case 5
% title, three buttons and default button string
title = varargin{1};
options{1} = varargin{2}; % button1
options{2} = varargin{3}; % button2
options{3} = varargin{4}; % button3
options{4} = varargin{5}; % default
otherwise
print_usage();
end
ret = java_invoke ('org.octave.JDialogBox', 'questdlg', question, title, options);
end
|