]> Creatis software - creaImageIO.git/blob - src/creaImageIOWxGimmickPanel.h
ed206eef7a98abf56db00912c3244aa6ab1dcafc
[creaImageIO.git] / src / creaImageIOWxGimmickPanel.h
1 #ifndef __creaImageIOWxGimmickPanel_h_INCLUDED__
2 #define __creaImageIOWxGimmickPanel_h_INCLUDED__
3
4 #ifdef USE_WXWIDGETS
5
6 // Signal/slot mechanism for progress events
7 #include <boost/signal.hpp>
8 #include <boost/bind.hpp>
9
10 #include <creaImageIOWxGimmickView.h>
11 #include <creaWx.h>
12
13 namespace creaImageIO
14 {
15   /**
16    * \ingroup GUI
17    */
18   //=====================================================================
19  //=====================================================================
20   class  CREAIMAGEIO_EXPORT WxGimmickPanel : public wxPanel
21   {
22   public:
23     WxGimmickPanel();    
24     WxGimmickPanel(wxWindow *parent, 
25                    const wxWindowID id,
26                    const wxPoint& pos, 
27                    const wxSize& size,
28                    const std::string i_namedescp , 
29                    const std::string i_namedb = "Local Database",
30                    int threads = 0);
31     
32     ~WxGimmickPanel();
33
34       //=============================================
35       typedef boost::signal<void (bool)> SendImageSignalType;
36       typedef SendImageSignalType::slot_function_type SendImageCallbackType;
37       //=============================================
38
39      //==================================================================
40       /// Adds the function f to the list of functions to call 
41       /// when the addition progresses.
42       /// f is of type ProgressCallbackType which is:
43       /// void (*ProgressCallbackType)(Progress&)
44       /// To pass a member function 'f' of an instance 'c' of a class 'C' 
45       /// as callback you have to 'bind' it, i.e. call:
46       /// ConnectSendImageObserver ( boost::bind( &C::f , c, _1 ) );
47       void ConnectSendImageObserver(SendImageCallbackType callback);
48      //==================================================================
49
50         //===============================================================================================
51         //Image Selection
52         //===============================================================================================
53
54     void GetSelectedImages(std::vector<vtkImageData*>& s, int dim)
55     { 
56         mView->GetSelectedImages(s, dim); 
57     }
58
59 //EED 28mai2010      Use new mechanism getSelected
60 //    void GetSelectedImagesInVector(std::vector<vtkImageData*>& s, int dim)
61 //    { 
62 //      mView->GetSelectedImagesInVector(s, dim); 
63 //    }
64
65
66         // ----get selected files in an Output structure-------
67         // out: vector structure output  < <img, info>, ... >
68         // i_attr: list of dicom tags to extract 
69         // mult: information of one file or multiple files
70         // outmodel: xml-filename that specifies images order..(todo) 
71         void getSelected(std::vector<OutStrGimmick> &outG,std::vector< std::string> i_attr, bool mult, const std::string outmodel)
72         {
73                 mView->getSelectedFiles(outG, i_attr, mult, outmodel);
74         }
75
76
77
78     void OnSelectedImage(bool t);
79
80     void AddImagesToDB(std::string dir);
81
82     //    DECLARE_EVENT_TABLE();
83   private :
84     
85         boost::shared_ptr<Gimmick>       mGimmick;
86     WxGimmickView* mView;
87
88         ///The sendImage signal
89     SendImageSignalType mSendImageSignal;
90
91   }; // class WxGimmickPanel
92   //=====================================================================
93
94   
95 } // EO namespace creaImageIO
96
97
98 #endif // USE_WIDGETS
99 // EOF
100 #endif