Implemented a simple modality under X11.
Filled wxDataFormat and wxDataObject etc. Added skeleton for X11 clipboard. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14370 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
13
configure
vendored
13
configure
vendored
@@ -19604,22 +19604,15 @@ EOF
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$wxUSE_CLIPBOARD" = "yes"; then
|
if test "$wxUSE_CLIPBOARD" = "yes"; then
|
||||||
if test "$wxUSE_X11" = 1; then
|
cat >> confdefs.h <<\EOF
|
||||||
echo "configure: warning: Clipboard not yet supported under X11... disabled" 1>&2
|
|
||||||
wxUSE_CLIPBOARD=no
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "$wxUSE_CLIPBOARD" = "yes"; then
|
|
||||||
cat >> confdefs.h <<\EOF
|
|
||||||
#define wxUSE_CLIPBOARD 1
|
#define wxUSE_CLIPBOARD 1
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
||||||
cat >> confdefs.h <<\EOF
|
cat >> confdefs.h <<\EOF
|
||||||
#define wxUSE_DATAOBJ 1
|
#define wxUSE_DATAOBJ 1
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$wxUSE_DRAG_AND_DROP" = "yes" ; then
|
if test "$wxUSE_DRAG_AND_DROP" = "yes" ; then
|
||||||
@@ -20509,7 +20502,7 @@ SAMPLES_SUBDIRS="`echo $SAMPLES_SUBDIRS | tr -s ' ' | tr ' ' '\n' | sort | uniq
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
|
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
|
||||||
echo "configure:20513: checking whether ${MAKE-make} sets \${MAKE}" >&5
|
echo "configure:20506: checking whether ${MAKE-make} sets \${MAKE}" >&5
|
||||||
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
|
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
|
||||||
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
|
13
configure.in
13
configure.in
@@ -4115,17 +4115,10 @@ if test "$wxUSE_IPC" = "yes"; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$wxUSE_CLIPBOARD" = "yes"; then
|
if test "$wxUSE_CLIPBOARD" = "yes"; then
|
||||||
if test "$wxUSE_X11" = 1; then
|
AC_DEFINE(wxUSE_CLIPBOARD)
|
||||||
AC_MSG_WARN([Clipboard not yet supported under X11... disabled])
|
|
||||||
wxUSE_CLIPBOARD=no
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "$wxUSE_CLIPBOARD" = "yes"; then
|
dnl required by clipboard code in configuration check
|
||||||
AC_DEFINE(wxUSE_CLIPBOARD)
|
AC_DEFINE(wxUSE_DATAOBJ)
|
||||||
|
|
||||||
dnl required by clipboard code in configuration check
|
|
||||||
AC_DEFINE(wxUSE_DATAOBJ)
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$wxUSE_DRAG_AND_DROP" = "yes" ; then
|
if test "$wxUSE_DRAG_AND_DROP" = "yes" ; then
|
||||||
|
@@ -1186,6 +1186,7 @@ colour.h X11H
|
|||||||
cursor.h X11H
|
cursor.h X11H
|
||||||
dataform.h X11H
|
dataform.h X11H
|
||||||
dataobj.h X11H
|
dataobj.h X11H
|
||||||
|
dataobj2.h X11H
|
||||||
dc.h X11H
|
dc.h X11H
|
||||||
dcclient.h X11H
|
dcclient.h X11H
|
||||||
dcmemory.h X11H
|
dcmemory.h X11H
|
||||||
|
@@ -460,6 +460,8 @@ private:
|
|||||||
#else // !__WXMSW__
|
#else // !__WXMSW__
|
||||||
#if defined(__WXGTK__)
|
#if defined(__WXGTK__)
|
||||||
#include "wx/gtk/dataobj2.h"
|
#include "wx/gtk/dataobj2.h"
|
||||||
|
#elif defined(__WXX11__)
|
||||||
|
#include "wx/x11/dataobj2.h"
|
||||||
#elif defined(__WXMAC__)
|
#elif defined(__WXMAC__)
|
||||||
#include "wx/mac/dataobj2.h"
|
#include "wx/mac/dataobj2.h"
|
||||||
#elif defined(__WXPM__)
|
#elif defined(__WXPM__)
|
||||||
|
@@ -1,84 +1,88 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: clipbrd.h
|
// Name: clipbrd.h
|
||||||
// Purpose: Clipboard functionality.
|
// Purpose: Clipboard functionality.
|
||||||
// Author: Julian Smart
|
// Author: Robert Roebling
|
||||||
// Modified by:
|
|
||||||
// Created: 17/09/98
|
// Created: 17/09/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) Robert Roebling
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_CLIPBRD_H_
|
#ifndef __X11CLIPBOARDH__
|
||||||
#define _WX_CLIPBRD_H_
|
#define __X11CLIPBOARDH__
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface "clipbrd.h"
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if wxUSE_CLIPBOARD
|
#if wxUSE_CLIPBOARD
|
||||||
|
|
||||||
|
#include "wx/object.h"
|
||||||
#include "wx/list.h"
|
#include "wx/list.h"
|
||||||
|
#include "wx/dataobj.h"
|
||||||
|
#include "wx/control.h"
|
||||||
|
#include "wx/module.h"
|
||||||
|
|
||||||
bool WXDLLEXPORT wxOpenClipboard();
|
// ----------------------------------------------------------------------------
|
||||||
bool WXDLLEXPORT wxClipboardOpen();
|
|
||||||
bool WXDLLEXPORT wxCloseClipboard();
|
|
||||||
bool WXDLLEXPORT wxEmptyClipboard();
|
|
||||||
bool WXDLLEXPORT wxIsClipboardFormatAvailable(wxDataFormat dataFormat);
|
|
||||||
bool WXDLLEXPORT wxSetClipboardData(wxDataFormat dataFormat, wxObject *obj, int width = 0, int height = 0);
|
|
||||||
wxObject* WXDLLEXPORT wxGetClipboardData(wxDataFormat dataFormat, long *len = NULL);
|
|
||||||
wxDataFormat WXDLLEXPORT wxEnumClipboardFormats(wxDataFormat dataFormat);
|
|
||||||
wxDataFormat WXDLLEXPORT wxRegisterClipboardFormat(char *formatName);
|
|
||||||
bool WXDLLEXPORT wxGetClipboardFormatName(wxDataFormat dataFormat, char *formatName, int maxCount);
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// wxClipboard
|
// wxClipboard
|
||||||
//-----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
class wxClipboard : public wxClipboardBase
|
class wxClipboard : public wxClipboardBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxClipboard();
|
wxClipboard();
|
||||||
~wxClipboard();
|
~wxClipboard();
|
||||||
|
|
||||||
// open the clipboard before SetData() and GetData()
|
// open the clipboard before SetData() and GetData()
|
||||||
virtual bool Open();
|
virtual bool Open();
|
||||||
|
|
||||||
// close the clipboard after SetData() and GetData()
|
// close the clipboard after SetData() and GetData()
|
||||||
virtual void Close();
|
virtual void Close();
|
||||||
|
|
||||||
// opened?
|
// query whether the clipboard is opened
|
||||||
virtual bool IsOpened() const { return m_open; }
|
virtual bool IsOpened() const;
|
||||||
|
|
||||||
// replaces the data on the clipboard with data
|
// set the clipboard data. all other formats will be deleted.
|
||||||
virtual bool SetData( wxDataObject *data );
|
virtual bool SetData( wxDataObject *data );
|
||||||
|
|
||||||
// adds data to the clipboard
|
// add to the clipboard data.
|
||||||
virtual bool AddData( wxDataObject *data );
|
virtual bool AddData( wxDataObject *data );
|
||||||
|
|
||||||
// format available on the clipboard ?
|
// ask if data in correct format is available
|
||||||
virtual bool IsSupported( const wxDataFormat& format );
|
virtual bool IsSupported( const wxDataFormat& format );
|
||||||
|
|
||||||
// fill data with data on the clipboard (if available)
|
// fill data with data on the clipboard (if available)
|
||||||
virtual bool GetData( wxDataObject& data );
|
virtual bool GetData( wxDataObject& data );
|
||||||
|
|
||||||
// clears wxTheClipboard and the system's clipboard if possible
|
// clears wxTheClipboard and the system's clipboard if possible
|
||||||
virtual void Clear();
|
virtual void Clear();
|
||||||
|
|
||||||
|
// If primary == TRUE, use primary selection in all further ops,
|
||||||
|
// primary == FALSE resets it.
|
||||||
virtual void UsePrimarySelection(bool primary = TRUE)
|
virtual void UsePrimarySelection(bool primary = TRUE)
|
||||||
{ m_usePrimary = primary; }
|
{ m_usePrimary = primary; }
|
||||||
|
|
||||||
// implementation from now on
|
// implementation from now on
|
||||||
|
|
||||||
bool m_open;
|
bool m_open;
|
||||||
wxList m_data;
|
bool m_ownsClipboard;
|
||||||
|
bool m_ownsPrimarySelection;
|
||||||
|
wxDataObject *m_data;
|
||||||
|
|
||||||
|
WXWindow m_clipboardWidget; /* for getting and offering data */
|
||||||
|
WXWindow m_targetsWidget; /* for getting list of supported formats */
|
||||||
|
bool m_waiting; /* querying data or formats is asynchronous */
|
||||||
|
|
||||||
|
bool m_formatSupported;
|
||||||
|
Atom m_targetRequested;
|
||||||
bool m_usePrimary;
|
bool m_usePrimary;
|
||||||
|
wxDataObject *m_receivedData;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxClipboard)
|
DECLARE_DYNAMIC_CLASS(wxClipboard)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // wxUSE_CLIPBOARD
|
#endif
|
||||||
|
// wxUSE_CLIPBOARD
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// _WX_CLIPBRD_H_
|
// __X11CLIPBOARDH__
|
||||||
|
@@ -9,8 +9,8 @@
|
|||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_MOTIF_DATAFORM_H
|
#ifndef _WX_X11_DATAFORM_H
|
||||||
#define _WX_MOTIF_DATAFORM_H
|
#define _WX_X11_DATAFORM_H
|
||||||
|
|
||||||
class wxDataFormat
|
class wxDataFormat
|
||||||
{
|
{
|
||||||
@@ -25,17 +25,17 @@ public:
|
|||||||
wxDataFormat( NativeFormat format );
|
wxDataFormat( NativeFormat format );
|
||||||
|
|
||||||
wxDataFormat& operator=(NativeFormat format)
|
wxDataFormat& operator=(NativeFormat format)
|
||||||
{ SetId(format); return *this; }
|
{ SetId(format); return *this; }
|
||||||
|
|
||||||
// comparison (must have both versions)
|
// comparison (must have both versions)
|
||||||
bool operator==(NativeFormat format) const
|
bool operator==(NativeFormat format) const
|
||||||
{ return m_format == (NativeFormat)format; }
|
{ return m_format == (NativeFormat)format; }
|
||||||
bool operator!=(NativeFormat format) const
|
bool operator!=(NativeFormat format) const
|
||||||
{ return m_format != (NativeFormat)format; }
|
{ return m_format != (NativeFormat)format; }
|
||||||
bool operator==(wxDataFormatId format) const
|
bool operator==(wxDataFormatId format) const
|
||||||
{ return m_type == (wxDataFormatId)format; }
|
{ return m_type == (wxDataFormatId)format; }
|
||||||
bool operator!=(wxDataFormatId format) const
|
bool operator!=(wxDataFormatId format) const
|
||||||
{ return m_type != (wxDataFormatId)format; }
|
{ return m_type != (wxDataFormatId)format; }
|
||||||
|
|
||||||
// explicit and implicit conversions to NativeFormat which is one of
|
// explicit and implicit conversions to NativeFormat which is one of
|
||||||
// standard data types (implicit conversion is useful for preserving the
|
// standard data types (implicit conversion is useful for preserving the
|
||||||
@@ -62,5 +62,5 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // _WX_MOTIF_DATAFORM_H
|
#endif // _WX_X11_DATAFORM_H
|
||||||
|
|
||||||
|
@@ -3,12 +3,12 @@
|
|||||||
// Purpose: declaration of the wxDataObject class for Motif
|
// Purpose: declaration of the wxDataObject class for Motif
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) 1998 Julian Smart
|
// Copyright: (c) 1998 Robert Roebling
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_MOTIF_DATAOBJ_H_
|
#ifndef _WX_X11_DATAOBJ_H_
|
||||||
#define _WX_MOTIF_DATAOBJ_H_
|
#define _WX_X11_DATAOBJ_H_
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface "dataobj.h"
|
#pragma interface "dataobj.h"
|
||||||
@@ -21,10 +21,14 @@
|
|||||||
class wxDataObject : public wxDataObjectBase
|
class wxDataObject : public wxDataObjectBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
wxDataObject();
|
||||||
|
|
||||||
#ifdef __DARWIN__
|
#ifdef __DARWIN__
|
||||||
~wxDataObject() { }
|
~wxDataObject() { }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
virtual bool IsSupportedFormat( const wxDataFormat& format, Direction dir = Get ) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //_WX_MOTIF_DATAOBJ_H_
|
#endif //_WX_X11_DATAOBJ_H_
|
||||||
|
|
||||||
|
89
include/wx/x11/dataobj2.h
Normal file
89
include/wx/x11/dataobj2.h
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: gtk/dataobj2.h
|
||||||
|
// Purpose: declaration of standard wxDataObjectSimple-derived classes
|
||||||
|
// Author: Robert Roebling
|
||||||
|
// Created: 19.10.99 (extracted from gtk/dataobj.h)
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 1998, 1999 Vadim Zeitlin, Robert Roebling
|
||||||
|
// Licence: wxWindows license
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef _WX_X11_DATAOBJ2_H_
|
||||||
|
#define _WX_X11_DATAOBJ2_H_
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface "dataobj.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxBitmapDataObject is a specialization of wxDataObject for bitmaps
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class wxBitmapDataObject : public wxBitmapDataObjectBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// ctors
|
||||||
|
wxBitmapDataObject();
|
||||||
|
wxBitmapDataObject(const wxBitmap& bitmap);
|
||||||
|
|
||||||
|
// destr
|
||||||
|
~wxBitmapDataObject();
|
||||||
|
|
||||||
|
// override base class virtual to update PNG data too
|
||||||
|
virtual void SetBitmap(const wxBitmap& bitmap);
|
||||||
|
|
||||||
|
// implement base class pure virtuals
|
||||||
|
// ----------------------------------
|
||||||
|
|
||||||
|
virtual size_t GetDataSize() const { return m_pngSize; }
|
||||||
|
virtual bool GetDataHere(void *buf) const;
|
||||||
|
virtual bool SetData(size_t len, const void *buf);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void Init() { m_pngData = (void *)NULL; m_pngSize = 0; }
|
||||||
|
void Clear() { free(m_pngData); }
|
||||||
|
void ClearAll() { Clear(); Init(); }
|
||||||
|
|
||||||
|
size_t m_pngSize;
|
||||||
|
void *m_pngData;
|
||||||
|
|
||||||
|
void DoConvertToPng();
|
||||||
|
|
||||||
|
private:
|
||||||
|
// virtual function hiding supression
|
||||||
|
size_t GetDataSize(const wxDataFormat& format) const
|
||||||
|
{ return(wxDataObjectSimple::GetDataSize(format)); }
|
||||||
|
bool GetDataHere(const wxDataFormat& format, void* pBuf) const
|
||||||
|
{ return(wxDataObjectSimple::GetDataHere(format, pBuf)); }
|
||||||
|
bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf)
|
||||||
|
{ return(wxDataObjectSimple::SetData(format, nLen, pBuf)); }
|
||||||
|
};
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxFileDataObject is a specialization of wxDataObject for file names
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class wxFileDataObject : public wxFileDataObjectBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// implement base class pure virtuals
|
||||||
|
// ----------------------------------
|
||||||
|
|
||||||
|
void AddFile( const wxString &filename );
|
||||||
|
|
||||||
|
virtual size_t GetDataSize() const;
|
||||||
|
virtual bool GetDataHere(void *buf) const;
|
||||||
|
virtual bool SetData(size_t len, const void *buf);
|
||||||
|
|
||||||
|
private:
|
||||||
|
// virtual function hiding supression
|
||||||
|
size_t GetDataSize(const wxDataFormat& format) const
|
||||||
|
{ return(wxDataObjectSimple::GetDataSize(format)); }
|
||||||
|
bool GetDataHere(const wxDataFormat& format, void* pBuf) const
|
||||||
|
{ return(wxDataObjectSimple::GetDataHere(format, pBuf)); }
|
||||||
|
bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf)
|
||||||
|
{ return(wxDataObjectSimple::SetData(format, nLen, pBuf)); }
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _WX_X11_DATAOBJ2_H_
|
||||||
|
|
@@ -174,9 +174,6 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
|||||||
|
|
||||||
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
char *test = NULL;
|
|
||||||
*test = 0;
|
|
||||||
|
|
||||||
// TRUE is to force the frame to close
|
// TRUE is to force the frame to close
|
||||||
Close(TRUE);
|
Close(TRUE);
|
||||||
}
|
}
|
||||||
|
@@ -435,7 +435,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
wxKeyEvent keyEvent(wxEVT_KEY_DOWN);
|
wxKeyEvent keyEvent(wxEVT_KEY_DOWN);
|
||||||
wxTranslateKeyEvent(keyEvent, win, window, event);
|
wxTranslateKeyEvent(keyEvent, win, window, event);
|
||||||
|
|
||||||
wxLogDebug( "OnKey from %s", win->GetName().c_str() );
|
// wxLogDebug( "OnKey from %s", win->GetName().c_str() );
|
||||||
|
|
||||||
// We didn't process wxEVT_KEY_DOWN, so send
|
// We didn't process wxEVT_KEY_DOWN, so send
|
||||||
// wxEVT_CHAR
|
// wxEVT_CHAR
|
||||||
@@ -598,14 +598,20 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
|
|
||||||
if (!win->IsEnabled())
|
if (!win->IsEnabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Here we check if the top level window is
|
||||||
|
// disabled, which is one aspect of modality.
|
||||||
|
wxWindow *tlw = win;
|
||||||
|
while (tlw && !tlw->IsTopLevel())
|
||||||
|
tlw = tlw->GetParent();
|
||||||
|
if (tlw && !tlw->IsEnabled())
|
||||||
|
return;
|
||||||
|
|
||||||
#if 1
|
|
||||||
if (event->type == ButtonPress)
|
if (event->type == ButtonPress)
|
||||||
{
|
{
|
||||||
if ((win != wxWindow::FindFocus()) && win->AcceptsFocus())
|
if ((win != wxWindow::FindFocus()) && win->AcceptsFocus())
|
||||||
win->SetFocus();
|
win->SetFocus();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
wxMouseEvent wxevent;
|
wxMouseEvent wxevent;
|
||||||
wxTranslateMouseEvent(wxevent, win, window, event);
|
wxTranslateMouseEvent(wxevent, win, window, event);
|
||||||
@@ -618,7 +624,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
if (win && event->xfocus.detail != NotifyPointer)
|
if (win && event->xfocus.detail != NotifyPointer)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
wxLogDebug( "FocusIn from %s", win->GetName().c_str() );
|
// wxLogDebug( "FocusIn from %s", win->GetName().c_str() );
|
||||||
|
|
||||||
wxFocusEvent focusEvent(wxEVT_SET_FOCUS, win->GetId());
|
wxFocusEvent focusEvent(wxEVT_SET_FOCUS, win->GetId());
|
||||||
focusEvent.SetEventObject(win);
|
focusEvent.SetEventObject(win);
|
||||||
@@ -632,7 +638,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
if (win && event->xfocus.detail != NotifyPointer)
|
if (win && event->xfocus.detail != NotifyPointer)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
wxLogDebug( "FocusOut from %s", win->GetName().c_str() );
|
// wxLogDebug( "FocusOut from %s", win->GetName().c_str() );
|
||||||
|
|
||||||
wxFocusEvent focusEvent(wxEVT_KILL_FOCUS, win->GetId());
|
wxFocusEvent focusEvent(wxEVT_KILL_FOCUS, win->GetId());
|
||||||
focusEvent.SetEventObject(win);
|
focusEvent.SetEventObject(win);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -120,8 +120,6 @@ const char *wxGetTextFromUserPromptStr = "Input Text";
|
|||||||
const char *wxMessageBoxCaptionStr = "Message";
|
const char *wxMessageBoxCaptionStr = "Message";
|
||||||
const char *wxFileSelectorPromptStr = "Select a file";
|
const char *wxFileSelectorPromptStr = "Select a file";
|
||||||
const char *wxFileSelectorDefaultWildcardStr = "*.*";
|
const char *wxFileSelectorDefaultWildcardStr = "*.*";
|
||||||
const char *wxInternalErrorStr = "wxWindows Internal Error";
|
|
||||||
const char *wxFatalErrorStr = "wxWindows Fatal Error";
|
|
||||||
const char *wxDirDialogNameStr = "wxDirCtrl";
|
const char *wxDirDialogNameStr = "wxDirCtrl";
|
||||||
const char *wxDirDialogDefaultFolderStr = "/";
|
const char *wxDirDialogDefaultFolderStr = "/";
|
||||||
const wxChar *wxTreeCtrlNameStr = wxT("wxTreeCtrl");
|
const wxChar *wxTreeCtrlNameStr = wxT("wxTreeCtrl");
|
||||||
|
@@ -8,22 +8,16 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation "dataobj.h"
|
#pragma implementation "dataobj.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/defs.h"
|
#include "wx/defs.h"
|
||||||
|
|
||||||
#if wxUSE_CLIPBOARD
|
|
||||||
|
|
||||||
#include "wx/dataobj.h"
|
#include "wx/dataobj.h"
|
||||||
|
#include "wx/mstream.h"
|
||||||
#include "wx/app.h"
|
#include "wx/app.h"
|
||||||
|
#include "wx/image.h"
|
||||||
|
|
||||||
#ifdef __VMS__
|
|
||||||
#pragma message disable nosimpint
|
|
||||||
#endif
|
|
||||||
#ifdef __VMS__
|
|
||||||
#pragma message enable nosimpint
|
|
||||||
#endif
|
|
||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
#include "wx/x11/private.h"
|
#include "wx/x11/private.h"
|
||||||
|
|
||||||
@@ -142,59 +136,237 @@ void wxDataFormat::PrepareFormats()
|
|||||||
if (!g_pngAtom)
|
if (!g_pngAtom)
|
||||||
g_pngAtom = XInternAtom( (Display*) wxGetDisplay(), "image/png", FALSE );
|
g_pngAtom = XInternAtom( (Display*) wxGetDisplay(), "image/png", FALSE );
|
||||||
if (!g_fileAtom)
|
if (!g_fileAtom)
|
||||||
g_fileAtom = XInternAtom( (Display*) wxGetDisplay(), "file:ALL", FALSE );
|
g_fileAtom = XInternAtom( (Display*) wxGetDisplay(), "text/uri-list", FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
// wxDataObject
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
wxDataObject::wxDataObject()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxDataObject::IsSupportedFormat(const wxDataFormat& format, Direction dir) const
|
||||||
|
{
|
||||||
|
size_t nFormatCount = GetFormatCount(dir);
|
||||||
|
if ( nFormatCount == 1 )
|
||||||
|
{
|
||||||
|
return format == GetPreferredFormat();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxDataFormat *formats = new wxDataFormat[nFormatCount];
|
||||||
|
GetAllFormats(formats,dir);
|
||||||
|
|
||||||
|
size_t n;
|
||||||
|
for ( n = 0; n < nFormatCount; n++ )
|
||||||
|
{
|
||||||
|
if ( formats[n] == format )
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
delete [] formats;
|
||||||
|
|
||||||
|
// found?
|
||||||
|
return n < nFormatCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxFileDataObject
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
bool wxFileDataObject::GetDataHere(void *buf) const
|
||||||
|
{
|
||||||
|
wxString filenames;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < m_filenames.GetCount(); i++)
|
||||||
|
{
|
||||||
|
filenames += m_filenames[i];
|
||||||
|
filenames += (wxChar) 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy( buf, filenames.mbc_str(), filenames.Len() + 1 );
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t wxFileDataObject::GetDataSize() const
|
||||||
|
{
|
||||||
|
size_t res = 0;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < m_filenames.GetCount(); i++)
|
||||||
|
{
|
||||||
|
res += m_filenames[i].Len();
|
||||||
|
res += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return res + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxFileDataObject::SetData(size_t WXUNUSED(size), const void *buf)
|
||||||
|
{
|
||||||
|
// VZ: old format
|
||||||
#if 0
|
#if 0
|
||||||
|
// filenames are stores as a string with #0 as deliminators
|
||||||
|
const char *filenames = (const char*) buf;
|
||||||
|
size_t pos = 0;
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
if (filenames[0] == 0)
|
||||||
|
break;
|
||||||
|
if (pos >= size)
|
||||||
|
break;
|
||||||
|
wxString file( filenames ); // this returns the first file
|
||||||
|
AddFile( file );
|
||||||
|
pos += file.Len()+1;
|
||||||
|
filenames += file.Len()+1;
|
||||||
|
}
|
||||||
|
#else // 1
|
||||||
|
m_filenames.Empty();
|
||||||
|
|
||||||
|
// the text/uri-list format is a sequence of URIs (filenames prefixed by
|
||||||
|
// "file:" as far as I see) delimited by "\r\n" of total length size
|
||||||
|
// (I wonder what happens if the file has '\n' in its filename??)
|
||||||
|
wxString filename;
|
||||||
|
for ( const char *p = (const char *)buf; ; p++ )
|
||||||
|
{
|
||||||
|
// some broken programs (testdnd GTK+ sample!) omit the trailing
|
||||||
|
// "\r\n", so check for '\0' explicitly here instead of doing it in
|
||||||
|
// the loop statement to account for it
|
||||||
|
if ( (*p == '\r' && *(p+1) == '\n') || !*p )
|
||||||
|
{
|
||||||
|
size_t lenPrefix = 5; // strlen("file:")
|
||||||
|
if ( filename.Left(lenPrefix).MakeLower() == _T("file:") )
|
||||||
|
{
|
||||||
|
// sometimes the syntax is "file:filename", sometimes it's
|
||||||
|
// URL-like: "file://filename" - deal with both
|
||||||
|
if ( filename[lenPrefix] == _T('/') &&
|
||||||
|
filename[lenPrefix + 1] == _T('/') )
|
||||||
|
{
|
||||||
|
// skip the slashes
|
||||||
|
lenPrefix += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
AddFile(filename.c_str() + lenPrefix);
|
||||||
|
filename.Empty();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxLogDebug(_T("Unsupported URI '%s' in wxFileDataObject"),
|
||||||
|
filename.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !*p )
|
||||||
|
break;
|
||||||
|
|
||||||
|
// skip '\r'
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
filename += *p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // 0/1
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxFileDataObject::AddFile( const wxString &filename )
|
||||||
|
{
|
||||||
|
m_filenames.Add( filename );
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxPrivateDataObject
|
// wxBitmapDataObject
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS( wxPrivateDataObject, wxDataObject )
|
wxBitmapDataObject::wxBitmapDataObject()
|
||||||
|
|
||||||
void wxPrivateDataObject::Free()
|
|
||||||
{
|
{
|
||||||
if ( m_data )
|
Init();
|
||||||
free(m_data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPrivateDataObject::wxPrivateDataObject()
|
wxBitmapDataObject::wxBitmapDataObject( const wxBitmap& bitmap )
|
||||||
|
: wxBitmapDataObjectBase(bitmap)
|
||||||
{
|
{
|
||||||
wxString id = wxT("application/");
|
Init();
|
||||||
id += wxTheApp->GetAppName();
|
|
||||||
|
|
||||||
m_format.SetId( id );
|
DoConvertToPng();
|
||||||
|
|
||||||
m_size = 0;
|
|
||||||
m_data = (void *)NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPrivateDataObject::SetData( const void *data, size_t size )
|
wxBitmapDataObject::~wxBitmapDataObject()
|
||||||
{
|
{
|
||||||
Free();
|
Clear();
|
||||||
|
|
||||||
m_size = size;
|
|
||||||
m_data = malloc(size);
|
|
||||||
|
|
||||||
memcpy( m_data, data, size );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPrivateDataObject::WriteData( void *dest ) const
|
void wxBitmapDataObject::SetBitmap( const wxBitmap &bitmap )
|
||||||
{
|
{
|
||||||
WriteData( m_data, dest );
|
ClearAll();
|
||||||
|
|
||||||
|
wxBitmapDataObjectBase::SetBitmap(bitmap);
|
||||||
|
|
||||||
|
DoConvertToPng();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t wxPrivateDataObject::GetSize() const
|
bool wxBitmapDataObject::GetDataHere(void *buf) const
|
||||||
{
|
{
|
||||||
return m_size;
|
if ( !m_pngSize )
|
||||||
|
{
|
||||||
|
wxFAIL_MSG( wxT("attempt to copy empty bitmap failed") );
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(buf, m_pngData, m_pngSize);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPrivateDataObject::WriteData( const void *data, void *dest ) const
|
bool wxBitmapDataObject::SetData(size_t size, const void *buf)
|
||||||
{
|
{
|
||||||
memcpy( dest, data, GetSize() );
|
Clear();
|
||||||
|
|
||||||
|
#if wxUSE_LIBPNG
|
||||||
|
m_pngSize = size;
|
||||||
|
m_pngData = malloc(m_pngSize);
|
||||||
|
|
||||||
|
memcpy( m_pngData, buf, m_pngSize );
|
||||||
|
|
||||||
|
wxMemoryInputStream mstream( (char*) m_pngData, m_pngSize );
|
||||||
|
wxImage image;
|
||||||
|
wxPNGHandler handler;
|
||||||
|
if ( !handler.LoadFile( &image, mstream ) )
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_bitmap = image.ConvertToBitmap();
|
||||||
|
|
||||||
|
return m_bitmap.Ok();
|
||||||
|
#else
|
||||||
|
return FALSE;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // 0
|
void wxBitmapDataObject::DoConvertToPng()
|
||||||
|
{
|
||||||
|
#if wxUSE_LIBPNG
|
||||||
|
if (!m_bitmap.Ok())
|
||||||
|
return;
|
||||||
|
|
||||||
|
wxImage image( m_bitmap );
|
||||||
|
wxPNGHandler handler;
|
||||||
|
|
||||||
|
wxCountingOutputStream count;
|
||||||
|
handler.SaveFile( &image, count );
|
||||||
|
|
||||||
|
m_pngSize = count.GetSize() + 100; // sometimes the size seems to vary ???
|
||||||
|
m_pngData = malloc(m_pngSize);
|
||||||
|
|
||||||
|
wxMemoryOutputStream mstream( (char*) m_pngData, m_pngSize );
|
||||||
|
handler.SaveFile( &image, mstream );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#endif // wxUSE_CLIPBOARD
|
|
||||||
|
@@ -473,6 +473,7 @@ ALL_HEADERS = \
|
|||||||
x11/cursor.h \
|
x11/cursor.h \
|
||||||
x11/dataform.h \
|
x11/dataform.h \
|
||||||
x11/dataobj.h \
|
x11/dataobj.h \
|
||||||
|
x11/dataobj2.h \
|
||||||
x11/dc.h \
|
x11/dc.h \
|
||||||
x11/dcclient.h \
|
x11/dcclient.h \
|
||||||
x11/dcmemory.h \
|
x11/dcmemory.h \
|
||||||
|
@@ -447,14 +447,14 @@ bool wxSetWMDecorations(Window w, long style)
|
|||||||
|
|
||||||
if (style & wxRESIZE_BORDER)
|
if (style & wxRESIZE_BORDER)
|
||||||
{
|
{
|
||||||
wxLogDebug("MWM_DECOR_RESIZEH");
|
// wxLogDebug("MWM_DECOR_RESIZEH");
|
||||||
hints.flags |= MWM_HINTS_DECORATIONS;
|
hints.flags |= MWM_HINTS_DECORATIONS;
|
||||||
hints.decorations |= MWM_DECOR_RESIZEH;
|
hints.decorations |= MWM_DECOR_RESIZEH;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (style & wxSYSTEM_MENU)
|
if (style & wxSYSTEM_MENU)
|
||||||
{
|
{
|
||||||
wxLogDebug("MWM_DECOR_MENU");
|
// wxLogDebug("MWM_DECOR_MENU");
|
||||||
hints.flags |= MWM_HINTS_DECORATIONS;
|
hints.flags |= MWM_HINTS_DECORATIONS;
|
||||||
hints.decorations |= MWM_DECOR_MENU;
|
hints.decorations |= MWM_DECOR_MENU;
|
||||||
}
|
}
|
||||||
@@ -463,28 +463,28 @@ bool wxSetWMDecorations(Window w, long style)
|
|||||||
(style & wxTINY_CAPTION_HORIZ) ||
|
(style & wxTINY_CAPTION_HORIZ) ||
|
||||||
(style & wxTINY_CAPTION_VERT))
|
(style & wxTINY_CAPTION_VERT))
|
||||||
{
|
{
|
||||||
wxLogDebug("MWM_DECOR_TITLE");
|
// wxLogDebug("MWM_DECOR_TITLE");
|
||||||
hints.flags |= MWM_HINTS_DECORATIONS;
|
hints.flags |= MWM_HINTS_DECORATIONS;
|
||||||
hints.decorations |= MWM_DECOR_TITLE;
|
hints.decorations |= MWM_DECOR_TITLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((style & wxTHICK_FRAME) || (style & wxSIMPLE_BORDER) || (style & wxCAPTION))
|
if ((style & wxTHICK_FRAME) || (style & wxSIMPLE_BORDER) || (style & wxCAPTION))
|
||||||
{
|
{
|
||||||
wxLogDebug("MWM_DECOR_BORDER");
|
// wxLogDebug("MWM_DECOR_BORDER");
|
||||||
hints.flags |= MWM_HINTS_DECORATIONS;
|
hints.flags |= MWM_HINTS_DECORATIONS;
|
||||||
hints.decorations |= MWM_DECOR_BORDER;
|
hints.decorations |= MWM_DECOR_BORDER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (style & wxMINIMIZE_BOX)
|
if (style & wxMINIMIZE_BOX)
|
||||||
{
|
{
|
||||||
wxLogDebug("MWM_DECOR_MINIMIZE");
|
// wxLogDebug("MWM_DECOR_MINIMIZE");
|
||||||
hints.flags |= MWM_HINTS_DECORATIONS;
|
hints.flags |= MWM_HINTS_DECORATIONS;
|
||||||
hints.decorations |= MWM_DECOR_MINIMIZE;
|
hints.decorations |= MWM_DECOR_MINIMIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (style & wxMAXIMIZE_BOX)
|
if (style & wxMAXIMIZE_BOX)
|
||||||
{
|
{
|
||||||
wxLogDebug("MWM_DECOR_MAXIMIZE");
|
// wxLogDebug("MWM_DECOR_MAXIMIZE");
|
||||||
hints.flags |= MWM_HINTS_DECORATIONS;
|
hints.flags |= MWM_HINTS_DECORATIONS;
|
||||||
hints.decorations |= MWM_DECOR_MAXIMIZE;
|
hints.decorations |= MWM_DECOR_MAXIMIZE;
|
||||||
}
|
}
|
||||||
@@ -585,14 +585,11 @@ void wxTopLevelWindowX11::DoSetClientSize(int width, int height)
|
|||||||
|
|
||||||
void wxTopLevelWindowX11::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
void wxTopLevelWindowX11::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxLogDebug( "Setting pos: %d, %d", x, y );
|
||||||
msg.Printf("Setting pos: %d, %d", x, y);
|
|
||||||
wxLogDebug(msg);
|
|
||||||
wxWindowX11::DoSetSize(x, y, width, height, sizeFlags);
|
wxWindowX11::DoSetSize(x, y, width, height, sizeFlags);
|
||||||
|
|
||||||
wxPoint pt = GetPosition();
|
wxPoint pt = GetPosition();
|
||||||
msg.Printf("After, pos: %d, %d", pt.x, pt.y);
|
wxLogDebug( "After, pos: %d, %d", pt.x, pt.y );
|
||||||
wxLogDebug(msg);
|
|
||||||
#if 0
|
#if 0
|
||||||
XSync(wxGlobalDisplay(), False);
|
XSync(wxGlobalDisplay(), False);
|
||||||
int w, h;
|
int w, h;
|
||||||
@@ -646,8 +643,8 @@ void wxTopLevelWindowX11::DoGetPosition(int *x, int *y) const
|
|||||||
Window window = (Window) m_mainWidget;
|
Window window = (Window) m_mainWidget;
|
||||||
if (window)
|
if (window)
|
||||||
{
|
{
|
||||||
int offsetX = 0;
|
int offsetX = 0;
|
||||||
int offsetY = 0;
|
int offsetY = 0;
|
||||||
|
|
||||||
#if !wxUSE_NANOX
|
#if !wxUSE_NANOX
|
||||||
wxLogDebug("Translating...");
|
wxLogDebug("Translating...");
|
||||||
@@ -655,9 +652,7 @@ void wxTopLevelWindowX11::DoGetPosition(int *x, int *y) const
|
|||||||
XTranslateCoordinates(wxGlobalDisplay(), window, XDefaultRootWindow(wxGlobalDisplay()),
|
XTranslateCoordinates(wxGlobalDisplay(), window, XDefaultRootWindow(wxGlobalDisplay()),
|
||||||
0, 0, & offsetX, & offsetY, & childWindow);
|
0, 0, & offsetX, & offsetY, & childWindow);
|
||||||
|
|
||||||
wxString msg;
|
wxLogDebug("Offset: %d, %d", offsetX, offsetY);
|
||||||
msg.Printf("Offset: %d, %d", offsetX, offsetY);
|
|
||||||
wxLogDebug(msg);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
XWindowAttributes attr;
|
XWindowAttributes attr;
|
||||||
|
@@ -383,7 +383,7 @@ void wxWindowX11::DoCaptureMouse()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxLogDebug("Grabbed pointer in %s", GetName().c_str() );
|
// wxLogDebug("Grabbed pointer in %s", GetName().c_str() );
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
res = XGrabButton(wxGlobalDisplay(), AnyButton, AnyModifier,
|
res = XGrabButton(wxGlobalDisplay(), AnyButton, AnyModifier,
|
||||||
@@ -443,7 +443,7 @@ void wxWindowX11::DoReleaseMouse()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
wxLogDebug( "Ungrabbed pointer in %s", GetName().c_str() );
|
// wxLogDebug( "Ungrabbed pointer in %s", GetName().c_str() );
|
||||||
|
|
||||||
m_winCaptured = FALSE;
|
m_winCaptured = FALSE;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user