diff scripts/gui/private/message_dialog.m @ 20281:98d10871018a

Accept CREATEMODE argument for errordlg, warndlg, msgbox (bug #44775). * errordlg.m: Update docstring. Use varargin to pass extra argument to msg_box. * warndlg.m: Update docstring. Use varargin to pass extra argument to msg_box. * msgbox.m: Update docstring. * message_dialog.m: Issue warning if unimplemented CREATEMODE argument given. Issue warning if icon type "custom" is used.
author Rik <rik@octave.org>
date Sat, 11 Apr 2015 08:18:42 -0700
parents 93b3d03b05e7
children aa36fb998a4d
line wrap: on
line diff
--- a/scripts/gui/private/message_dialog.m
+++ b/scripts/gui/private/message_dialog.m
@@ -17,11 +17,11 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn {Function File} {@var{h} =} message_dialog (@var{caller}, @var{msg}, @var{title}, @var{icon})
+## @deftypefn {Function File} {@var{h} =} message_dialog (@var{caller}, @var{msg}, @var{title}, @var{icon}, @var{createmode})
 ## Undocumented internal function.
 ## @end deftypefn
 
-function retval = message_dialog (caller, msg, title = "", icon)
+function retval = message_dialog (caller, msg, title = "", icon, createmode)
 
   if (! ischar (msg))
     if (iscell (msg))
@@ -37,7 +37,7 @@
   endif
 
   dlg = "emptydlg";
-  if (nargin == 4)
+  if (nargin >= 4)
     switch (icon)
       case "error"
         dlg = "errordlg";
@@ -47,6 +47,9 @@
         dlg = "warndlg";
       case "none"
         dlg = "emptydlg";
+      case "custom"
+        icon = "emptydlg";
+        warning ("%s: custom icons not yet supported", caller);
       otherwise
         error ("%s: ICON is not a valid type", caller);
     endswitch
@@ -54,6 +57,18 @@
     icon = "none";
   endif
 
+  if (nargin == 5)
+    if ((isstruct (createmode)) && (isfield (createmode, "WindowStyle")))
+      createmode = createmode.WindowStyle;
+    endif
+    switch (createmode)
+      case {"nonmodal", "non-modal", "modal", "replace"}
+        warning ("%s: %s is not yet supported", caller, createmode);
+      otherwise
+        error ("%s: CREATEMODE is not a valid type", caller);
+    endswitch
+  endif
+  
   if (__octave_link_enabled__ ())
     retval = __octave_link_message_dialog__ (icon, msg, title);
   elseif (__have_feature__ ("JAVA"))