class wxFileIconEntry : public wxObject
{
- public:
- wxFileIconEntry(int i) { id = i; }
+public:
+ wxFileIconEntry(int i) { id = i; }
- int id;
+ int id;
};
class wxFileIconsTable
{
- public:
-
- wxFileIconsTable();
+public:
+ wxFileIconsTable();
- int GetIconID(const wxString& extension, const wxString& mime = wxEmptyString);
- wxImageList *GetImageList() { return &m_ImageList; }
+ int GetIconID(const wxString& extension, const wxString& mime = wxEmptyString);
+ wxImageList *GetImageList() { return &m_ImageList; }
- protected:
- wxImageList m_ImageList;
- wxHashTable m_HashTable;
+protected:
+ wxImageList m_ImageList;
+ wxHashTable m_HashTable;
};
static wxFileIconsTable *g_IconsTable = NULL;
BEGIN_EVENT_TABLE(wxFileCtrl,wxListCtrl)
EVT_LIST_DELETE_ITEM(-1, wxFileCtrl::OnListDeleteItem)
+ EVT_LIST_DELETE_ALL_ITEMS(-1, wxFileCtrl::OnListDeleteAllItems)
EVT_LIST_END_LABEL_EDIT(-1, wxFileCtrl::OnListEndLabelEdit)
END_EVENT_TABLE()
-
wxFileCtrl::wxFileCtrl()
{
m_dirName = wxT("/");
delete fd;
}
+void wxFileCtrl::OnListDeleteAllItems( wxListEvent &WXUNUSED(event) )
+{
+ wxListItem item;
+ item.m_mask = wxLIST_MASK_DATA;
+
+ item.m_itemId = GetNextItem( -1, wxLIST_NEXT_ALL );
+ while ( item.m_itemId != -1 )
+ {
+ GetItem( item );
+ wxFileData *fd = (wxFileData*)item.m_data;
+ delete fd;
+ item.m_data = 0;
+ SetItem( item );
+ item.m_itemId = GetNextItem( item.m_itemId, wxLIST_NEXT_ALL );
+ }
+}
+
void wxFileCtrl::OnListEndLabelEdit( wxListEvent &event )
{
wxFileData *fd = (wxFileData*)event.m_item.m_data;
item.m_mask = wxLIST_MASK_TEXT;
item.m_itemId = m_list->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
- while ( item.m_itemId != -1 )
+ while ( item.m_itemId != -1 )
{
m_list->GetItem( item );
paths.Add( dir + item.m_text );
item.m_mask = wxLIST_MASK_TEXT;
item.m_itemId = m_list->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
- while ( item.m_itemId != -1 )
+ while ( item.m_itemId != -1 )
{
m_list->GetItem( item );
files.Add( item.m_text );