]> Creatis software - bbtk.git/blob - packages/wx/src/bbwxColourDialogButton.h
wxColorDialogButton
[bbtk.git] / packages / wx / src / bbwxColourDialogButton.h
1 /*=========================================================================
2                                                                                 
3   Program:   bbtk
4   Module:    $RCSfile: bbwxColourDialogButton.h,v $
5   Language:  C++
6   Date:      $Date: 2008/02/13 15:09:37 $
7   Version:   $Revision: 1.1 $
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::Slider
28  * \brief 
29
30  * \class bbwx::SliderWidget
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 __bbwxColourDialogButton_h_INCLUDED_H__
40 #define __bbwxColourDialogButton_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
54 class ColourDialogButton;
55
56 class wxColourPickerCtrlWidget :public wxPanel
57 {
58
59 public:
60         wxColourPickerCtrlWidget(       ColourDialogButton* box, 
61                                                                 wxWindow *parent, 
62                                                                 unsigned char  cr,
63                                                                 unsigned char  cg,
64                                                                 unsigned char  cb  );
65
66         ~wxColourPickerCtrlWidget();
67         void OnColorChange(wxColourPickerEvent& e);
68         void UpdateBox();
69 private:
70         wxColourPickerCtrl *picker; 
71         ColourDialogButton *mBox;
72 };
73 //------------------------------------------------------------------------
74 //------------------------------------------------------------------------
75 //------------------------------------------------------------------------
76
77
78
79
80 //------------------------------------------------------------------------
81 // The black box
82   class /*BBTK_EXPORT*/ ColourDialogButton : public bbtk::WxBlackBox
83   {    
84     BBTK_USER_BLACK_BOX_INTERFACE(ColourDialogButton,bbtk::WxBlackBox);
85     BBTK_DECLARE_INPUT(In,std::string);
86     BBTK_DECLARE_OUTPUT(Out,std::string);
87     BBTK_PROCESS(Process);
88     BBTK_CREATE_WIDGET(CreateWidget);
89     void Process();
90     void CreateWidget();
91
92   protected:
93     virtual void bbUserConstructor();
94  
95   private:
96           wxColourPickerCtrlWidget* pickerWidget;
97   };
98    
99   //=================================================================
100   // UserBlackBox description
101   BBTK_BEGIN_DESCRIBE_BLACK_BOX(ColourDialogButton,bbtk::WxBlackBox);
102   BBTK_NAME("ColourDialogButton");
103   BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr");
104   // Already inserted for any WxBlackBox  BBTK_CATEGORY("widget");
105   BBTK_DESCRIPTION("A button which displays a colour picker dialog when clicked");
106   BBTK_INPUT(ColourDialogButton,In,"Initial colour",std::string);
107   BBTK_OUTPUT(ColourDialogButton,Out,"Colour choosen in format '[0,1] [0,1] [0,1]'",std::string);
108   BBTK_END_DESCRIBE_BLACK_BOX(ColourDialogButton);
109   //=================================================================
110   
111   
112 }//namespace  bbwx
113
114 #endif  // __bbwxColourDialogButton_h_INCLUDED_H__
115
116 #endif //_USE_WXWIDGETS_