warning msgs
toolbar updates mdi fixes dnd works now Forty Thieves drawing optimization wxDF_Text constants ListCtrl bugs fixed memory leak work imrc now refers to home dir dcclient/memory leak fixed git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@381 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
326
user/wxFile/FMJobs.cpp
Normal file
326
user/wxFile/FMJobs.cpp
Normal file
@@ -0,0 +1,326 @@
|
||||
/*
|
||||
* Program: FMJobs.cpp
|
||||
*
|
||||
* Author: Robert Roebling
|
||||
*
|
||||
* Copyright: (C) 1997, GNU (Robert Roebling)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "FMJobs.h"
|
||||
#endif
|
||||
|
||||
#include "FMJobs.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/filefn.h"
|
||||
#include "wx/msgdlg.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxCopyStatusDia
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxCopyStatusDia,wxDialog);
|
||||
|
||||
const ID_CANCEL_COPY = 1000;
|
||||
|
||||
BEGIN_EVENT_TABLE(wxCopyStatusDia,wxDialog)
|
||||
EVT_BUTTON (ID_CANCEL_COPY, wxCopyStatusDia::OnCommand)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
wxCopyStatusDia::wxCopyStatusDia( wxFrame *parent, const wxString &dest, wxArrayString *files ) :
|
||||
wxDialog( parent, -1, "FileMaker copy job control", wxPoint(180,180), wxSize(500,200) )
|
||||
{
|
||||
int w = 0;
|
||||
int h = 0;
|
||||
GetSize( &w, &h );
|
||||
|
||||
m_dest = dest;
|
||||
m_files = files;
|
||||
m_stop = FALSE;
|
||||
|
||||
(void)new wxStaticText( this, -1, "Copying files", wxPoint(10,10) );
|
||||
(void)new wxStaticText( this, -1, "from:", wxPoint(30,40) );
|
||||
m_sourceMsg = new wxStaticText( this, -1, "", wxPoint(80,40), wxSize(200,-1) );
|
||||
(void)new wxStaticText( this, -1, " to:", wxPoint(30,70) );
|
||||
m_destMsg = new wxStaticText( this, -1, "", wxPoint(80,70), wxSize(200,-1) );
|
||||
(void)new wxStaticText( this, -1, " Kb copied:", wxPoint(30,100) );
|
||||
m_statusMsg = new wxStaticText( this, -1, "0", wxPoint(120,100), wxSize(100,-1) );
|
||||
|
||||
m_cancelButton = new wxButton( this, ID_CANCEL_COPY, "Return", wxPoint(w-130,h-50), wxSize(85,30) );
|
||||
|
||||
Centre( wxVERTICAL | wxHORIZONTAL );
|
||||
|
||||
m_timer = new wxCopyTimer( this );
|
||||
m_timer->Start( 300, TRUE );
|
||||
|
||||
Show( TRUE );
|
||||
};
|
||||
|
||||
wxCopyStatusDia::~wxCopyStatusDia()
|
||||
{
|
||||
delete m_timer;
|
||||
};
|
||||
|
||||
void wxCopyStatusDia::OnCommand( wxCommandEvent &WXUNUSED(event) )
|
||||
{
|
||||
if (m_stop) EndModal(wxID_CANCEL);
|
||||
m_stop = TRUE;
|
||||
};
|
||||
|
||||
void wxCopyStatusDia::DoCopy(void)
|
||||
{
|
||||
wxYield();
|
||||
|
||||
if (!wxDirExists(m_dest))
|
||||
{
|
||||
wxMessageBox( "Target is not a directory or it doesn`t exist. Can`t copy.", "FileMaker" );
|
||||
return;
|
||||
};
|
||||
|
||||
for (uint i = 0; i < m_files->Count(); i++)
|
||||
{
|
||||
wxString src = (*m_files)[i];
|
||||
if (wxDirExists( src ))
|
||||
CopyDir( src, m_dest );
|
||||
else
|
||||
CopyFile( src, m_dest );
|
||||
if (m_stop) return;
|
||||
};
|
||||
m_stop = TRUE;
|
||||
};
|
||||
|
||||
void wxCopyStatusDia::CopyDir( wxString &srcDir, wxString &destDir )
|
||||
{
|
||||
wxString src = srcDir;
|
||||
wxString dest = destDir;
|
||||
dest += "/";
|
||||
dest += wxFileNameFromPath( src );
|
||||
if (!wxMkdir( dest ))
|
||||
{
|
||||
wxMessageBox( "Could not create target directory.", "FileMaker" );
|
||||
return;
|
||||
};
|
||||
|
||||
wxArrayString list;
|
||||
src += "/*";
|
||||
char *f = wxFindFirstFile( src, wxDIR );
|
||||
while (f)
|
||||
{
|
||||
list.Add( f );
|
||||
f = wxFindNextFile();
|
||||
};
|
||||
|
||||
for (uint i = 0; i < list.Count(); i++)
|
||||
{
|
||||
wxString filename = list[i];
|
||||
if (wxDirExists( filename ))
|
||||
CopyDir( filename, dest );
|
||||
else
|
||||
CopyFile( filename, dest );
|
||||
if (m_stop) return;
|
||||
};
|
||||
};
|
||||
|
||||
void wxCopyStatusDia::CopyFile( wxString &src, wxString &destDir )
|
||||
{
|
||||
m_sourceMsg->SetLabel( src );
|
||||
wxString dest = destDir;
|
||||
dest += "/";
|
||||
dest += wxFileNameFromPath( src );
|
||||
m_destMsg->SetLabel( dest );
|
||||
|
||||
wxYield();
|
||||
|
||||
if (wxFileExists(dest))
|
||||
{
|
||||
wxString s = "Target file ";
|
||||
s += dest;
|
||||
s += " exists already. Overwrite?";
|
||||
int ret = wxMessageBox( s, "FileMaker", wxYES_NO );
|
||||
if (ret == wxNO) return;
|
||||
};
|
||||
|
||||
FILE *fs = NULL, *fd = NULL;
|
||||
if (!(fs = fopen(src, "rb")))
|
||||
{
|
||||
wxString s = "Cannot open source file ";
|
||||
s += src;
|
||||
s += ".";
|
||||
wxMessageBox( s, "FileMaker" );
|
||||
return;
|
||||
}
|
||||
else
|
||||
if (!(fd = fopen(dest, "wb")))
|
||||
{
|
||||
fclose(fs);
|
||||
wxString s = "Cannot open target file ";
|
||||
s += dest;
|
||||
s += ".";
|
||||
wxMessageBox( s, "FileMaker" );
|
||||
return;
|
||||
};
|
||||
int ch;
|
||||
long kcounter = 0;
|
||||
while (!m_stop)
|
||||
{
|
||||
int counter = 0;
|
||||
while ((ch = getc( fs )) != EOF)
|
||||
{
|
||||
putc( ch, fd );
|
||||
counter++;
|
||||
if (counter == 1000) break;
|
||||
};
|
||||
kcounter++;
|
||||
m_statusMsg->SetLabel( IntToString( kcounter) );
|
||||
wxYield();
|
||||
if (ch == EOF) break;
|
||||
};
|
||||
fclose( fs );
|
||||
fclose( fd );
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxDeleteStatusDia
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxDeleteStatusDia,wxDialogBox);
|
||||
|
||||
wxDeleteStatusDia::wxDeleteStatusDia( wxFrame *parent, wxStringList *files ) :
|
||||
wxDialogBox( parent, "FileMaker delete job control", TRUE,
|
||||
180, 180, 500, 200, wxCAPTION | wxTRANSIENT )
|
||||
{
|
||||
int w = 0;
|
||||
int h = 0;
|
||||
GetSize( &w, &h );
|
||||
|
||||
m_files = files;
|
||||
m_stop = FALSE;
|
||||
m_countFiles = 0;
|
||||
m_countDirs = 0;
|
||||
|
||||
wxFont *myFont = wxTheFontList->FindOrCreateFont( 12, wxROMAN, wxNORMAL, wxNORMAL );
|
||||
SetLabelFont( myFont );
|
||||
SetButtonFont( myFont );
|
||||
|
||||
wxStaticText *msg = new wxStaticText( this, "Deleting file or directory:", 10, 10 );
|
||||
m_targetMsg = new wxStaticText( this, "", 80, 40, 300 );
|
||||
msg = new wxStaticText( this, " Directories deleted:", 10, 80 );
|
||||
m_dirsMsg = new wxStaticText( this, "0", 120, 80, 80 );
|
||||
msg = new wxStaticText( this, " Files deleted:", 10, 110 );
|
||||
m_filesMsg = new wxStaticText( this, "0", 120, 110, 100 );
|
||||
|
||||
m_cancelButton = new wxButton( this, NULL, "Return", w-130, h-50, 85, 30 );
|
||||
|
||||
Centre( wxVERTICAL | wxHORIZONTAL );
|
||||
|
||||
m_timer = new wxDeleteTimer( this );
|
||||
m_timer->Start( 300, TRUE );
|
||||
|
||||
Show( TRUE );
|
||||
};
|
||||
|
||||
wxDeleteStatusDia::~wxDeleteStatusDia()
|
||||
{
|
||||
delete m_timer;
|
||||
};
|
||||
|
||||
void wxDeleteStatusDia::OnCommand( wxWindow &win, wxCommandEvent &WXUNUSED(event) )
|
||||
{
|
||||
if (&win == m_cancelButton)
|
||||
{
|
||||
if (m_stop) Show( FALSE );
|
||||
m_stop = TRUE;
|
||||
return;
|
||||
};
|
||||
};
|
||||
|
||||
void wxDeleteStatusDia::DoDelete(void)
|
||||
{
|
||||
while (wxTheApp->Pending()) wxTheApp->Dispatch();
|
||||
wxNode *node = m_files->First();
|
||||
while (node)
|
||||
{
|
||||
char *target = (char*)node->Data();
|
||||
if (wxDirExists( target ))
|
||||
DeleteDir( target );
|
||||
else
|
||||
DeleteFile( target );
|
||||
if (m_stop) return;
|
||||
node = node->Next();
|
||||
};
|
||||
m_stop = TRUE;
|
||||
};
|
||||
|
||||
void wxDeleteStatusDia::DeleteDir( char *target )
|
||||
{
|
||||
wxString s = target;
|
||||
s += "// *";
|
||||
wxStringList list;
|
||||
char *f = wxFindFirstFile( s );
|
||||
while (f)
|
||||
{
|
||||
list.Add( f );
|
||||
f = wxFindNextFile();
|
||||
};
|
||||
wxNode *node = list.First();
|
||||
while (node)
|
||||
{
|
||||
f = (char*)node->Data();
|
||||
if (wxDirExists( f ))
|
||||
DeleteDir( f );
|
||||
else
|
||||
DeleteFile( f );
|
||||
if (m_stop) return;
|
||||
node = node->Next();
|
||||
};
|
||||
if (!wxRmdir( target ))
|
||||
{
|
||||
s = "Could not remove directory ";
|
||||
s += target;
|
||||
s += ".";
|
||||
wxMessageBox( s, "FileMaker" );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_countDirs++;
|
||||
m_dirsMsg->SetLabel( wxIntToString( m_countDirs) );
|
||||
};
|
||||
};
|
||||
|
||||
void wxDeleteStatusDia::DeleteFile( char *target )
|
||||
{
|
||||
m_targetMsg->SetLabel( target );
|
||||
while (wxTheApp->Pending()) wxTheApp->Dispatch();
|
||||
if (!wxRemoveFile( target ))
|
||||
{
|
||||
wxString s = "Could not delete file ";
|
||||
s += target;
|
||||
s += ".";
|
||||
wxMessageBox( s, "FileMaker" );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_countFiles++;
|
||||
m_filesMsg->SetLabel( wxIntToString( m_countFiles) );
|
||||
};
|
||||
};
|
||||
|
||||
*/
|
143
user/wxFile/FMJobs.h
Normal file
143
user/wxFile/FMJobs.h
Normal file
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* File: FMJobs.h
|
||||
*
|
||||
* Author: Robert Roebling
|
||||
*
|
||||
* Copyright: (C) 1997, GNU (Robert Roebling)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef FMJobs_h
|
||||
#define FMJobs_h
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/dialog.h"
|
||||
#include "wx/frame.h"
|
||||
#include "wx/button.h"
|
||||
#include "wx/stattext.h"
|
||||
#include "wx/timer.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// derived classes
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxCopyStatusDia;
|
||||
class wxDeleteStatusDia;
|
||||
class wxCopyTimer;
|
||||
class wxDeleteTimer;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxCopyStatusDia
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxCopyStatusDia: public wxDialog
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS( wxCopyStatusDia );
|
||||
|
||||
private:
|
||||
|
||||
wxString m_dest;
|
||||
wxArrayString *m_files;
|
||||
wxButton *m_cancelButton;
|
||||
wxStaticText *m_sourceMsg;
|
||||
wxStaticText *m_destMsg;
|
||||
wxStaticText *m_statusMsg;
|
||||
bool m_stop;
|
||||
wxTimer *m_timer;
|
||||
|
||||
public:
|
||||
|
||||
wxCopyStatusDia(void) : wxDialog() {};
|
||||
wxCopyStatusDia( wxFrame *parent, const wxString &dest, wxArrayString *files );
|
||||
~wxCopyStatusDia();
|
||||
void OnCommand( wxCommandEvent &event );
|
||||
void DoCopy(void);
|
||||
|
||||
private:
|
||||
void CopyDir( wxString &srcDir, wxString &destDir );
|
||||
void CopyFile( wxString &src, wxString &destDir );
|
||||
|
||||
DECLARE_EVENT_TABLE();
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxDeleteStatusDia
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
class wxDeleteStatusDia: public wxDialog
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS( wxDeleteStatusDia );
|
||||
|
||||
private:
|
||||
|
||||
wxArrayString *m_files;
|
||||
wxButton *m_cancelButton;
|
||||
wxStaticText *m_targetMsg;
|
||||
wxStaticText *m_filesMsg,*m_dirsMsg;
|
||||
bool m_stop;
|
||||
wxTimer *m_timer;
|
||||
int m_countFiles,m_countDirs;
|
||||
|
||||
public:
|
||||
|
||||
wxDeleteStatusDia(void) : wxDialog() {};
|
||||
wxDeleteStatusDia( wxFrame *parent, wxArrayString *files );
|
||||
~wxDeleteStatusDia();
|
||||
void OnCommand( wxCommandEvent &event );
|
||||
void DoDelete(void);
|
||||
|
||||
private:
|
||||
void DeleteDir( wxString &target );
|
||||
void DeleteFile( wxString &target );
|
||||
|
||||
DECLARE_EVENT_TABLE();
|
||||
};
|
||||
*/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxTimer
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxCopyTimer: public wxTimer
|
||||
{
|
||||
private:
|
||||
wxCopyStatusDia *m_owner;
|
||||
|
||||
public:
|
||||
wxCopyTimer( wxCopyStatusDia *owner ) { m_owner = owner; };
|
||||
void Notify() { m_owner->DoCopy(); };
|
||||
};
|
||||
|
||||
/*
|
||||
class wxDeleteTimer: public wxTimer
|
||||
{
|
||||
private:
|
||||
wxDeleteStatusDia *m_owner;
|
||||
|
||||
public:
|
||||
wxDeleteTimer( wxDeleteStatusDia *owner ) { m_owner = owner; };
|
||||
void Notify() { m_owner->DoDelete(); };
|
||||
};
|
||||
*/
|
||||
|
||||
#endif // FMJobs_h
|
||||
|
||||
|
@@ -10,11 +10,11 @@ RULE=bin
|
||||
BIN_TARGET=wxFile
|
||||
# define library sources
|
||||
BIN_SRC=\
|
||||
wxFile.cpp filectrl.cpp dirctrl.cpp
|
||||
wxFile.cpp filectrl.cpp dirctrl.cpp FMJobs.cpp
|
||||
|
||||
#define library objects
|
||||
BIN_OBJ=\
|
||||
wxFile.o filectrl.o dirctrl.o
|
||||
wxFile.o filectrl.o dirctrl.o FMJobs.o
|
||||
|
||||
# additional things needed to link
|
||||
BIN_LINK=
|
||||
|
@@ -16,6 +16,7 @@
|
||||
#include "dirctrl.h"
|
||||
#include "wx/gdicmn.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/dnd.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxDirInfo
|
||||
@@ -75,7 +76,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 +95,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 +178,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 +211,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() );
|
||||
};
|
||||
};
|
||||
|
||||
|
@@ -67,7 +67,6 @@ class wxDirCtrl: public wxTreeCtrl
|
||||
void OnExpandItem( const wxTreeEvent &event );
|
||||
void OnCollapseItem( const wxTreeEvent &event );
|
||||
void OnDeleteItem( const wxTreeEvent &event );
|
||||
void OnMouse( wxMouseEvent &event );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
@@ -206,7 +206,7 @@ void wxFileData::MakeItem( wxListItem &item )
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxFileCtrl,wxListCtrl);
|
||||
|
||||
BEGIN_EVENT_TABLE(wxFileCtrl,wxListCtrl)
|
||||
EVT_SET_FOCUS (wxFileCtrl::OnSetFocus)
|
||||
EVT_SET_FOCUS (wxFileCtrl::OnSetFocus)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
wxFileCtrl *wxFileCtrl::m_lastFocus = NULL;
|
||||
@@ -222,8 +222,8 @@ wxFileCtrl::wxFileCtrl( wxWindow *win, const wxWindowID id, const wxString &dirN
|
||||
const long style, const wxString &name ) :
|
||||
wxListCtrl( win, id, pos, size, style, name )
|
||||
{
|
||||
SetItemSpacing( 20 );
|
||||
wxImageList *imageList = new wxImageList( 18, 18 );
|
||||
SetItemSpacing( 40 );
|
||||
wxImageList *imageList = new wxImageList( 30, 30 );
|
||||
imageList->Add( wxBitmap( folder_xpm ) );
|
||||
imageList->Add( wxBitmap( txt_xpm ) );
|
||||
imageList->Add( wxBitmap( list_xpm ) );
|
||||
@@ -236,8 +236,12 @@ wxFileCtrl::wxFileCtrl( wxWindow *win, const wxWindowID id, const wxString &dirN
|
||||
Update();
|
||||
|
||||
m_lastFocus = this;
|
||||
|
||||
SetDropTarget( new wxTextDropTarget() );
|
||||
|
||||
m_dragStartX = 0;
|
||||
m_dragStartY = 0;
|
||||
m_dragCount = 0;
|
||||
|
||||
SetDropTarget( new wxFileDropTarget() );
|
||||
};
|
||||
|
||||
void wxFileCtrl::ChangeToListMode()
|
||||
@@ -538,4 +542,3 @@ void wxFileCtrl::OnSetFocus( wxFocusEvent &event )
|
||||
event.Skip();
|
||||
};
|
||||
|
||||
|
||||
|
@@ -79,6 +79,9 @@ class wxFileCtrl : public wxListCtrl
|
||||
private:
|
||||
wxString m_dirName;
|
||||
bool m_showHidden;
|
||||
int m_dragStartX;
|
||||
int m_dragStartY;
|
||||
int m_dragCount;
|
||||
|
||||
public:
|
||||
wxFileCtrl( void );
|
||||
|
@@ -312,8 +312,11 @@ void MyFrame::OnListEndLabelEdit( wxListEvent &event )
|
||||
|
||||
void MyFrame::OnListDrag( wxListEvent &event )
|
||||
{
|
||||
printf( "OnDrag.\n" );
|
||||
return;
|
||||
wxFileDataObject data;
|
||||
data.AddFile( "/home/karl/test.txt" );
|
||||
|
||||
wxDropSource drag( data, m_leftFile->m_lastFocus );
|
||||
drag.DoDragDrop();
|
||||
};
|
||||
|
||||
void MyFrame::OnTreeSelected( wxTreeEvent &event )
|
||||
|
Reference in New Issue
Block a user