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