update for HEAD-2003091401
[reactos.git] / subsys / system / explorer / Seashell / SeaShellExt / Include / cbformats.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
19 #if !defined(AFX_IMSELECTION_H__BE28E652_2B85_11d1_9B50_006008284B53__INCLUDED_)
20 #define AFX_IMSELECTION_H__BE28E652_2B85_11d1_9B50_006008284B53__INCLUDED_
21 #if _MSC_VER >= 1000
22 #pragma once
23 #endif // _MSC_VER >= 1000
24
25
26 #ifndef DROPEFFECT_ALL
27 #define DROPEFFECT_ALL DROPEFFECT_COPY | DROPEFFECT_MOVE | DROPEFFECT_LINK
28 #endif
29
30 //////////////////////////////////////////
31 class CTRL_EXT_CLASS CCF_App : public CObject
32 {
33 public:
34         CCF_App() : m_hWnd(NULL) {};
35         void SetHwnd(HWND hWnd);
36         HANDLE GetHwnd();
37         virtual void Serialize(CArchive &ar);
38 private:
39         HWND m_hWnd;
40         DECLARE_SERIAL(CCF_App)
41 };
42
43 inline void CCF_App::SetHwnd(HWND hWnd)
44 {
45         m_hWnd = hWnd;
46 }
47
48 inline HANDLE CCF_App::GetHwnd()
49 {
50         return m_hWnd;
51 }
52
53 //////////////////////////////////////////
54 class CTRL_EXT_CLASS CCF_FolderType : public CObject
55 {
56 public:
57         CCF_FolderType(LPCTSTR pszParentCategory,long nCategory,LPCTSTR pszCategory);
58         CCF_FolderType() { m_nCategory=0; };
59         ~CCF_FolderType();
60 public:
61         CCF_FolderType(const CCF_FolderType &WebSite);
62         const CCF_FolderType &operator=(const CCF_FolderType &rThat);
63         // virtual
64         virtual void Serialize(CArchive &ar);
65         // inline
66         CString GetParentCategory();
67         long GetCategory();
68         CString GetCategoryName();
69 protected:
70         long m_nCategory;
71         CString m_strParentCategory;
72         CString m_strCategory;
73
74         DECLARE_SERIAL(CCF_FolderType)
75 };
76
77 inline CString CCF_FolderType::GetParentCategory()
78 {
79         return m_strParentCategory;
80 }
81
82 inline long CCF_FolderType::GetCategory()
83 {
84         return m_nCategory;
85 }
86
87 inline CString CCF_FolderType::GetCategoryName()
88 {
89         return m_strCategory;
90 }
91
92 //////////////////////////////////////////
93 class CTRL_EXT_CLASS CCF_ShellIDList : public CObject
94 {
95 public:
96         CCF_ShellIDList();
97         virtual ~CCF_ShellIDList();
98 public:
99         // virtual
100         virtual void Serialize(CArchive &ar);
101         virtual void AddPidl(LPCITEMIDLIST pidl);
102         virtual LPCITEMIDLIST GetPidl(UINT nIndex) const;
103         virtual UINT GetCount() const;
104         LPCITEMIDLIST operator[](UINT nIndex) const;
105 protected:
106         DECLARE_SERIAL(CCF_ShellIDList)
107 private:
108         typedef CArray<LPCITEMIDLIST,LPCITEMIDLIST> arItemIDList;
109         arItemIDList m_pidls;
110 };
111
112
113 //////////////////////////////////////////
114 class CTRL_EXT_CLASS CCF_WebSite : public CObject
115 {
116 public:
117         CCF_WebSite() {};
118         CCF_WebSite(LPCTSTR pszURL,LPCTSTR pszTitle);
119         ~CCF_WebSite();
120 public:
121         CCF_WebSite(const CCF_WebSite &WebSite);
122         const CCF_WebSite &operator=(const CCF_WebSite &rThat);
123         // virtual
124         virtual void Serialize(CArchive &ar);
125         // inline
126         virtual LPCTSTR GetURL();
127         virtual LPCTSTR GetTitle();
128 protected:
129         CString m_strURL;
130         CString m_strTitle;
131 //
132         DECLARE_SERIAL(CCF_WebSite)
133 };
134
135 inline  LPCTSTR CCF_WebSite::GetURL()
136 {
137         return m_strURL;
138 }
139
140 inline  LPCTSTR CCF_WebSite::GetTitle()
141 {
142         return m_strTitle;
143 }
144
145 class CTRL_EXT_CLASS CCF_DBFolderList : public CList<CCF_FolderType,CCF_FolderType&>
146 {
147 public:
148         CCF_DBFolderList(HWND hWnd=NULL) { m_App.SetHwnd(hWnd); };
149         ~CCF_DBFolderList() {};
150         void SetDatabase(const CString &strDatabase);
151         CString GetDatabase() const;
152         virtual void Serialize(CArchive &ar);
153 public:
154         CCF_App m_App;
155 protected:
156         CString m_strDatabase;
157         DECLARE_SERIAL(CCF_DBFolderList)
158 };
159
160 inline void CCF_DBFolderList::SetDatabase(const CString &strDatabase)
161 {
162         m_strDatabase = strDatabase;
163 }
164
165 inline CString CCF_DBFolderList::GetDatabase() const
166 {
167         return m_strDatabase;
168 }
169
170 // template CCF_DBFolderList
171 /////////////////////////////////////
172 template<> void CTRL_EXT_CLASS AFXAPI SerializeElements <CCF_FolderType>(CArchive& ar, CCF_FolderType *pWebSiteCategory, int nCount );
173 template<> void CTRL_EXT_CLASS AFXAPI DestructElements<CCF_FolderType>(CCF_FolderType *pElements, int nCount);
174 template<> void CTRL_EXT_CLASS AFXAPI ConstructElements<CCF_FolderType>(CCF_FolderType *pElements, int nCount);
175
176 // template CList
177 /////////////////////////////////////
178 typedef CList<CCF_WebSite,CCF_WebSite&> CListWebSites;
179 template<> void CTRL_EXT_CLASS AFXAPI SerializeElements <CCF_WebSite>(CArchive& ar, CCF_WebSite *pWebSite, int nCount );
180 template<> void CTRL_EXT_CLASS AFXAPI DestructElements<CCF_WebSite>(CCF_WebSite *pElements, int nCount);
181 template<> void CTRL_EXT_CLASS AFXAPI ConstructElements<CCF_WebSite>(CCF_WebSite *pElements, int nCount);
182
183 /////////////////////////////////////
184 class CTRL_EXT_CLASS CCF_WebSites : public CObject
185 {
186 public:
187         CCF_WebSites(HWND hWnd=NULL) { m_App.SetHwnd(hWnd); };
188         ~CCF_WebSites() {};
189         CListWebSites &GetListWebSites();
190         POSITION GetHeadPosition();
191         CCF_WebSite &GetNext(POSITION &pos);
192         virtual void Serialize(CArchive &ar);
193 protected:
194         CCF_App m_App;
195         CListWebSites m_listWebSites;
196         DECLARE_SERIAL(CCF_WebSites)
197 };
198
199 inline CCF_WebSite &CCF_WebSites::GetNext(POSITION &pos)
200 {
201         return m_listWebSites.GetNext(pos);
202 }
203
204 inline POSITION CCF_WebSites::GetHeadPosition()
205 {
206         return m_listWebSites.GetHeadPosition();
207 }
208
209 inline CListWebSites &CCF_WebSites::GetListWebSites()
210 {
211         return m_listWebSites;
212 }
213
214 //////////////////////////////////////////
215 class CTRL_EXT_CLASS CCF_String : public CObject
216 {
217 public:
218         CCF_String() {};
219         CCF_String(LPCTSTR pszText);
220         ~CCF_String();
221 public:
222         // virtual
223         virtual void Serialize(CArchive &ar);
224         virtual LPCTSTR GetString();
225         void SetString(LPCTSTR pszText);
226         DECLARE_SERIAL(CCF_String)
227 private:
228         CString m_sText;
229 };
230
231 class CTRL_EXT_CLASS CCF_RightMenu : public CObject
232 {
233 public:
234         CCF_RightMenu() { m_bRightDrag = false; };
235         ~CCF_RightMenu() {};
236 public:
237         void SetRightDrag(bool bRightDrag);
238         // virtual
239         virtual void Serialize(CArchive &ar);
240         virtual bool IsRightDrag();
241
242         DECLARE_SERIAL(CCF_RightMenu)
243 private:
244         bool m_bRightDrag;
245 };
246
247 class CTRL_EXT_CLASS CCF_FileGroupDescriptor : public CObject
248 {
249 public:
250         CCF_FileGroupDescriptor();
251         ~CCF_FileGroupDescriptor();
252 public:
253         CString GetFileName(UINT nItem);
254         CString GetTitle(UINT nItem);
255         void SetTitle(const CString &sTitle);
256         LPFILEDESCRIPTOR GetFileDescriptor(UINT nItem);
257         // virtual
258         virtual void Serialize(CArchive &ar);
259
260         DECLARE_SERIAL(CCF_FileGroupDescriptor)
261 private:
262         CString m_sTitle;
263         UINT m_nItems;
264         LPFILEDESCRIPTOR m_pFileDescrs;
265 };
266
267 //////////////////////////////////
268 class CTRL_EXT_CLASS CCF_HDROP : public CObject
269 {
270 public:
271         CCF_HDROP();
272         ~CCF_HDROP();
273 public:
274         UINT GetCount() { return m_sFileNames.GetSize(); }
275         CString GetFileName(UINT nItem);
276         void AddFileName(LPCTSTR pszFileName);
277         void AddDropPoint(CPoint &pt,BOOL bfNC=FALSE);
278         // virtual
279         virtual void Serialize(CArchive &ar);
280
281         DECLARE_SERIAL(CCF_HDROP)
282 private:
283         CStringArray m_sFileNames;
284         int m_nFiles;
285         CPoint m_pt;
286         BOOL m_fNC;
287 };
288
289 class CTRL_EXT_CLASS CWDClipboardData : public CObject
290 {
291 public:
292         enum eCBFormats
293         {
294                 e_cfString,
295                 e_cfHDROP,
296                 e_cfWebSiteURL,
297                 e_cfWebSite,
298                 e_cfHTMLFormat,
299                 e_cfFolder,
300                 e_cfRightMenu,
301                 e_cfFileGroupDesc,
302                 e_cfShellIDList,
303                 e_cfMax
304         };
305         CWDClipboardData();
306         ~CWDClipboardData();
307 public:
308         void SetData(COleDataSource *pDataSource,CObject *pObj,eCBFormats format,LPFORMATETC lpFormatEtc=NULL);
309         bool GetData(COleDataObject *pDataObject,CObject *pObj,eCBFormats format);
310         CLIPFORMAT GetClipboardFormat(eCBFormats format);
311         bool IsDataAvailable(COleDataObject *pDataObject);
312         static CWDClipboardData *Instance();
313 protected:
314         bool IsValidFormat(CLIPFORMAT cfFormat);
315 private:
316         CLIPFORMAT m_aFormatIDs[e_cfMax];
317 };
318
319 #endif // BE28E652-2B85-11d1-9B50-006008284B53
320