add missing wxUSE_DRAG_AND_DROP checks

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58347 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-01-23 23:55:17 +00:00
parent 1c1e6b5b50
commit 9adeb77af4
2 changed files with 89 additions and 60 deletions

View File

@@ -450,8 +450,10 @@ public:
virtual void SetFocus(); virtual void SetFocus();
#if wxUSE_DRAG_AND_DROP
virtual bool EnableDragSource( const wxDataFormat &format ); virtual bool EnableDragSource( const wxDataFormat &format );
virtual bool EnableDropTarget( const wxDataFormat &format ); virtual bool EnableDropTarget( const wxDataFormat &format );
#endif // wxUSE_DRAG_AND_DROP
virtual wxBorder GetDefaultBorder() const; virtual wxBorder GetDefaultBorder() const;

View File

@@ -417,7 +417,9 @@ public:
wxDataViewCtrl *GetOwner() { return m_owner; } wxDataViewCtrl *GetOwner() { return m_owner; }
const wxDataViewCtrl *GetOwner() const { return m_owner; } const wxDataViewCtrl *GetOwner() const { return m_owner; }
#if wxUSE_DRAG_AND_DROP
wxBitmap CreateItemBitmap( unsigned int row, int &indent ); wxBitmap CreateItemBitmap( unsigned int row, int &indent );
#endif // wxUSE_DRAG_AND_DROP
void OnPaint( wxPaintEvent &event ); void OnPaint( wxPaintEvent &event );
void OnArrowChar(unsigned int newCurrent, const wxKeyEvent& event); void OnArrowChar(unsigned int newCurrent, const wxKeyEvent& event);
void OnChar( wxKeyEvent &event ); void OnChar( wxKeyEvent &event );
@@ -488,6 +490,7 @@ public:
void Collapse( unsigned int row ) { OnCollapsing( row ); } void Collapse( unsigned int row ) { OnCollapsing( row ); }
bool IsExpanded( unsigned int row ) const; bool IsExpanded( unsigned int row ) const;
#if wxUSE_DRAG_AND_DROP
bool EnableDragSource( const wxDataFormat &format ); bool EnableDragSource( const wxDataFormat &format );
bool EnableDropTarget( const wxDataFormat &format ); bool EnableDropTarget( const wxDataFormat &format );
@@ -496,6 +499,7 @@ public:
bool OnDrop( wxDataFormat format, wxCoord x, wxCoord y ); bool OnDrop( wxDataFormat format, wxCoord x, wxCoord y );
wxDragResult OnData( wxDataFormat format, wxCoord x, wxCoord y, wxDragResult def ); wxDragResult OnData( wxDataFormat format, wxCoord x, wxCoord y, wxDragResult def );
void OnLeave(); void OnLeave();
#endif // wxUSE_DRAG_AND_DROP
private: private:
wxDataViewTreeNode * GetTreeNodeByRow( unsigned int row ) const; wxDataViewTreeNode * GetTreeNodeByRow( unsigned int row ) const;
@@ -524,6 +528,7 @@ private:
bool m_hasFocus; bool m_hasFocus;
#if wxUSE_DRAG_AND_DROP
int m_dragCount; int m_dragCount;
wxPoint m_dragStart; wxPoint m_dragStart;
@@ -534,6 +539,7 @@ private:
wxDataFormat m_dropFormat; wxDataFormat m_dropFormat;
bool m_dropHint; bool m_dropHint;
unsigned int m_dropHintLine; unsigned int m_dropHintLine;
#endif // wxUSE_DRAG_AND_DROP
// for double click logic // for double click logic
unsigned int m_lineLastClicked, unsigned int m_lineLastClicked,
@@ -1140,6 +1146,8 @@ wxDataViewIconTextRenderer::GetValueFromEditorCtrl(wxControl* WXUNUSED(editor),
// wxDataViewDropTarget // wxDataViewDropTarget
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#if wxUSE_DRAG_AND_DROP
class wxBitmapCanvas: public wxWindow class wxBitmapCanvas: public wxWindow
{ {
public: public:
@@ -1258,6 +1266,8 @@ public:
wxDataViewMainWindow *m_win; wxDataViewMainWindow *m_win;
}; };
#endif // wxUSE_DRAG_AND_DROP
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxDataViewRenameTimer // wxDataViewRenameTimer
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -1314,16 +1324,19 @@ wxDataViewMainWindow::wxDataViewMainWindow( wxDataViewCtrl *parent, wxWindowID i
m_lineHeight = wxMax( 17, GetCharHeight() + 2 ); // 17 = mini icon height + 1 m_lineHeight = wxMax( 17, GetCharHeight() + 2 ); // 17 = mini icon height + 1
#if wxUSE_DRAG_AND_DROP
m_dragCount = 0; m_dragCount = 0;
m_dragStart = wxPoint(0,0); m_dragStart = wxPoint(0,0);
m_lineLastClicked = (unsigned int) -1;
m_lineBeforeLastClicked = (unsigned int) -1;
m_lineSelectSingleOnUp = (unsigned int) -1;
m_dragEnabled = false; m_dragEnabled = false;
m_dropEnabled = false; m_dropEnabled = false;
m_dropHint = false; m_dropHint = false;
m_dropHintLine = (unsigned int) -1; m_dropHintLine = (unsigned int) -1;
#endif // wxUSE_DRAG_AND_DROP
m_lineLastClicked = (unsigned int) -1;
m_lineBeforeLastClicked = (unsigned int) -1;
m_lineSelectSingleOnUp = (unsigned int) -1;
m_hasFocus = false; m_hasFocus = false;
@@ -1351,6 +1364,8 @@ wxDataViewMainWindow::~wxDataViewMainWindow()
delete m_renameTimer; delete m_renameTimer;
} }
#if wxUSE_DRAG_AND_DROP
bool wxDataViewMainWindow::EnableDragSource( const wxDataFormat &format ) bool wxDataViewMainWindow::EnableDragSource( const wxDataFormat &format )
{ {
m_dragFormat = format; m_dragFormat = format;
@@ -1596,6 +1611,9 @@ wxBitmap wxDataViewMainWindow::CreateItemBitmap( unsigned int row, int &indent )
return bitmap; return bitmap;
} }
#endif // wxUSE_DRAG_AND_DROP
void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
{ {
wxDataViewModel *model = GetOwner()->GetModel(); wxDataViewModel *model = GetOwner()->GetModel();
@@ -1714,13 +1732,16 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
} }
} }
#if wxUSE_DRAG_AND_DROP
if (m_dropHint) if (m_dropHint)
{ {
wxRect rect( x_start, GetLineStart( m_dropHintLine ), x_last, GetLineHeight( m_dropHintLine ) ); wxRect rect( x_start, GetLineStart( m_dropHintLine ),
x_last, GetLineHeight( m_dropHintLine ) );
dc.SetPen( *wxBLACK_PEN ); dc.SetPen( *wxBLACK_PEN );
dc.SetBrush( *wxTRANSPARENT_BRUSH ); dc.SetBrush( *wxTRANSPARENT_BRUSH );
dc.DrawRectangle( rect ); dc.DrawRectangle( rect );
} }
#endif // wxUSE_DRAG_AND_DROP
wxDataViewColumn *expander = GetOwner()->GetExpanderColumn(); wxDataViewColumn *expander = GetOwner()->GetExpanderColumn();
if (!expander) if (!expander)
@@ -3365,6 +3386,7 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event )
wxDataViewModel *model = GetOwner()->GetModel(); wxDataViewModel *model = GetOwner()->GetModel();
#if wxUSE_DRAG_AND_DROP
if (event.Dragging()) if (event.Dragging())
{ {
if (m_dragCount == 0) if (m_dragCount == 0)
@@ -3412,6 +3434,7 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event )
{ {
m_dragCount = 0; m_dragCount = 0;
} }
#endif // wxUSE_DRAG_AND_DROP
bool forceClick = false; bool forceClick = false;
@@ -3795,6 +3818,8 @@ bool wxDataViewCtrl::AssociateModel( wxDataViewModel *model )
return true; return true;
} }
#if wxUSE_DRAG_AND_DROP
bool wxDataViewCtrl::EnableDragSource( const wxDataFormat &format ) bool wxDataViewCtrl::EnableDragSource( const wxDataFormat &format )
{ {
return m_clientArea->EnableDragSource( format ); return m_clientArea->EnableDragSource( format );
@@ -3805,6 +3830,8 @@ bool wxDataViewCtrl::EnableDropTarget( const wxDataFormat &format )
return m_clientArea->EnableDropTarget( format ); return m_clientArea->EnableDropTarget( format );
} }
#endif // wxUSE_DRAG_AND_DROP
bool wxDataViewCtrl::AppendColumn( wxDataViewColumn *col ) bool wxDataViewCtrl::AppendColumn( wxDataViewColumn *col )
{ {
if (!wxDataViewCtrlBase::AppendColumn(col)) if (!wxDataViewCtrlBase::AppendColumn(col))