]> Creatis software - bbtk.git/commitdiff
*** empty log message ***
authorEduardo Davila <Eduardo.Davila@creatis.insa-lyon.fr>
Thu, 14 Feb 2008 16:53:38 +0000 (16:53 +0000)
committerEduardo Davila <Eduardo.Davila@creatis.insa-lyon.fr>
Thu, 14 Feb 2008 16:53:38 +0000 (16:53 +0000)
packages/wx/bbs/appli/testSplitInSplit.bbs
packages/wx/src/bbwxColourDialog.cxx [new file with mode: 0644]
packages/wx/src/bbwxColourDialog.h [new file with mode: 0644]
packages/wx/src/bbwxColourDialogButton.cxx
packages/wx/src/bbwxSplit.cxx

index 8e7e11e2521863535715a5b182ceac5ade4a106f..b9575e141c15588f86c3cb94a7d96848439f0eba 100644 (file)
@@ -5,65 +5,69 @@ category "test"
 load std
 load wx
 
+
+#----- I N T E R F A C E  -------------------------------------
+
+
 new Split main
-#set main.Orientation 1
+ set main.Orientation H
 
 new Sizer up
 set up.Orientation 0
 
 new Sizer down
-set down.Orientation 1
+  set down.Orientation 1
+  new Slider sDown
+  connect sDown.Widget   down.Widget1
+  new RadioButton rb
+    set rb.Title "Rad But"
+    set rb.In0 "Choix 1"
+    set rb.In1 "Choix 2"
+    set rb.In2 "Choix 3"
+    set rb.In3 "Choix 4"
+    set rb.In 1
+   connect rb.Widget down.Widget2
 
-new Sizer upRight
-set upRight.Orientation 0
-
-new Split upLeft
-#set upLeft.Proportion 80
 
 connect up.Widget   main.Widget1
 connect down.Widget main.Widget2
 
-connect upLeft.Widget  up.Widget1
-connect upRight.Widget up.Widget2
-
-# -- todo : add it, again later
-# --        (when RadioButton exists again)
-
-new RadioButton rb
-set rb.Title "Rad But"
-set rb.In0 "Choix 1"
-set rb.In1 "Choix 2"
-set rb.In2 "Choix 3"
-set rb.In3 "Choix 4"
-set rb.In 1
-
-
-new Slider sUpLeft
-new Slider sDown
-
-new Slider s1
-set s1.Orientation 1
-set s1.Title "s1"
-new Slider s2
-set s2.Orientation 1
-set s2.Title "s2"
-new Slider s3
-set s3.Orientation 1
-set s3.Title "s3"
-new Slider s4
-set s4.Orientation 1
-set s4.Title "s4"
-
-connect s1.Widget upRight.Widget1 
-connect s2.Widget upRight.Widget2 
-connect s3.Widget upRight.Widget3 
-connect s4.Widget upRight.Widget4 
-
-connect sUpLeft.Widget upLeft.Widget1
-connect rb.Widget      down.Widget2
-connect sDown.Widget   down.Widget1
-
-#graph
+
+  new Split upLeft
+    #set upLeft.Proportion 80
+    new Slider eed
+    connect eed.Widget upLeft.Widget1
+    new Slider sUpLeft
+    connect sUpLeft.Widget upLeft.Widget2
+  connect upLeft.Widget up.Widget1
+
+
+  new Sizer upRight
+    set upRight.Orientation 0
+    new Slider s1
+    set s1.Orientation 1
+    set s1.Title "s1"
+    new Slider s2
+    set s2.Orientation 1
+    set s2.Title "s2"
+    new Slider s3
+    set s3.Orientation 1
+    set s3.Title "s3"
+    new Slider s4
+    set s4.Orientation 1
+    set s4.Title "s4"
+    connect s1.Widget upRight.Widget1 
+    connect s2.Widget upRight.Widget2 
+    connect s3.Widget upRight.Widget3 
+    connect s4.Widget upRight.Widget4 
+  connect upRight.Widget up.Widget2
+
+#------p i p e l i n e---------------------------------------
+#...
+#------------------------------------------------------------
+
+
+graph
 #set main.WinDialog 1
 exec main
 
diff --git a/packages/wx/src/bbwxColourDialog.cxx b/packages/wx/src/bbwxColourDialog.cxx
new file mode 100644 (file)
index 0000000..7f6c929
--- /dev/null
@@ -0,0 +1,73 @@
+/*=========================================================================
+                                                                                
+  Program:   bbtk
+  Module:    $RCSfile: bbwxColourDialog.cxx,v $
+  Language:  C++
+  Date:      $Date: 2008/02/14 16:55:07 $
+  Version:   $Revision: 1.1 $
+                                                                                
+  Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
+  l'Image). All rights reserved. See Doc/License.txt or
+  http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
+                                                                                
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notices for more information.
+                                                                                
+=========================================================================*/
+/**
+ *  \file 
+ *  \brief 
+ */
+
+
+#ifdef _USE_WXWIDGETS_
+
+
+#include "bbwxColourDialog.h"
+#include "bbwxPackage.h"
+
+
+
+
+namespace bbwx
+{
+
+  BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,ColourDialog);
+  BBTK_USER_BLACK_BOX_IMPLEMENTATION(ColourDialog,bbtk::WxBlackBox);
+
+
+  void ColourDialog::bbUserConstructor()
+  {
+  }
+
+  void ColourDialog::Process() 
+  { 
+    bbtkDebugMessageInc("Core",9,"ColourDialog::Process() ["
+                       <<bbGetFullName()<<"]"<<std::endl);
+    
+    if (mColorDialog->GetReturnCode()==wxID_OK)
+      {
+       char col[100];
+       wxColour& c = mColorDialog->GetColourData().GetColour();
+       sprintf(col,"%f %f %f",c.Red()/255.,c.Green()/255.,c.Blue()/255.);
+       bbSetOutputOut( col );
+      }
+    else
+      { 
+       bbSetOutputOut("");
+       }
+
+    bbtkDebugDecTab("Core",9); 
+  }
+  
+  void ColourDialog::CreateWidget()
+  {
+    mColorDialog = new wxColourDialog( 0 );
+    bbSetOutputWidget( mColorDialog );
+  }
+
+}//namespace bbwx
+
+#endif // _USE_WXWIDGETS_ 
+
diff --git a/packages/wx/src/bbwxColourDialog.h b/packages/wx/src/bbwxColourDialog.h
new file mode 100644 (file)
index 0000000..1877264
--- /dev/null
@@ -0,0 +1,89 @@
+/*=========================================================================
+                                                                                
+  Program:   bbtk
+  Module:    $RCSfile: bbwxColourDialog.h,v $
+  Language:  C++
+  Date:      $Date: 2008/02/14 16:55:07 $
+  Version:   $Revision: 1.1 $
+                                                                                
+  Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
+  l'Image). All rights reserved. See Doc/License.txt or
+  http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
+                                                                                
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notices for more information.
+                                                                                
+=========================================================================*//**
+ /**
+ * \file 
+ * \brief Short description in one line
+ * 
+ * Long description which 
+ * can span multiple lines
+*/
+
+/**
+ * \class bbwx::ColorDialog
+ * \brief 
+
+ */
+
+#ifdef _USE_WXWIDGETS_
+
+
+#ifndef __bbWxColourDialog_h__
+#define __bbWxColourDialog_h__
+
+#include "bbtkWxBlackBox.h"
+
+#include <wx/colordlg.h>
+
+// Namespace of the package "wx" is "bbwx" 
+// Namespace associated to packages should be of the form :
+// bbPACKAGENAME
+namespace bbwx
+{
+  
+  
+  
+
+  //=================================================================
+  class /*BBTK_EXPORT*/ ColourDialog : public bbtk::WxBlackBox
+  {
+    BBTK_USER_BLACK_BOX_INTERFACE(ColourDialog,bbtk::WxBlackBox);
+    BBTK_DECLARE_OUTPUT(Out,std::string);
+    BBTK_PROCESS(Process);
+    BBTK_CREATE_WIDGET(CreateWidget);
+    void Process();
+    void CreateWidget();
+
+  protected:
+    virtual void bbUserConstructor();
+  private:
+    wxColourDialog* mColorDialog;
+  };
+  //=================================================================
+  
+  //=================================================================
+  // UserBlackBox description
+  BBTK_BEGIN_DESCRIBE_BLACK_BOX(ColourDialog,bbtk::WxBlackBox);
+  // Already inserted for any WxBlackBox  BBTK_CATEGORY("widget");
+  BBTK_NAME("ColourDialog");
+  BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr");
+  BBTK_DESCRIPTION("Colour chooser dialog (bbfication of wxColourDialog)");
+  BBTK_OUTPUT(ColourDialog,Out,"The colour selected by the user",std::string);
+  BBTK_END_DESCRIBE_BLACK_BOX(ColourDialog);
+  //=================================================================
+
+
+
+}
+
+
+
+//namespace bbtk
+#endif  //__bbtkWxColourDialog_h__
+
+#endif //_USE_WXWIDGETS_
index b8137008fb4a579538a1559dc32661bb8eb44df1..eadb5e9ad3e77c6a2b6ce0e625569508a2abe67e 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbwxColourDialogButton.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/02/14 08:06:19 $
-  Version:   $Revision: 1.2 $
+  Date:      $Date: 2008/02/14 16:55:07 $
+  Version:   $Revision: 1.3 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -63,7 +63,7 @@ wxColourPickerCtrlWidget::wxColourPickerCtrlWidget(   ColourDialogButton* box,
     bbtkDebugMessage("Process",9,"<= wxColourPickerCtrlWidget::wxColourPickerCtrlWidget"<<std::endl);
     wxFlexGridSizer *sizer = new wxFlexGridSizer(10);
        sizer -> AddGrowableRow(0);
-       sizer -> Add( picker,1,wxGROW );                
+       sizer -> Add( picker, 1, wxEXPAND, 0 );         
        panel -> SetSizer(sizer);
   }
 
index 8d05e106c3024af86cf8b1c87c8a50ff74f810c5..2e61dc71b4f82cdb46c03e64863976d242ae0dc1 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbwxSplit.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/02/08 14:58:31 $
-  Version:   $Revision: 1.5 $
+  Date:      $Date: 2008/02/14 16:55:07 $
+  Version:   $Revision: 1.6 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -43,6 +43,8 @@ namespace bbwx
        bbSetInputWinTitle("Split");
     bbSetInputOrientation("HORIZONTAL");
     bbSetInputProportion(50);
+    bbSetInputWidget1(NULL);
+    bbSetInputWidget2(NULL);
   }
 
   void Split::Process() 
@@ -62,6 +64,8 @@ namespace bbwx
     wxWindow* w1 = bbGetInputWidget1();
     wxWindow* w2 = bbGetInputWidget2();
 
+    if (w1==NULL) { w1=new wxPanel(bbGetWxParent()); }
+    if (w2==NULL) { w2=new wxPanel(bbGetWxParent()); }
     w1->Reparent(w);
     w2->Reparent(w);
     int orientation=0;