Set svn:eol-style to native
[scilab.git] / scilab / modules / gui / sci_gateway / cpp / sci_getlookandfeel.cpp
1 /*
2  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3  * Copyright (C) 2008 - DIGITEO - Allan CORNET
4  * 
5  * This file must be used under the terms of the CeCILL.
6  * This source file is licensed as described in the file COPYING, which
7  * you should have received as part of this distribution.  The terms
8  * are also available at    
9  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
10  *
11  */
12
13 #include "LookAndFeelManager.hxx"
14
15
16 extern "C"
17 {
18 #include <stdlib.h>
19 #include "gw_gui.h"
20 #include "stack-c.h"
21 #include "getScilabJavaVM.h"
22 #include "Scierror.h"
23 #include "localization.h"
24 /*--------------------------------------------------------------------------*/
25 int sci_getlookandfeel(char *fname,unsigned long fname_len)
26 {
27         CheckRhs(0,0);
28         CheckLhs(1,1);
29
30         org_scilab_modules_gui_utils::LookAndFeelManager *lnf = new org_scilab_modules_gui_utils::LookAndFeelManager(getScilabJavaVM());
31         if (lnf)
32         {
33                 static integer n1 = 0,m1 = 0,l1 = 0;
34
35                 char *look = lnf->getCurrentLookAndFeel();
36                 delete lnf;
37
38                 if (look)
39                 {       
40                         m1 = (int)strlen(look);
41                         n1 = 1;
42                         CreateVarFromPtr(Rhs+1,STRING_DATATYPE,&m1,&n1,&look);
43                         if (look) {free(look); look = NULL;} /* free because giws uses malloc */
44                         LhsVar(1) = Rhs+1;
45                         C2F(putlhsvar)();
46                 }
47                 else
48                 {
49                         Scierror(999,_("%s: An error occurred: %s.\n"),fname,_("Impossible to get current look and feel"));
50                 }
51         }
52         else
53         {
54                 Scierror(999,_("%s: No more memory.\n"),fname);
55         }
56
57         return 0;
58 }
59 /*--------------------------------------------------------------------------*/
60
61 } /* END OF extern "C" */
62 /*--------------------------------------------------------------------------*/
63