]> Creatis software - bbtk.git/blob - packages/wx/src/bbwxCommandButton.h
*** empty log message ***
[bbtk.git] / packages / wx / src / bbwxCommandButton.h
1 /*========================================================================= 
2                                                                                  
3   Program:   bbtk 
4   Module:    $RCSfile: bbwxCommandButton.h,v $ 
5   Language:  C++ 
6   Date:      $Date: 2008/07/25 07:44:12 $ 
7   Version:   $Revision: 1.5 $ 
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  * \brief Short description in one line 
20  *  
21  * Long description which  
22  * can span multiple lines 
23  */ 
24 /** 
25  * \file  
26  * \brief Pattern for the definition of a new type of Node (header) 
27  */ 
28 /** 
29  * \class bbtk::NodePatern  
30  * \brief Pattern for the definition of a new type of Node  
31  */ 
32  
33  
34 #ifdef _USE_WXWIDGETS_ 
35  
36 #ifndef __bbwxCommandButton_h_INCLUDED_H__ 
37 #define __bbwxCommandButton_h_INCLUDED_H__ 
38  
39  
40 #include "bbtkWxBlackBox.h" 
41  
42  
43  
44 namespace bbwx 
45
46   class CommandButton;
47   
48   //--------------------------------------------------------------------------
49   class CommandButtonWidget : public wxPanel
50   {
51   public:
52     CommandButtonWidget(CommandButton* box, wxWindow *parent, 
53                         wxString title);
54     ~CommandButtonWidget();
55     void OnCommandButton( wxEvent& );
56     void SetLabel(wxString title);
57     void SetColour(wxColour color);
58         
59   private:
60     CommandButton* mBox;
61     wxButton    *mwxCommandButton;
62   }; 
63    
64   //--------------------------------------------------------------------------
65   //--------------------------------------------------------------------------
66   //--------------------------------------------------------------------------
67
68   class /*BBTK_EXPORT*/ CommandButton : public bbtk::WxBlackBox 
69   {     
70     friend class CommandButtonWidget;
71     BBTK_BLACK_BOX_INTERFACE(CommandButton,bbtk::WxBlackBox); 
72     BBTK_DECLARE_INPUT(In, std::string );       
73     BBTK_DECLARE_INPUT(Label, std::string ); 
74     BBTK_DECLARE_INPUT(Colour, std::vector<double> );   
75     //    BBTK_DECLARE_OUTPUT(Out,int); 
76     BBTK_PROCESS(Process); 
77     void Process(); 
78     BBTK_CREATE_WIDGET(CreateWidget);
79     void CreateWidget();
80   protected: 
81     virtual void bbUserConstructor(); 
82     
83     
84   private: 
85     void UpdateColour();
86     void UpdateLabel();
87   }; 
88     
89   //================================================================= 
90   // UserBlackBox description 
91   BBTK_BEGIN_DESCRIBE_BLACK_BOX(CommandButton,bbtk::WxBlackBox); 
92   BBTK_NAME("CommandButton"); 
93   BBTK_AUTHOR("eduardo.davila@creatis.insa-lyon.fr"); 
94   BBTK_DESCRIPTION("Button which executes bbi commands"); 
95
96   typedef std::vector<double> vectorcolour;
97   
98   BBTK_INPUT(CommandButton,In,"Commands to be executed separated by commas (;). Each single quote (') is replaced by a double quote (\").",std::string,"");   
99   BBTK_INPUT(CommandButton,Label,"Label of the button",std::string,""); 
100   BBTK_INPUT(CommandButton,Colour,"Colour of the button (-1 -1 -1  Background)",vectorcolour,"colour"); 
101   //    BBTK_OUTPUT(CommandButton,Out,"..Out..",int); 
102   BBTK_END_DESCRIBE_BLACK_BOX(CommandButton); 
103   //================================================================= 
104  
105  
106 }//namespace  bbwx 
107  
108 #endif  // __bbwxCommandButton_h_INCLUDED_H__ 
109  
110 #endif //_USE_WXWIDGETS_