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