(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:
parent
a4294b7832
commit
1195ec4251
@ -58,7 +58,7 @@ void wxResourceEditorProjectTree::LeftDClick(wxMouseEvent& WXUNUSED(event))
|
||||
if (GetItemData(sel) == 0)
|
||||
return;
|
||||
|
||||
wxItemResource* res = (wxItemResource*) GetItemData(sel);
|
||||
wxItemResource* res = (wxResourceTreeData *)GetItemData(sel)->GetResource();
|
||||
wxString resType(res->GetType());
|
||||
if (resType != "wxDialog" && resType != "wxDialogBox" && resType != "wxPanel")
|
||||
return;
|
||||
@ -82,7 +82,7 @@ void wxResourceEditorProjectTree::OnSelChanged(wxTreeEvent& WXUNUSED(event))
|
||||
if (m_invalid)
|
||||
return;
|
||||
|
||||
wxItemResource* res = (wxItemResource*) GetItemData(sel);
|
||||
wxItemResource* res = ((wxResourceTreeData *)GetItemData(sel))->GetResource();
|
||||
wxString resType(res->GetType());
|
||||
if (resType != "wxDialog" && resType != "wxDialogBox" && resType != "wxPanel")
|
||||
return;
|
||||
|
@ -847,11 +847,7 @@ void wxResourceManager::UpdateResourceList()
|
||||
m_editorResourceTree->SetInvalid(TRUE);
|
||||
m_editorResourceTree->DeleteAllItems();
|
||||
|
||||
long id = m_editorResourceTree->InsertItem(0, "Dialogs"
|
||||
#ifdef __WXMSW__
|
||||
, 1, 2
|
||||
#endif
|
||||
);
|
||||
long id = m_editorResourceTree->AddRoot("Dialogs", 1, 2);
|
||||
|
||||
m_resourceTable.BeginFind();
|
||||
wxNode *node;
|
||||
@ -864,7 +860,7 @@ void wxResourceManager::UpdateResourceList()
|
||||
AddItemsRecursively(id, res);
|
||||
}
|
||||
}
|
||||
m_editorResourceTree->ExpandItem(id, wxTREE_EXPAND_EXPAND);
|
||||
m_editorResourceTree->Expand(id);
|
||||
m_editorResourceTree->SetInvalid(FALSE);
|
||||
}
|
||||
|
||||
@ -886,7 +882,7 @@ void wxResourceManager::AddItemsRecursively(long parent, wxItemResource *resourc
|
||||
#endif
|
||||
);
|
||||
|
||||
m_editorResourceTree->SetItemData(id, (long) resource);
|
||||
m_editorResourceTree->SetItemData(id, new wxResourceTreeData(resource));
|
||||
|
||||
if (strcmp(resource->GetType(), "wxBitmap") != 0)
|
||||
{
|
||||
@ -906,7 +902,8 @@ bool wxResourceManager::EditSelectedResource()
|
||||
int sel = m_editorResourceTree->GetSelection();
|
||||
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 FALSE;
|
||||
@ -1797,7 +1794,8 @@ bool wxResourceManager::DeleteSelection()
|
||||
int sel = m_editorResourceTree->GetSelection();
|
||||
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);
|
||||
if (win)
|
||||
{
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "wx/resource.h"
|
||||
#include "wx/toolbar.h"
|
||||
#include "wx/imaglist.h"
|
||||
#include "wx/treectrl.h"
|
||||
|
||||
#include "proplist.h"
|
||||
#include "symbtabl.h"
|
||||
@ -437,5 +438,19 @@ DECLARE_EVENT_TABLE()
|
||||
#define TOOLBAR_TO_BACK 17
|
||||
#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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user