comparison scripts/java/questdlg.m @ 15625:acf0addfc610

include Octave Forge java package in core Octave * scripts/java: New directory tree. * scripts/Makefile.am: Include java/module.mk. (JAR_FILES): New variable. (nobase_fcnfile_DATA): Include $(JAR_FILES) in the list. (all-local): Depend on $(JAR_FILES). (java/PKG_ADD, java_GEN_FCN_FILES, java/$(octave_dirstamp)): New rules. * libinterp/link-deps (LIBOCTINTERP_LINK_DEP): Include $(JAVA_LIBS) in the list. * dldfcn/__java__.h, dldfcn/__java__.cc: New files. * dldfcn/module-files (__java__.cc): New file description. * doc/interpreter/java.txi: New file. * doc/interpreter/octave.texi: Include java.texi. * doc/interpreter/java-images: New directory. * doc/interpreter/Makefile.am (JAVA_IMAGES): New variable. (IMAGES): Include $(JAVA_IMAGSES) in the list. (MUNGED_TEXI_SRC): Include java.texi in the list. * configure.ac: Check for Java libraries and tools. Include Java info in the summary message. * build-aux/common.mk (JAVA_CPPFLAGS, JAVA_LIBS): New variables. * NEWS: Update. * contributors.in: Include Martin Hepperle in the list.
author John W. Eaton <jwe@octave.org>
date Fri, 23 Nov 2012 15:29:13 -0500
parents
children 9fee0b741de6
comparison
equal deleted inserted replaced
15624:550147454137 15625:acf0addfc610
1 ## Copyright (C) 2010 Martin Hepperle
2 ##
3 ## This program is free software; you can redistribute it and/or modify
4 ## it under the terms of the GNU General Public License as published by
5 ## the Free Software Foundation; either version 2 of the License, or
6 ## (at your option) any later version.
7 ##
8 ## This program is distributed in the hope that it will be useful,
9 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 ## GNU General Public License for more details.
12 ##
13 ## You should have received a copy of the GNU General Public License
14 ## along with this program; If not, see <http://www.gnu.org/licenses/>.
15
16 ## -*- texinfo -*-
17 ## @deftypefn {Function file} {@var{P} =} questdlg (@var{MESSAGE}, @var{TITLE})
18 ## @deftypefnx {Function file} @var{P} = questdlg (@var{MESSAGE}, @var{TITLE}, @var{DEFAULT})
19 ## @deftypefnx {Function file} @var{P} = questdlg (@var{MESSAGE}, @var{TITLE}, @var{BTN1}, @var{BTN2}, @var{DEFAULT})
20 ## @deftypefnx {Function file} @var{P} = questdlg (@var{MESSAGE}, @var{TITLE}, @var{BTN1}, @var{BTN2}, @var{BTN3}, @var{DEFAULT})
21 ##
22 ## Displays the @var{MESSAGE} using a question dialog box.
23 ## The dialog contains two or three buttons which all close the dialog.
24 ## It returns the caption of the activated button.
25 ##
26 ## The @var{TITLE} can be used optionally to decorate the dialog caption.
27 ## The string @var{DEFAULT} identifies the default button,
28 ## which is activated by pressing the ENTER key.
29 ## It must match one of the strings given in @var{BTN1}, @var{BTN2} or @var{BTN3}.
30 ##
31 ## If only @var{MESSAGE} and @var{TITLE} are specified, three buttons with
32 ## the default captions "Yes", "No", "Cancel" are used.
33 ##
34 ## If only two button captions @var{BTN1} and @var{BTN2} are specified,
35 ## the dialog will have only these two buttons.
36 ##
37 ## @end deftypefn
38 ## @seealso{errordlg, helpdlg, inputdlg, listdlg, warndlg}
39
40 function ret = questdlg(question,varargin)
41
42 if length(varargin) < 1
43 print_usage();
44 end
45
46 options{1} = 'Yes'; % button1
47 options{2} = 'No'; % button2
48 options{3} = 'Cancel'; % button3
49 options{4} = 'Yes'; % default
50
51
52 switch length(varargin)
53 case 1
54 % title was given
55 title = varargin{1};
56 case 2
57 % title and default button string
58 title = varargin{1};
59 options{4} = varargin{2}; % default
60 case 4
61 % title, two buttons and default button string
62 title = varargin{1};
63 options{1} = varargin{2}; % button1
64 options{2} = ''; % not used, no middle button
65 options{3} = varargin{3}; % button3
66 options{4} = varargin{4}; % default
67 case 5
68 % title, three buttons and default button string
69 title = varargin{1};
70 options{1} = varargin{2}; % button1
71 options{2} = varargin{3}; % button2
72 options{3} = varargin{4}; % button3
73 options{4} = varargin{5}; % default
74 otherwise
75 print_usage();
76 end
77
78
79 ret = java_invoke ('org.octave.JDialogBox', 'questdlg', question, title, options);
80
81 end