]> Creatis software - bbtk.git/blob - packages/wx/src/bbwxColourSelector.cxx
1194f88a35a67b0445a07501b1fafb963e0d472f
[bbtk.git] / packages / wx / src / bbwxColourSelector.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   bbtk
4   Module:    $RCSfile: bbwxColourSelector.cxx,v $
5   Language:  C++
6   Date:      $Date: 2008/09/10 12:01:47 $
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  * \file
20  * \brief Short description in one line
21  *
22  * Long
23  * description
24  *
25  */
26
27 #ifdef _USE_WXWIDGETS_
28
29 #include "bbwxColourSelector.h"
30 #include "bbwxPackage.h"
31
32 #include <wx/colordlg.h>
33
34 namespace bbwx
35 {
36
37   BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,ColourSelector);
38   BBTK_BLACK_BOX_IMPLEMENTATION(ColourSelector,bbtk::AtomicBlackBox);
39
40   void ColourSelector::bbUserConstructor()
41   {
42   }
43
44   void ColourSelector::Process()
45    {
46       bbtkDebugMessageInc("Core",9,"ColourSelector::Process() ["
47                           <<bbGetFullName()<<"]"<<std::endl);
48
49       wxColourDialog *colordialog = new wxColourDialog( 0 );
50       int result_colordialog = colordialog->ShowModal();
51
52         // This line is need it by windows // EED
53         colordialog->SetReturnCode( result_colordialog );
54
55       if (colordialog->GetReturnCode()==wxID_OK)
56       {
57          char col[100];
58          wxColour& c = colordialog->GetColourData().GetColour();
59          sprintf(col,"%f %f %f",c.Red()/255.,c.Green()/255.,c.Blue()/255.);
60          bbSetOutputOut( col );
61       } else {
62          bbSetOutputOut("");
63       }
64       bbtkDebugDecTab("Core",9);
65    }
66
67 //  void ColourSelector::CreateWidget()
68 //  {
69 //    mColorDialog = new wxColourSelector( 0 );
70 //    bbSetOutputWidget( mColourSelector );
71 //  }
72
73 }//namespace bbwx
74
75 #endif // _USE_WXWIDGETS_ 
76