Version: 0.6.0
dataobject.h
1 /******************************************************************************
2  * Project: wxGIS (GIS Catalog)
3  * Purpose: A DataObject represents data that can be copied to or from the clipboard, or dragged and dropped.
4  * Author: Dmitry Baryshnikov (aka Bishop), polimax@mail.ru
5  ******************************************************************************
6 * Copyright (C) 2012 Dmitry Baryshnikov
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  ****************************************************************************/
21 #pragma once
22 
23 #include "wxgis/framework/framework.h"
24 
25 #ifdef wxUSE_DRAG_AND_DROP
26 
34 class WXDLLIMPEXP_GIS_FRW wxGISStringDataObject : public wxDataObjectSimple
35 {
36 public:
37  // ctor: use AddFile() later to fill the array
38  wxGISStringDataObject(const wxDataFormat &format = wxFormatInvalid);
39 
40  // get a reference to our array
41  const wxArrayString& GetStrings() const { return m_oaStrings; }
42  // implement base class pure virtuals
43  virtual bool SetData(size_t len, const void *buf);
44  virtual size_t GetDataSize() const;
45  virtual bool GetDataHere(void *pData) const;
46  virtual void AddString(const wxString& sStr);
47 
48 protected:
49  wxArrayString m_oaStrings;
50 
51  static const size_t sizeOfChar = sizeof(wxChar);
52  static const size_t sizeOfsize_t = sizeof(size_t);
53 
54 private:
55  wxDECLARE_NO_COPY_CLASS(wxGISStringDataObject);
56 };
57 
65 class WXDLLIMPEXP_GIS_FRW wxGISDecimalDataObject : public wxDataObjectSimple
66 {
67 public:
68  // ctor: use AddFile() later to fill the array
69  wxGISDecimalDataObject(const wxDataFormat &format = wxFormatInvalid);
70 
71  // get a reference to our array
72  const wxArrayLong& GetDecimals() const { return m_oaDecimals; }
73  // implement base class pure virtuals
74  virtual bool SetData(size_t len, const void *buf);
75  virtual size_t GetDataSize() const;
76  virtual bool GetDataHere(void *pData) const;
77  //
78  virtual void AddDecimal(long nValue);
79 
80 protected:
81  wxArrayLong m_oaDecimals;
82 
83  static const size_t sizeOfLong = sizeof(long);
84  static const size_t sizeOfsize_t = sizeof(size_t);
85 
86 private:
87  wxDECLARE_NO_COPY_CLASS(wxGISDecimalDataObject);
88 };
89 
90 
98 class WXDLLIMPEXP_GIS_FRW wxGISTaskDataObject : public wxGISDecimalDataObject
99 {
100 public:
101  // ctor: use AddFile() later to fill the array
102  wxGISTaskDataObject(long nParentPointer, const wxDataFormat &format = wxFormatInvalid);
103 
104  virtual bool SetData(size_t len, const void *buf);
105  virtual size_t GetDataSize() const;
106  virtual bool GetDataHere(void *pData) const;
107  //
108  const long GetParentPointer() const { return m_nParentPointer; }
109 
110 
111 protected:
112  long m_nParentPointer;//window id for prevent cross app dnd
113 
114 private:
115  wxDECLARE_NO_COPY_CLASS(wxGISTaskDataObject);
116 };
117 
118 #endif // wxUSE_DRAG_AND_DROP