X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=packages%2Fwx%2Fsrc%2FbbwxColourSelectorButton.h;fp=packages%2Fwx%2Fsrc%2FbbwxColourSelectorButton.h;h=0ffeb1dbdd05715508c8b372e97435086314995e;hb=5e3d12f47887915d40f55316633783da9f2a6802;hp=0000000000000000000000000000000000000000;hpb=159a37b178f2b92e2a201929f3f9cc0cde5366ce;p=bbtk.git diff --git a/packages/wx/src/bbwxColourSelectorButton.h b/packages/wx/src/bbwxColourSelectorButton.h new file mode 100644 index 0000000..0ffeb1d --- /dev/null +++ b/packages/wx/src/bbwxColourSelectorButton.h @@ -0,0 +1,115 @@ +/*========================================================================= + + Program: bbtk + Module: $RCSfile: bbwxColourSelectorButton.h,v $ + Language: C++ + Date: $Date: 2008/02/20 11:36:29 $ + Version: $Revision: 1.1 $ + + Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de + l'Image). All rights reserved. See Doc/License.txt or + http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*//** +/** + * \file + * \brief Short description in one line + * + * Long description which + * can span multiple lines +*/ + +/** + * \class bbwx::ColourSelectorButton + * \brief + + * \class bbwx::wxColourPickerCtrlWidget + * \brief + */ + +#ifdef _USE_WXWIDGETS_ + +// Prevents multiple inclusions : use symbols of the form +// __FILENAME_INCLUDED__ +// where FILENAME must be replaced by the actual file name +#ifndef __bbwxColourSelectorButton_h_INCLUDED_H__ +#define __bbwxColourSelectorButton_h_INCLUDED_H__ + +// Include wxBlackBox definition +#include "bbtkWxBlackBox.h" + +#include + +// Namespace of the package "wx" is "bbwx" +// Namespace associated to packages should be of the form : +// bbPACKAGENAME +namespace bbwx +{ + +class ColourSelectorButton; + +class wxColourPickerCtrlWidget :public wxPanel +{ + +public: + wxColourPickerCtrlWidget( ColourSelectorButton* box, + wxWindow *parent, + unsigned char cr, + unsigned char cg, + unsigned char cb ); + + ~wxColourPickerCtrlWidget(); + void OnColorChange(wxColourPickerEvent& e); + void UpdateBox(); +private: + wxColourPickerCtrl *picker; + ColourSelectorButton *mBox; +}; +//------------------------------------------------------------------------ +//------------------------------------------------------------------------ +//------------------------------------------------------------------------ + + + + +//------------------------------------------------------------------------ +// The black box + class /*BBTK_EXPORT*/ ColourSelectorButton : public bbtk::WxBlackBox + { + BBTK_USER_BLACK_BOX_INTERFACE(ColourSelectorButton,bbtk::WxBlackBox); + BBTK_DECLARE_INPUT(In,std::string); + BBTK_DECLARE_OUTPUT(Out,std::string); + BBTK_PROCESS(Process); + BBTK_CREATE_WIDGET(CreateWidget); + void Process(); + void CreateWidget(); + + protected: + virtual void bbUserConstructor(); + + private: + wxColourPickerCtrlWidget* pickerWidget; + }; + + //================================================================= + // UserBlackBox description + BBTK_BEGIN_DESCRIBE_BLACK_BOX(ColourSelectorButton,bbtk::WxBlackBox); + BBTK_NAME("ColourSelectorButton"); + BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr"); + // Already inserted for any WxBlackBox BBTK_CATEGORY("widget"); + BBTK_DESCRIPTION("A button which displays a colour picker dialog when clicked"); + BBTK_INPUT(ColourSelectorButton,In,"Initial colour",std::string); + BBTK_OUTPUT(ColourSelectorButton,Out,"Colour choosen in format '[0,1] [0,1] [0,1]'",std::string); + BBTK_END_DESCRIBE_BLACK_BOX(ColourSelectorButton); + //================================================================= + + +}//namespace bbwx + +#endif // __bbwxColourSelectorButton_h_INCLUDED_H__ + +#endif //_USE_WXWIDGETS_