(minor) fixes to make it compile with the modified wxTreeCtrl

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@869 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1998-10-18 22:43:42 +00:00
parent a4294b7832
commit 1195ec4251
3 changed files with 24 additions and 11 deletions

View File

@@ -58,7 +58,7 @@ void wxResourceEditorProjectTree::LeftDClick(wxMouseEvent& WXUNUSED(event))
if (GetItemData(sel) == 0) if (GetItemData(sel) == 0)
return; return;
wxItemResource* res = (wxItemResource*) GetItemData(sel); wxItemResource* res = (wxResourceTreeData *)GetItemData(sel)->GetResource();
wxString resType(res->GetType()); wxString resType(res->GetType());
if (resType != "wxDialog" && resType != "wxDialogBox" && resType != "wxPanel") if (resType != "wxDialog" && resType != "wxDialogBox" && resType != "wxPanel")
return; return;
@@ -82,7 +82,7 @@ void wxResourceEditorProjectTree::OnSelChanged(wxTreeEvent& WXUNUSED(event))
if (m_invalid) if (m_invalid)
return; return;
wxItemResource* res = (wxItemResource*) GetItemData(sel); wxItemResource* res = ((wxResourceTreeData *)GetItemData(sel))->GetResource();
wxString resType(res->GetType()); wxString resType(res->GetType());
if (resType != "wxDialog" && resType != "wxDialogBox" && resType != "wxPanel") if (resType != "wxDialog" && resType != "wxDialogBox" && resType != "wxPanel")
return; return;

View File

@@ -847,11 +847,7 @@ void wxResourceManager::UpdateResourceList()
m_editorResourceTree->SetInvalid(TRUE); m_editorResourceTree->SetInvalid(TRUE);
m_editorResourceTree->DeleteAllItems(); m_editorResourceTree->DeleteAllItems();
long id = m_editorResourceTree->InsertItem(0, "Dialogs" long id = m_editorResourceTree->AddRoot("Dialogs", 1, 2);
#ifdef __WXMSW__
, 1, 2
#endif
);
m_resourceTable.BeginFind(); m_resourceTable.BeginFind();
wxNode *node; wxNode *node;
@@ -864,7 +860,7 @@ void wxResourceManager::UpdateResourceList()
AddItemsRecursively(id, res); AddItemsRecursively(id, res);
} }
} }
m_editorResourceTree->ExpandItem(id, wxTREE_EXPAND_EXPAND); m_editorResourceTree->Expand(id);
m_editorResourceTree->SetInvalid(FALSE); m_editorResourceTree->SetInvalid(FALSE);
} }
@@ -886,7 +882,7 @@ void wxResourceManager::AddItemsRecursively(long parent, wxItemResource *resourc
#endif #endif
); );
m_editorResourceTree->SetItemData(id, (long) resource); m_editorResourceTree->SetItemData(id, new wxResourceTreeData(resource));
if (strcmp(resource->GetType(), "wxBitmap") != 0) if (strcmp(resource->GetType(), "wxBitmap") != 0)
{ {
@@ -906,7 +902,8 @@ bool wxResourceManager::EditSelectedResource()
int sel = m_editorResourceTree->GetSelection(); int sel = m_editorResourceTree->GetSelection();
if (sel != 0) if (sel != 0)
{ {
wxItemResource *res = (wxItemResource *)m_editorResourceTree->GetItemData(sel); wxResourceTreeData *data = (wxResourceTreeData *)m_editorResourceTree->GetItemData(sel);
wxItemResource *res = data->GetResource();
return Edit(res); return Edit(res);
} }
return FALSE; return FALSE;
@@ -1797,7 +1794,8 @@ bool wxResourceManager::DeleteSelection()
int sel = m_editorResourceTree->GetSelection(); int sel = m_editorResourceTree->GetSelection();
if (sel != 0) if (sel != 0)
{ {
wxItemResource *res = (wxItemResource *)m_editorResourceTree->GetItemData(sel); wxResourceTreeData *data = (wxResourceTreeData *)m_editorResourceTree->GetItemData(sel);
wxItemResource *res = data->GetResource();
wxWindow *win = FindWindowForResource(res); wxWindow *win = FindWindowForResource(res);
if (win) if (win)
{ {

View File

@@ -24,6 +24,7 @@
#include "wx/resource.h" #include "wx/resource.h"
#include "wx/toolbar.h" #include "wx/toolbar.h"
#include "wx/imaglist.h" #include "wx/imaglist.h"
#include "wx/treectrl.h"
#include "proplist.h" #include "proplist.h"
#include "symbtabl.h" #include "symbtabl.h"
@@ -437,5 +438,19 @@ DECLARE_EVENT_TABLE()
#define TOOLBAR_TO_BACK 17 #define TOOLBAR_TO_BACK 17
#define TOOLBAR_COPY_SIZE 18 #define TOOLBAR_COPY_SIZE 18
/*
* this class is used to store data associated with a tree item
*/
class wxResourceTreeData : public wxTreeItemData
{
public:
wxResourceTreeData(wxItemResource *resource) { m_resource = resource; }
wxItemResource *GetResource() const { return m_resource; }
private:
wxItemResource *m_resource;
};
#endif #endif