]> Creatis software - bbtk.git/commitdiff
#2452 BBTK Feature New Normal - ComboBox in wx package
authordavila <eduardo.davila@creatis.insa-lyon.fr>
Thu, 11 Sep 2014 15:03:42 +0000 (17:03 +0200)
committerdavila <eduardo.davila@creatis.insa-lyon.fr>
Thu, 11 Sep 2014 15:03:42 +0000 (17:03 +0200)
packages/vtk/src/bbvtkPolyDataReader.xml
packages/wx/bbs/appli/example_ComboBox.bbg [new file with mode: 0644]
packages/wx/bbs/appli/example_ComboBox.bbs [new file with mode: 0644]
packages/wx/src/bbwxComboBox.cxx [new file with mode: 0644]
packages/wx/src/bbwxComboBox.h [new file with mode: 0644]

index cfcc86c87d45a7aa6c3de3b6b491ed6eaf263441..d5241d90266a514c8e5192472953514e70acb1b6 100644 (file)
  
  <process><PRE>
    bbGetVtkObject()->SetFileName(bbGetInputIn().c_str());
+   bbGetVtkObject()->ReadAllScalarsOn();
+   bbGetVtkObject()->ReadAllVectorsOn();
+   bbGetVtkObject()->ReadAllNormalsOn();
+   bbGetVtkObject()->ReadAllTensorsOn();
+   bbGetVtkObject()->ReadAllColorScalarsOn ();
+   bbGetVtkObject()->ReadAllTCoordsOn();
+   bbGetVtkObject()->ReadAllFieldsOn();
    bbGetVtkObject()->Update();
  </PRE></process>
 
diff --git a/packages/wx/bbs/appli/example_ComboBox.bbg b/packages/wx/bbs/appli/example_ComboBox.bbg
new file mode 100644 (file)
index 0000000..b97fb68
--- /dev/null
@@ -0,0 +1,61 @@
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBG BlackBox Diagram file
+# - /home/davila/Creatis/creaTools/creatools_source/bbtk/packages/wx/bbs/appli/example_ComboBox.bbg
+# ----------------------------------
+
+APP_START
+CATEGORY:<VOID>
+DESCRIPTION:Description ??
+AUTHOR:Author ??
+COMPLEXBOX:FALSE
+COMPLEXINPUTS:0
+BOXES:4
+BOX
+wx:ComboBox:Box00
+ISEXEC:FALSE
+-32.040827:62.309811:-900.000000
+13.534173:52.309811:-900.000000
+PORT
+In:"'uno' 'dos' 'tres' "
+FIN_BOX
+BOX
+wx:OutputText:Box01
+ISEXEC:FALSE
+-83.128966:30.711945:-900.000000
+-37.553966:20.711945:-900.000000
+FIN_BOX
+BOX
+wx:LayoutLine:Box02
+ISEXEC:TRUE
+-40.309428:0.885921:-900.000000
+17.250572:-9.114079:-900.000000
+FIN_BOX
+BOX
+wx:OutputText:Box03
+ISEXEC:FALSE
+-9.678370:32.107594:-900.000000
+35.896630:22.107594:-900.000000
+FIN_BOX
+CONNECTIONS:7
+CONNECTION
+Box00:BoxChange:Box01:BoxExecute
+NumberOfControlPoints:0
+CONNECTION
+Box00:Widget:Box02:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box01:Widget:Box02:Widget2
+NumberOfControlPoints:0
+CONNECTION
+Box00:OutString:Box03:In
+NumberOfControlPoints:0
+CONNECTION
+Box00:Out:Box01:In
+NumberOfControlPoints:0
+CONNECTION
+Box00:BoxChange:Box03:BoxExecute
+NumberOfControlPoints:0
+CONNECTION
+Box03:Widget:Box02:Widget3
+NumberOfControlPoints:0
+APP_END
diff --git a/packages/wx/bbs/appli/example_ComboBox.bbs b/packages/wx/bbs/appli/example_ComboBox.bbs
new file mode 100644 (file)
index 0000000..3d6c1f1
--- /dev/null
@@ -0,0 +1,45 @@
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBS BlackBox Script
+# - /home/davila/Creatis/creaTools/creatools_source/bbtk/packages/wx/bbs/appli/example_ComboBox.bbs
+# ----------------------------------
+
+# BBTK GEditor Script
+# ----------------------
+
+include std
+include itkvtk
+include wx
+
+author "Author ??"
+description "Description ??"
+category "<VOID>"
+
+new ComboBox Box00
+  set Box00.In "'uno' 'dos' 'tres' "
+
+new OutputText Box01
+
+new LayoutLine Box02
+
+new OutputText Box03
+
+
+connect Box00.BoxChange Box01.BoxExecute
+
+connect Box00.Widget Box02.Widget1
+
+connect Box01.Widget Box02.Widget2
+
+connect Box00.OutString Box03.In
+
+connect Box00.Out Box01.In
+
+connect Box00.BoxChange Box03.BoxExecute
+
+connect Box03.Widget Box02.Widget3
+
+
+
+# Complex input ports
+message    
+exec Box02
diff --git a/packages/wx/src/bbwxComboBox.cxx b/packages/wx/src/bbwxComboBox.cxx
new file mode 100644 (file)
index 0000000..4d4ce17
--- /dev/null
@@ -0,0 +1,161 @@
+//===== 
+// 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 "bbwxComboBox.h"
+#include "bbwxPackage.h"
+
+
+#include <vector>
+#include <string>
+
+#include <wx/choice.h>
+
+namespace bbwx
+{
+  //--------------------------------------------------------------------------
+  // The widget created by the box 
+  class ComboBoxWidget : public wxPanel
+  {
+  public:
+       ComboBoxWidget( ComboBox* box, wxWindow *parent, 
+                      int iSelection, 
+                      std::string title, 
+                      std::vector< std::string > lstIn );
+
+       ~ComboBoxWidget();
+
+       void OnComboBox(wxEvent& event);
+
+  private:
+    ComboBox      *mBox;
+        wxChoice               *wxchoice;
+  };
+  
+
+
+  //------------------------------------------------------------------------
+  //------------------------------------------------------------------------
+  //------------------------------------------------------------------------
+
+  //-------------------------------------------------------------------------
+  ComboBoxWidget::ComboBoxWidget( ComboBox* box,
+               wxWindow *parent,
+               int iSelection,
+               std::string title,
+               std::vector< std::string > lstIn )
+    :
+    wxPanel( parent, -1) ,
+    mBox(box)
+  {
+    wxPanel *panel     = this;
+
+
+    
+    //---------------------------------------------------------------------
+    // 1) Creation de wxChoise widget
+
+        wxchoice = new wxChoice ( panel , -1 );
+
+        Connect( wxchoice->GetId(), wxEVT_COMMAND_CHOICE_SELECTED, (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&))&ComboBoxWidget::OnComboBox ); 
+
+    int i;
+    for (i=0;i<lstIn.size(); i++)
+    {
+          wxchoice->Append(  bbtk::std2wx( lstIn[i] )  ); 
+        } // for i
+    wxchoice->SetSelection(iSelection);
+
+    //---------------------------------------------------------------------
+    // 2) Insertion of the components in the window
+    
+    // We use a FlexGridSizer
+    wxFlexGridSizer *sizer     = new wxFlexGridSizer(1);
+    if (title!="")
+    {
+          sizer->Add( new wxStaticText(panel,-1,  bbtk::std2wx(title) ) ); 
+    }
+    sizer->Add( wxchoice,1,wxGROW ); 
+    sizer->AddGrowableCol(0);
+    panel->SetSizer(sizer);
+
+//    panel->SetAutoLayout(true);
+//    panel->Layout();
+
+  }
+  //-------------------------------------------------------------------------
+  
+  ComboBoxWidget::~ComboBoxWidget()
+  {
+  }
+
+  //--------------------------------------------------------------------------
+  void ComboBoxWidget::OnComboBox(wxEvent& event)
+  {
+
+       int iSelection = wxchoice->GetSelection();
+    mBox->bbSetInputSelection( iSelection );
+
+    mBox->bbSetOutputOut( iSelection );
+    mBox->bbSetOutputOutString(    bbtk::wx2std( wxchoice->GetString(iSelection) )     );
+    mBox->bbSignalOutputModification("Out");
+    mBox->bbSignalOutputModification("OutString");
+  }
+
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,ComboBox)
+BBTK_BLACK_BOX_IMPLEMENTATION(ComboBox,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 ComboBox::Process()
+{
+}
+//===== 
+// 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 ComboBox::CreateWidget(wxWindow* parent)
+{
+
+//   bbSetOutputWidget( new wxStaticText ( parent , -1 , _T("") ) );
+//   bbSetOutputWidget( new wxComboBox ( parent , -1 , _T("ups") ) );  
+//   bbSetOutputWidget( new wxChoice ( parent , -1 ) );  
+
+    ComboBoxWidget *w = new ComboBoxWidget(
+                               this,
+                                                                       parent,
+                               bbGetInputSelection() ,
+                               bbGetInputTitle(),
+                               bbGetInputIn() );
+
+   bbSetOutputOut( bbGetInputSelection() );
+   bbSetOutputOutString( bbGetInputIn()[ bbGetInputSelection() ] );
+   bbSetOutputWidget( w );
+
+
+}
+//===== 
+// 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 ComboBox::bbUserSetDefaultValues()
+{
+       bbSetInputSelection(0);
+       bbSetInputTitle("");
+}
+//===== 
+// 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 ComboBox::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 ComboBox::bbUserFinalizeProcessing()
+{
+
+}
+}
+// EO namespace bbwx
+
+
diff --git a/packages/wx/src/bbwxComboBox.h b/packages/wx/src/bbwxComboBox.h
new file mode 100644 (file)
index 0000000..2d59f16
--- /dev/null
@@ -0,0 +1,56 @@
+//===== 
+// 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 __bbwxComboBox_h_INCLUDED__
+#define __bbwxComboBox_h_INCLUDED__
+#include "bbwx_EXPORT.h"
+#include "bbtkWxBlackBox.h"
+
+namespace bbwx
+{
+
+class bbwx_EXPORT ComboBox
+ : 
+   public bbtk::WxBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(ComboBox,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(Title,std::string);
+  BBTK_DECLARE_INPUT(Selection, int );
+  BBTK_DECLARE_INPUT(In,std::vector< std::string >);
+  BBTK_DECLARE_OUTPUT(Out, int );
+  BBTK_DECLARE_OUTPUT(OutString, std::string );
+  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(ComboBox,bbtk::WxBlackBox);
+       BBTK_NAME("ComboBox");
+       BBTK_AUTHOR("Info-Dev");
+       BBTK_DESCRIPTION("No Description.");
+       BBTK_CATEGORY("__CategoryBlackBox__");
+       BBTK_INPUT(ComboBox,Title,"Title prepended to the text",std::string,"");
+       BBTK_INPUT(ComboBox,Selection,"i element to be selected (default 0)",int,"");
+       BBTK_INPUT(ComboBox,In,"Vector of strings",std::vector< std::string >,"");
+
+   BBTK_OUTPUT(ComboBox,Out,"i Item selected",int,"");
+   BBTK_OUTPUT(ComboBox,OutString,"string Item selected",std::string,"");
+
+BBTK_END_DESCRIBE_BLACK_BOX(ComboBox);
+//===== 
+// 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 // __bbwxComboBox_h_INCLUDED__
+#endif // _USE_WXWIDGETS_
+