]> Creatis software - bbtk.git/blob - packages/wx/src/bbwxColourSelectorButton.h
ba752c6bf02ba27faec8848dd5f39348887fd44d
[bbtk.git] / packages / wx / src / bbwxColourSelectorButton.h
1 /*=========================================================================
2                                                                                 
3   Program:   bbtk
4   Module:    $RCSfile: bbwxColourSelectorButton.h,v $
5   Language:  C++
6   Date:      $Date: 2008/05/07 13:14:49 $
7   Version:   $Revision: 1.4 $
8                                                                                 
9   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10   l'Image). All rights reserved. See Doc/License.txt or
11   http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
12                                                                                 
13      This software is distributed WITHOUT ANY WARRANTY; without even
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15      PURPOSE.  See the above copyright notices for more information.
16                                                                                 
17 =========================================================================*//**
18 /**
19  * \file 
20  * \brief Short description in one line
21  * 
22  * Long description which 
23  * can span multiple lines
24 */
25
26 /**
27  * \class bbwx::ColourSelectorButton
28  * \brief 
29
30  * \class bbwx::wxColourPickerCtrlWidget
31  * \brief 
32  */
33
34 #ifdef _USE_WXWIDGETS_
35
36 // Prevents multiple inclusions : use symbols of the form
37 // __FILENAME_INCLUDED__ 
38 // where FILENAME must be replaced by the actual file name
39 #ifndef __bbwxColourSelectorButton_h_INCLUDED_H__
40 #define __bbwxColourSelectorButton_h_INCLUDED_H__
41
42 // Include wxBlackBox definition
43 #include "bbtkWxBlackBox.h"
44
45 #include <wx/clrpicker.h>
46
47 // Namespace of the package "wx" is "bbwx" 
48 // Namespace associated to packages should be of the form :
49 // bbPACKAGENAME
50 namespace bbwx
51 {
52
53 class ColourSelectorButton;
54
55 class wxColourPickerCtrlWidget :public wxPanel
56 {
57
58 public:
59    wxColourPickerCtrlWidget( ColourSelectorButton* box, 
60                              wxWindow *parent, 
61                              unsigned char  cr,
62                              unsigned char  cg,
63                              unsigned char  cb  );
64
65    ~wxColourPickerCtrlWidget();
66    void OnColorChange(wxColourPickerEvent& e);
67    void UpdateBox();
68 private:
69    wxColourPickerCtrl *picker; 
70    ColourSelectorButton *mBox;
71 };
72 //------------------------------------------------------------------------
73 //------------------------------------------------------------------------
74 //------------------------------------------------------------------------
75
76
77
78
79 //------------------------------------------------------------------------
80 // The black box
81   class /*BBTK_EXPORT*/ ColourSelectorButton : public bbtk::WxBlackBox
82   {    
83     BBTK_BLACK_BOX_INTERFACE(ColourSelectorButton,bbtk::WxBlackBox);
84     BBTK_DECLARE_INPUT(In,std::string);
85     BBTK_DECLARE_OUTPUT(Out,std::string);
86     BBTK_PROCESS(Process);
87     BBTK_CREATE_WIDGET(CreateWidget);
88     void Process();
89     void CreateWidget();
90
91   protected:
92      virtual void bbUserConstructor();
93  
94   private:
95      wxColourPickerCtrlWidget* pickerWidget;
96   };
97    
98   //=================================================================
99   // UserBlackBox description
100   BBTK_BEGIN_DESCRIBE_BLACK_BOX(ColourSelectorButton,bbtk::WxBlackBox);
101   BBTK_NAME("ColourSelectorButton");
102   BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr");
103   // Already inserted for any WxBlackBox  BBTK_CATEGORY("widget");
104   BBTK_DESCRIPTION("A button which displays a colour picker dialog when clicked");
105   BBTK_INPUT(ColourSelectorButton,In,"Initial colour",std::string,"colour");
106   BBTK_OUTPUT(ColourSelectorButton,Out,"Colour choosen in format '[0,1] [0,1] [0,1]'",std::string,"colour");
107   BBTK_END_DESCRIBE_BLACK_BOX(ColourSelectorButton);
108   //=================================================================
109   
110   
111 }//namespace  bbwx
112
113 #endif  // __bbwxColourSelectorButton_h_INCLUDED_H__
114
115 #endif //_USE_WXWIDGETS_