comparison scripts/gui/private/__get_funcname__.m @ 18971:f084aab05cd9

Move checks for graphics_toolkit GUI functions to own script. * __get_funcname__.m: New function to buid the function name from basename and graphics_toolkit. * uigetdir.m, uigetfile.m, uiputfile.m: Adapt to use __get_funcname__ with basename = mfilename ()
author Andreas Weber <andy.weber.aw@gmail.com>
date Thu, 31 Jul 2014 00:03:56 +0200
parents
children
comparison
equal deleted inserted replaced
18970:bb2a03f9ed20 18971:f084aab05cd9
1 ## Copyright (C) 2014 Andreas Weber
2 ##
3 ## This file is part of Octave.
4 ##
5 ## Octave is free software; you can redistribute it and/or modify it
6 ## under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 3 of the License, or (at
8 ## your option) any later version.
9 ##
10 ## Octave is distributed in the hope that it will be useful, but
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ## General Public License for more details.
14 ##
15 ## You should have received a copy of the GNU General Public License
16 ## along with Octave; see the file COPYING. If not, see
17 ## <http://www.gnu.org/licenses/>.
18
19 ## -*- texinfo -*-
20 ## @deftypefn {Function File} {@var{funcname} =} __get_funcname__ (@var{basename})
21 ## Internal function.
22 ##
23 ## Build function name for the current graphics toolkit according to schema
24 ## __[basename]_[graphics_toolkit]__, use fltk as default.
25 ## @end deftypefn
26
27 ## Author: Andreas Weber
28
29 function funcname = __get_funcname__ (basename)
30
31 if (! __octave_link_enabled__ ())
32 tk = graphics_toolkit ();
33 funcname = strcat ("__", basename, "_", tk, "__");
34 if ((numel (tk) > 0) && (! strcmp(tk, "fltk")) && (! __is_function__ (funcname)))
35 warning ("%s: no implementation for toolkit '%s', using 'fltk' instead",basename, tk);
36 endif
37 funcname = strcat ("__", basename, "_fltk__");
38 else
39 funcname = "";
40 endif
41
42 endfunction