CPListFrame.h

Go to the documentation of this file.
00001 // -*- c-basic-offset: 4 -*-
00024 #ifndef _CPLISTFRAME_H
00025 #define _CPLISTFRAME_H
00026 
00027 #include <wx/xrc/xh_listc.h>
00028 #include <vector>
00029 
00030 class MainFrame;
00031 
00033 struct CPListItem
00034 {
00035     size_t globalIndex;
00036     size_t localNumber;
00037 };
00038 
00043 class CPListCtrl : public wxListView, public HuginBase::PanoramaObserver
00044 {
00045 public:
00046     CPListCtrl();
00047     ~CPListCtrl();
00048     bool Create(wxWindow *parent,
00049         wxWindowID id = wxID_ANY,
00050         const wxPoint& pos = wxDefaultPosition,
00051         const wxSize& size = wxDefaultSize,
00052         long style = wxLC_REPORT | wxLC_VIRTUAL,
00053         const wxValidator& validator = wxDefaultValidator,
00054         const wxString& name = wxListCtrlNameStr);
00055 
00056     void Init(HuginBase::Panorama* pano);
00057     virtual void panoramaChanged(HuginBase::Panorama &pano);
00058     virtual void panoramaImagesChanged(HuginBase::Panorama &pano, const HuginBase::UIntSet& changed) {};
00060     void DeleteSelected();
00062     void SelectDistanceThreshold(double threshold);
00064     void SelectAll();
00065 protected:
00067     virtual wxString OnGetItemText(long item, long column) const;
00069     void OnCPListSelectionChanged(wxListEvent & e);
00071     void OnCPListHeaderClick(wxListEvent & e);
00073     void OnColumnWidthChange(wxListEvent & e);
00075     void OnChar(wxKeyEvent& e);
00076 private:
00077     void UpdateInternalCPList();
00078     void SortInternalList(bool isAscending);
00079 
00080     HuginBase::Panorama* m_pano;
00081     // current sorting column
00082     int m_sortCol;
00083     bool m_sortAscend;
00084     std::vector<CPListItem> m_internalCPList;
00085     std::map<std::string, int> m_localIds;
00086 
00087     DECLARE_EVENT_TABLE()
00088     DECLARE_DYNAMIC_CLASS(CPListCtrl)
00089 };
00090 
00092 class CPListCtrlXmlHandler : public wxListCtrlXmlHandler
00093 {
00094     DECLARE_DYNAMIC_CLASS(CPListCtrlXmlHandler)
00095 
00096 public:
00098     CPListCtrlXmlHandler();
00100     virtual wxObject *DoCreateResource();
00102     virtual bool CanHandle(wxXmlNode *node);
00103 };
00104 
00105 class CPListFrame : public wxFrame
00106 {
00107 public:
00110     CPListFrame(wxFrame* parent, HuginBase::Panorama & pano);
00111         
00114     virtual ~CPListFrame();
00115 
00116 protected:
00117     void OnDeleteButton(wxCommandEvent & e);
00118     void OnSelectButton(wxCommandEvent & e);
00119     void OnClose(wxCloseEvent& event);
00120 private:
00121     CPListCtrl* m_list;
00122     HuginBase::Panorama& m_pano;
00123     // needed for receiving events.
00124     DECLARE_EVENT_TABLE();
00125 };
00126 
00127 
00128 
00129 #endif // _CPLISTFRAME_H

Generated on 27 Aug 2015 for Hugintrunk by  doxygen 1.4.7