Added some tentative wxMotif clipboard code; did some file formatting
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1408 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -41,10 +41,6 @@ High Priority
|
|||||||
|
|
||||||
- Get wxGLCanvas from 1.68 working.
|
- Get wxGLCanvas from 1.68 working.
|
||||||
|
|
||||||
- wxClipboard
|
|
||||||
|
|
||||||
- EVT_KEY_DOWN, EVT_KEY_UP events.
|
|
||||||
|
|
||||||
Low Priority
|
Low Priority
|
||||||
------------
|
------------
|
||||||
|
|
||||||
|
@@ -16,6 +16,8 @@ Please see also:
|
|||||||
|
|
||||||
- Documentation: mention include files with each class.
|
- Documentation: mention include files with each class.
|
||||||
|
|
||||||
|
- Document wxTime.
|
||||||
|
|
||||||
- Get Karsten to remove trashed CVS files:
|
- Get Karsten to remove trashed CVS files:
|
||||||
|
|
||||||
include/wx/msw/magnif1.cur
|
include/wx/msw/magnif1.cur
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
#if defined(__WXMSW__)
|
#if defined(__WXMSW__)
|
||||||
#include "wx/msw/ole/dataobj.h"
|
#include "wx/msw/ole/dataobj.h"
|
||||||
#elif defined(__WXMOTIF__)
|
#elif defined(__WXMOTIF__)
|
||||||
#include "wx/motif/dnd.h"
|
#include "wx/motif/dataobj.h"
|
||||||
#elif defined(__WXGTK__)
|
#elif defined(__WXGTK__)
|
||||||
#include "wx/gtk/dataobj.h"
|
#include "wx/gtk/dataobj.h"
|
||||||
#elif defined(__WXQT__)
|
#elif defined(__WXQT__)
|
||||||
|
@@ -23,17 +23,77 @@
|
|||||||
#include "wx/setup.h"
|
#include "wx/setup.h"
|
||||||
|
|
||||||
#include "wx/list.h"
|
#include "wx/list.h"
|
||||||
|
#include "wx/module.h"
|
||||||
|
|
||||||
bool WXDLLEXPORT wxOpenClipboard();
|
bool WXDLLEXPORT wxOpenClipboard();
|
||||||
bool WXDLLEXPORT wxClipboardOpen();
|
bool WXDLLEXPORT wxClipboardOpen();
|
||||||
bool WXDLLEXPORT wxCloseClipboard();
|
bool WXDLLEXPORT wxCloseClipboard();
|
||||||
bool WXDLLEXPORT wxEmptyClipboard();
|
bool WXDLLEXPORT wxEmptyClipboard();
|
||||||
bool WXDLLEXPORT wxIsClipboardFormatAvailable(int dataFormat);
|
bool WXDLLEXPORT wxIsClipboardFormatAvailable(wxDataFormat dataFormat);
|
||||||
bool WXDLLEXPORT wxSetClipboardData(int dataFormat, wxObject *obj, int width = 0, int height = 0);
|
bool WXDLLEXPORT wxSetClipboardData(wxDataFormat dataFormat, wxObject *obj, int width = 0, int height = 0);
|
||||||
wxObject* WXDLLEXPORT wxGetClipboardData(int dataFormat, long *len = NULL);
|
wxObject* WXDLLEXPORT wxGetClipboardData(wxDataFormat dataFormat, long *len = NULL);
|
||||||
int WXDLLEXPORT wxEnumClipboardFormats(int dataFormat);
|
wxDataFormat WXDLLEXPORT wxEnumClipboardFormats(wxDataFormat dataFormat);
|
||||||
int WXDLLEXPORT wxRegisterClipboardFormat(char *formatName);
|
wxDataFormat WXDLLEXPORT wxRegisterClipboardFormat(char *formatName);
|
||||||
bool WXDLLEXPORT wxGetClipboardFormatName(int dataFormat, char *formatName, int maxCount);
|
bool WXDLLEXPORT wxGetClipboardFormatName(wxDataFormat dataFormat, char *formatName, int maxCount);
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// wxClipboard
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxDataObject;
|
||||||
|
class WXDLLEXPORT wxClipboard: public wxObject
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxClipboard)
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
wxClipboard();
|
||||||
|
~wxClipboard();
|
||||||
|
|
||||||
|
// open the clipboard before SetData() and GetData()
|
||||||
|
virtual bool Open();
|
||||||
|
|
||||||
|
// close the clipboard after SetData() and GetData()
|
||||||
|
virtual void Close();
|
||||||
|
|
||||||
|
// can be called several times
|
||||||
|
virtual bool SetData( wxDataObject *data );
|
||||||
|
|
||||||
|
// format available on the clipboard ?
|
||||||
|
// supply ID if private format, the same as wxPrivateDataObject::SetId()
|
||||||
|
virtual bool IsSupportedFormat( wxDataFormat format, const wxString &id = wxEmptyString );
|
||||||
|
|
||||||
|
// fill data with data on the clipboard (if available)
|
||||||
|
virtual bool GetData( wxDataObject *data );
|
||||||
|
|
||||||
|
// clears wxTheClipboard and the system's clipboard if possible
|
||||||
|
virtual void Clear();
|
||||||
|
|
||||||
|
// implementation
|
||||||
|
|
||||||
|
bool m_open;
|
||||||
|
wxList m_data;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* The clipboard */
|
||||||
|
WXDLLEXPORT_DATA(extern wxClipboard*) wxTheClipboard;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// wxClipboardModule
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class wxClipboardModule: public wxModule
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxClipboardModule)
|
||||||
|
|
||||||
|
public:
|
||||||
|
wxClipboardModule() {}
|
||||||
|
bool OnInit();
|
||||||
|
void OnExit();
|
||||||
|
};
|
||||||
|
|
||||||
|
// This is the old, 1.68 implementation
|
||||||
|
#if 0
|
||||||
|
|
||||||
/* A clipboard client holds data belonging to the clipboard.
|
/* A clipboard client holds data belonging to the clipboard.
|
||||||
For plain text, a client is not necessary. */
|
For plain text, a client is not necessary. */
|
||||||
@@ -100,5 +160,8 @@ void WXDLLEXPORT wxInitClipboard();
|
|||||||
/* The clipboard */
|
/* The clipboard */
|
||||||
WXDLLEXPORT_DATA(extern wxClipboard*) wxTheClipboard;
|
WXDLLEXPORT_DATA(extern wxClipboard*) wxTheClipboard;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
// Old clipboard class
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// _WX_CLIPBRD_H_
|
// _WX_CLIPBRD_H_
|
||||||
|
@@ -1,22 +1,27 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: dnd.h
|
// Name: dnd.h
|
||||||
// Purpose: Declaration of the wxDropTarget, wxDropSource class etc.
|
// Purpose: declaration of wxDropTarget, wxDropSource classes
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) 1998 Julian Smart
|
// Copyright: (c) 1998 Vadim Zeitlin, Robert Roebling, Julian Smart
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#ifndef _WX_DND_H_
|
#ifndef _WX_DND_H_
|
||||||
#define _WX_DND_H_
|
#define _WX_DND_H_
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface "dnd.h"
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/defs.h"
|
#include "wx/defs.h"
|
||||||
|
|
||||||
|
#if wxUSE_DRAG_AND_DROP
|
||||||
|
|
||||||
#include "wx/object.h"
|
#include "wx/object.h"
|
||||||
#include "wx/string.h"
|
#include "wx/string.h"
|
||||||
|
#include "wx/dataobj.h"
|
||||||
#include "wx/cursor.h"
|
#include "wx/cursor.h"
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
@@ -25,119 +30,13 @@
|
|||||||
|
|
||||||
class WXDLLEXPORT wxWindow;
|
class WXDLLEXPORT wxWindow;
|
||||||
|
|
||||||
class WXDLLEXPORT wxDataObject;
|
|
||||||
class WXDLLEXPORT wxTextDataObject;
|
|
||||||
class WXDLLEXPORT wxFileDataObject;
|
|
||||||
|
|
||||||
class WXDLLEXPORT wxDropTarget;
|
class WXDLLEXPORT wxDropTarget;
|
||||||
class WXDLLEXPORT wxTextDropTarget;
|
class WXDLLEXPORT wxTextDropTarget;
|
||||||
class WXDLLEXPORT wxFileDropTarget;
|
class WXDLLEXPORT wxFileDropTarget;
|
||||||
|
class WXDLLEXPORT wxPrivateDropTarget;
|
||||||
|
|
||||||
class WXDLLEXPORT wxDropSource;
|
class WXDLLEXPORT wxDropSource;
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
// wxDataObject
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class WXDLLEXPORT wxDataObject: public wxObject
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// all data formats (values are the same as in windows.h, do not change!)
|
|
||||||
enum StdFormat
|
|
||||||
{
|
|
||||||
Invalid,
|
|
||||||
Text,
|
|
||||||
Bitmap,
|
|
||||||
MetafilePict,
|
|
||||||
Sylk,
|
|
||||||
Dif,
|
|
||||||
Tiff,
|
|
||||||
OemText,
|
|
||||||
Dib,
|
|
||||||
Palette,
|
|
||||||
Pendata,
|
|
||||||
Riff,
|
|
||||||
Wave,
|
|
||||||
UnicodeText,
|
|
||||||
EnhMetafile,
|
|
||||||
Hdrop,
|
|
||||||
Locale,
|
|
||||||
Max
|
|
||||||
};
|
|
||||||
|
|
||||||
// function to return symbolic name of clipboard format (debug messages)
|
|
||||||
static const char *GetFormatName(wxDataFormat format);
|
|
||||||
|
|
||||||
// ctor & dtor
|
|
||||||
wxDataObject() {};
|
|
||||||
~wxDataObject() {};
|
|
||||||
|
|
||||||
// pure virtuals to override
|
|
||||||
// get the best suited format for our data
|
|
||||||
virtual wxDataFormat GetPreferredFormat() const = 0;
|
|
||||||
// decide if we support this format (should be one of values of
|
|
||||||
// StdFormat enumerations or a user-defined format)
|
|
||||||
virtual bool IsSupportedFormat(wxDataFormat format) const = 0;
|
|
||||||
// get the (total) size of data
|
|
||||||
virtual size_t GetDataSize() const = 0;
|
|
||||||
// copy raw data to provided pointer
|
|
||||||
virtual void GetDataHere(void *pBuf) const = 0;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// wxTextDataObject is a specialization of wxDataObject for text data
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class WXDLLEXPORT wxTextDataObject : public wxDataObject
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// ctors
|
|
||||||
wxTextDataObject() { }
|
|
||||||
wxTextDataObject(const wxString& strText) : m_strText(strText) { }
|
|
||||||
void Init(const wxString& strText) { m_strText = strText; }
|
|
||||||
|
|
||||||
// implement base class pure virtuals
|
|
||||||
virtual wxDataFormat GetPreferredFormat() const
|
|
||||||
{ return wxDF_TEXT; }
|
|
||||||
virtual bool IsSupportedFormat(wxDataFormat format) const
|
|
||||||
{ return format == wxDF_TEXT; }
|
|
||||||
virtual size_t GetDataSize() const
|
|
||||||
{ return m_strText.Len() + 1; } // +1 for trailing '\0'of course
|
|
||||||
virtual void GetDataHere(void *pBuf) const
|
|
||||||
{ memcpy(pBuf, m_strText.c_str(), GetDataSize()); }
|
|
||||||
|
|
||||||
private:
|
|
||||||
wxString m_strText;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// wxFileDataObject is a specialization of wxDataObject for file names
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class WXDLLEXPORT wxFileDataObject : public wxDataObject
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
wxFileDataObject(void) { }
|
|
||||||
void AddFile( const wxString &file )
|
|
||||||
{ m_files += file; m_files += ";"; }
|
|
||||||
|
|
||||||
// implement base class pure virtuals
|
|
||||||
virtual wxDataFormat GetPreferredFormat() const
|
|
||||||
{ return wxDF_FILENAME; }
|
|
||||||
virtual bool IsSupportedFormat(wxDataFormat format) const
|
|
||||||
{ return format == wxDF_FILENAME; }
|
|
||||||
virtual size_t GetDataSize() const
|
|
||||||
{ return m_files.Len() + 1; } // +1 for trailing '\0'of course
|
|
||||||
virtual void GetDataHere(void *pBuf) const
|
|
||||||
{ memcpy(pBuf, m_files.c_str(), GetDataSize()); }
|
|
||||||
|
|
||||||
private:
|
|
||||||
wxString m_files;
|
|
||||||
|
|
||||||
};
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// wxDropTarget
|
// wxDropTarget
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
@@ -151,16 +50,14 @@ class WXDLLEXPORT wxDropTarget: public wxObject
|
|||||||
|
|
||||||
virtual void OnEnter() { }
|
virtual void OnEnter() { }
|
||||||
virtual void OnLeave() { }
|
virtual void OnLeave() { }
|
||||||
virtual bool OnDrop( long x, long y, const void *pData ) = 0;
|
virtual bool OnDrop( long x, long y, const void *data, size_t size ) = 0;
|
||||||
|
|
||||||
// protected:
|
|
||||||
|
|
||||||
friend wxWindow;
|
|
||||||
|
|
||||||
// Override these to indicate what kind of data you support:
|
// Override these to indicate what kind of data you support:
|
||||||
|
|
||||||
virtual size_t GetFormatCount() const = 0;
|
virtual size_t GetFormatCount() const = 0;
|
||||||
virtual wxDataFormat GetFormat(size_t n) const = 0;
|
virtual wxDataFormat GetFormat(size_t n) const = 0;
|
||||||
|
|
||||||
|
// implementation
|
||||||
};
|
};
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
@@ -172,7 +69,7 @@ class WXDLLEXPORT wxTextDropTarget: public wxDropTarget
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
wxTextDropTarget() {};
|
wxTextDropTarget() {};
|
||||||
virtual bool OnDrop( long x, long y, const void *pData );
|
virtual bool OnDrop( long x, long y, const void *data, size_t size );
|
||||||
virtual bool OnDropText( long x, long y, const char *psz );
|
virtual bool OnDropText( long x, long y, const char *psz );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -181,6 +78,36 @@ class WXDLLEXPORT wxTextDropTarget: public wxDropTarget
|
|||||||
virtual wxDataFormat GetFormat(size_t n) const;
|
virtual wxDataFormat GetFormat(size_t n) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
// wxPrivateDropTarget
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxPrivateDropTarget: public wxDropTarget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
wxPrivateDropTarget();
|
||||||
|
|
||||||
|
// you have to override OnDrop to get at the data
|
||||||
|
|
||||||
|
// the string ID identifies the format of clipboard or DnD data. a word
|
||||||
|
// processor would e.g. add a wxTextDataObject and a wxPrivateDataObject
|
||||||
|
// to the clipboard - the latter with the Id "WXWORD_FORMAT".
|
||||||
|
|
||||||
|
void SetId( const wxString& id )
|
||||||
|
{ m_id = id; }
|
||||||
|
|
||||||
|
wxString GetId()
|
||||||
|
{ return m_id; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
virtual size_t GetFormatCount() const;
|
||||||
|
virtual wxDataFormat GetFormat(size_t n) const;
|
||||||
|
|
||||||
|
wxString m_id;
|
||||||
|
};
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// A drop target which accepts files (dragged from File Manager or Explorer)
|
// A drop target which accepts files (dragged from File Manager or Explorer)
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -191,7 +118,7 @@ class WXDLLEXPORT wxFileDropTarget: public wxDropTarget
|
|||||||
|
|
||||||
wxFileDropTarget() {};
|
wxFileDropTarget() {};
|
||||||
|
|
||||||
virtual bool OnDrop(long x, long y, const void *pData);
|
virtual bool OnDrop( long x, long y, const void *data, size_t size );
|
||||||
virtual bool OnDropFiles( long x, long y,
|
virtual bool OnDropFiles( long x, long y,
|
||||||
size_t nFiles, const char * const aszFiles[] );
|
size_t nFiles, const char * const aszFiles[] );
|
||||||
|
|
||||||
@@ -228,11 +155,24 @@ class WXDLLEXPORT wxDropSource: public wxObject
|
|||||||
|
|
||||||
virtual bool GiveFeedback( wxDragResult WXUNUSED(effect), bool WXUNUSED(bScrolling) ) { return TRUE; };
|
virtual bool GiveFeedback( wxDragResult WXUNUSED(effect), bool WXUNUSED(bScrolling) ) { return TRUE; };
|
||||||
|
|
||||||
protected:
|
// implementation
|
||||||
|
#if 0
|
||||||
|
void RegisterWindow(void);
|
||||||
|
void UnregisterWindow(void);
|
||||||
|
|
||||||
|
wxWindow *m_window;
|
||||||
|
wxDragResult m_retValue;
|
||||||
wxDataObject *m_data;
|
wxDataObject *m_data;
|
||||||
|
|
||||||
|
wxCursor m_defaultCursor;
|
||||||
|
wxCursor m_goaheadCursor;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// wxUSE_DRAG_AND_DROP
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
//_WX_DND_H_
|
//_WX_DND_H_
|
||||||
|
|
||||||
|
@@ -418,7 +418,6 @@ public:
|
|||||||
void OnChar(wxKeyEvent& event);
|
void OnChar(wxKeyEvent& event);
|
||||||
void OnKeyDown(wxKeyEvent& event);
|
void OnKeyDown(wxKeyEvent& event);
|
||||||
void OnKeyUp(wxKeyEvent& event);
|
void OnKeyUp(wxKeyEvent& event);
|
||||||
void OnChar(wxKeyEvent& event);
|
|
||||||
void OnPaint(wxPaintEvent& event);
|
void OnPaint(wxPaintEvent& event);
|
||||||
void OnIdle(wxIdleEvent& event);
|
void OnIdle(wxIdleEvent& event);
|
||||||
|
|
||||||
|
@@ -26,7 +26,6 @@
|
|||||||
|
|
||||||
#include "wx/motif/private.h"
|
#include "wx/motif/private.h"
|
||||||
|
|
||||||
// TODO: correct symbol, path?
|
|
||||||
#if wxUSE_XPM
|
#if wxUSE_XPM
|
||||||
#include <X11/xpm.h>
|
#include <X11/xpm.h>
|
||||||
#endif
|
#endif
|
||||||
|
@@ -20,76 +20,365 @@
|
|||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
#include "wx/metafile.h"
|
#include "wx/metafile.h"
|
||||||
#include "wx/clipbrd.h"
|
#include "wx/clipbrd.h"
|
||||||
|
#include "wx/dataobj.h"
|
||||||
|
|
||||||
|
#include <Xm/Xm.h>
|
||||||
|
#include <Xm/CutPaste.h>
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
#if !USE_SHARED_LIBRARY
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject)
|
// IMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject)
|
||||||
IMPLEMENT_ABSTRACT_CLASS(wxClipboardClient, wxObject)
|
// IMPLEMENT_ABSTRACT_CLASS(wxClipboardClient, wxObject)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static bool gs_clipboardIsOpen = FALSE;
|
||||||
|
|
||||||
bool wxOpenClipboard()
|
bool wxOpenClipboard()
|
||||||
{
|
{
|
||||||
// TODO
|
if (!gs_clipboardIsOpen)
|
||||||
|
{
|
||||||
|
gs_clipboardIsOpen = TRUE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxCloseClipboard()
|
bool wxCloseClipboard()
|
||||||
{
|
{
|
||||||
// TODO
|
if (gs_clipboardIsOpen)
|
||||||
|
{
|
||||||
|
gs_clipboardIsOpen = FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxEmptyClipboard()
|
bool wxEmptyClipboard()
|
||||||
{
|
{
|
||||||
// TODO
|
// No equivalent in Motif
|
||||||
return FALSE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxClipboardOpen()
|
bool wxClipboardOpen()
|
||||||
{
|
{
|
||||||
// TODO
|
return gs_clipboardIsOpen;
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxIsClipboardFormatAvailable(int dataFormat)
|
bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat)
|
||||||
{
|
{
|
||||||
// TODO
|
// Only text is supported.
|
||||||
|
if (dataFormat != wxDF_TEXT)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
unsigned long numBytes = 0;
|
||||||
|
long privateId = 0;
|
||||||
|
|
||||||
|
Window window = (Window) 0;
|
||||||
|
if (wxTheApp->GetTopWindow())
|
||||||
|
window = XtWindow( (Widget) wxTheApp->GetTopWindow()->GetTopWidget() );
|
||||||
|
|
||||||
|
int success = XmClipboardRetrieve((Display*) wxGetDisplay(),
|
||||||
|
window, "TEXT", (XtPointer) 0, 0, & numBytes, & privateId) ;
|
||||||
|
|
||||||
|
// Assume only text is supported. If we have anything at all,
|
||||||
|
// or the clipboard is locked so we're not sure, we say we support it.
|
||||||
|
if (success == ClipboardNoData)
|
||||||
|
return FALSE;
|
||||||
|
else
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxSetClipboardData(int dataFormat, wxObject *obj, int width, int height)
|
bool wxSetClipboardData(wxDataFormat dataFormat, wxObject *obj, int width, int height)
|
||||||
{
|
{
|
||||||
// TODO
|
if (dataFormat != wxDF_TEXT)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
char* data = (char*) obj;
|
||||||
|
|
||||||
|
XmString text = XmStringCreateSimple ("CLIPBOARD");
|
||||||
|
Window window = (Window) 0;
|
||||||
|
if (wxTheApp->GetTopWindow())
|
||||||
|
window = XtWindow( (Widget) wxTheApp->GetTopWindow()->GetTopWidget() );
|
||||||
|
|
||||||
|
long itemId = 0;
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
while ((result =
|
||||||
|
XmClipboardStartCopy((Display*) wxGetDisplay(),
|
||||||
|
window,
|
||||||
|
text,
|
||||||
|
XtLastTimestampProcessed((Display*) wxGetDisplay()),
|
||||||
|
(Widget) 0,
|
||||||
|
(XmCutPasteProc) 0,
|
||||||
|
& itemId)) != ClipboardSuccess)
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
XmStringFree (text);
|
||||||
|
|
||||||
|
long dataId = 0;
|
||||||
|
while ((result =
|
||||||
|
XmClipboardCopy((Display*) wxGetDisplay(),
|
||||||
|
window,
|
||||||
|
itemId,
|
||||||
|
"TEXT",
|
||||||
|
(XtPointer) data,
|
||||||
|
strlen(data) + 1,
|
||||||
|
0,
|
||||||
|
& dataId)) != ClipboardSuccess)
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
while (( result =
|
||||||
|
XmClipboardEndCopy((Display*) wxGetDisplay(),
|
||||||
|
window, itemId) ) != ClipboardSuccess)
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxObject *wxGetClipboardData(int dataFormat, long *len)
|
wxObject *wxGetClipboardData(wxDataFormat dataFormat, long *len)
|
||||||
{
|
{
|
||||||
// TODO
|
if (dataFormat != wxDF_TEXT)
|
||||||
|
return (wxObject*) NULL;
|
||||||
|
|
||||||
|
bool done = FALSE;
|
||||||
|
long id = 0;
|
||||||
|
unsigned long numBytes = 0;
|
||||||
|
int result = 0;
|
||||||
|
Window window = (Window) 0;
|
||||||
|
if (wxTheApp->GetTopWindow())
|
||||||
|
window = XtWindow( (Widget) wxTheApp->GetTopWindow()->GetTopWidget() );
|
||||||
|
|
||||||
|
int currentDataSize = 256;
|
||||||
|
char* data = new char[currentDataSize];
|
||||||
|
|
||||||
|
while (!done)
|
||||||
|
{
|
||||||
|
if (result == ClipboardTruncate)
|
||||||
|
{
|
||||||
|
delete[] data;
|
||||||
|
currentDataSize = 2*currentDataSize;
|
||||||
|
data = new char[currentDataSize];
|
||||||
|
}
|
||||||
|
result = XmClipboardRetrieve((Display*) wxGetDisplay(),
|
||||||
|
window,
|
||||||
|
"TEXT",
|
||||||
|
(XtPointer) data,
|
||||||
|
currentDataSize,
|
||||||
|
&numBytes,
|
||||||
|
&id);
|
||||||
|
|
||||||
|
switch (result)
|
||||||
|
{
|
||||||
|
case ClipboardSuccess:
|
||||||
|
{
|
||||||
|
if (len)
|
||||||
|
*len = strlen(data) + 1;
|
||||||
|
return (wxObject*) data;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ClipboardTruncate:
|
||||||
|
case ClipboardLocked:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
case ClipboardNoData:
|
||||||
|
{
|
||||||
|
return (wxObject*) NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxEnumClipboardFormats(int dataFormat)
|
wxDataFormat wxEnumClipboardFormats(wxDataFormat dataFormat)
|
||||||
{
|
{
|
||||||
// TODO
|
// Only wxDF_TEXT supported
|
||||||
return 0;
|
if (dataFormat == (wxDataFormat) 0)
|
||||||
|
return wxDF_TEXT;
|
||||||
|
else
|
||||||
|
return (wxDataFormat) 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxRegisterClipboardFormat(char *formatName)
|
wxDataFormat wxRegisterClipboardFormat(char *formatName)
|
||||||
{
|
{
|
||||||
// TODO
|
// Not supported
|
||||||
return 0;
|
return (wxDataFormat) 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxGetClipboardFormatName(int dataFormat, char *formatName, int maxCount)
|
bool wxGetClipboardFormatName(wxDataFormat dataFormat, char *formatName, int maxCount)
|
||||||
{
|
{
|
||||||
// TODO
|
// Only wxDF_TEXT supported
|
||||||
|
if (dataFormat == wxDF_TEXT)
|
||||||
|
{
|
||||||
|
strcpy(formatName, "TEXT");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// wxClipboard
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxClipboard,wxObject)
|
||||||
|
|
||||||
|
wxClipboard* wxTheClipboard = (wxClipboard*) NULL;
|
||||||
|
|
||||||
|
wxClipboard::wxClipboard()
|
||||||
|
{
|
||||||
|
m_open = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxClipboard::~wxClipboard()
|
||||||
|
{
|
||||||
|
Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxClipboard::Clear()
|
||||||
|
{
|
||||||
|
wxNode* node = m_data.First();
|
||||||
|
while (node)
|
||||||
|
{
|
||||||
|
wxDataObject* data = (wxDataObject*) node->Data();
|
||||||
|
delete data;
|
||||||
|
node = node->Next();
|
||||||
|
}
|
||||||
|
m_data.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxClipboard::Open()
|
||||||
|
{
|
||||||
|
wxCHECK_MSG( !m_open, FALSE, "clipboard already open" );
|
||||||
|
|
||||||
|
m_open = TRUE;
|
||||||
|
|
||||||
|
return wxOpenClipboard();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxClipboard::SetData( wxDataObject *data )
|
||||||
|
{
|
||||||
|
wxCHECK_MSG( data, FALSE, "data is invalid" );
|
||||||
|
wxCHECK_MSG( m_open, FALSE, "clipboard not open" );
|
||||||
|
|
||||||
|
switch (data->GetFormat())
|
||||||
|
{
|
||||||
|
case wxDF_TEXT:
|
||||||
|
case wxDF_OEMTEXT:
|
||||||
|
{
|
||||||
|
wxTextDataObject* textDataObject = (wxTextDataObject*) data;
|
||||||
|
wxString str(textDataObject->GetText());
|
||||||
|
return wxSetClipboardData(data->GetFormat(), (wxObject*) (const char*) str);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case wxDF_BITMAP:
|
||||||
|
case wxDF_DIB:
|
||||||
|
{
|
||||||
|
wxBitmapDataObject* bitmapDataObject = (wxBitmapDataObject*) data;
|
||||||
|
wxBitmap bitmap(bitmapDataObject->GetBitmap());
|
||||||
|
return wxSetClipboardData(data->GetFormat(), & bitmap);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxClipboard::Close()
|
||||||
|
{
|
||||||
|
wxCHECK_RET( m_open, "clipboard not open" );
|
||||||
|
|
||||||
|
m_open = FALSE;
|
||||||
|
wxCloseClipboard();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxClipboard::IsSupportedFormat( wxDataFormat format, const wxString& WXUNUSED(id) )
|
||||||
|
{
|
||||||
|
return wxIsClipboardFormatAvailable(format);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxClipboard::GetData( wxDataObject *data )
|
||||||
|
{
|
||||||
|
wxCHECK_MSG( m_open, FALSE, "clipboard not open" );
|
||||||
|
|
||||||
|
switch (data->GetFormat())
|
||||||
|
{
|
||||||
|
case wxDF_TEXT:
|
||||||
|
case wxDF_OEMTEXT:
|
||||||
|
{
|
||||||
|
wxTextDataObject* textDataObject = (wxTextDataObject*) data;
|
||||||
|
char* s = (char*) wxGetClipboardData(data->GetFormat());
|
||||||
|
if (s)
|
||||||
|
{
|
||||||
|
textDataObject->SetText(s);
|
||||||
|
delete[] s;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return FALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case wxDF_BITMAP:
|
||||||
|
case wxDF_DIB:
|
||||||
|
{
|
||||||
|
wxBitmapDataObject* bitmapDataObject = (wxBitmapDataObject*) data;
|
||||||
|
wxBitmap* bitmap = (wxBitmap*) wxGetClipboardData(data->GetFormat());
|
||||||
|
if (bitmap)
|
||||||
|
{
|
||||||
|
bitmapDataObject->SetBitmap(* bitmap);
|
||||||
|
delete bitmap;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return FALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// wxClipboardModule
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxClipboardModule,wxModule)
|
||||||
|
|
||||||
|
bool wxClipboardModule::OnInit()
|
||||||
|
{
|
||||||
|
wxTheClipboard = new wxClipboard();
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxClipboardModule::OnExit()
|
||||||
|
{
|
||||||
|
if (wxTheClipboard) delete wxTheClipboard;
|
||||||
|
wxTheClipboard = (wxClipboard*) NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generalized clipboard implementation by Matthew Flatt
|
* Old clipboard implementation by Matthew Flatt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
wxClipboard *wxTheClipboard = NULL;
|
wxClipboard *wxTheClipboard = NULL;
|
||||||
@@ -234,4 +523,5 @@ char *wxClipboard::GetClipboardData(char *format, long *length, long time)
|
|||||||
return receivedString;
|
return receivedString;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@@ -1,10 +1,8 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: dnd.cpp
|
// Name: dnd.cpp
|
||||||
// Purpose: wxDropTarget, wxDropSource, wxDataObject implementation
|
// Purpose: wxDropTarget, wxDropSource classes
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart
|
||||||
// Modified by:
|
// Id: $Id$
|
||||||
// Created: 17/09/98
|
|
||||||
// RCS-ID: $Id$
|
|
||||||
// Copyright: (c) 1998 Julian Smart
|
// Copyright: (c) 1998 Julian Smart
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -13,10 +11,19 @@
|
|||||||
#pragma implementation "dnd.h"
|
#pragma implementation "dnd.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "wx/setup.h"
|
||||||
|
|
||||||
|
#if wxUSE_DRAG_AND_DROP
|
||||||
|
|
||||||
#include "wx/dnd.h"
|
#include "wx/dnd.h"
|
||||||
#include "wx/window.h"
|
#include "wx/window.h"
|
||||||
#include "wx/app.h"
|
#include "wx/app.h"
|
||||||
#include "wx/gdicmn.h"
|
#include "wx/gdicmn.h"
|
||||||
|
#include "wx/intl.h"
|
||||||
|
#include "wx/utils.h"
|
||||||
|
#include "wx/log.h"
|
||||||
|
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// global
|
// global
|
||||||
@@ -28,28 +35,28 @@
|
|||||||
|
|
||||||
wxDropTarget::wxDropTarget()
|
wxDropTarget::wxDropTarget()
|
||||||
{
|
{
|
||||||
};
|
}
|
||||||
|
|
||||||
wxDropTarget::~wxDropTarget()
|
wxDropTarget::~wxDropTarget()
|
||||||
{
|
{
|
||||||
};
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxTextDropTarget
|
// wxTextDropTarget
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool wxTextDropTarget::OnDrop( long x, long y, const void *pData )
|
bool wxTextDropTarget::OnDrop( long x, long y, const void *data, size_t WXUNUSED(size) )
|
||||||
{
|
{
|
||||||
OnDropText( x, y, (const char*)pData );
|
OnDropText( x, y, (const char*)data );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
};
|
}
|
||||||
|
|
||||||
bool wxTextDropTarget::OnDropText( long x, long y, const char *psz )
|
bool wxTextDropTarget::OnDropText( long x, long y, const char *psz )
|
||||||
{
|
{
|
||||||
printf( "Got dropped text: %s.\n", psz );
|
wxLogDebug( "Got dropped text: %s.", psz );
|
||||||
printf( "At x: %d, y: %d.\n", (int)x, (int)y );
|
wxLogDebug( "At x: %d, y: %d.", (int)x, (int)y );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
};
|
}
|
||||||
|
|
||||||
size_t wxTextDropTarget::GetFormatCount() const
|
size_t wxTextDropTarget::GetFormatCount() const
|
||||||
{
|
{
|
||||||
@@ -65,18 +72,41 @@ wxDataFormat wxTextDropTarget::GetFormat(size_t WXUNUSED(n)) const
|
|||||||
// wxFileDropTarget
|
// wxFileDropTarget
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool wxFileDropTarget::OnDropFiles( long x, long y, size_t nFiles, const char * const WXUNUSED(aszFiles)[] )
|
bool wxFileDropTarget::OnDropFiles( long x, long y, size_t nFiles, const char * const aszFiles[] )
|
||||||
{
|
{
|
||||||
printf( "Got %d dropped files.\n", (int)nFiles );
|
wxLogDebug( "Got %d dropped files.", (int)nFiles );
|
||||||
printf( "At x: %d, y: %d.\n", (int)x, (int)y );
|
wxLogDebug( "At x: %d, y: %d.", (int)x, (int)y );
|
||||||
|
for (size_t i = 0; i < nFiles; i++)
|
||||||
|
{
|
||||||
|
wxLogDebug( aszFiles[i] );
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFileDropTarget::OnDrop(long x, long y, const void *WXUNUSED(pData) )
|
bool wxFileDropTarget::OnDrop(long x, long y, const void *data, size_t size )
|
||||||
{
|
{
|
||||||
char *str = "/this/is/a/path.txt";
|
size_t number = 0;
|
||||||
|
char *text = (char*) data;
|
||||||
|
for (size_t i = 0; i < size; i++)
|
||||||
|
if (text[i] == 0) number++;
|
||||||
|
|
||||||
return OnDropFiles(x, y, 1, &str );
|
if (number == 0) return TRUE;
|
||||||
|
|
||||||
|
char **files = new char*[number];
|
||||||
|
|
||||||
|
text = (char*) data;
|
||||||
|
for (size_t i = 0; i < number; i++)
|
||||||
|
{
|
||||||
|
files[i] = text;
|
||||||
|
int len = strlen( text );
|
||||||
|
text += len+1;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ret = OnDropFiles( x, y, 1, files );
|
||||||
|
|
||||||
|
free( files );
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t wxFileDropTarget::GetFormatCount() const
|
size_t wxFileDropTarget::GetFormatCount() const
|
||||||
@@ -93,41 +123,100 @@ wxDataFormat wxFileDropTarget::GetFormat(size_t WXUNUSED(n)) const
|
|||||||
// wxDropSource
|
// wxDropSource
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// drag request
|
|
||||||
|
|
||||||
wxDropSource::wxDropSource( wxWindow *win )
|
wxDropSource::wxDropSource( wxWindow *win )
|
||||||
{
|
{
|
||||||
// TODO
|
#if 0
|
||||||
// m_window = win;
|
m_window = win;
|
||||||
m_data = NULL;
|
m_data = (wxDataObject *) NULL;
|
||||||
|
m_retValue = wxDragCancel;
|
||||||
|
|
||||||
// m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
|
m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
|
||||||
// m_goaheadCursor = wxCursor( wxCURSOR_HAND );
|
m_goaheadCursor = wxCursor( wxCURSOR_HAND );
|
||||||
};
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
wxDropSource::wxDropSource( wxDataObject &data, wxWindow *win )
|
wxDropSource::wxDropSource( wxDataObject &data, wxWindow *win )
|
||||||
{
|
{
|
||||||
// TODO
|
#if 0
|
||||||
// m_window = win;
|
g_blockEventsOnDrag = TRUE;
|
||||||
|
|
||||||
|
m_window = win;
|
||||||
|
m_widget = win->m_widget;
|
||||||
|
if (win->m_wxwindow) m_widget = win->m_wxwindow;
|
||||||
|
m_retValue = wxDragCancel;
|
||||||
|
|
||||||
m_data = &data;
|
m_data = &data;
|
||||||
|
|
||||||
// m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
|
m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
|
||||||
// m_goaheadCursor = wxCursor( wxCURSOR_HAND );
|
m_goaheadCursor = wxCursor( wxCURSOR_HAND );
|
||||||
};
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void wxDropSource::SetData( wxDataObject &data )
|
void wxDropSource::SetData( wxDataObject &data )
|
||||||
{
|
{
|
||||||
m_data = &data;
|
// m_data = &data;
|
||||||
};
|
}
|
||||||
|
|
||||||
wxDropSource::~wxDropSource(void)
|
wxDropSource::~wxDropSource(void)
|
||||||
{
|
{
|
||||||
};
|
// if (m_data) delete m_data;
|
||||||
|
}
|
||||||
|
|
||||||
wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
|
wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
|
||||||
{
|
{
|
||||||
// TODO
|
// wxASSERT_MSG( m_data, "wxDragSource: no data" );
|
||||||
return wxDragError;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
return wxDragNone;
|
||||||
|
#if 0
|
||||||
|
if (!m_data) return (wxDragResult) wxDragNone;
|
||||||
|
if (m_data->GetDataSize() == 0) return (wxDragResult) wxDragNone;
|
||||||
|
|
||||||
|
RegisterWindow();
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
|
||||||
|
UnregisterWindow();
|
||||||
|
|
||||||
|
g_blockEventsOnDrag = FALSE;
|
||||||
|
|
||||||
|
return m_retValue;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
void wxDropSource::RegisterWindow(void)
|
||||||
|
{
|
||||||
|
if (!m_data) return;
|
||||||
|
|
||||||
|
wxString formats;
|
||||||
|
|
||||||
|
wxDataFormat df = m_data->GetPreferredFormat();
|
||||||
|
|
||||||
|
switch (df)
|
||||||
|
{
|
||||||
|
case wxDF_TEXT:
|
||||||
|
formats += "text/plain";
|
||||||
|
break;
|
||||||
|
case wxDF_FILENAME:
|
||||||
|
formats += "file:ALL";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *str = WXSTRINGCAST formats;
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxDropSource::UnregisterWindow(void)
|
||||||
|
{
|
||||||
|
if (!m_widget) return;
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
// wxUSE_DRAG_AND_DROP
|
||||||
|
@@ -18,5 +18,3 @@
|
|||||||
#if !USE_SHARED_LIBRARIES
|
#if !USE_SHARED_LIBRARIES
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject)
|
IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// TODO: Nothing to do, unless you want to.
|
|
||||||
|
@@ -87,6 +87,7 @@ LIB_CPP_SRC=\
|
|||||||
combobox.cpp \
|
combobox.cpp \
|
||||||
cursor.cpp \
|
cursor.cpp \
|
||||||
data.cpp \
|
data.cpp \
|
||||||
|
dataobj.cpp \
|
||||||
dc.cpp \
|
dc.cpp \
|
||||||
dcclient.cpp \
|
dcclient.cpp \
|
||||||
dcmemory.cpp \
|
dcmemory.cpp \
|
||||||
|
@@ -346,69 +346,6 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
|
|||||||
|
|
||||||
ChangeBackgroundColour();
|
ChangeBackgroundColour();
|
||||||
|
|
||||||
// Old stuff
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
m_frameWidget = (WXWidget) XtVaCreateManagedWidget("main_window",
|
|
||||||
xmMainWindowWidgetClass, (Widget) clientWindow->GetTopWidget(),
|
|
||||||
XmNresizePolicy, XmRESIZE_NONE,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
// TODO: make sure this doesn't cause problems.
|
|
||||||
// I think ~wxFrame will do the right thing since it deletes m_frameWidget,
|
|
||||||
// then sets the main widget to NULL.
|
|
||||||
m_mainWidget = m_frameWidget;
|
|
||||||
|
|
||||||
m_workArea = (WXWidget) XtVaCreateWidget("form",
|
|
||||||
xmFormWidgetClass, (Widget) m_frameWidget,
|
|
||||||
XmNresizePolicy, XmRESIZE_NONE,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
m_clientArea = (WXWidget) XtVaCreateWidget("client",
|
|
||||||
xmBulletinBoardWidgetClass, (Widget) m_workArea,
|
|
||||||
XmNmarginWidth, 0,
|
|
||||||
XmNmarginHeight, 0,
|
|
||||||
XmNrightAttachment, XmATTACH_FORM,
|
|
||||||
XmNleftAttachment, XmATTACH_FORM,
|
|
||||||
XmNtopAttachment, XmATTACH_FORM,
|
|
||||||
XmNbottomAttachment, XmATTACH_FORM,
|
|
||||||
// XmNresizePolicy, XmRESIZE_ANY,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
XtVaSetValues((Widget) m_frameWidget,
|
|
||||||
XmNworkWindow, (Widget) m_workArea,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
XtManageChild((Widget) m_clientArea);
|
|
||||||
XtManageChild((Widget) m_workArea);
|
|
||||||
|
|
||||||
wxASSERT_MSG ((wxWidgetHashTable->Get((long)m_workArea) == (wxObject*) NULL), "Widget table clash in frame.cpp") ;
|
|
||||||
|
|
||||||
wxAddWindowToTable((Widget) m_workArea, this);
|
|
||||||
|
|
||||||
XtTranslations ptr ;
|
|
||||||
|
|
||||||
XtOverrideTranslations((Widget) m_workArea,
|
|
||||||
ptr = XtParseTranslationTable("<Configure>: resize()"));
|
|
||||||
|
|
||||||
XtFree((char *)ptr);
|
|
||||||
|
|
||||||
XtAddCallback((Widget) m_workArea, XmNfocusCallback,
|
|
||||||
(XtCallbackProc)wxFrameFocusProc, (XtPointer)this);
|
|
||||||
|
|
||||||
XtManageChild((Widget) m_mainWidget);
|
|
||||||
|
|
||||||
if (x > -1)
|
|
||||||
XtVaSetValues((Widget) m_mainWidget, XmNx, x, NULL);
|
|
||||||
if (y > -1)
|
|
||||||
XtVaSetValues((Widget) m_mainWidget, XmNy, y, NULL);
|
|
||||||
if (width > -1)
|
|
||||||
XtVaSetValues((Widget) m_mainWidget, XmNwidth, width, NULL);
|
|
||||||
if (height > -1)
|
|
||||||
XtVaSetValues((Widget) m_mainWidget, XmNheight, height, NULL);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
XtManageChild((Widget) m_mainWidget);
|
XtManageChild((Widget) m_mainWidget);
|
||||||
|
|
||||||
SetTitle(title);
|
SetTitle(title);
|
||||||
@@ -540,10 +477,8 @@ void wxMDIChildFrame::SetIcon(const wxIcon& icon)
|
|||||||
m_icon = icon;
|
m_icon = icon;
|
||||||
if (m_icon.Ok())
|
if (m_icon.Ok())
|
||||||
{
|
{
|
||||||
/* TODO: doesn't work yet (crashes in XCopyArea)
|
// Not appropriate since there are no icons in
|
||||||
Pixmap pixmap = (Pixmap) m_icon.GetPixmap();
|
// a tabbed window
|
||||||
m_mdiWindow->setPixmap(pixmap);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -326,8 +326,7 @@ void wxMenuItemCallback (Widget w, XtPointer clientData,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void wxMenuItemArmCallback (Widget w, XtPointer clientData,
|
||||||
wxMenuItemArmCallback (Widget w, XtPointer clientData,
|
|
||||||
XtPointer ptr)
|
XtPointer ptr)
|
||||||
{
|
{
|
||||||
wxMenuItem *item = (wxMenuItem *) clientData;
|
wxMenuItem *item = (wxMenuItem *) clientData;
|
||||||
|
@@ -1526,7 +1526,7 @@ bool wxWindow::TransferDataToWindow()
|
|||||||
if ( child->GetValidator() &&
|
if ( child->GetValidator() &&
|
||||||
!child->GetValidator()->TransferToWindow() )
|
!child->GetValidator()->TransferToWindow() )
|
||||||
{
|
{
|
||||||
wxMessageBox("Application Error", "Could not transfer data to window", wxOK|wxICON_EXCLAMATION);
|
wxLogError("Could not transfer data to window.");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2604,7 +2604,13 @@ void wxCanvasInputEvent (Widget drawingArea, XtPointer data, XmDrawingAreaCallba
|
|||||||
(void) XLookupString ((XKeyEvent *) & local_event, wxBuffer, 20, &keySym, NULL);
|
(void) XLookupString ((XKeyEvent *) & local_event, wxBuffer, 20, &keySym, NULL);
|
||||||
int id = wxCharCodeXToWX (keySym);
|
int id = wxCharCodeXToWX (keySym);
|
||||||
|
|
||||||
wxKeyEvent event (wxEVT_CHAR);
|
wxEventType eventType = wxEVT_CHAR;
|
||||||
|
|
||||||
|
// TODO: Is this the correct criterion for wxEVT_KEY_DOWN down versus wxEVT_CHAR?
|
||||||
|
if (id > WXK_START) // Non-ASCII values
|
||||||
|
eventType = wxEVT_KEY_DOWN;
|
||||||
|
|
||||||
|
wxKeyEvent event (eventType);
|
||||||
|
|
||||||
if (local_event.xkey.state & ShiftMask)
|
if (local_event.xkey.state & ShiftMask)
|
||||||
event.m_shiftDown = TRUE;
|
event.m_shiftDown = TRUE;
|
||||||
@@ -2637,6 +2643,32 @@ void wxCanvasInputEvent (Widget drawingArea, XtPointer data, XmDrawingAreaCallba
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case KeyRelease:
|
||||||
|
{
|
||||||
|
KeySym keySym;
|
||||||
|
(void) XLookupString ((XKeyEvent *) & local_event, wxBuffer, 20, &keySym, NULL);
|
||||||
|
int id = wxCharCodeXToWX (keySym);
|
||||||
|
|
||||||
|
wxKeyEvent event (wxEVT_KEY_UP);
|
||||||
|
|
||||||
|
if (local_event.xkey.state & ShiftMask)
|
||||||
|
event.m_shiftDown = TRUE;
|
||||||
|
if (local_event.xkey.state & ControlMask)
|
||||||
|
event.m_controlDown = TRUE;
|
||||||
|
if (local_event.xkey.state & Mod3Mask)
|
||||||
|
event.m_altDown = TRUE;
|
||||||
|
if (local_event.xkey.state & Mod1Mask)
|
||||||
|
event.m_metaDown = TRUE;
|
||||||
|
event.SetEventObject(canvas);
|
||||||
|
event.m_keyCode = id;
|
||||||
|
event.SetTimestamp(local_event.xkey.time);
|
||||||
|
|
||||||
|
if (id > -1)
|
||||||
|
{
|
||||||
|
canvas->GetEventHandler()->ProcessEvent (event);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case FocusIn:
|
case FocusIn:
|
||||||
{
|
{
|
||||||
if (local_event.xfocus.detail != NotifyPointer)
|
if (local_event.xfocus.detail != NotifyPointer)
|
||||||
|
@@ -323,10 +323,6 @@ bool wxGetClipboardFormatName(wxDataFormat dataFormat, char *formatName, int max
|
|||||||
return (::GetClipboardFormatName((int) dataFormat, formatName, maxCount) > 0);
|
return (::GetClipboardFormatName((int) dataFormat, formatName, maxCount) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* wxClipboard
|
|
||||||
*/
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxClipboard
|
// wxClipboard
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user