X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4c6819972f9536b2508dd21100eb0c09ed8350a9..0b4d4194a26948f4681701ce4b99ac9c665f104e:/user/wxFile/dirctrl.cpp diff --git a/user/wxFile/dirctrl.cpp b/user/wxFile/dirctrl.cpp index f4ee19aba7..16ad375642 100644 --- a/user/wxFile/dirctrl.cpp +++ b/user/wxFile/dirctrl.cpp @@ -16,6 +16,7 @@ #include "dirctrl.h" #include "wx/gdicmn.h" #include "wx/utils.h" +#include "wx/dnd.h" //----------------------------------------------------------------------------- // wxDirInfo @@ -32,10 +33,8 @@ wxDirInfo::wxDirInfo( const wxString &path ) if (m_path == "/home") { m_name = "My Home"; - m_path += "/"; - char buf[300]; - wxGetHomeDir( buf ); - m_path = buf; + m_path = ""; + wxGetHomeDir( &m_path ); } else if (m_path == "/proc") m_name = "Info Filesystem"; @@ -75,7 +74,6 @@ BEGIN_EVENT_TABLE(wxDirCtrl,wxTreeCtrl) EVT_TREE_ITEM_EXPANDED (-1, wxDirCtrl::OnExpandItem) EVT_TREE_ITEM_COLLAPSED (-1, wxDirCtrl::OnCollapseItem) EVT_TREE_DELETE_ITEM (-1, wxDirCtrl::OnDeleteItem) - EVT_MOUSE_EVENTS (wxDirCtrl::OnMouse) END_EVENT_TABLE() wxDirCtrl::wxDirCtrl(void) @@ -95,11 +93,9 @@ wxDirCtrl::wxDirCtrl(wxWindow *parent, const wxWindowID id, const wxString &WXUN item.m_mask = wxTREE_MASK_TEXT | wxTREE_MASK_CHILDREN | wxTREE_MASK_DATA; item.m_text = "Sections"; item.m_children = 1; -/* - wxDirInfo *info = new wxDirInfo( dir ); - item.m_data = (long)info; -*/ m_rootId = InsertItem( 0, item ); + +// SetDropTarget( new wxFileDropTarget() ); }; void wxDirCtrl::OnExpandItem( const wxTreeEvent &event ) @@ -180,7 +176,8 @@ void wxDirCtrl::OnExpandItem( const wxTreeEvent &event ) (path != "/proc") && (path != "/mnt") ) - slist.Add( path ); // ref counting in action ! + + slist.Add( path ); // ref counting in action ! }; path = wxFindNextFile(); }; @@ -212,26 +209,3 @@ void wxDirCtrl::OnDeleteItem( const wxTreeEvent &event ) wxDirInfo *info = (wxDirInfo *)event.m_item.m_data; if (info) delete info; }; - -void wxDirCtrl::OnMouse( wxMouseEvent &event ) -{ - event.Skip(TRUE); - - if (event.LeftDown()) - { - m_dragX = event.GetX(); - m_dragY = event.GetY(); - return; - }; - - if (event.Dragging()) - { - if ((abs(m_dragX-event.GetX()) < 2) && - (abs(m_dragY-event.GetY()) < 2)) return; - - wxTextDragSource drag( this ); - drag.SetTextData( "Oh, what a drag." ); - drag.Start( event.GetX(), event.GetY() ); - }; -}; -