1. wxPostEvent added and documented
2. Made it possible to have wxDataObjects which support multiple formats painlessly 3. Extensively modified dnd sample to show a "real life" wxDataObject git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4028 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -48,10 +48,6 @@
|
||||
wxApp *wxTheApp = (wxApp *) NULL;
|
||||
wxAppInitializerFunction wxAppBase::m_appInitFn = (wxAppInitializerFunction) NULL;
|
||||
|
||||
#if wxUSE_THREADS
|
||||
extern wxList *wxPendingEvents;
|
||||
extern wxCriticalSection *wxPendingEventsLocker;
|
||||
#endif
|
||||
extern wxResourceCache *wxTheResourceCache;
|
||||
extern bool g_isIdle;
|
||||
|
||||
@@ -127,7 +123,7 @@ unsigned char g_palette[64*3] =
|
||||
// local functions
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
extern void wxFlushResources(void);
|
||||
extern void wxFlushResources();
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// global functions
|
||||
@@ -265,6 +261,7 @@ static gint wxapp_wakeup_timerout_callback( gpointer WXUNUSED(data) )
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif // wxUSE_THREADS
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -427,11 +424,9 @@ void wxApp::OnIdle( wxIdleEvent &event )
|
||||
|
||||
s_inOnIdle = TRUE;
|
||||
|
||||
#if wxUSE_THREADS
|
||||
/* Resend in the main thread events which have been prepared in other
|
||||
threads */
|
||||
ProcessPendingEvents();
|
||||
#endif
|
||||
|
||||
/* 'Garbage' collection of windows deleted with Close(). */
|
||||
DeletePendingObjects();
|
||||
@@ -520,12 +515,16 @@ void wxApp::Dispatch()
|
||||
gtk_main_iteration();
|
||||
}
|
||||
|
||||
#if wxUSE_THREADS
|
||||
void wxApp::ProcessPendingEvents()
|
||||
{
|
||||
wxNode *node = wxPendingEvents->First();
|
||||
#if wxUSE_THREADS
|
||||
wxCriticalSectionLocker locker(*wxPendingEventsLocker);
|
||||
#endif // wxUSE_THREADS
|
||||
|
||||
if ( !wxPendingEvents )
|
||||
return;
|
||||
|
||||
wxNode *node = wxPendingEvents->First();
|
||||
while (node)
|
||||
{
|
||||
wxEvtHandler *handler = (wxEvtHandler *)node->Data();
|
||||
@@ -537,7 +536,6 @@ void wxApp::ProcessPendingEvents()
|
||||
node = wxPendingEvents->First();
|
||||
}
|
||||
}
|
||||
#endif // wxUSE_THREADS
|
||||
|
||||
void wxApp::DeletePendingObjects()
|
||||
{
|
||||
|
@@ -39,12 +39,6 @@ wxWindowList wxTopLevelWindows;
|
||||
/* List of windows pending deletion */
|
||||
wxList wxPendingDelete;
|
||||
|
||||
#if wxUSE_THREADS
|
||||
/* List of events pending processing */
|
||||
wxList *wxPendingEvents = NULL;
|
||||
wxCriticalSection *wxPendingEventsLocker = NULL;
|
||||
#endif
|
||||
|
||||
/* Current cursor, in order to hang on to
|
||||
* cursor handle when setting the cursor globally */
|
||||
wxCursor g_globalCursor;
|
||||
|
@@ -651,7 +651,7 @@ source_drag_data_get (GtkWidget *WXUNUSED(widget),
|
||||
/* disable GUI threads */
|
||||
wxapp_uninstall_thread_wakeup();
|
||||
#endif
|
||||
|
||||
|
||||
gtk_selection_data_set( selection_data,
|
||||
selection_data->target,
|
||||
8, // 8-bit
|
||||
@@ -745,7 +745,8 @@ wxDropSource::wxDropSource( wxWindow *win, const wxIcon &go, const wxIcon &stop
|
||||
if (wxNullIcon == stop) m_stopIcon = wxIcon( gv_xpm );
|
||||
}
|
||||
|
||||
wxDropSource::wxDropSource( wxDataObject *data, wxWindow *win, const wxIcon &go, const wxIcon &stop )
|
||||
wxDropSource::wxDropSource( wxDataObject& data, wxWindow *win,
|
||||
const wxIcon &go, const wxIcon &stop )
|
||||
{
|
||||
m_waiting = TRUE;
|
||||
|
||||
@@ -754,15 +755,8 @@ wxDropSource::wxDropSource( wxDataObject *data, wxWindow *win, const wxIcon &go,
|
||||
if (win->m_wxwindow) m_widget = win->m_wxwindow;
|
||||
m_retValue = wxDragCancel;
|
||||
|
||||
if (data)
|
||||
{
|
||||
m_data = new wxDataBroker();
|
||||
m_data->Add( data );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_data = (wxDataBroker*) NULL;
|
||||
}
|
||||
m_data = new wxDataBroker;
|
||||
m_data->Add(&data);
|
||||
|
||||
m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
|
||||
m_goaheadCursor = wxCursor( wxCURSOR_HAND );
|
||||
@@ -786,6 +780,15 @@ wxDropSource::wxDropSource( wxDataBroker *data, wxWindow *win )
|
||||
m_goaheadCursor = wxCursor( wxCURSOR_HAND );
|
||||
}
|
||||
|
||||
void wxDropSource::SetData( wxDataObject& data )
|
||||
{
|
||||
if ( m_data )
|
||||
delete m_data;
|
||||
|
||||
m_data = new wxDataBroker;
|
||||
m_data->Add(&data);
|
||||
}
|
||||
|
||||
void wxDropSource::SetData( wxDataObject *data )
|
||||
{
|
||||
if (m_data) delete m_data;
|
||||
@@ -808,7 +811,7 @@ void wxDropSource::SetData( wxDataBroker *data )
|
||||
m_data = data;
|
||||
}
|
||||
|
||||
wxDropSource::~wxDropSource(void)
|
||||
wxDropSource::~wxDropSource()
|
||||
{
|
||||
if (m_data) delete m_data;
|
||||
|
||||
@@ -854,7 +857,7 @@ wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
|
||||
/* disable GUI threads */
|
||||
wxapp_uninstall_thread_wakeup();
|
||||
#endif
|
||||
|
||||
|
||||
/* don't start dragging if no button is down */
|
||||
if (button_number)
|
||||
{
|
||||
@@ -883,7 +886,7 @@ wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
|
||||
/* re-enable GUI threads */
|
||||
wxapp_install_thread_wakeup();
|
||||
#endif
|
||||
|
||||
|
||||
g_blockEventsOnDrag = FALSE;
|
||||
|
||||
UnregisterWindow();
|
||||
|
Reference in New Issue
Block a user