rename wxFileList to wxFileListCtrl
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48746 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -26,7 +26,7 @@ class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
|
|||||||
extern WXDLLEXPORT_DATA(const wxChar) wxFileSelectorDefaultWildcardStr[];
|
extern WXDLLEXPORT_DATA(const wxChar) wxFileSelectorDefaultWildcardStr[];
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxFileData - a class to hold the file info for the wxFileList
|
// wxFileData - a class to hold the file info for the wxFileListCtrl
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLEXPORT wxFileData
|
class WXDLLEXPORT wxFileData
|
||||||
@@ -83,7 +83,7 @@ public:
|
|||||||
// Get/Set the type of file, file/dir/drive/link
|
// Get/Set the type of file, file/dir/drive/link
|
||||||
int GetType() const { return m_type; }
|
int GetType() const { return m_type; }
|
||||||
|
|
||||||
// the wxFileList fields in report view
|
// the wxFileListCtrl fields in report view
|
||||||
enum fileListFieldType
|
enum fileListFieldType
|
||||||
{
|
{
|
||||||
FileList_Name,
|
FileList_Name,
|
||||||
@@ -96,7 +96,7 @@ public:
|
|||||||
FileList_Max
|
FileList_Max
|
||||||
};
|
};
|
||||||
|
|
||||||
// Get the entry for report view of wxFileList
|
// Get the entry for report view of wxFileListCtrl
|
||||||
wxString GetEntry( fileListFieldType num ) const;
|
wxString GetEntry( fileListFieldType num ) const;
|
||||||
|
|
||||||
// Get a string representation of the file info
|
// Get a string representation of the file info
|
||||||
@@ -121,14 +121,14 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxFileList
|
// wxFileListCtrl
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLEXPORT wxFileList : public wxListCtrl
|
class WXDLLEXPORT wxFileListCtrl : public wxListCtrl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxFileList();
|
wxFileListCtrl();
|
||||||
wxFileList( wxWindow *win,
|
wxFileListCtrl( wxWindow *win,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxString &wild,
|
const wxString &wild,
|
||||||
bool showHidden,
|
bool showHidden,
|
||||||
@@ -137,7 +137,7 @@ public:
|
|||||||
long style = wxLC_LIST,
|
long style = wxLC_LIST,
|
||||||
const wxValidator &validator = wxDefaultValidator,
|
const wxValidator &validator = wxDefaultValidator,
|
||||||
const wxString &name = wxT("filelist") );
|
const wxString &name = wxT("filelist") );
|
||||||
virtual ~wxFileList();
|
virtual ~wxFileListCtrl();
|
||||||
|
|
||||||
virtual void ChangeToListMode();
|
virtual void ChangeToListMode();
|
||||||
virtual void ChangeToReportMode();
|
virtual void ChangeToReportMode();
|
||||||
@@ -177,7 +177,7 @@ protected:
|
|||||||
wxFileData::fileListFieldType m_sort_field;
|
wxFileData::fileListFieldType m_sort_field;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxFileList)
|
DECLARE_DYNAMIC_CLASS(wxFileListCtrl)
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -242,7 +242,7 @@ public:
|
|||||||
void GoToParentDir();
|
void GoToParentDir();
|
||||||
void GoToHomeDir();
|
void GoToHomeDir();
|
||||||
|
|
||||||
wxFileList *GetFileList() { return m_list; }
|
wxFileListCtrl *GetFileList() { return m_list; }
|
||||||
|
|
||||||
void ChangeToReportMode() { m_list->ChangeToReportMode(); }
|
void ChangeToReportMode() { m_list->ChangeToReportMode(); }
|
||||||
void ChangeToListMode() { m_list->ChangeToListMode(); }
|
void ChangeToListMode() { m_list->ChangeToListMode(); }
|
||||||
@@ -268,13 +268,13 @@ private:
|
|||||||
wxString m_filterExtension;
|
wxString m_filterExtension;
|
||||||
wxChoice *m_choice;
|
wxChoice *m_choice;
|
||||||
wxTextCtrl *m_text;
|
wxTextCtrl *m_text;
|
||||||
wxFileList *m_list;
|
wxFileListCtrl *m_list;
|
||||||
wxCheckBox *m_check;
|
wxCheckBox *m_check;
|
||||||
wxStaticText *m_static;
|
wxStaticText *m_static;
|
||||||
|
|
||||||
wxString m_dir;
|
wxString m_dir;
|
||||||
wxString m_fileName;
|
wxString m_fileName;
|
||||||
wxString m_wildCard; // wild card in one string as passed to the object previously.
|
wxString m_wildCard; // wild card in one string as we got it
|
||||||
|
|
||||||
int m_filterIndex;
|
int m_filterIndex;
|
||||||
bool m_inSelected;
|
bool m_inSelected;
|
||||||
|
@@ -390,29 +390,29 @@ void wxFileData::MakeItem( wxListItem &item )
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxFileList
|
// wxFileListCtrl
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
static bool ignoreChanges = false;
|
static bool ignoreChanges = false;
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxFileList,wxListCtrl)
|
IMPLEMENT_DYNAMIC_CLASS(wxFileListCtrl,wxListCtrl)
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxFileList,wxListCtrl)
|
BEGIN_EVENT_TABLE(wxFileListCtrl,wxListCtrl)
|
||||||
EVT_LIST_DELETE_ITEM(wxID_ANY, wxFileList::OnListDeleteItem)
|
EVT_LIST_DELETE_ITEM(wxID_ANY, wxFileListCtrl::OnListDeleteItem)
|
||||||
EVT_LIST_DELETE_ALL_ITEMS(wxID_ANY, wxFileList::OnListDeleteAllItems)
|
EVT_LIST_DELETE_ALL_ITEMS(wxID_ANY, wxFileListCtrl::OnListDeleteAllItems)
|
||||||
EVT_LIST_END_LABEL_EDIT(wxID_ANY, wxFileList::OnListEndLabelEdit)
|
EVT_LIST_END_LABEL_EDIT(wxID_ANY, wxFileListCtrl::OnListEndLabelEdit)
|
||||||
EVT_LIST_COL_CLICK(wxID_ANY, wxFileList::OnListColClick)
|
EVT_LIST_COL_CLICK(wxID_ANY, wxFileListCtrl::OnListColClick)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
wxFileList::wxFileList()
|
wxFileListCtrl::wxFileListCtrl()
|
||||||
{
|
{
|
||||||
m_showHidden = false;
|
m_showHidden = false;
|
||||||
m_sort_foward = 1;
|
m_sort_foward = 1;
|
||||||
m_sort_field = wxFileData::FileList_Name;
|
m_sort_field = wxFileData::FileList_Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFileList::wxFileList(wxWindow *win,
|
wxFileListCtrl::wxFileListCtrl(wxWindow *win,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxString& wild,
|
const wxString& wild,
|
||||||
bool showHidden,
|
bool showHidden,
|
||||||
@@ -439,14 +439,14 @@ wxFileList::wxFileList(wxWindow *win,
|
|||||||
ChangeToReportMode();
|
ChangeToReportMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileList::ChangeToListMode()
|
void wxFileListCtrl::ChangeToListMode()
|
||||||
{
|
{
|
||||||
ClearAll();
|
ClearAll();
|
||||||
SetSingleStyle( wxLC_LIST );
|
SetSingleStyle( wxLC_LIST );
|
||||||
UpdateFiles();
|
UpdateFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileList::ChangeToReportMode()
|
void wxFileListCtrl::ChangeToReportMode()
|
||||||
{
|
{
|
||||||
ClearAll();
|
ClearAll();
|
||||||
SetSingleStyle( wxLC_REPORT );
|
SetSingleStyle( wxLC_REPORT );
|
||||||
@@ -473,20 +473,20 @@ void wxFileList::ChangeToReportMode()
|
|||||||
UpdateFiles();
|
UpdateFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileList::ChangeToSmallIconMode()
|
void wxFileListCtrl::ChangeToSmallIconMode()
|
||||||
{
|
{
|
||||||
ClearAll();
|
ClearAll();
|
||||||
SetSingleStyle( wxLC_SMALL_ICON );
|
SetSingleStyle( wxLC_SMALL_ICON );
|
||||||
UpdateFiles();
|
UpdateFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileList::ShowHidden( bool show )
|
void wxFileListCtrl::ShowHidden( bool show )
|
||||||
{
|
{
|
||||||
m_showHidden = show;
|
m_showHidden = show;
|
||||||
UpdateFiles();
|
UpdateFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxFileList::Add( wxFileData *fd, wxListItem &item )
|
long wxFileListCtrl::Add( wxFileData *fd, wxListItem &item )
|
||||||
{
|
{
|
||||||
long ret = -1;
|
long ret = -1;
|
||||||
item.m_mask = wxLIST_MASK_TEXT + wxLIST_MASK_DATA + wxLIST_MASK_IMAGE;
|
item.m_mask = wxLIST_MASK_TEXT + wxLIST_MASK_DATA + wxLIST_MASK_IMAGE;
|
||||||
@@ -505,7 +505,7 @@ long wxFileList::Add( wxFileData *fd, wxListItem &item )
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileList::UpdateItem(const wxListItem &item)
|
void wxFileListCtrl::UpdateItem(const wxListItem &item)
|
||||||
{
|
{
|
||||||
wxFileData *fd = (wxFileData*)GetItemData(item);
|
wxFileData *fd = (wxFileData*)GetItemData(item);
|
||||||
wxCHECK_RET(fd, wxT("invalid filedata"));
|
wxCHECK_RET(fd, wxT("invalid filedata"));
|
||||||
@@ -522,7 +522,7 @@ void wxFileList::UpdateItem(const wxListItem &item)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileList::UpdateFiles()
|
void wxFileListCtrl::UpdateFiles()
|
||||||
{
|
{
|
||||||
// don't do anything before ShowModal() call which sets m_dirName
|
// don't do anything before ShowModal() call which sets m_dirName
|
||||||
if ( m_dirName == wxT("*") )
|
if ( m_dirName == wxT("*") )
|
||||||
@@ -629,7 +629,7 @@ void wxFileList::UpdateFiles()
|
|||||||
SortItems(m_sort_field, m_sort_foward);
|
SortItems(m_sort_field, m_sort_foward);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileList::SetWild( const wxString &wild )
|
void wxFileListCtrl::SetWild( const wxString &wild )
|
||||||
{
|
{
|
||||||
if (wild.Find(wxT('|')) != wxNOT_FOUND)
|
if (wild.Find(wxT('|')) != wxNOT_FOUND)
|
||||||
return;
|
return;
|
||||||
@@ -638,7 +638,7 @@ void wxFileList::SetWild( const wxString &wild )
|
|||||||
UpdateFiles();
|
UpdateFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileList::MakeDir()
|
void wxFileListCtrl::MakeDir()
|
||||||
{
|
{
|
||||||
wxString new_name( _("NewName") );
|
wxString new_name( _("NewName") );
|
||||||
wxString path( m_dirName );
|
wxString path( m_dirName );
|
||||||
@@ -686,7 +686,7 @@ void wxFileList::MakeDir()
|
|||||||
delete fd;
|
delete fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileList::GoToParentDir()
|
void wxFileListCtrl::GoToParentDir()
|
||||||
{
|
{
|
||||||
if (!IsTopMostDir(m_dirName))
|
if (!IsTopMostDir(m_dirName))
|
||||||
{
|
{
|
||||||
@@ -717,13 +717,13 @@ void wxFileList::GoToParentDir()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileList::GoToHomeDir()
|
void wxFileListCtrl::GoToHomeDir()
|
||||||
{
|
{
|
||||||
wxString s = wxGetUserHome( wxString() );
|
wxString s = wxGetUserHome( wxString() );
|
||||||
GoToDir(s);
|
GoToDir(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileList::GoToDir( const wxString &dir )
|
void wxFileListCtrl::GoToDir( const wxString &dir )
|
||||||
{
|
{
|
||||||
if (!wxDirExists(dir)) return;
|
if (!wxDirExists(dir)) return;
|
||||||
|
|
||||||
@@ -737,7 +737,7 @@ void wxFileList::GoToDir( const wxString &dir )
|
|||||||
EnsureVisible( 0 );
|
EnsureVisible( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileList::FreeItemData(wxListItem& item)
|
void wxFileListCtrl::FreeItemData(wxListItem& item)
|
||||||
{
|
{
|
||||||
if ( item.m_data )
|
if ( item.m_data )
|
||||||
{
|
{
|
||||||
@@ -748,17 +748,17 @@ void wxFileList::FreeItemData(wxListItem& item)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileList::OnListDeleteItem( wxListEvent &event )
|
void wxFileListCtrl::OnListDeleteItem( wxListEvent &event )
|
||||||
{
|
{
|
||||||
FreeItemData(event.m_item);
|
FreeItemData(event.m_item);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileList::OnListDeleteAllItems( wxListEvent & WXUNUSED(event) )
|
void wxFileListCtrl::OnListDeleteAllItems( wxListEvent & WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
FreeAllItemsData();
|
FreeAllItemsData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileList::FreeAllItemsData()
|
void wxFileListCtrl::FreeAllItemsData()
|
||||||
{
|
{
|
||||||
wxListItem item;
|
wxListItem item;
|
||||||
item.m_mask = wxLIST_MASK_DATA;
|
item.m_mask = wxLIST_MASK_DATA;
|
||||||
@@ -772,7 +772,7 @@ void wxFileList::FreeAllItemsData()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileList::OnListEndLabelEdit( wxListEvent &event )
|
void wxFileListCtrl::OnListEndLabelEdit( wxListEvent &event )
|
||||||
{
|
{
|
||||||
wxFileData *fd = (wxFileData*)event.m_item.m_data;
|
wxFileData *fd = (wxFileData*)event.m_item.m_data;
|
||||||
wxASSERT( fd );
|
wxASSERT( fd );
|
||||||
@@ -820,7 +820,7 @@ void wxFileList::OnListEndLabelEdit( wxListEvent &event )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileList::OnListColClick( wxListEvent &event )
|
void wxFileListCtrl::OnListColClick( wxListEvent &event )
|
||||||
{
|
{
|
||||||
int col = event.GetColumn();
|
int col = event.GetColumn();
|
||||||
|
|
||||||
@@ -841,7 +841,7 @@ void wxFileList::OnListColClick( wxListEvent &event )
|
|||||||
SortItems(m_sort_field, m_sort_foward);
|
SortItems(m_sort_field, m_sort_foward);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileList::SortItems(wxFileData::fileListFieldType field, bool forward)
|
void wxFileListCtrl::SortItems(wxFileData::fileListFieldType field, bool forward)
|
||||||
{
|
{
|
||||||
m_sort_field = field;
|
m_sort_field = field;
|
||||||
m_sort_foward = forward;
|
m_sort_foward = forward;
|
||||||
@@ -868,11 +868,11 @@ void wxFileList::SortItems(wxFileData::fileListFieldType field, bool forward)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFileList::~wxFileList()
|
wxFileListCtrl::~wxFileListCtrl()
|
||||||
{
|
{
|
||||||
// Normally the data are freed via an EVT_LIST_DELETE_ALL_ITEMS event and
|
// Normally the data are freed via an EVT_LIST_DELETE_ALL_ITEMS event and
|
||||||
// wxFileList::OnListDeleteAllItems. But if the event is generated after
|
// wxFileListCtrl::OnListDeleteAllItems. But if the event is generated after
|
||||||
// the destruction of the wxFileList we need to free any data here:
|
// the destruction of the wxFileListCtrl we need to free any data here:
|
||||||
FreeAllItemsData();
|
FreeAllItemsData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -959,7 +959,7 @@ bool wxGenericFileCtrl::Create( wxWindow *parent,
|
|||||||
style2 |= wxSUNKEN_BORDER;
|
style2 |= wxSUNKEN_BORDER;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_list = new wxFileList( this, ID_FILELIST_CTRL,
|
m_list = new wxFileListCtrl( this, ID_FILELIST_CTRL,
|
||||||
wxEmptyString, false,
|
wxEmptyString, false,
|
||||||
wxDefaultPosition, wxSize( 400, 140 ),
|
wxDefaultPosition, wxSize( 400, 140 ),
|
||||||
style2 );
|
style2 );
|
||||||
|
Reference in New Issue
Block a user