GPL + CeCILL Header change
[scilab.git] / scilab / modules / gui / sci_gateway / cpp / gui_gw.cpp
1 /*
2  *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3  *  Copyright (C) 2010-2010 - DIGITEO - Bruno JOFRET
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  * === LICENSE_END ===
14  *
15  */
16
17 #include "gui_gw.hxx"
18 #include "function.hxx"
19 #include "context.hxx"
20
21 #define MODULE_NAME L"gui"
22 extern "C"
23 {
24 #include "gw_gui.h"
25 #include "loadOnUseClassPath.h"
26 }
27
28 bool GuiModule::loadedDep = false;
29
30 int GuiModule::LoadDeps(const std::wstring& _functionName)
31 {
32     if (loadedDep == false &&
33             (_functionName == L"uicontrol" ||
34              _functionName == L"uimenu" ||
35              _functionName == L"usecanvas" ||
36              _functionName == L"loadGui" ||
37              _functionName == L"figure"))
38     {
39         loadOnUseClassPath("graphics");
40         loadedDep = true;
41     }
42
43     return 1;
44 }
45
46 int GuiModule::Load()
47 {
48     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"x_dialog", &sci_x_dialog, &GuiModule::LoadDeps, MODULE_NAME));
49     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"x_choose", &sci_x_choose, &GuiModule::LoadDeps, MODULE_NAME));
50     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"x_mdialog", &sci_x_mdialog, &GuiModule::LoadDeps, MODULE_NAME));
51     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"xchoicesi", &sci_x_choice, &GuiModule::LoadDeps, MODULE_NAME));
52     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"delmenu", &sci_delmenu, &GuiModule::LoadDeps, MODULE_NAME));
53     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"setmenu", &sci_setmenu, &GuiModule::LoadDeps, MODULE_NAME));
54     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"unsetmenu", &sci_unsetmenu, &GuiModule::LoadDeps, MODULE_NAME));
55     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"raise_window", &sci_raise_window, &GuiModule::LoadDeps, MODULE_NAME));
56     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"getlookandfeel", &sci_getlookandfeel, &GuiModule::LoadDeps, MODULE_NAME));
57     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"getinstalledlookandfeels", &sci_getinstalledlookandfeels, &GuiModule::LoadDeps, MODULE_NAME));
58     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"setlookandfeel", &sci_setlookandfeel, &GuiModule::LoadDeps, MODULE_NAME));
59     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"ClipBoard", &sci_ClipBoard, &GuiModule::LoadDeps, MODULE_NAME));
60     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"toolbar", &sci_toolbar, &GuiModule::LoadDeps, MODULE_NAME));
61     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"uigetdir", &sci_uigetdir, &GuiModule::LoadDeps, MODULE_NAME));
62     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"uicontrol", &sci_uicontrol, &GuiModule::LoadDeps, MODULE_NAME));
63     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"uimenu", &sci_uimenu, &GuiModule::LoadDeps, MODULE_NAME));
64     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"uipopup", &sci_mpopup, &GuiModule::LoadDeps, MODULE_NAME));
65     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"x_choose_modeless", &sci_x_choose_modeless, &GuiModule::LoadDeps, MODULE_NAME));
66     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"uicontextmenu", &sci_uicontextmenu, &GuiModule::LoadDeps, MODULE_NAME));
67     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"uiwait", &sci_uiwait, &GuiModule::LoadDeps, MODULE_NAME));
68     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"messagebox", &sci_messagebox, &GuiModule::LoadDeps, MODULE_NAME));
69     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"waitbar", &sci_waitbar, &GuiModule::LoadDeps, MODULE_NAME));
70     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"progressionbar", &sci_progressionbar, &GuiModule::LoadDeps, MODULE_NAME));
71     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"helpbrowser", &sci_helpbrowser, &GuiModule::LoadDeps, MODULE_NAME));
72     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"uigetfont", &sci_uigetfont, &GuiModule::LoadDeps, MODULE_NAME));
73     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"uigetcolor", &sci_uigetcolor, &GuiModule::LoadDeps, MODULE_NAME));
74     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"getcallbackobject", &sci_getcallbackobject, &GuiModule::LoadDeps, MODULE_NAME));
75     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"printfigure", &sci_printfigure, &GuiModule::LoadDeps, MODULE_NAME));
76     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"exportUI", &sci_exportUI, &GuiModule::LoadDeps, MODULE_NAME));
77     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"printsetupbox", &sci_printsetupbox, &GuiModule::LoadDeps, MODULE_NAME));
78     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"toprint", &sci_toprint, &GuiModule::LoadDeps, MODULE_NAME));
79     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"uigetfile", &sci_uigetfile, &GuiModule::LoadDeps, MODULE_NAME));
80     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"usecanvas", &sci_usecanvas, &GuiModule::LoadDeps, MODULE_NAME));
81     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"uiDisplayTree", &sci_displaytree, &GuiModule::LoadDeps, MODULE_NAME));
82     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"uiputfile", &sci_uiputfile, &GuiModule::LoadDeps, MODULE_NAME));
83     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"about", &sci_about, &GuiModule::LoadDeps, MODULE_NAME));
84     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"fire_closing_finished", &sci_fire_closing_finished, &GuiModule::LoadDeps, MODULE_NAME));
85     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"useeditor", &sci_useeditor, &GuiModule::LoadDeps, MODULE_NAME));
86     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"openged", &sci_openged, &GuiModule::LoadDeps, MODULE_NAME));
87     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"datatipCreate", &sci_datatipcreate, &GuiModule::LoadDeps, MODULE_NAME));
88     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"datatipRemove", &sci_datatipremove, &GuiModule::LoadDeps, MODULE_NAME));
89     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"plotbrowser", &sci_plotbrowser, &GuiModule::LoadDeps, MODULE_NAME));
90     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"datatipManagerMode", &sci_datatip_manager_mode, &GuiModule::LoadDeps, MODULE_NAME));
91     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"datatipToggle", &sci_datatip_toggle, &GuiModule::LoadDeps, MODULE_NAME));
92     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"datatipMove", &sci_datatipmove, &GuiModule::LoadDeps, MODULE_NAME));
93     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"datatipSetStyle", &sci_datatip_set_style, &GuiModule::LoadDeps, MODULE_NAME));
94     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"datatipSetDisplay", &sci_datatip_set_display, &GuiModule::LoadDeps, MODULE_NAME));
95     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"datatipSetInterp", &sci_datatip_set_interp, &GuiModule::LoadDeps, MODULE_NAME));
96     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"datatipSetOrient", &sci_datatip_set_orient, &GuiModule::LoadDeps, MODULE_NAME));
97     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"figure", &sci_figure, &GuiModule::LoadDeps, MODULE_NAME));
98     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"saveGui", &sci_saveGui, &GuiModule::LoadDeps, MODULE_NAME));
99     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"loadGui", &sci_loadGui, &GuiModule::LoadDeps, MODULE_NAME));
100     return 1;
101 }