]> Creatis software - bbtk.git/commitdiff
ColourDialog -> ColourSelector
authorjean-pierre roux <jean-pierre.roux@creatis.insa-lyon.fr>
Wed, 20 Feb 2008 11:51:59 +0000 (11:51 +0000)
committerjean-pierre roux <jean-pierre.roux@creatis.insa-lyon.fr>
Wed, 20 Feb 2008 11:51:59 +0000 (11:51 +0000)
packages/wx/src/bbwxColourSelector.cxx [new file with mode: 0644]
packages/wx/src/bbwxColourSelector.h [new file with mode: 0644]

diff --git a/packages/wx/src/bbwxColourSelector.cxx b/packages/wx/src/bbwxColourSelector.cxx
new file mode 100644 (file)
index 0000000..cf6547e
--- /dev/null
@@ -0,0 +1,73 @@
+/*=========================================================================
+                                                                                
+  Program:   bbtk
+  Module:    $RCSfile: bbwxColourSelector.cxx,v $
+  Language:  C++
+  Date:      $Date: 2008/02/20 11:51:59 $
+  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 "bbwxColourSelector.h"
+#include "bbwxPackage.h"
+
+#include <wx/colordlg.h>
+
+
+
+namespace bbwx
+{
+
+  BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,ColourSelector);
+  BBTK_USER_BLACK_BOX_IMPLEMENTATION(ColourSelector,bbtk::AtomicBlackBox);
+
+
+  void ColourSelector::bbUserConstructor()
+  {
+  }
+
+  void ColourSelector::Process() 
+  { 
+      bbtkDebugMessageInc("Core",9,"ColourSelector::Process() ["
+                       <<bbGetFullName()<<"]"<<std::endl);
+    
+      wxColourDialog *colordialog = new wxColourDialog( 0 );
+      colordialog->ShowModal();
+      if (colordialog->GetReturnCode()==wxID_OK)
+      {
+         char col[100];
+         wxColour& c = colordialog->GetColourData().GetColour();
+         sprintf(col,"%f %f %f",c.Red()/255.,c.Green()/255.,c.Blue()/255.);
+         bbSetOutputOut( col );
+      } else { 
+         bbSetOutputOut("");
+      }
+      bbtkDebugDecTab("Core",9); 
+   }
+  
+//  void ColourSelector::CreateWidget()
+//  {
+//    mColorDialog = new wxColourSelector( 0 );
+//    bbSetOutputWidget( mColourSelector );
+//  }
+
+}//namespace bbwx
+
+#endif // _USE_WXWIDGETS_ 
+
diff --git a/packages/wx/src/bbwxColourSelector.h b/packages/wx/src/bbwxColourSelector.h
new file mode 100644 (file)
index 0000000..cae667b
--- /dev/null
@@ -0,0 +1,79 @@
+/*=========================================================================
+                                                                                
+  Program:   bbtk
+  Module:    $RCSfile: bbwxColourSelector.h,v $
+  Language:  C++
+  Date:      $Date: 2008/02/20 11:51:59 $
+  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 __bbWxColourSelector_h__
+#define __bbWxColourSelector_h__
+
+#include "bbtkWxBlackBox.h"
+
+// Namespace of the package "wx" is "bbwx" 
+// Namespace associated to packages should be of the form :
+// bbPACKAGENAME
+namespace bbwx
+{
+
+  //=================================================================
+  class /*BBTK_EXPORT*/ ColourSelector : public bbtk::AtomicBlackBox
+  {
+    BBTK_USER_BLACK_BOX_INTERFACE(ColourSelector,bbtk::AtomicBlackBox);
+    BBTK_DECLARE_OUTPUT(Out,std::string);
+    BBTK_PROCESS(Process);
+//    BBTK_CREATE_WIDGET(CreateWidget);
+    void Process();
+//    void CreateWidget();
+
+  protected:
+    virtual void bbUserConstructor();
+ // private:
+ //   wxColourSelector* mColorDialog;
+  };
+  //=================================================================
+
+  //=================================================================
+  // UserBlackBox description
+  BBTK_BEGIN_DESCRIBE_BLACK_BOX(ColourSelector,bbtk::AtomicBlackBox);
+  // Already inserted for any WxBlackBox  BBTK_CATEGORY("widget");
+  BBTK_NAME("ColourSelector");
+  BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr");
+  BBTK_DESCRIPTION("Colour Selector dialog (bbfication of wxColourSelector)");
+  BBTK_OUTPUT(ColourSelector,Out,"The colour selected by the user",std::string);
+  BBTK_END_DESCRIBE_BLACK_BOX(ColourSelector);
+  //=================================================================
+
+}
+
+//namespace bbtk
+#endif  //__bbtkWxColourSelector_h__
+
+#endif //_USE_WXWIDGETS_