1 /*
2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2014 - Scilab Enterprises - Antoine ELIAS
4 *
5 * Copyright (C) 2012 - 2016 - Scilab Enterprises
6 *
7 * This file is hereby licensed under the terms of the GNU GPL v2.0,
8 * pursuant to article 5.3.4 of the CeCILL v.2.1.
9 * This file was originally licensed under the terms of the CeCILL v2.1,
10 * and continues to be available under such terms.
11 * For more information, see the COPYING file which you should have received
12 * along with this program.
13 *
14 */
15 #include "setHandleProperty.h"
16 #include "SetProperty.h"
17 #include "getPropertyAssignedValue.h"
18 #include "Scierror.h"
19 #include "localization.h"
20 #include "SetPropertyStatus.h"
21 #include "GetProperty.h"
22 #include "BOOL.h"
23 #include "TitlePositionType.h"
24 #include "os_string.h"
25
26 #include "setGraphicObjectProperty.h"
27 #include "getGraphicObjectProperty.h"
28 #include "graphicObjectProperties.h"
29
30 /*------------------------------------------------------------------------*/
set_title_scroll_property(void * _pvCtx,int iObjUID,void * _pvData,int valueType,int nbRow,int nbCol)31 int set_title_scroll_property(void* _pvCtx, int iObjUID, void* _pvData, int valueType, int nbRow, int nbCol)
32 {
33 int b = (int)FALSE;
34 BOOL status = FALSE;
35
36 b = tryGetBooleanValueFromStack(_pvData, valueType, nbRow, nbCol, "title_scroll");
37 if (b == NOT_A_BOOLEAN_VALUE)
38 {
39 return SET_PROPERTY_ERROR;
40 }
41
42 status = setGraphicObjectProperty(iObjUID, __GO_UI_TITLE_SCROLL__, &b, jni_bool, 1);
43
44 if (status == TRUE)
45 {
46 return SET_PROPERTY_SUCCEED;
47 }
48 else
49 {
50 Scierror(999, _("'%s' property does not exist for this handle.\n"), "title_scroll");
51 return SET_PROPERTY_ERROR;
52 }
53 }
54 /*------------------------------------------------------------------------*/
set_title_position_property(void * _pvCtx,int iObjUID,void * _pvData,int valueType,int nbRow,int nbCol)55 int set_title_position_property(void* _pvCtx, int iObjUID, void* _pvData, int valueType, int nbRow, int nbCol)
56 {
57 enum TitlePositionType pos = TITLE_TOP;
58
59 if (valueType != sci_strings)
60 {
61 Scierror(999, _("Wrong type for '%s' property: String expected.\n"), "title_position");
62 return SET_PROPERTY_ERROR;
63 }
64
65 if (stricmp((char*)_pvData, "top") == 0)
66 {
67 pos = TITLE_TOP;
68 }
69 else if (stricmp((char*)_pvData, "left") == 0)
70 {
71 pos = TITLE_LEFT;
72 }
73 else if (stricmp((char*)_pvData, "bottom") == 0)
74 {
75 pos = TITLE_BOTTOM;
76 }
77 else if (stricmp((char*)_pvData, "right") == 0)
78 {
79 pos = TITLE_RIGHT;
80 }
81 else
82 {
83 Scierror(999, _("Wrong value for '%s' property: %s, %s or %s expected.\n"), "title_position", "'top'", "'left'", "'bottom'", "'right'");
84 return SET_PROPERTY_ERROR;
85 }
86
87 if (setGraphicObjectProperty(iObjUID, __GO_UI_TITLE_POSITION__, &pos, jni_int, 1) == FALSE)
88 {
89 Scierror(999, _("'%s' property does not exist for this handle.\n"), "title_position");
90 return SET_PROPERTY_ERROR;
91 }
92
93 return SET_PROPERTY_SUCCEED;
94 }
95