source: filezilla/trunk/fuentes/src/interface/LocalListView.h @ 3185

Last change on this file since 3185 was 3185, checked in by jrpelegrina, 3 years ago

Update new version: 3.15.02

File size: 3.2 KB
Line 
1#ifndef __LOCALLISTVIEW_H__
2#define __LOCALLISTVIEW_H__
3
4#include "filelistctrl.h"
5#include "state.h"
6
7class CQueueView;
8class CLocalListViewDropTarget;
9#ifdef __WXMSW__
10class CVolumeDescriptionEnumeratorThread;
11#endif
12
13class CLocalFileData final : public CGenericFileData
14{
15public:
16        wxString name;
17#ifdef __WXMSW__
18        CSparseOptional<wxString> label;
19#endif
20        fz::datetime time;
21        int64_t size;
22        int attributes;
23        bool dir;
24        bool is_dir() const { return dir; }
25};
26
27class CLocalListView : public CFileListCtrl<CLocalFileData>, CStateEventHandler
28{
29        friend class CLocalListViewDropTarget;
30        friend class CLocalListViewSortType;
31
32public:
33        CLocalListView(wxWindow* parent, CState *pState, CQueueView *pQueue);
34        virtual ~CLocalListView();
35
36protected:
37        void OnStateChange(CState* pState, enum t_statechange_notifications notification, const wxString& data, const void*);
38        bool DisplayDir(CLocalPath const& dirname);
39        void ApplyCurrentFilter();
40
41        // Declared const due to design error in wxWidgets.
42        // Won't be fixed since a fix would break backwards compatibility
43        // Both functions use a const_cast<CLocalListView *>(this) and modify
44        // the instance.
45        virtual int OnGetItemImage(long item) const;
46        virtual wxListItemAttr* OnGetItemAttr(long item) const;
47
48        // Clears all selections and returns the list of items that were selected
49        std::list<wxString> RememberSelectedItems(wxString& focused);
50
51        // Select a list of items based in their names.
52        // Sort order may not change between call to RememberSelectedItems and
53        // ReselectItems
54        void ReselectItems(const std::list<wxString>& selectedNames, wxString focused, bool ensureVisible = false);
55
56#ifdef __WXMSW__
57        void DisplayDrives();
58        void DisplayShares(wxString computer);
59#endif
60
61public:
62        virtual bool CanStartComparison();
63        virtual void StartComparison();
64        virtual bool get_next_file(wxString& name, bool &dir, int64_t &size, fz::datetime& date);
65        virtual void FinishComparison();
66
67        virtual bool ItemIsDir(int index) const;
68        virtual int64_t ItemGetSize(int index) const;
69
70protected:
71        virtual wxString GetItemText(int item, unsigned int column);
72
73        bool IsItemValid(unsigned int item) const;
74        CLocalFileData *GetData(unsigned int item);
75
76        virtual CSortComparisonObject GetSortComparisonObject();
77
78        void RefreshFile(const wxString& file);
79
80        virtual void OnNavigationEvent(bool forward);
81
82        virtual bool OnBeginRename(const wxListEvent& event);
83        virtual bool OnAcceptRename(const wxListEvent& event);
84
85        CLocalPath m_dir;
86
87        int m_dropTarget;
88
89        wxString MenuMkdir();
90
91        // Event handlers
92        DECLARE_EVENT_TABLE()
93        void OnItemActivated(wxListEvent& event);
94        void OnContextMenu(wxContextMenuEvent& event);
95        void OnMenuUpload(wxCommandEvent& event);
96        void OnMenuMkdir(wxCommandEvent& event);
97        void OnMenuMkdirChgDir(wxCommandEvent&);
98        void OnMenuDelete(wxCommandEvent& event);
99        void OnMenuRename(wxCommandEvent& event);
100        void OnKeyDown(wxKeyEvent& event);
101        void OnBeginDrag(wxListEvent& event);
102        void OnMenuOpen(wxCommandEvent& event);
103        void OnMenuEdit(wxCommandEvent& event);
104        void OnMenuEnter(wxCommandEvent& event);
105#ifdef __WXMSW__
106        void OnVolumesEnumerated(wxCommandEvent& event);
107        CVolumeDescriptionEnumeratorThread* m_pVolumeEnumeratorThread;
108#endif
109        void OnMenuRefresh(wxCommandEvent& event);
110};
111
112#endif
Note: See TracBrowser for help on using the repository browser.