as such it can work with just wxUSE_CLIPBOARD.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26001
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
dnl ---------------------------------------------------------------------------
dnl String stuff
dnl ---------------------------------------------------------------------------
dnl ---------------------------------------------------------------------------
dnl String stuff
dnl ---------------------------------------------------------------------------
if test "$wxUSE_DRAG_AND_DROP" = "yes"; then
AC_DEFINE(wxUSE_DRAG_AND_DROP)
if test "$wxUSE_DRAG_AND_DROP" = "yes"; then
AC_DEFINE(wxUSE_DRAG_AND_DROP)
- SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS dnd"
+if test "$wxUSE_DRAG_AND_DROP" = "yes" -o "$wxUSE_CLIPBOARD" = "yes"; then
+ SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS dnd"
+fi
+
if test "$wxUSE_SPLINES" = "yes" ; then
AC_DEFINE(wxUSE_SPLINES)
fi
if test "$wxUSE_SPLINES" = "yes" ; then
AC_DEFINE(wxUSE_SPLINES)
fi
#include "wx/clipbrd.h"
#include "wx/colordlg.h"
#include "wx/sizer.h"
#include "wx/clipbrd.h"
#include "wx/colordlg.h"
#include "wx/sizer.h"
#if wxUSE_METAFILES
#include "wx/metafile.h"
#if wxUSE_METAFILES
#include "wx/metafile.h"
+#if wxUSE_DRAG_AND_DROP || wxUSE_CLIPBOARD
// ----------------------------------------------------------------------------
// Define canvas class to show a bitmap
// ----------------------------------------------------------------------------
// Define canvas class to show a bitmap
// shapes, each one with its own colour and position
// ----------------------------------------------------------------------------
// shapes, each one with its own colour and position
// ----------------------------------------------------------------------------
+#if wxUSE_DRAG_AND_DROP
+
DnDShapeFrame *m_frame;
};
DnDShapeFrame *m_frame;
};
+#endif // wxUSE_DRAG_AND_DROP
+
// ----------------------------------------------------------------------------
// functions prototypes
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// functions prototypes
// ----------------------------------------------------------------------------
EVT_SIZE( DnDFrame::OnSize)
END_EVENT_TABLE()
EVT_SIZE( DnDFrame::OnSize)
END_EVENT_TABLE()
+#if wxUSE_DRAG_AND_DROP
+
BEGIN_EVENT_TABLE(DnDShapeFrame, wxFrame)
EVT_MENU(Menu_Shape_New, DnDShapeFrame::OnNewShape)
EVT_MENU(Menu_Shape_Edit, DnDShapeFrame::OnEditShape)
BEGIN_EVENT_TABLE(DnDShapeFrame, wxFrame)
EVT_MENU(Menu_Shape_New, DnDShapeFrame::OnNewShape)
EVT_MENU(Menu_Shape_Edit, DnDShapeFrame::OnEditShape)
EVT_BUTTON(Button_Colour, DnDShapeDialog::OnColour)
END_EVENT_TABLE()
EVT_BUTTON(Button_Colour, DnDShapeDialog::OnColour)
END_EVENT_TABLE()
+#endif // wxUSE_DRAG_AND_DROP
+
BEGIN_EVENT_TABLE(DnDCanvasBitmap, wxScrolledWindow)
EVT_PAINT(DnDCanvasBitmap::OnPaint)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(DnDCanvasBitmap, wxScrolledWindow)
EVT_PAINT(DnDCanvasBitmap::OnPaint)
END_EVENT_TABLE()
// `Main program' equivalent, creating windows and returning main app frame
bool DnDApp::OnInit()
{
// `Main program' equivalent, creating windows and returning main app frame
bool DnDApp::OnInit()
{
+#if wxUSE_DRAG_AND_DROP || wxUSE_CLIPBOARD
// switch on trace messages
#if defined(__WXGTK__)
wxLog::AddTraceMask(_T("clipboard"));
// switch on trace messages
#if defined(__WXGTK__)
wxLog::AddTraceMask(_T("clipboard"));
#endif // wxUSE_DRAG_AND_DROP
}
#endif // wxUSE_DRAG_AND_DROP
}
+#if wxUSE_DRAG_AND_DROP || wxUSE_CLIPBOARD
DnDFrame::DnDFrame(wxFrame *frame, wxChar *title, int x, int y, int w, int h)
: wxFrame(frame, wxID_ANY, title, wxPoint(x, y), wxSize(w, h)),
DnDFrame::DnDFrame(wxFrame *frame, wxChar *title, int x, int y, int w, int h)
: wxFrame(frame, wxID_ANY, title, wxPoint(x, y), wxSize(w, h)),
m_pLog = new wxLogTextCtrl(m_ctrlLog);
m_pLogPrev = wxLog::SetActiveTarget(m_pLog);
m_pLog = new wxLogTextCtrl(m_ctrlLog);
m_pLogPrev = wxLog::SetActiveTarget(m_pLog);
// associate drop targets with the controls
m_ctrlFile->SetDropTarget(new DnDFile(m_ctrlFile));
m_ctrlText->SetDropTarget(new DnDText(m_ctrlText));
m_ctrlLog->SetDropTarget(new URLDropTarget);
// associate drop targets with the controls
m_ctrlFile->SetDropTarget(new DnDFile(m_ctrlFile));
m_ctrlText->SetDropTarget(new DnDText(m_ctrlText));
m_ctrlLog->SetDropTarget(new URLDropTarget);
+#endif // wxUSE_DRAG_AND_DROP
wxBoxSizer *m_sizer_top = new wxBoxSizer( wxHORIZONTAL );
m_sizer_top->Add(m_ctrlFile, 1, wxEXPAND );
wxBoxSizer *m_sizer_top = new wxBoxSizer( wxHORIZONTAL );
m_sizer_top->Add(m_ctrlFile, 1, wxEXPAND );
void DnDFrame::OnNewFrame(wxCommandEvent& WXUNUSED(event))
{
void DnDFrame::OnNewFrame(wxCommandEvent& WXUNUSED(event))
{
(new DnDShapeFrame(this))->Show(true);
wxLogStatus(this, wxT("Double click the new frame to select a shape for it"));
(new DnDShapeFrame(this))->Show(true);
wxLogStatus(this, wxT("Double click the new frame to select a shape for it"));
+#endif // wxUSE_DRAG_AND_DROP
}
void DnDFrame::OnDrag(wxCommandEvent& WXUNUSED(event))
{
}
void DnDFrame::OnDrag(wxCommandEvent& WXUNUSED(event))
{
wxString strText = wxGetTextFromUser
(
_T("After you enter text in this dialog, press any mouse\n")
wxString strText = wxGetTextFromUser
(
_T("After you enter text in this dialog, press any mouse\n")
+#endif // wxUSE_DRAG_AND_DROP
}
void DnDFrame::OnDragMoveByDefault(wxCommandEvent& event)
}
void DnDFrame::OnDragMoveByDefault(wxCommandEvent& event)
void DnDFrame::OnLeftDown(wxMouseEvent &WXUNUSED(event) )
{
void DnDFrame::OnLeftDown(wxMouseEvent &WXUNUSED(event) )
{
if ( !m_strText.IsEmpty() )
{
// start drag operation
if ( !m_strText.IsEmpty() )
{
// start drag operation
SetStatusText(wxString(_T("Drag result: ")) + pc);
}
SetStatusText(wxString(_T("Drag result: ")) + pc);
}
+#endif // wxUSE_DRAG_AND_DROP
}
void DnDFrame::OnRightDown(wxMouseEvent &event )
}
void DnDFrame::OnRightDown(wxMouseEvent &event )
wxTheClipboard->Close();
}
wxTheClipboard->Close();
}
+#if wxUSE_DRAG_AND_DROP
+
// ----------------------------------------------------------------------------
// Notifications called by the base class
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// Notifications called by the base class
// ----------------------------------------------------------------------------
self->m_hasBitmap = true;
}
self->m_hasBitmap = true;
}
+#endif // wxUSE_DRAG_AND_DROP
+
// ----------------------------------------------------------------------------
// global functions
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// global functions
// ----------------------------------------------------------------------------
#endif // wxUSE_METAFILES
#endif // wxUSE_METAFILES
-#endif // wxUSE_DRAG_AND_DROP
+#endif // wxUSE_DRAG_AND_DROP || wxUSE_CLIPBOARD