]> Creatis software - bbtk.git/blob - packages/wx/src/bbwxColourSelector.cxx
*** empty log message ***
[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/06/26 07:37:11 $
7   Version:   $Revision: 1.4 $
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 
21  */
22
23 #ifdef _USE_WXWIDGETS_
24
25 #include "bbwxColourSelector.h"
26 #include "bbwxPackage.h"
27
28 #include <wx/colordlg.h>
29
30 namespace bbwx
31 {
32
33   BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,ColourSelector);
34   BBTK_BLACK_BOX_IMPLEMENTATION(ColourSelector,bbtk::AtomicBlackBox);
35
36   void ColourSelector::bbUserConstructor()
37   {
38   }
39
40   void ColourSelector::Process() 
41    { 
42       bbtkDebugMessageInc("Core",9,"ColourSelector::Process() ["
43                           <<bbGetFullName()<<"]"<<std::endl);
44
45       wxColourDialog *colordialog = new wxColourDialog( 0 );
46       int result_colordialog = colordialog->ShowModal();
47
48         // This line is need it by windows // EED
49         colordialog->SetReturnCode( result_colordialog );
50
51       if (colordialog->GetReturnCode()==wxID_OK)
52       {
53          char col[100];
54          wxColour& c = colordialog->GetColourData().GetColour();
55          sprintf(col,"%f %f %f",c.Red()/255.,c.Green()/255.,c.Blue()/255.);
56          bbSetOutputOut( col );
57       } else { 
58          bbSetOutputOut("");
59       }
60       bbtkDebugDecTab("Core",9); 
61    }
62
63 //  void ColourSelector::CreateWidget()
64 //  {
65 //    mColorDialog = new wxColourSelector( 0 );
66 //    bbSetOutputWidget( mColourSelector );
67 //  }
68
69 }//namespace bbwx
70
71 #endif // _USE_WXWIDGETS_ 
72