From: Eduardo DAVILA Date: Fri, 28 Apr 2023 09:19:25 +0000 (+0200) Subject: #3499 Export to JavaScript X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=103f8756e4e48f909eb4f6db115043d5b08c6f1d;p=bbtk.git #3499 Export to JavaScript --- diff --git a/kernel/appli/bbs2cpp/bbs2.cxx b/kernel/appli/bbs2cpp/bbs2.cxx index c193d24..e0b303c 100644 --- a/kernel/appli/bbs2cpp/bbs2.cxx +++ b/kernel/appli/bbs2cpp/bbs2.cxx @@ -46,21 +46,22 @@ #include -#include "bbtkInterpreter.h" -#include "bbtkInterpreterPy.h" #include "bbtkUtilities.h" +#include "bbtkInterpreter.h" +#include "bbtkInterpreterJavaScript.h" +#include "bbtkInterpreterPython.h" int main(int argc, char* argv[]) { if (argc<3) { - printf("bbs2 \n"); + printf("bbs2 \n"); return 1; } - std::string file,path; + std::string fileBase,file,path; std::string extention( argv[2] ); - file = bbtk::Utilities::ExtractScriptName(argv[1],path); - file += std::string(".")+extention; + fileBase = bbtk::Utilities::ExtractScriptName(argv[1],path); + file = fileBase + std::string(".") + extention; if ( extention.compare("cxx")==0) { @@ -78,28 +79,56 @@ int main(int argc, char* argv[]) if ( extention.compare("py")==0) { printf("bbs -> py\n"); - bbtk::InterpreterPy::Pointer I = bbtk::InterpreterPy::New(); + bbtk::InterpreterPython::Pointer I = bbtk::InterpreterPython::New(); I->SetThrow(true); try { I->InterpretFile(argv[1]); - std::vector pythonBBTK= ((bbtk::InterpreterPy*)(I.get()))->pythonBBTK ; + std::vector pythonBBTK= ((bbtk::InterpreterPython*)(I.get()))->pythonBBTK ; FILE *ff=fopen(file.c_str(),"w+"); fprintf(ff,"from bbtk.bbtkBlackBox import *\n" ); - fprintf(ff,"class appliTest02:\n" ); + fprintf(ff,"class %s:\n",fileBase.c_str() ); fprintf(ff," def Run(self):\n" ); - fprintf(ff," mCB = ComplexBlackBox('appliTest02')\n"); + fprintf(ff," mCBpy = ComplexBlackBox('%s')\n",fileBase.c_str()); int i,size=pythonBBTK.size(); for (i=0; i js\n"); + bbtk::InterpreterJavaScript::Pointer I = bbtk::InterpreterJavaScript::New(); + I->SetThrow(true); + try + { + I->InterpretFile(argv[1]); + std::vector javascriptBBTK= ((bbtk::InterpreterJavaScript*)(I.get()))->javascriptBBTK ; + FILE *ff=fopen(file.c_str(),"w+"); + fprintf(ff,"import * as bbtk from './bbtk.js' \n" ); + fprintf(ff,"export class %s{\n",fileBase.c_str() ); + fprintf(ff," Run(){\n" ); + fprintf(ff," let mCBjs = new bbtk.ComplexBlackBox('%s')\n",fileBase.c_str()); + int i,size=javascriptBBTK.size(); + for (i=0; ijavascriptBBTK.push_back(code); + } + //========================================================================= + + + //========================================================================= + /// Connects the output boxOutput to the input boxInput + void InterpreterJavaScript::commandConnection (const std::string &boxfrom, + const std::string &output, + const std::string &boxto, + const std::string &input) // virtual + { + //ex: mCB.Connection( "Box10" , "Out", "Box11", "In") + std::string code("Connection('"+boxfrom+"','"+output+"','"+boxto+"','"+input+"')"); + this->javascriptBBTK.push_back(code); + } + //========================================================================= + + //========================================================================= + void InterpreterJavaScript::commandInput(const std::string &name,const std::string &box,const std::string &input,const std::string &help) + { + } + //========================================================================= + + //========================================================================= + void InterpreterJavaScript::commandOutput(const std::string &name,const std::string &box,const std::string &output,const std::string &help) + { + } + //========================================================================= + + + //========================================================================= + /// sets the input of the box with the value + void InterpreterJavaScript::commandSet(const std::string &box,const std::string &input,const std::string &value) // virtual + { + //ex: mCB.Set("Box10","In2","/hola.mhd") + std::string code("Set('"+box+"','"+input+"','"+value+"')"); + this->javascriptBBTK.push_back(code); + } + //========================================================================= + + + //========================================================================= + void InterpreterJavaScript::commandDefine(const std::string &name,const std::string &pack,const std::string &scriptfilename) // virtual + { + } + //========================================================================= + + + //========================================================================= + void InterpreterJavaScript::commandEndDefine() // virtual + { + } + //========================================================================= + + + //========================================================================= + void InterpreterJavaScript::commandExec(const std::string &word) // virtual + { + //Ex: mCB.AddToExecutableLst("Box13") + std::string code("AddToExecutableLst('"+word+"')"); + this->javascriptBBTK.push_back(code); + } + //========================================================================= + + + //========================================================================= + void InterpreterJavaScript::commandAuthor(const std::string &author) // virtual + { + } + //========================================================================= + + //========================================================================= + void InterpreterJavaScript::commandCategory(const std::string &categorytype) // virtual + { + } + //========================================================================= + + //========================================================================= + void InterpreterJavaScript::commandDescription(const std::string &description) // virtual + { + } + //========================================================================= + +} // EO namespace bbtk + +// EOF + diff --git a/kernel/src/bbtkInterpreterJavaScript.h b/kernel/src/bbtkInterpreterJavaScript.h new file mode 100644 index 0000000..380e239 --- /dev/null +++ b/kernel/src/bbtkInterpreterJavaScript.h @@ -0,0 +1,99 @@ +/* +# --------------------------------------------------------------------- +# +# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image +# pour la Santé) +# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton +# +# This software is governed by the CeCILL-B license under French law and +# abiding by the rules of distribution of free software. You can use, +# modify and/ or redistribute the software under the terms of the CeCILL-B +# license as circulated by CEA, CNRS and INRIA at the following URL +# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +# or in the file LICENSE.txt. +# +# As a counterpart to the access to the source code and rights to copy, +# modify and redistribute granted by the license, users are provided only +# with a limited warranty and the software's author, the holder of the +# economic rights, and the successive licensors have only limited +# liability. +# +# The fact that you are presently reading this means that you have had +# knowledge of the CeCILL-B license and that you accept its terms. +# ------------------------------------------------------------------------ +*/ + +/*========================================================================= +Program: bbtk +Module: $RCSfile$ +Language: C++ +Date: $Date$ +Version: $Revision$ +=========================================================================*/ + + +#ifndef __bbtkBBPInterpreterJavaScript_h__ +#define __bbtkBBPInterpreterJavaScript_h__ + +//Includes bbtk +#include "bbtkInterpreterVirtual.h" + +//Includes std +#include +#include + + +//#include "bbtkSystem.h" +//#include "bbtkComplexBlackBox.h" + +namespace bbtk +{ + class BBTK_EXPORT InterpreterJavaScript : public InterpreterVirtual + { + public: + static Pointer New(); + InterpreterJavaScript(); + ~InterpreterJavaScript(); + + //Public methods + + virtual void commandNew( const std::string& boxType, const std::string& boxName); + + virtual void commandConnection (const std::string &boxfrom, + const std::string &output, + const std::string &boxto, + const std::string &input); + virtual void commandSet(const std::string &box,const std::string &input,const std::string &value); + + + virtual void commandDefine(const std::string &name,const std::string &pack,const std::string &scriptfilename); + virtual void commandEndDefine(); + + virtual void commandExec(const std::string &word); + + virtual void commandAuthor(const std::string &author); + virtual void commandCategory(const std::string &categorytype); + virtual void commandDescription(const std::string &description); + + virtual void commandInput(const std::string &name,const std::string &box,const std::string &input,const std::string &help); + virtual void commandOutput(const std::string &name,const std::string &box,const std::string &output,const std::string &help); + + std::vector javascriptBBTK; + + private: + + //Private Attributes + + //Private Methods + + protected: + + //Protected Attributes + + //Protected methods + + }; +} +// namespace bbtk +#endif + diff --git a/kernel/src/bbtkInterpreterPy.cxx b/kernel/src/bbtkInterpreterPython.cxx similarity index 79% rename from kernel/src/bbtkInterpreterPy.cxx rename to kernel/src/bbtkInterpreterPython.cxx index 95900b4..68cce94 100644 --- a/kernel/src/bbtkInterpreterPy.cxx +++ b/kernel/src/bbtkInterpreterPython.cxx @@ -38,7 +38,7 @@ Version: $Revision$ */ -#include "bbtkInterpreterPy.h" +#include "bbtkInterpreterPython.h" #include "bbtkExecuter.h" #include "bbtkMessageManager.h" @@ -49,23 +49,23 @@ namespace bbtk { //========================================================================= - InterpreterPy::Pointer InterpreterPy::New() + InterpreterPython::Pointer InterpreterPython::New() { - return MakePointer( new InterpreterPy() ); + return MakePointer( new InterpreterPython() ); } //========================================================================= //========================================================================= - InterpreterPy::InterpreterPy() + InterpreterPython::InterpreterPython() { bbtk::InterpreterVirtual::Init(); } //========================================================================= //========================================================================= - InterpreterPy::~InterpreterPy() + InterpreterPython::~InterpreterPython() { } //========================================================================= @@ -73,7 +73,7 @@ namespace bbtk //========================================================================= /// Creates a new black box in current complex box - void InterpreterPy::commandNew( const std::string& boxType, const std::string& boxName) // virtual + void InterpreterPython::commandNew( const std::string& boxType, const std::string& boxName) // virtual { int pos = boxType.find( std::string(":") ); std::string boxTypeTmp=boxType; @@ -87,7 +87,7 @@ namespace bbtk //========================================================================= /// Connects the output boxOutput to the input boxInput - void InterpreterPy::commandConnection (const std::string &boxfrom, + void InterpreterPython::commandConnection (const std::string &boxfrom, const std::string &output, const std::string &boxto, const std::string &input) // virtual @@ -99,13 +99,13 @@ namespace bbtk //========================================================================= //========================================================================= - void InterpreterPy::commandInput(const std::string &name,const std::string &box,const std::string &input,const std::string &help) + void InterpreterPython::commandInput(const std::string &name,const std::string &box,const std::string &input,const std::string &help) { } //========================================================================= //========================================================================= - void InterpreterPy::commandOutput(const std::string &name,const std::string &box,const std::string &output,const std::string &help) + void InterpreterPython::commandOutput(const std::string &name,const std::string &box,const std::string &output,const std::string &help) { } //========================================================================= @@ -113,7 +113,7 @@ namespace bbtk //========================================================================= /// sets the input of the box with the value - void InterpreterPy::commandSet(const std::string &box,const std::string &input,const std::string &value) // virtual + void InterpreterPython::commandSet(const std::string &box,const std::string &input,const std::string &value) // virtual { //ex: mCB.Set("Box10","In2","/hola.mhd") std::string code("Set('"+box+"','"+input+"','"+value+"')"); @@ -123,21 +123,21 @@ namespace bbtk //========================================================================= - void InterpreterPy::commandDefine(const std::string &name,const std::string &pack,const std::string &scriptfilename) // virtual + void InterpreterPython::commandDefine(const std::string &name,const std::string &pack,const std::string &scriptfilename) // virtual { } //========================================================================= //========================================================================= - void InterpreterPy::commandEndDefine() // virtual + void InterpreterPython::commandEndDefine() // virtual { } //========================================================================= //========================================================================= - void InterpreterPy::commandExec(const std::string &word) // virtual + void InterpreterPython::commandExec(const std::string &word) // virtual { //Ex: mCB.AddToExecutableLst("Box13") std::string code("AddToExecutableLst('"+word+"')"); @@ -147,19 +147,19 @@ namespace bbtk //========================================================================= - void InterpreterPy::commandAuthor(const std::string &author) // virtual + void InterpreterPython::commandAuthor(const std::string &author) // virtual { } //========================================================================= //========================================================================= - void InterpreterPy::commandCategory(const std::string &categorytype) // virtual + void InterpreterPython::commandCategory(const std::string &categorytype) // virtual { } //========================================================================= //========================================================================= - void InterpreterPy::commandDescription(const std::string &description) // virtual + void InterpreterPython::commandDescription(const std::string &description) // virtual { } //========================================================================= diff --git a/kernel/src/bbtkInterpreterPy.h b/kernel/src/bbtkInterpreterPython.h similarity index 93% rename from kernel/src/bbtkInterpreterPy.h rename to kernel/src/bbtkInterpreterPython.h index a65ecf6..07a0ba2 100644 --- a/kernel/src/bbtkInterpreterPy.h +++ b/kernel/src/bbtkInterpreterPython.h @@ -32,8 +32,8 @@ Version: $Revision$ =========================================================================*/ -#ifndef __bbtkBBPInterpreter_h__ -#define __bbtkBBPInterpreter_h__ +#ifndef __bbtkBBPInterpreterPython_h__ +#define __bbtkBBPInterpreterPython_h__ //Includes bbtk #include "bbtkInterpreterVirtual.h" @@ -48,12 +48,12 @@ Version: $Revision$ namespace bbtk { - class BBTK_EXPORT InterpreterPy : public InterpreterVirtual + class BBTK_EXPORT InterpreterPython : public InterpreterVirtual { public: static Pointer New(); - InterpreterPy(); - ~InterpreterPy(); + InterpreterPython(); + ~InterpreterPython(); //Public methods diff --git a/packages/wx/bbs/appli/exampleCollapsiblePane.bbg b/packages/wx/bbs/appli/exampleCollapsiblePane.bbg new file mode 100644 index 0000000..6e6f840 --- /dev/null +++ b/packages/wx/bbs/appli/exampleCollapsiblePane.bbg @@ -0,0 +1,244 @@ +# ---------------------------------- +# - BBTKGEditor v 1.5 BBG BlackBox Diagram file +# - /Users/davila/Creatis/C23/creatools_source/bbtk/packages/wx/bbs/appli/exampleCollapsiblePane.bbg +# ---------------------------------- + +APP_START +CATEGORY: +DESCRIPTION:Description ?? +AUTHOR:Author ?? +COMPLEXBOX:FALSE +COMPLEXINPUTS:0 +BOXES:24 +BOX +wx:LayoutLine:Box00 +ISEXEC:FALSE +-24.139296:-24.408258:-900.000000 +9.180704:-26.908258:-900.000000 +FIN_BOX +BOX +wx:CollapsiblePane:Box01 +ISEXEC:FALSE +-11.498105:13.246355:-900.000000 +10.711895:10.746355:-900.000000 +PORT +Label:"ups&&2P&&" +FIN_BOX +BOX +wx:OutputText:Box02 +ISEXEC:FALSE +-45.656217:-0.201721:-900.000000 +-23.986217:-2.701721:-900.000000 +PORT +In:"hola 1" +FIN_BOX +BOX +wx:OutputText:Box03 +ISEXEC:FALSE +-8.427356:-0.628557:-900.000000 +13.242644:-3.128557:-900.000000 +PORT +In:"hola 2" +FIN_BOX +BOX +wx:LayoutLine:Box04 +ISEXEC:FALSE +-15.787488:5.125875:-900.000000 +17.532512:2.625875:-900.000000 +FIN_BOX +BOX +wx:LayoutSplit:Box05 +ISEXEC:TRUE +9.254966:-44.069344:-900.000000 +32.014966:-46.569344:-900.000000 +PORT +Orientation:"H" +FIN_BOX +BOX +vtk:LoadHola:Box06 +ISEXEC:FALSE +55.106180:-16.877335:-900.000000 +76.656180:-19.377335:-900.000000 +FIN_BOX +BOX +creaMaracasVisu:ViewerNV:Box07 +ISEXEC:FALSE +48.651104:-23.870335:-900.000000 +87.251104:-26.370335:-900.000000 +FIN_BOX +BOX +wx:OutputText:Box08 +ISEXEC:FALSE +-2.562097:-6.733170:-900.000000 +19.107903:-9.233170:-900.000000 +PORT +In:"hola 2" +FIN_BOX +BOX +wx:LayoutLine:Box09 +ISEXEC:FALSE +4.384626:24.491104:-900.000000 +37.704626:21.991104:-900.000000 +FIN_BOX +BOX +wx:OutputText:Box10 +ISEXEC:FALSE +-59.224773:42.377045:-900.000000 +-37.554773:39.877045:-900.000000 +PORT +In:"hola 1" +FIN_BOX +BOX +wx:OutputText:Box11 +ISEXEC:FALSE +-32.718062:42.459892:-900.000000 +-11.048062:39.959892:-900.000000 +PORT +In:"hola 2" +FIN_BOX +BOX +wx:OutputText:Box12 +ISEXEC:FALSE +-9.573371:42.408258:-900.000000 +12.096629:39.908258:-900.000000 +PORT +In:"hola 2" +FIN_BOX +BOX +wx:OutputText:Box14 +ISEXEC:FALSE +15.157088:43.670219:-900.000000 +36.827088:41.170219:-900.000000 +PORT +In:"hola 1" +FIN_BOX +BOX +wx:OutputText:Box15 +ISEXEC:FALSE +41.663798:43.753065:-900.000000 +63.333798:41.253065:-900.000000 +PORT +In:"hola 2" +FIN_BOX +BOX +wx:OutputText:Box16 +ISEXEC:FALSE +64.808490:43.701431:-900.000000 +86.478490:41.201431:-900.000000 +PORT +In:"hola 2" +FIN_BOX +BOX +wx:OutputText:Box17 +ISEXEC:FALSE +89.418468:43.970393:-900.000000 +111.088468:41.470393:-900.000000 +PORT +In:"hola 2" +FIN_BOX +BOX +wx:CommandButton:Box19 +ISEXEC:FALSE +82.302224:33.821911:-900.000000 +104.577224:31.321911:-900.000000 +FIN_BOX +BOX +wx:CollapsiblePane:Box20 +ISEXEC:FALSE +52.457462:9.645773:-900.000000 +74.667462:7.145773:-900.000000 +PORT +Label:"ups2" +FIN_BOX +BOX +wx:CommandButton:Box21 +ISEXEC:FALSE +64.453146:15.576375:-900.000000 +86.728146:13.076375:-900.000000 +FIN_BOX +BOX +wx:CollapsiblePane:Box22 +ISEXEC:FALSE +81.427860:9.625070:-900.000000 +103.637860:7.125070:-900.000000 +FIN_BOX +BOX +wx:CommandButton:Box23 +ISEXEC:FALSE +93.423544:15.555671:-900.000000 +115.698544:13.055671:-900.000000 +FIN_BOX +BOX +wx:CollapsiblePane:Box24 +ISEXEC:FALSE +109.584650:9.278923:-900.000000 +131.794650:6.778923:-900.000000 +FIN_BOX +BOX +wx:CommandButton:Box25 +ISEXEC:FALSE +121.580333:15.209524:-900.000000 +143.855333:12.709524:-900.000000 +FIN_BOX +CONNECTIONS:20 +CONNECTION +Box01:Widget:Box04:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box04:Widget:Box00:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box00:Widget:Box05:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box06:Out:Box07:In +NumberOfControlPoints:0 +CONNECTION +Box07:Widget:Box05:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box10:Widget:Box09:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box11:Widget:Box09:Widget3 +NumberOfControlPoints:0 +CONNECTION +Box12:Widget:Box09:Widget4 +NumberOfControlPoints:0 +CONNECTION +Box14:Widget:Box09:Widget5 +NumberOfControlPoints:0 +CONNECTION +Box15:Widget:Box09:Widget6 +NumberOfControlPoints:0 +CONNECTION +Box16:Widget:Box09:Widget7 +NumberOfControlPoints:0 +CONNECTION +Box17:Widget:Box09:Widget8 +NumberOfControlPoints:0 +CONNECTION +Box19:Widget:Box09:Widget9 +NumberOfControlPoints:0 +CONNECTION +Box21:Widget:Box20:Widget +NumberOfControlPoints:0 +CONNECTION +Box23:Widget:Box22:Widget +NumberOfControlPoints:0 +CONNECTION +Box25:Widget:Box24:Widget +NumberOfControlPoints:0 +CONNECTION +Box20:Widget:Box00:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box22:Widget:Box00:Widget3 +NumberOfControlPoints:0 +CONNECTION +Box24:Widget:Box00:Widget4 +NumberOfControlPoints:0 +CONNECTION +Box09:Widget:Box01:Widget +NumberOfControlPoints:0 +APP_END diff --git a/packages/wx/bbs/appli/exampleCollapsiblePane.bbs b/packages/wx/bbs/appli/exampleCollapsiblePane.bbs new file mode 100644 index 0000000..d4cfae3 --- /dev/null +++ b/packages/wx/bbs/appli/exampleCollapsiblePane.bbs @@ -0,0 +1,124 @@ +# ---------------------------------- +# - BBTKGEditor v 1.5 BBS BlackBox Script +# - /Users/davila/Creatis/C23/creatools_source/bbtk/packages/wx/bbs/appli/exampleCollapsiblePane.bbs +# ---------------------------------- + +# BBTK GEditor Script +# ---------------------- + +include std +include itkvtk +include wx +include vtk +include creaMaracasVisu + +author "Author ??" +description "Description ??" +category "" + +new wx:LayoutLine Box00 + +new wx:CollapsiblePane Box01 + set Box01.Label "ups:" + +new wx:OutputText Box02 + set Box02.In "hola 1" + +new wx:OutputText Box03 + set Box03.In "hola 2" + +new wx:LayoutLine Box04 + +new wx:LayoutSplit Box05 + set Box05.Orientation "H" + +new vtk:LoadHola Box06 + +new creaMaracasVisu:ViewerNV Box07 + +new wx:OutputText Box08 + set Box08.In "hola 2" + +new wx:LayoutLine Box09 + +new wx:OutputText Box10 + set Box10.In "hola 1" + +new wx:OutputText Box11 + set Box11.In "hola 2" + +new wx:OutputText Box12 + set Box12.In "hola 2" + +new wx:OutputText Box14 + set Box14.In "hola 1" + +new wx:OutputText Box15 + set Box15.In "hola 2" + +new wx:OutputText Box16 + set Box16.In "hola 2" + +new wx:OutputText Box17 + set Box17.In "hola 2" + +new wx:CommandButton Box19 + +new wx:CollapsiblePane Box20 + set Box20.Label "ups2" + +new wx:CommandButton Box21 + +new wx:CollapsiblePane Box22 + +new wx:CommandButton Box23 + +new wx:CollapsiblePane Box24 + +new wx:CommandButton Box25 + + +connect Box01.Widget Box04.Widget1 + +connect Box04.Widget Box00.Widget2 + +connect Box00.Widget Box05.Widget1 + +connect Box06.Out Box07.In + +connect Box07.Widget Box05.Widget2 + +connect Box10.Widget Box09.Widget1 + +connect Box11.Widget Box09.Widget3 + +connect Box12.Widget Box09.Widget4 + +connect Box14.Widget Box09.Widget5 + +connect Box15.Widget Box09.Widget6 + +connect Box16.Widget Box09.Widget7 + +connect Box17.Widget Box09.Widget8 + +connect Box19.Widget Box09.Widget9 + +connect Box21.Widget Box20.Widget + +connect Box23.Widget Box22.Widget + +connect Box25.Widget Box24.Widget + +connect Box20.Widget Box00.Widget1 + +connect Box22.Widget Box00.Widget3 + +connect Box24.Widget Box00.Widget4 + +connect Box09.Widget Box01.Widget + + + +# Complex input ports +exec Box05 diff --git a/packages/wx/src/bbwxCollapsiblePane.cxx b/packages/wx/src/bbwxCollapsiblePane.cxx new file mode 100644 index 0000000..36fb219 --- /dev/null +++ b/packages/wx/src/bbwxCollapsiblePane.cxx @@ -0,0 +1,79 @@ +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +#include "bbwxCollapsiblePane.h" +#include "bbwxPackage.h" + +#include +#include + +namespace bbwx +{ +BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,CollapsiblePane) +BBTK_BLACK_BOX_IMPLEMENTATION(CollapsiblePane,bbtk::WxBlackBox); +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +void CollapsiblePane::Process() +{ + printf("CollapsiblePane::CreateWidget EED Somethin is wrong with the wxCollapsiblePane\n"); +} +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +void CollapsiblePane::CreateWidget(wxWindow* parent) +{ + printf("CollapsiblePane::CreateWidget EED Somethin is wrong with the wxCollapsiblePane\n"); + printf("CollapsiblePane::CreateWidget EED Somethin is wrong with the wxCollapsiblePane\n"); + printf("CollapsiblePane::CreateWidget EED Somethin is wrong with the wxCollapsiblePane\n"); + printf("CollapsiblePane::CreateWidget EED Somethin is wrong with the wxCollapsiblePane\n"); + printf("CollapsiblePane::CreateWidget EED Somethin is wrong with the wxCollapsiblePane\n"); + printf("CollapsiblePane::CreateWidget EED Somethin is wrong with the wxCollapsiblePane\n"); + + wxPanel *mainWidget = new wxPanel(parent, -1, wxDefaultPosition, wxSize(40,40) ); + wxCollapsiblePane *collpane = new wxCollapsiblePane( mainWidget, wxID_ANY, bbtk::std2wx( bbGetInputLabel() ), wxDefaultPosition, wxDefaultSize, wxCP_DEFAULT_STYLE|wxCP_NO_TLW_RESIZE); + wxBoxSizer *mainSizer = new wxBoxSizer(wxHORIZONTAL); + + wxWindow *winPane = collpane->GetPane(); + wxSizer *paneSz = new wxBoxSizer(wxHORIZONTAL); + + wxWindow* cw; + if ((cw=bbCreateWidgetOfInput("Widget",winPane)) != 0) + { + paneSz->Add( cw , 1, wxGROW|wxALL, 2); + } + winPane->SetSizer(paneSz); + + mainSizer->Add(collpane, 0, wxGROW|wxALL, 5); + mainWidget->SetSizer(mainSizer); + + + bbSetOutputWidget( mainWidget ); +} + +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +void CollapsiblePane::bbUserSetDefaultValues() +{ + bbSetInputLabel("void"); + bbSetInputWidget(NULL); +} + +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +void CollapsiblePane::bbUserInitializeProcessing() +{ +} + +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +void CollapsiblePane::bbUserFinalizeProcessing() +{ +} + +}// EO namespace bbwx + + diff --git a/packages/wx/src/bbwxCollapsiblePane.h b/packages/wx/src/bbwxCollapsiblePane.h new file mode 100644 index 0000000..36b958d --- /dev/null +++ b/packages/wx/src/bbwxCollapsiblePane.h @@ -0,0 +1,49 @@ +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +#ifdef _USE_WXWIDGETS_ +#ifndef __bbwxCollapsiblePane_h_INCLUDED__ +#define __bbwxCollapsiblePane_h_INCLUDED__ + +#include "bbwx_EXPORT.h" +#include "bbtkWxBlackBox.h" + +namespace bbwx +{ + +class bbwx_EXPORT CollapsiblePane + : + public bbtk::WxBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(CollapsiblePane,bbtk::WxBlackBox); +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== + BBTK_DECLARE_INPUT(Label,std::string); + BBTK_DECLARE_INPUT(Widget,wxWindow*); + BBTK_PROCESS(Process); + void Process(); + BBTK_CREATE_WIDGET(CreateWidget); + void CreateWidget(wxWindow*); +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +}; + +BBTK_BEGIN_DESCRIBE_BLACK_BOX(CollapsiblePane,bbtk::WxBlackBox); + BBTK_NAME("CollapsiblePane"); + BBTK_AUTHOR("InfoDev"); + BBTK_DESCRIPTION("No Description."); + BBTK_CATEGORY("__CategoryBlackBox__"); + BBTK_INPUT(CollapsiblePane,Label,"(default void) Label",std::string,""); + BBTK_INPUT(CollapsiblePane,Widget,"Widget",wxWindow*,""); +BBTK_END_DESCRIBE_BLACK_BOX(CollapsiblePane); +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +} +// EO namespace bbwx + +#endif // __bbwxCollapsiblePane_h_INCLUDED__ +#endif // _USE_WXWIDGETS_ + diff --git a/packages/wx/src/bbwxLayoutLine.cxx b/packages/wx/src/bbwxLayoutLine.cxx index cdd1322..961218b 100644 --- a/packages/wx/src/bbwxLayoutLine.cxx +++ b/packages/wx/src/bbwxLayoutLine.cxx @@ -114,6 +114,21 @@ void LayoutLine::Process() sizer = new wxBoxSizer(style); wxWindow* cw; + +// +//Borrame +// , 0, wxGROW|wxALL, +/* + if ((cw=bbCreateWidgetOfInput("Widget1",w)) != 0) sizer->Add(cw, 0, wxGROW|wxALL, 0); + if ((cw=bbCreateWidgetOfInput("Widget2",w)) != 0) sizer->Add(cw, 0, wxGROW|wxALL, 0); + if ((cw=bbCreateWidgetOfInput("Widget3",w)) != 0) sizer->Add(cw, 0, wxGROW|wxALL, 0); + if ((cw=bbCreateWidgetOfInput("Widget4",w)) != 0) sizer->Add(cw, 0, wxGROW|wxALL, 0); + if ((cw=bbCreateWidgetOfInput("Widget5",w)) != 0) sizer->Add(cw, 0, wxGROW|wxALL, 0); + if ((cw=bbCreateWidgetOfInput("Widget6",w)) != 0) sizer->Add(cw, 0, wxGROW|wxALL, 0); + if ((cw=bbCreateWidgetOfInput("Widget7",w)) != 0) sizer->Add(cw, 0, wxGROW|wxALL, 0); + if ((cw=bbCreateWidgetOfInput("Widget8",w)) != 0) sizer->Add(cw, 0, wxGROW|wxALL, 0); + if ((cw=bbCreateWidgetOfInput("Widget9",w)) != 0) sizer->Add(cw, 0, wxGROW|wxALL, 0); +*/ if ((cw=bbCreateWidgetOfInput("Widget1",w)) != 0) sizer->Add(cw, 1, wxGROW, 0); if ((cw=bbCreateWidgetOfInput("Widget2",w)) != 0) sizer->Add(cw, 1, wxGROW, 0); if ((cw=bbCreateWidgetOfInput("Widget3",w)) != 0) sizer->Add(cw, 1, wxGROW, 0); @@ -123,6 +138,7 @@ void LayoutLine::Process() if ((cw=bbCreateWidgetOfInput("Widget7",w)) != 0) sizer->Add(cw, 1, wxGROW, 0); if ((cw=bbCreateWidgetOfInput("Widget8",w)) != 0) sizer->Add(cw, 1, wxGROW, 0); if ((cw=bbCreateWidgetOfInput("Widget9",w)) != 0) sizer->Add(cw, 1, wxGROW, 0); + /* TryInsertWindow(w,bbGetInputWidget1(),sizer); TryInsertWindow(w,bbGetInputWidget2(),sizer);