1 /*
2  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3  * Copyright (C) 2008 - INRIA - Vincent COUVERT
4  * Copyright (C) 2011 - DIGITEO - Vincent COUVERT
5  *
6  * Copyright (C) 2012 - 2016 - Scilab Enterprises
7  *
8  * This file is hereby licensed under the terms of the GNU GPL v2.0,
9  * pursuant to article 5.3.4 of the CeCILL v.2.1.
10  * This file was originally licensed under the terms of the CeCILL v2.1,
11  * and continues to be available under such terms.
12  * For more information, see the COPYING file which you should have received
13  * along with this program.
14  *
15  */
16 
17 #include <stdio.h>
18 #include <string.h>
19 /*--------------------------------------------------------------------------*/
20 #include "gw_gui.h"
21 #include "gw_gui.h"
22 #include "localization.h"
23 #include "api_scilab.h"
24 #include "GetProperty.h"
25 #include "sciprint.h"
26 #include "localization.h"
27 #include "Scierror.h"
28 #include "HandleManagement.h"
29 #include "createGraphicObject.h"
30 #include "graphicObjectProperties.h"
31 /*--------------------------------------------------------------------------*/
sci_uicontextmenu(char * fname,void * pvApiCtx)32 int sci_uicontextmenu(char *fname, void* pvApiCtx)
33 {
34     SciErr sciErr;
35 
36     long long* stkAdr = NULL;
37     int nbRow = 0, nbCol = 0;
38     unsigned long GraphicHandle = 0;
39 
40     CheckInputArgument(pvApiCtx, 0, 0);
41     CheckOutputArgument(pvApiCtx, 0, 1);
42 
43     /* Create a new context menu */
44     GraphicHandle = getHandle(createGraphicObject(__GO_UICONTEXTMENU__));
45 
46     /* Create return variable */
47     nbRow = 1;
48     nbCol = 1;
49 
50     sciErr = allocMatrixOfHandle(pvApiCtx, nbInputArgument(pvApiCtx) + 1, nbRow, nbCol, &stkAdr);
51     if (sciErr.iErr)
52     {
53         printError(&sciErr, 0);
54         Scierror(999, _("%s: Memory allocation error.\n"), fname);
55         return 1;
56     }
57 
58     *stkAdr = GraphicHandle;
59 
60     AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
61     ReturnArguments(pvApiCtx);
62     return TRUE;
63 }
64 
65 /*--------------------------------------------------------------------------*/
66