]> Creatis software - bbtk.git/blob - packages/wx/src/bbwxCommandButton.h
36a4f9c66b13ba89153c734dc6bf580deb9146c8
[bbtk.git] / packages / wx / src / bbwxCommandButton.h
1 /*=========================================================================                                                                               
2   Program:   bbtk
3   Module:    $RCSfile: bbwxCommandButton.h,v $
4   Language:  C++
5   Date:      $Date: 2008/11/24 15:45:51 $
6   Version:   $Revision: 1.7 $
7 =========================================================================*/
8
9 /* ---------------------------------------------------------------------
10
11 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
12 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
13 *
14 *  This software is governed by the CeCILL-B license under French law and 
15 *  abiding by the rules of distribution of free software. You can  use, 
16 *  modify and/ or redistribute the software under the terms of the CeCILL-B 
17 *  license as circulated by CEA, CNRS and INRIA at the following URL 
18 *  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
19 *  or in the file LICENSE.txt.
20 *
21 *  As a counterpart to the access to the source code and  rights to copy,
22 *  modify and redistribute granted by the license, users are provided only
23 *  with a limited warranty  and the software's author,  the holder of the
24 *  economic rights,  and the successive licensors  have only  limited
25 *  liability. 
26 *
27 *  The fact that you are presently reading this means that you have had
28 *  knowledge of the CeCILL-B license and that you accept its terms.
29 * ------------------------------------------------------------------------ */                                                                         
30
31 /**
32  * \brief Short description in one line 
33  *  
34  * Long description which  
35  * can span multiple lines 
36  */ 
37 /** 
38  * \file  
39  * \brief Pattern for the definition of a new type of Node (header) 
40  */ 
41 /** 
42  * \class bbtk::NodePatern  
43  * \brief Pattern for the definition of a new type of Node  
44  */ 
45  
46  
47 #ifdef _USE_WXWIDGETS_ 
48  
49 #ifndef __bbwxCommandButton_h_INCLUDED_H__ 
50 #define __bbwxCommandButton_h_INCLUDED_H__ 
51  
52  
53 #include "bbtkWxBlackBox.h" 
54  
55  
56  
57 namespace bbwx 
58
59   class CommandButton;
60   
61   //--------------------------------------------------------------------------
62   class CommandButtonWidget : public wxPanel
63   {
64   public:
65     CommandButtonWidget(CommandButton* box, wxWindow *parent, 
66                         wxString title);
67     ~CommandButtonWidget();
68     void OnCommandButton( wxEvent& );
69     void SetLabel(wxString title);
70     void SetColour(wxColour color);
71         
72   private:
73     CommandButton* mBox;
74     wxButton    *mwxCommandButton;
75   }; 
76    
77   //--------------------------------------------------------------------------
78   //--------------------------------------------------------------------------
79   //--------------------------------------------------------------------------
80
81   class /*BBTK_EXPORT*/ CommandButton : public bbtk::WxBlackBox 
82   {     
83     friend class CommandButtonWidget;
84     BBTK_BLACK_BOX_INTERFACE(CommandButton,bbtk::WxBlackBox); 
85     BBTK_DECLARE_INPUT(In, std::string );       
86     BBTK_DECLARE_INPUT(Label, std::string ); 
87     BBTK_DECLARE_INPUT(Colour, std::vector<double> );   
88     //    BBTK_DECLARE_OUTPUT(Out,int); 
89     BBTK_PROCESS(Process); 
90     void Process(); 
91     BBTK_CREATE_WIDGET(CreateWidget);
92     void CreateWidget(wxWindow*);
93   protected: 
94     virtual void bbUserConstructor(); 
95     
96     
97   private: 
98     void UpdateColour();
99     void UpdateLabel();
100   }; 
101     
102   //================================================================= 
103   // UserBlackBox description 
104   BBTK_BEGIN_DESCRIBE_BLACK_BOX(CommandButton,bbtk::WxBlackBox); 
105   BBTK_NAME("CommandButton"); 
106   BBTK_AUTHOR("eduardo.davila@creatis.insa-lyon.fr"); 
107   BBTK_DESCRIPTION("Button which executes bbi commands"); 
108
109   typedef std::vector<double> vectorcolour;
110   
111   BBTK_INPUT(CommandButton,In,"Commands to be executed separated by commas (;). Each single quote (') is replaced by a double quote (\").",std::string,"");   
112   BBTK_INPUT(CommandButton,Label,"Label of the button",std::string,""); 
113   BBTK_INPUT(CommandButton,Colour,"Colour of the button (-1 -1 -1  Background)",vectorcolour,"colour"); 
114   //    BBTK_OUTPUT(CommandButton,Out,"..Out..",int); 
115   BBTK_END_DESCRIBE_BLACK_BOX(CommandButton); 
116   //================================================================= 
117  
118  
119 }//namespace  bbwx 
120  
121 #endif  // __bbwxCommandButton_h_INCLUDED_H__ 
122  
123 #endif //_USE_WXWIDGETS_