]> Creatis software - bbtk.git/blobdiff - packages/wx/src/bbwxColourSelectorButton.h
ColourDialog --> ColourSelector
[bbtk.git] / packages / wx / src / bbwxColourSelectorButton.h
diff --git a/packages/wx/src/bbwxColourSelectorButton.h b/packages/wx/src/bbwxColourSelectorButton.h
new file mode 100644 (file)
index 0000000..0ffeb1d
--- /dev/null
@@ -0,0 +1,115 @@
+/*=========================================================================
+                                                                                
+  Program:   bbtk
+  Module:    $RCSfile: bbwxColourSelectorButton.h,v $
+  Language:  C++
+  Date:      $Date: 2008/02/20 11:36:29 $
+  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::ColourSelectorButton
+ * \brief 
+
+ * \class bbwx::wxColourPickerCtrlWidget
+ * \brief 
+ */
+
+#ifdef _USE_WXWIDGETS_
+
+// Prevents multiple inclusions : use symbols of the form
+// __FILENAME_INCLUDED__ 
+// where FILENAME must be replaced by the actual file name
+#ifndef __bbwxColourSelectorButton_h_INCLUDED_H__
+#define __bbwxColourSelectorButton_h_INCLUDED_H__
+
+// Include wxBlackBox definition
+#include "bbtkWxBlackBox.h"
+
+#include <wx/clrpicker.h>
+
+// Namespace of the package "wx" is "bbwx" 
+// Namespace associated to packages should be of the form :
+// bbPACKAGENAME
+namespace bbwx
+{
+
+class ColourSelectorButton;
+
+class wxColourPickerCtrlWidget :public wxPanel
+{
+
+public:
+   wxColourPickerCtrlWidget( ColourSelectorButton* box, 
+                             wxWindow *parent, 
+                             unsigned char  cr,
+                             unsigned char  cg,
+                             unsigned char  cb  );
+
+   ~wxColourPickerCtrlWidget();
+   void OnColorChange(wxColourPickerEvent& e);
+   void UpdateBox();
+private:
+   wxColourPickerCtrl *picker; 
+   ColourSelectorButton *mBox;
+};
+//------------------------------------------------------------------------
+//------------------------------------------------------------------------
+//------------------------------------------------------------------------
+
+
+
+
+//------------------------------------------------------------------------
+// The black box
+  class /*BBTK_EXPORT*/ ColourSelectorButton : public bbtk::WxBlackBox
+  {    
+    BBTK_USER_BLACK_BOX_INTERFACE(ColourSelectorButton,bbtk::WxBlackBox);
+    BBTK_DECLARE_INPUT(In,std::string);
+    BBTK_DECLARE_OUTPUT(Out,std::string);
+    BBTK_PROCESS(Process);
+    BBTK_CREATE_WIDGET(CreateWidget);
+    void Process();
+    void CreateWidget();
+
+  protected:
+     virtual void bbUserConstructor();
+  private:
+     wxColourPickerCtrlWidget* pickerWidget;
+  };
+   
+  //=================================================================
+  // UserBlackBox description
+  BBTK_BEGIN_DESCRIBE_BLACK_BOX(ColourSelectorButton,bbtk::WxBlackBox);
+  BBTK_NAME("ColourSelectorButton");
+  BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr");
+  // Already inserted for any WxBlackBox  BBTK_CATEGORY("widget");
+  BBTK_DESCRIPTION("A button which displays a colour picker dialog when clicked");
+  BBTK_INPUT(ColourSelectorButton,In,"Initial colour",std::string);
+  BBTK_OUTPUT(ColourSelectorButton,Out,"Colour choosen in format '[0,1] [0,1] [0,1]'",std::string);
+  BBTK_END_DESCRIBE_BLACK_BOX(ColourSelectorButton);
+  //=================================================================
+  
+  
+}//namespace  bbwx
+
+#endif  // __bbwxColourSelectorButton_h_INCLUDED_H__
+
+#endif //_USE_WXWIDGETS_