creaImageIOWxTreeView.h

Go to the documentation of this file.
00001 #ifndef __creaImageIOWxTreeView_h_INCLUDED__
00002 #define __creaImageIOWxTreeView_h_INCLUDED__
00003 
00004 #ifdef USE_WXWIDGETS
00005 
00006 #include <creaImageIOTreeView.h>
00007 #include <creaWx.h>
00008 
00009 #include <wx/listctrl.h>
00010 #include <wx/splitter.h>
00011 //#include <vector>
00012 
00013 namespace creaImageIO
00014 {
00015 
00019   //=====================================================================
00020   
00021   //=====================================================================
00023   class WxTreeView : public wxPanel, virtual public TreeView
00024     {
00025     public:
00027       WxTreeView(TreeHandler*, GimmickView*, 
00028                  wxWindow* parent, const wxWindowID id);
00030       virtual ~WxTreeView();
00031 
00032       
00034       virtual void UpdateLevel( int );
00035 
00037       virtual void RemoveSelected();
00038 
00040           virtual unsigned int GetLastSelectedLevel(){return mLastLevel;}
00041 
00043       void OnItemSelected(wxListEvent& event);
00044 
00046       void OnItemDeSelected(wxListEvent& event);
00047       
00049       void OnColClick(wxListEvent& event);
00050       
00052       void OnPopupSort(wxCommandEvent& event);
00053       
00055       void OnPopupFilter(wxCommandEvent& event);
00056 
00058       void OnLocalCopy(wxCommandEvent& event);
00059 
00061       void OnEditField(wxCommandEvent& event);
00062       
00064       void OnMouseClick(wxMouseEvent& event);
00065 
00067           void OnItemMenu(wxListEvent &event);
00068           
00070           void GetAttributes(std::vector<std::string>& areShown, std::vector<std::string>& notShown, int level);
00071 
00073           void SetNonVisibleAttributes(const std::vector<std::string>& notShown, int level);
00074 
00076           void CreateCtrl(std::vector<std::string>& notShown, int nlevel);
00077   
00079           bool IsAttributeVisible(const std::string& val, int level);
00080       
00083       //      void ProcessItem
00084     private:
00088       struct LevelType
00089       {
00090         // The List Control
00091         wxListCtrl* wxCtrl;
00092         wxSplitterWindow* wxSplitter;
00093         std::vector<std::string> key;
00094         // The vector of currently selected nodes of the level
00095         std::vector<tree::Node*> Selected;
00096         // True iff the vector Selected is up to date
00097         bool SelectedUpToDate;
00098         // The column used for sorting
00099         unsigned int SortColumn;
00102         bool SortAscending;
00103         //The vector of not shown attributes
00104         std::vector<std::string> notShownAtts; 
00105       };
00107       std::vector<LevelType> mLevelList;
00108       
00110       wxListCtrl* GetCtrl(int l) { return mLevelList[l].wxCtrl; }
00112       wxSplitterWindow* GetSplitter(int l) { return mLevelList[l].wxSplitter; }
00113       //Returns the maximum number of levels
00114       int GetNumberOfLevels(){ return mLevelList.size(); }
00117       const std::vector<tree::Node*>& GetSelected(int level);
00119       void SetSelectedUpToDate(int l, bool v) { mLevelList[l].SelectedUpToDate = v; }
00121       bool GetSelectedUpToDate(int l) { return mLevelList[l].SelectedUpToDate; }
00123       void ValidateSelectedImages(bool isSelection);   
00125       void GetSelectedAsString(std::vector<std::string>&s);
00127           void GetFilenamesAsString(const std::vector<tree::Node*>& nodes, std::vector<std::string>&s);
00129       void GetNodes(std::vector<tree::Node*>& nodes, bool direction);
00132       virtual void RecursiveUpdateLevel( int );
00134       void SetColor(int level, int item);
00136       void CreateColorPalette();
00138       void SelectAll(int level);
00140       void UnSelectAll(int level);
00141 
00142           void OnKeyDown(wxListEvent &event);
00144       void SortLevel(int level);
00145       
00147       int mColumnSelected;
00149       long mLastSelected;
00150 
00152           long mLastRightSelected;
00153 
00155           int mLastRightLevel;
00157       typedef std::map<tree::Node*,wxColour> ColorMap;
00158       typedef std::pair<tree::Node*,wxColour> NodeColorPair;
00159       ColorMap mColorMap;
00161       std::vector<std::string> mColorPalette;
00162 
00163       wxMenu* menu;
00164           
00165       wxObject* senderCtrl;
00166       int mAscendingID;
00167       int mDescendingID;
00168       int mFilterID;
00169       unsigned int mLastLevel;
00170       
00171           wxMenu* menuItem;
00172           int mAnonymizingID;
00173           int mLocalCopyID;
00174           int mEditFieldID;
00175           
00176       // If set to true then OnSelectedChanged returns immediately.
00177       // Used to do avoid useless process during multiple selections 
00178       // or sorting
00179       bool mIgnoreSelectedChanged;
00180 
00181 
00182       DECLARE_EVENT_TABLE()
00183     };
00184     // EO class WxTreeView
00185     //=====================================================================
00186 
00187 
00188 
00189 } // EO namespace creaImageIO
00190 
00191 
00192 #endif // USE_WIDGETS
00193 // EOF
00194 #endif  

Generated on Mon Jun 22 10:49:30 2009 for CreaImageIO by  doxygen 1.5.3