]> Creatis software - bbtk.git/commitdiff
Merge branch 'master' of ssh://git.creatis.insa-lyon.fr/bbtk
authorEduardo DAVILA <davila@localhost.localdomain>
Wed, 25 Apr 2018 13:40:47 +0000 (15:40 +0200)
committerEduardo DAVILA <davila@localhost.localdomain>
Wed, 25 Apr 2018 13:40:47 +0000 (15:40 +0200)
packages/wx/src/bbwxHtmlWindow.cxx [new file with mode: 0644]
packages/wx/src/bbwxHtmlWindow.h [new file with mode: 0644]
packages/wx/src/bbwxRadioButton.cxx

diff --git a/packages/wx/src/bbwxHtmlWindow.cxx b/packages/wx/src/bbwxHtmlWindow.cxx
new file mode 100644 (file)
index 0000000..befc400
--- /dev/null
@@ -0,0 +1,71 @@
+//===== 
+// 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 "bbwxHtmlWindow.h"
+#include "bbwxPackage.h"
+#include <wx/html/htmlwin.h>
+
+namespace bbwx
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,HtmlWindow)
+BBTK_BLACK_BOX_IMPLEMENTATION(HtmlWindow,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 HtmlWindow::Process()
+{
+/*
+   std::string msg;
+    if (bbGetInputTitle()!="")
+      {
+       msg = bbGetInputTitle()+": " + bbGetInputIn();
+      }
+    else
+      {
+       msg = bbGetInputIn();
+      }
+   ((wxStaticText*)bbGetOutputWidget())->SetLabel( bbtk::std2wx( msg ) ); 
+  */
+
+       wxHtmlWindow* html = (wxHtmlWindow*)bbGetOutputWidget();
+       html->LoadPage( bbtk::std2wx( bbGetInputFileName() ));
+
+}
+//===== 
+// 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 HtmlWindow::CreateWidget(wxWindow* parent)
+{
+
+//   bbSetOutputWidget( new wxStaticText ( parent , -1 , _T("") ) );
+   bbSetOutputWidget( new wxHtmlWindow(parent, -1, wxDefaultPosition, wxSize(380, 160), wxHW_SCROLLBAR_NEVER) );
+}
+//===== 
+// 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 HtmlWindow::bbUserSetDefaultValues()
+{
+
+}
+//===== 
+// 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 HtmlWindow::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 HtmlWindow::bbUserFinalizeProcessing()
+{
+
+}
+}
+// EO namespace bbwx
+
+
diff --git a/packages/wx/src/bbwxHtmlWindow.h b/packages/wx/src/bbwxHtmlWindow.h
new file mode 100644 (file)
index 0000000..3707c9c
--- /dev/null
@@ -0,0 +1,46 @@
+//===== 
+// 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 __bbwxHtmlWindow_h_INCLUDED__
+#define __bbwxHtmlWindow_h_INCLUDED__
+#include "bbwx_EXPORT.h"
+#include "bbtkWxBlackBox.h"
+
+namespace bbwx
+{
+
+class bbwx_EXPORT HtmlWindow
+ : 
+   public bbtk::WxBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(HtmlWindow,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(FileName,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(HtmlWindow,bbtk::WxBlackBox);
+       BBTK_NAME("HtmlWindow");
+       BBTK_AUTHOR("InfoDev");
+       BBTK_DESCRIPTION("No Description.");
+       BBTK_CATEGORY("__CategoryBlackBox__");
+       BBTK_INPUT(HtmlWindow,FileName,"Web page (.html)",std::string,"");
+BBTK_END_DESCRIBE_BLACK_BOX(HtmlWindow);
+//===== 
+// 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 // __bbwxHtmlWindow_h_INCLUDED__
+#endif // _USE_WXWIDGETS_
+
index ce0f36b5c84c03f1a3c158b202b19b3f44d06c11..8ff7751aeeb00911f08b3e5c6e9077b154ea3f64 100644 (file)
@@ -65,11 +65,14 @@ namespace bbwx
 
     int GetValue();
     void OnRadioButton(wxEvent& event);
+       void AddElements(std::vector<wxString> lstIn, int In, wxString title);
 
   private:
     RadioButton      *mBox;
     int                     MAX_RADIOBUTTON;
     wxRadioButton    *mwxRadioButton[10];
+
+       wxFlexGridSizer  *sizer;
   };
   
   //------------------------------------------------------------------------
@@ -86,8 +89,10 @@ namespace bbwx
     wxPanel( parent, -1) ,
     mBox(box)
   {
-    wxPanel *panel     = this;
+
+/*
     MAX_RADIOBUTTON = lstIn.size();
+    wxPanel *panel     = this;
     int i;
     long style=wxRB_GROUP;
     for (i=0;i<MAX_RADIOBUTTON; i++)
@@ -103,9 +108,7 @@ namespace bbwx
              if (In==i)
              {
                      mwxRadioButton[i]->SetValue(true);
-             } 
-             else 
-             {
+             } else {
                      mwxRadioButton[i]->SetValue(false);
              }
               Connect( mwxRadioButton[i]->GetId(),  
@@ -113,18 +116,20 @@ namespace bbwx
                   (wxObjectEventFunction) 
                   (void (wxPanel::*)(wxEvent&))
                   &RadioButtonWidget::OnRadioButton ); 
-          } 
-          else 
-          {
+          } else {
               mwxRadioButton[i]=NULL;
-          }
-    }
+          } // if
+    } // for 
     
     //---------------------------------------------------------------------
     // 2) Insertion of the components in the window
     
     // We use a FlexGridSizer
-    wxFlexGridSizer *sizer     = new wxFlexGridSizer(1);
+
+//EED 2018-04-18
+//    wxFlexGridSizer *sizer   = new wxFlexGridSizer(1);
+    sizer      = new wxFlexGridSizer(1);
+
     if (title!=_T(""))
     {
           sizer->Add( new wxStaticText(panel,-1, title ) ); 
@@ -141,6 +146,7 @@ namespace bbwx
 
 //    panel->SetAutoLayout(true);
 //    panel->Layout();
+*/
 
   }
   //-------------------------------------------------------------------------
@@ -176,6 +182,73 @@ namespace bbwx
     mBox->bbSignalOutputModification("Out");
   }
 
+
+  //--------------------------------------------------------------------------
+  void RadioButtonWidget::AddElements( std::vector<wxString> lstIn ,int In, wxString title)
+  {
+       DestroyChildren();
+
+    MAX_RADIOBUTTON = lstIn.size();
+    wxPanel *panel     = this;
+    int i;
+    long style=wxRB_GROUP;
+    for (i=0;i<MAX_RADIOBUTTON; i++)
+    {
+          if ( lstIn[i]!=_T(""))
+          {
+    //---------------------------------------------------------------------
+    // 1) Creation of the components of the widget
+    // Any top level sub-widget must have the panel returned by panel
+    // for parent
+             mwxRadioButton[i] = new wxRadioButton( panel, -1, lstIn[i],wxDefaultPosition, wxDefaultSize, style);
+             style=0;
+             if (In==i)
+             {
+                     mwxRadioButton[i]->SetValue(true);
+             } else {
+                     mwxRadioButton[i]->SetValue(false);
+             }
+              Connect( mwxRadioButton[i]->GetId(),  
+                   wxEVT_COMMAND_RADIOBUTTON_SELECTED, 
+                  (wxObjectEventFunction) 
+                  (void (wxPanel::*)(wxEvent&))
+                  &RadioButtonWidget::OnRadioButton ); 
+          } else {
+              mwxRadioButton[i]=NULL;
+          } // if
+    } // for 
+    
+    //---------------------------------------------------------------------
+    // 2) Insertion of the components in the window
+    
+    // We use a FlexGridSizer
+
+//EED 2018-04-18
+//    wxFlexGridSizer *sizer   = new wxFlexGridSizer(1);
+    sizer      = new wxFlexGridSizer(1);
+
+    if (title!=_T(""))
+    {
+          sizer->Add( new wxStaticText(panel,-1, title ) ); 
+    }
+    for (i=0;i<MAX_RADIOBUTTON; i++)
+    {
+       if (mwxRadioButton[i]!=NULL)
+       {
+          sizer->Add( mwxRadioButton[i],1,wxGROW ); 
+       }
+    }
+    sizer->AddGrowableCol(0);
+    panel->SetSizer(sizer);
+
+//    panel->SetAutoLayout(true);
+//    panel->Layout();
+
+
+
+  }
+
+
   //--------------------------------------------------------------------------
   //-------------------------------------------------------------------------
   //--------------------------------------------------------------------------
@@ -216,6 +289,24 @@ namespace bbwx
   { 
     bbtkDebugMessageInc("Core",9,"RadioButton::Process()"<<std::endl);
     bbtkDebugDecTab("Core",9);
+
+
+    std::vector<wxString> lstIn;
+    lstIn.push_back( bbtk::std2wx(bbGetInputIn0()) );
+    lstIn.push_back( bbtk::std2wx(bbGetInputIn1()) );
+    lstIn.push_back( bbtk::std2wx(bbGetInputIn2()) );
+    lstIn.push_back( bbtk::std2wx(bbGetInputIn3()) );
+    lstIn.push_back( bbtk::std2wx(bbGetInputIn4()) );
+    lstIn.push_back( bbtk::std2wx(bbGetInputIn5()) );
+    lstIn.push_back( bbtk::std2wx(bbGetInputIn6()) );
+    lstIn.push_back( bbtk::std2wx(bbGetInputIn7()) );
+    lstIn.push_back( bbtk::std2wx(bbGetInputIn8()) );
+    lstIn.push_back( bbtk::std2wx(bbGetInputIn9()) );
+
+
+       ( (RadioButtonWidget*)bbGetOutputWidget() )->AddElements(lstIn, bbGetInputIn() , bbtk::std2wx(bbGetInputTitle()) );
+
+
   }
 
   /**
@@ -241,7 +332,7 @@ namespace bbwx
     RadioButtonWidget *w = new RadioButtonWidget(
                          this,
 //                         bbGetWxParent(),
-                                                       parent, 
+                                                parent,        
                          bbGetInputIn() ,
                          bbtk::std2wx(bbGetInputTitle()),
                          lstIn );