2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2013 - Gustavo Barbosa Libotte <gustavolibotte@gmail.com>
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.1-en.txt
13 #include "DatatipCreate.hxx"
17 #include "api_scilab.h"
18 #include "getScilabJavaVM.h"
19 #include "localization.h"
22 #include "HandleManagement.h"
23 #include "getGraphicObjectProperty.h"
24 #include "setGraphicObjectProperty.h"
25 #include "graphicObjectProperties.h"
28 using namespace org_scilab_modules_gui_datatip;
30 int sci_datatip_set_interp(char *fname, void* pvApiCtx)
34 long long llHandle = 0;
35 int interpIntBool = 0;
42 CheckInputArgument(pvApiCtx, 2, 2);
43 CheckOutputArgument(pvApiCtx, 0, 0);
45 if (nbInputArgument(pvApiCtx) == 2)
47 sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
50 printError(&sciErr, 0);
54 iErr = getScalarHandle(pvApiCtx, piAddr, &llHandle);
57 Scierror(999, _("%s: Can not read input argument #%d.\n"), fname, 1);
61 iDatatipUID = getObjectFromHandle((unsigned long) llHandle);
63 if (checkInputArgumentType(pvApiCtx, 1, sci_handles))
65 getGraphicObjectProperty(iDatatipUID, __GO_TYPE__, jni_int, (void**) &piType);
66 if (iType == __GO_DATATIP__ || iType == __GO_POLYLINE__)
68 if (checkInputArgumentType(pvApiCtx, 2, sci_boolean))
70 sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr);
73 printError(&sciErr, 0);
77 iErr = getScalarBoolean(pvApiCtx, piAddr, &interpIntBool);
80 Scierror(999, _("%s: Can not read input argument #%d.\n"), fname, 2);
84 DatatipCreate::datatipSetInterp(getScilabJavaVM(), iDatatipUID, interpIntBool != 0);
88 Scierror(999, _("%s: Wrong type for input argument #%d: A boolean expected.\n"), fname, 2);
94 Scierror(999, _("%s: Wrong type for input argument #%d: A '%s' handle expected.\n"), fname, 1, "Datatip");
100 Scierror(999, _("%s: Wrong type for input argument #%d: A '%s' handle expected.\n"), fname, 1, "Datatip");
106 Scierror(999, _("%s: Wrong number of input arguments: %d expected.\n"), fname, 2);
110 AssignOutputVariable(pvApiCtx, 1) = 0;
111 ReturnArguments(pvApiCtx);