update for HEAD-2003091401
[reactos.git] / subsys / system / explorer / Seashell / SeaShellExt / Include / IEShellListCtrl.h
1 //*******************************************************************************
2 // COPYRIGHT NOTES
3 // ---------------
4 // You may use this source code, compile or redistribute it as part of your application 
5 // for free. You cannot redistribute it as a part of a software development 
6 // library without the agreement of the author. If the sources are 
7 // distributed along with the application, you should leave the original 
8 // copyright notes in the source code without any changes.
9 // This code can be used WITHOUT ANY WARRANTIES at your own risk.
10 // 
11 // For the latest updates to this code, check this site:
12 // http://www.masmex.com 
13 // after Sept 2000
14 // 
15 // Copyright(C) 2000 Philip Oldaker <email: philip@masmex.com>
16 //*******************************************************************************
17
18 #ifndef __IESHELLLISTCTRL_H__
19 #define __IESHELLLISTCTRL_H__
20
21 #ifndef __AFXMT_H__
22 #include "afxmt.h"
23 #endif
24
25 #if _MSC_VER > 1000
26 #pragma once
27 #endif // _MSC_VER > 1000
28
29 typedef struct SLC_COLUMN_DATA
30 {
31         SLC_COLUMN_DATA() { pidl = NULL; iImage = -1;} 
32         CStringArray sItems;
33         LPITEMIDLIST pidl;
34         int iImage;
35 } SLC_COLUMN_DATA, *PSLC_COLUMN_DATA;
36
37 class CCF_HDROP;
38
39 // IEShellListCtrl.h : header file
40 //
41 #include <afxpriv.h>
42 #include "UICtrl.h"
43 #include "ShellPidl.h"
44 #include "ShellDetails.h"
45 #include "ShellSettings.h"
46 #include "Refresh.h"
47 #include "IEShellDragDrop.h"
48 /////////////////////////////////////////////////////////////////////////////
49 // CIEShellListCtrl window
50 #include <vector>
51 using namespace std;
52 typedef vector<LPLVITEMDATA> vecListItemData;
53
54 class CTRL_EXT_CLASS CIEShellListCtrl : public CUIODListCtrl
55 {
56 // Construction
57 public:
58         CIEShellListCtrl();
59
60         enum Cols
61         {
62                 COL_NAME,
63                 COL_SIZE,
64                 COL_TYPE,
65                 COL_MODIFIED,
66                 COL_MAX
67         };
68 // Attributes
69 public:
70         void SetFileFilter(LPCTSTR pszFilter) { m_sFileFilter = pszFilter; }
71         CString GetFileFilter() { return m_sFileFilter.IsEmpty() ? _T("*.*") : m_sFileFilter; }
72         void SetNotifyParent(bool bNotifyParent) { m_bNotifyParent = bNotifyParent; }
73         void NoExtAllowed() { m_bNoExt = true; }
74         void ExcludeFileType(LPCTSTR pszType) { m_ExcludedLookup.AddHead(pszType); }
75         CStringList &GetExcludedFileTypes() { return m_ExcludedLookup; }
76         void FillExcludedFileTypes(CComboBox &cb);
77         void SetExcludedFileTypes(CComboBox &cb);
78         bool RefreshAllowed() { return m_bRefreshAllowed; }
79         void SetRefreshAllowed(bool bRefresh) { m_bRefreshAllowed = bRefresh; } 
80         CShellPidl &GetShellPidl() { return m_ShellPidl; }
81         LPMALLOC GetMalloc() { return m_pMalloc; }
82         LPTVITEMDATA GetTVID() { return &m_tvid; }
83         LPSHELLFOLDER GetShellFolder() { return m_tvid.lpsfParent; }
84         bool GetCallBack() { return m_bCallBack; }
85         CString GetPathName(int nRow);
86         CString GetCurrPathName();
87         LPCITEMIDLIST GetPathPidl(int nRow);
88         const CShellSettings &GetShellSettings() const;
89         CShellSettings &GetShellSettings();
90 // Operations
91 public:
92         virtual void PopupTheMenu(int nRow,CPoint point);
93         virtual void ShellExecute(int nRow,LPCTSTR pszVerb=NULL);
94         virtual void SetNotificationObject(bool bNotify);
95         virtual BOOL Populate(LPTVITEMDATA lptvid,LPSHELLFOLDER psfFolder,bool bCallBack);
96         virtual BOOL Populate(LPCTSTR pszPath, bool bCallBack=false);
97         virtual BOOL Populate(LPTVITEMDATA lptvid);
98         virtual void Refresh();
99         virtual void StartPopulate();
100         virtual void EndPopulate();
101 // Overridables
102 protected:
103         virtual void DestroyThreads();
104         virtual void Load();
105         virtual void SetColumnWidths();
106         virtual void RemoveExt(LPTSTR pszFileName);
107         virtual void InitColumns();
108         virtual CString GetColumns();
109         virtual BOOL InitImageLists();
110         virtual BOOL InitItems(LPTVITEMDATA lptvid, bool bCallBack);
111         virtual void InitShellSettings();
112         virtual bool FilterItem(LPSHELLFOLDER pFolder,LPCITEMIDLIST pidl,UINT ulAttrs);
113         virtual bool GetColText(int nCol,LPCITEMIDLIST pidlAbs,LPLVITEMDATA lplvid,CString &sText);
114         virtual void GetText(PSLC_COLUMN_DATA pColData,LV_DISPINFO *pDispInfo,LPLVITEMDATA lplvid);
115         virtual void GetFileDetails(LPCITEMIDLIST pidl, CString &sSize, CString &sDateTime);
116         virtual void CreateFileChangeThread(HWND hwnd);
117         virtual void FreeTVID();
118         virtual void FreeInterface(IUnknown *pInterface);
119         virtual bool UseShellColumns();
120         virtual LPCTSTR GetFilterMask(LPCTSTR pszFilter,CString &sMask);
121 private:
122         void LoadFilterFiles(const CString &sFileFilter);
123 // Overrides    
124         // ClassWizard generated virtual function overrides
125         //{{AFX_VIRTUAL(CIEShellListCtrl)
126         public:
127         virtual void ChangeStyle(UINT &dwStyle);
128         virtual void Init();
129         protected:
130         virtual void GoBack(int nRow);
131         virtual void ShowPopupMenu(int nRow,int nCol,CPoint point);
132         virtual BOOL OnEnter(NM_LISTVIEW* pNMListView);
133         virtual BOOL DoubleClick(NM_LISTVIEW* pNMListView);
134         virtual void PreSubclassWindow();
135         virtual bool DragOver(CDD_OleDropTargetInfo *pInfo);
136         virtual bool DragLeave(CDD_OleDropTargetInfo *pInfo);
137         virtual bool DragEnter(CDD_OleDropTargetInfo *pInfo);
138         virtual bool DragDrop(CDD_OleDropTargetInfo *pInfo);
139         virtual BOOL GetDispInfo(LV_DISPINFO *pDispInfo);
140         virtual PFNLVCOMPARE GetCompareFunc();
141         virtual void AllItemsDeleted();
142         virtual DROPEFFECT DoDragDrop(int *pnRows,COleDataSource *pOleDataSource);
143         virtual bool EndLabelEdit(int nRow,int nCol,LPCTSTR pszText);
144         //}}AFX_VIRTUAL
145 // Implementation
146 public:
147         virtual ~CIEShellListCtrl();
148
149 // Generated message map functions
150 protected:
151         //{{AFX_MSG(CIEShellListCtrl)
152                         // NOTE - the ClassWizard will add and remove member functions here.
153         afx_msg void OnDestroy();
154         afx_msg void OnMenuSelect(UINT nItemID, UINT nFlags, HMENU hSysMenu);
155         afx_msg LRESULT OnAppFileChangeNewPath(WPARAM wParam, LPARAM lParam);
156         afx_msg LRESULT OnAppFileChangeEvent(WPARAM wParam, LPARAM lParam);
157         afx_msg LRESULT OnAppUpdateAllViews(WPARAM wParam, LPARAM lParam );
158         afx_msg LRESULT OnSettingChange(WPARAM wParam,LPARAM lParam);
159         afx_msg LRESULT OnSetmessagestring(WPARAM wParam, LPARAM lParam );
160         //}}AFX_MSG
161         afx_msg LRESULT OnAppDeleteKey(WPARAM wParam, LPARAM lParam);
162         afx_msg LRESULT OnAppPropertiesKey(WPARAM wParam, LPARAM lParam);
163         DECLARE_MESSAGE_MAP()
164 private:
165         static UINT ThreadFunc (LPVOID pParam);
166         enum { MAX_THREADS=1 };
167
168         vecListItemData m_vecItemData;
169         CShellPidl m_ShellPidl;
170         TVITEMDATA m_tvid;
171         LPSHELLFOLDER m_psfSubFolder;
172         LPITEMIDLIST m_pidlInternet;
173         IMalloc *m_pMalloc;
174         HANDLE m_hThreads[MAX_THREADS];
175         CWinThread *m_pThreads[MAX_THREADS];
176         CEvent m_event[MAX_THREADS];
177         CEvent m_MonitorEvent[MAX_THREADS];
178         CString m_sMonitorPath;
179         CIEShellDragDrop m_ShellDragDrop;
180         CShellDetails m_ShellDetails;
181         CShellSettings m_ShellSettings;
182         CString m_sColumns;
183         CString m_sFileFilter;
184         CStringList m_FilterLookup;
185         CStringList m_ExcludedLookup;
186         int m_nThreadCount;
187         bool m_bCallBack;
188         bool m_bNoExt;
189         bool m_bRefreshAllowed;
190         bool m_bPopulateInit;
191         bool m_bInitiliazed;
192         bool m_bNotifyParent;
193 };
194 /////////////////////////////////////////////////////////////////////////////
195 typedef struct FC_THREADINFO
196 {
197     HANDLE hEvent;
198         HANDLE hMonitorEvent;
199     CIEShellListCtrl *pListCtrl;
200 } FC_THREADINFO, *PFC_THREADINFO;
201
202 inline const CShellSettings &CIEShellListCtrl::GetShellSettings() const
203 {
204         return m_ShellSettings;
205 }
206
207 inline CShellSettings &CIEShellListCtrl::GetShellSettings()
208 {
209         return m_ShellSettings;
210 }
211
212 //{{AFX_INSERT_LOCATION}}
213 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
214
215 #endif //__IESHELLLISTCTRL_H__