wxDataObejct and related changes (won't compile right now)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4089 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
68
include/wx/msw/ole/dataform.h
Normal file
68
include/wx/msw/ole/dataform.h
Normal file
@@ -0,0 +1,68 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: msw/ole/dataform.h
|
||||
// Purpose: declaration of the wxDataFormat class
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 19.10.99 (extracted from msw/ole/dataobj.h)
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_MSW_OLE_DATAFORM_H
|
||||
#define _WX_MSW_OLE_DATAFORM_H
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDataFormat identifies the single format of data
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxDataFormat
|
||||
{
|
||||
public:
|
||||
// the clipboard formats under Win32 are UINTs
|
||||
typedef unsigned int NativeFormat;
|
||||
|
||||
wxDataFormat(NativeFormat format = wxDF_INVALID) { m_format = format; }
|
||||
wxDataFormat(const wxChar *format) { SetId(format); }
|
||||
|
||||
wxDataFormat& operator=(NativeFormat format)
|
||||
{ m_format = format; return *this; }
|
||||
wxDataFormat& operator=(const wxDataFormat& format)
|
||||
{ m_format = format.m_format; return *this; }
|
||||
|
||||
// default copy ctor/assignment operators ok
|
||||
|
||||
// comparison (must have both versions)
|
||||
bool operator==(wxDataFormatId format) const
|
||||
{ return m_format == (NativeFormat)format; }
|
||||
bool operator!=(wxDataFormatId format) const
|
||||
{ return m_format != (NativeFormat)format; }
|
||||
bool operator==(const wxDataFormat& format) const
|
||||
{ return m_format == format.m_format; }
|
||||
bool operator!=(const wxDataFormat& format) const
|
||||
{ return m_format != format.m_format; }
|
||||
|
||||
// explicit and implicit conversions to NativeFormat which is one of
|
||||
// standard data types (implicit conversion is useful for preserving the
|
||||
// compatibility with old code)
|
||||
NativeFormat GetFormatId() const { return m_format; }
|
||||
operator NativeFormat() const { return m_format; }
|
||||
|
||||
// this only works with standard ids
|
||||
void SetType(wxDataFormatId format) { m_format = format; }
|
||||
wxDataFormatId GetType() const { return m_format; }
|
||||
|
||||
// string ids are used for custom types - this SetId() must be used for
|
||||
// application-specific formats
|
||||
wxString GetId() const;
|
||||
void SetId(const wxChar *format);
|
||||
|
||||
private:
|
||||
// returns TRUE if the format is one of those defined in wxDataFormatId
|
||||
bool IsStandard() const { return m_format > 0 && m_format < wxDF_MAX; }
|
||||
|
||||
NativeFormat m_format;
|
||||
};
|
||||
|
||||
#endif // _WX_MSW_OLE_DATAFORM_H
|
||||
|
@@ -1,67 +1,16 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: ole/dataobj.h
|
||||
// Name: msw/ole/dataobj.h
|
||||
// Purpose: declaration of the wxDataObject class
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Modified by:
|
||||
// Created: 10.05.98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_OLEDATAOBJ_H
|
||||
#define _WX_OLEDATAOBJ_H
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDataFormat identifies the single format of data
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxDataFormat
|
||||
{
|
||||
public:
|
||||
// the clipboard formats under Win32 are UINTs
|
||||
typedef unsigned int NativeFormat;
|
||||
|
||||
wxDataFormat(NativeFormat format = wxDF_INVALID) { m_format = format; }
|
||||
wxDataFormat(const wxChar *format) { SetId(format); }
|
||||
|
||||
wxDataFormat& operator=(NativeFormat format)
|
||||
{ m_format = format; return *this; }
|
||||
wxDataFormat& operator=(const wxDataFormat& format)
|
||||
{ m_format = format.m_format; return *this; }
|
||||
|
||||
// defautl copy ctor/assignment operators ok
|
||||
|
||||
// comparison (must have both versions)
|
||||
bool operator==(wxDataFormatId format) const
|
||||
{ return m_format == (NativeFormat)format; }
|
||||
bool operator!=(wxDataFormatId format) const
|
||||
{ return m_format != (NativeFormat)format; }
|
||||
bool operator==(const wxDataFormat& format) const
|
||||
{ return m_format == format.m_format; }
|
||||
bool operator!=(const wxDataFormat& format) const
|
||||
{ return m_format != format.m_format; }
|
||||
|
||||
// explicit and implicit conversions to NativeFormat which is one of
|
||||
// standard data types (implicit conversion is useful for preserving the
|
||||
// compatibility with old code)
|
||||
NativeFormat GetFormatId() const { return m_format; }
|
||||
operator NativeFormat() const { return m_format; }
|
||||
|
||||
// this only works with standard ids
|
||||
void SetId(wxDataFormatId format) { m_format = format; }
|
||||
|
||||
// string ids are used for custom types - this SetId() must be used for
|
||||
// application-specific formats
|
||||
wxString GetId() const;
|
||||
void SetId(const wxChar *format);
|
||||
|
||||
private:
|
||||
// returns TRUE if the format is one of those defined in wxDataFormatId
|
||||
bool IsStandard() const { return m_format > 0 && m_format < wxDF_MAX; }
|
||||
|
||||
NativeFormat m_format;
|
||||
};
|
||||
#ifndef _WX_MSW_OLE_DATAOBJ_H
|
||||
#define _WX_MSW_OLE_DATAOBJ_H
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// forward declarations
|
||||
@@ -198,5 +147,5 @@ private:
|
||||
|
||||
// TODO: wxFileDataObject.
|
||||
|
||||
#endif //_WX_OLEDATAOBJ_H
|
||||
#endif //_WX_MSW_OLE_DATAOBJ_H
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
// Name: ole/dropsrc.h
|
||||
// Purpose: declaration of the wxDropSource class
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Modified by:
|
||||
// Created: 06.03.98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
@@ -28,19 +28,6 @@ class wxIDropSource;
|
||||
class WXDLLEXPORT wxDataObject;
|
||||
class WXDLLEXPORT wxWindow;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
enum wxDragResult
|
||||
{
|
||||
wxDragError, // error prevented the d&d operation from completing
|
||||
wxDragNone, // drag target didn't accept the data
|
||||
wxDragCopy, // the data was successfully copied
|
||||
wxDragMove, // the data was successfully moved
|
||||
wxDragCancel // the operation was cancelled by user (not an error)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDropSource is used to start the drag-&-drop operation on associated
|
||||
// wxDataObject object. It's responsible for giving UI feedback while dragging.
|
||||
@@ -49,37 +36,34 @@ enum wxDragResult
|
||||
class WXDLLEXPORT wxDropSource
|
||||
{
|
||||
public:
|
||||
// ctors: if you use default ctor you must call SetData() later!
|
||||
// NB: the "wxWindow *win" parameter is unused and is here only for wxGTK
|
||||
// compatibility, as well as both icon parameters
|
||||
wxDropSource(wxWindow *win = NULL,
|
||||
const wxIcon &go = wxNullIcon,
|
||||
const wxIcon &stop = wxNullIcon );
|
||||
wxDropSource(wxDataObject& data,
|
||||
wxWindow *win = NULL,
|
||||
const wxIcon &go = wxNullIcon,
|
||||
const wxIcon &stop = wxNullIcon );
|
||||
// ctors: if you use default ctor you must call SetData() later!
|
||||
//
|
||||
// NB: the "wxWindow *win" parameter is unused and is here only for wxGTK
|
||||
// compatibility, as well as both icon parameters
|
||||
wxDropSource(wxWindow *win = NULL,
|
||||
const wxIcon &go = wxNullIcon,
|
||||
const wxIcon &stop = wxNullIcon );
|
||||
wxDropSource(wxDataObject& data,
|
||||
wxWindow *win = NULL,
|
||||
const wxIcon &go = wxNullIcon,
|
||||
const wxIcon &stop = wxNullIcon );
|
||||
|
||||
void SetData(wxDataObject& data);
|
||||
virtual ~wxDropSource();
|
||||
|
||||
virtual ~wxDropSource();
|
||||
// do it (call this in response to a mouse button press, for example)
|
||||
// params: if bAllowMove is false, data can be only copied
|
||||
virtual wxDragResult DoDragDrop(bool bAllowMove = FALSE);
|
||||
|
||||
// do it (call this in response to a mouse button press, for example)
|
||||
// params: if bAllowMove is false, data can be only copied
|
||||
wxDragResult DoDragDrop(bool bAllowMove = FALSE);
|
||||
|
||||
// overridable: you may give some custom UI feedback during d&d operation
|
||||
// in this function (it's called on each mouse move, so it shouldn't be too
|
||||
// slow). Just return false if you want default feedback.
|
||||
virtual bool GiveFeedback(wxDragResult effect, bool bScrolling);
|
||||
// overridable: you may give some custom UI feedback during d&d operation
|
||||
// in this function (it's called on each mouse move, so it shouldn't be
|
||||
// too slow). Just return false if you want default feedback.
|
||||
virtual bool GiveFeedback(wxDragResult effect, bool bScrolling);
|
||||
|
||||
protected:
|
||||
void Init();
|
||||
|
||||
wxDataObject *m_pData; // pointer to associated data object
|
||||
void Init();
|
||||
|
||||
private:
|
||||
wxIDropSource *m_pIDropSource; // the pointer to COM interface
|
||||
wxIDropSource *m_pIDropSource; // the pointer to COM interface
|
||||
};
|
||||
|
||||
#endif //_WX_OLEDROPSRC_H
|
||||
|
@@ -2,7 +2,7 @@
|
||||
// Name: ole/droptgt.h
|
||||
// Purpose: declaration of the wxDropTarget class
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Modified by:
|
||||
// Created: 06.03.98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
@@ -33,7 +33,7 @@ struct IDataObject;
|
||||
// An instance of the class wxDropTarget may be associated with any wxWindow
|
||||
// derived object via SetDropTarget() function. If this is done, the virtual
|
||||
// methods of wxDropTarget are called when something is dropped on the window.
|
||||
//
|
||||
//
|
||||
// Note that wxDropTarget is an abstract base class (ABC) and you should derive
|
||||
// your own class from it implementing pure virtual function in order to use it
|
||||
// (all of them, including protected ones which are called by the class itself)
|
||||
@@ -41,38 +41,38 @@ struct IDataObject;
|
||||
class WXDLLEXPORT wxDropTarget
|
||||
{
|
||||
public:
|
||||
// ctor & dtor
|
||||
wxDropTarget();
|
||||
virtual ~wxDropTarget();
|
||||
// ctor & dtor
|
||||
wxDropTarget();
|
||||
virtual ~wxDropTarget();
|
||||
|
||||
// normally called by wxWindow on window creation/destruction, but might be
|
||||
// called `manually' as well. Register() returns true on success.
|
||||
bool Register(WXHWND hwnd);
|
||||
void Revoke(WXHWND hwnd);
|
||||
// normally called by wxWindow on window creation/destruction, but might be
|
||||
// called `manually' as well. Register() returns true on success.
|
||||
bool Register(WXHWND hwnd);
|
||||
void Revoke(WXHWND hwnd);
|
||||
|
||||
// do we accept this kind of data?
|
||||
virtual bool IsAcceptedData(IDataObject *pIDataSource) const;
|
||||
// do we accept this kind of data?
|
||||
virtual bool IsAcceptedData(IDataObject *pIDataSource) const;
|
||||
|
||||
// called when mouse enters/leaves the window: might be used to give
|
||||
// some visual feedback to the user
|
||||
virtual void OnEnter() { }
|
||||
virtual void OnLeave() { }
|
||||
// called when mouse enters/leaves the window: might be used to give
|
||||
// some visual feedback to the user
|
||||
virtual void OnEnter() { }
|
||||
virtual void OnLeave() { }
|
||||
|
||||
// this function is called when data is dropped.
|
||||
// (x, y) are the coordinates of the drop
|
||||
virtual bool OnDrop(long x, long y, const void *pData) = 0;
|
||||
// this function is called when data is dropped.
|
||||
// (x, y) are the coordinates of the drop
|
||||
virtual bool OnDrop(long x, long y, const void *pData) = 0;
|
||||
|
||||
protected:
|
||||
// Override these to indicate what kind of data you support: the first
|
||||
// format to which data can be converted is used. The classes below show
|
||||
// how it can be done in the simplest cases.
|
||||
// how many different (clipboard) formats do you support?
|
||||
virtual size_t GetFormatCount() const = 0;
|
||||
// return the n-th supported format
|
||||
virtual wxDataFormat GetFormat(size_t n) const = 0;
|
||||
// Override these to indicate what kind of data you support: the first
|
||||
// format to which data can be converted is used. The classes below show
|
||||
// how it can be done in the simplest cases.
|
||||
// how many different (clipboard) formats do you support?
|
||||
virtual size_t GetFormatCount() const = 0;
|
||||
// return the n-th supported format
|
||||
virtual wxDataFormat GetFormat(size_t n) const = 0;
|
||||
|
||||
private:
|
||||
wxIDropTarget *m_pIDropTarget; // the pointer to COM interface
|
||||
wxIDropTarget *m_pIDropTarget; // the pointer to COM interface
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
virtual bool OnDrop(long x, long y, const void *pData);
|
||||
|
||||
// params: the number of files and the array of file names
|
||||
virtual bool OnDropFiles(long x, long y,
|
||||
virtual bool OnDropFiles(long x, long y,
|
||||
size_t nFiles, const wxChar * const aszFiles[]) = 0;
|
||||
|
||||
protected:
|
||||
|
Reference in New Issue
Block a user