X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?p=CreaPhase.git;a=blobdiff_plain;f=octave_packages%2Fjava-1.2.8%2Fquestdlg.m;fp=octave_packages%2Fjava-1.2.8%2Fquestdlg.m;h=31a127df131c2ef3324037fe62b3778a98565b97;hp=0000000000000000000000000000000000000000;hb=f5f7a74bd8a4900f0b797da6783be80e11a68d86;hpb=1705066eceaaea976f010f669ce8e972f3734b05 diff --git a/octave_packages/java-1.2.8/questdlg.m b/octave_packages/java-1.2.8/questdlg.m new file mode 100644 index 0000000..31a127d --- /dev/null +++ b/octave_packages/java-1.2.8/questdlg.m @@ -0,0 +1,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 . + +## -*- 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