]> git.saurik.com Git - wxWidgets.git/blame - utils/dialoged/src/edtree.cpp
Repaired radiobox problem.
[wxWidgets.git] / utils / dialoged / src / edtree.cpp
CommitLineData
ae8351fc
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: edtree.cpp
3// Purpose: Resource editor project management tree
4// Author: Julian Smart
5// Modified by:
6// Created: 04/01/98
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __GNUG__
13#pragma implementation "edtree.h"
14#endif
15
16// For compilers that support precompilation, includes "wx/wx.h".
17#include "wx/wxprec.h"
18
19#ifdef __BORLANDC__
20#pragma hdrstop
21#endif
22
23#ifndef WX_PRECOMP
24#include "wx/wx.h"
25
26#include "wx/checkbox.h"
27#include "wx/button.h"
28#include "wx/choice.h"
29#include "wx/listbox.h"
30#include "wx/radiobox.h"
31#include "wx/statbox.h"
32#include "wx/gauge.h"
33#include "wx/slider.h"
34#include "wx/textctrl.h"
35#endif
36
37#include "edtree.h"
38#include "reseditr.h"
39
40BEGIN_EVENT_TABLE(wxResourceEditorProjectTree, wxTreeCtrl)
41 EVT_LEFT_DCLICK(wxResourceEditorProjectTree::LeftDClick)
42 EVT_TREE_SEL_CHANGED(IDC_TREECTRL, wxResourceEditorProjectTree::OnSelChanged)
43END_EVENT_TABLE()
44
45wxResourceEditorProjectTree::wxResourceEditorProjectTree(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
46 long style):
47 wxTreeCtrl(parent, id, pos, size, style)
48{
49}
50
51void wxResourceEditorProjectTree::LeftDClick(wxMouseEvent& event)
52{
53#if 0
54 long sel = GetSelection();
55 if (sel == -1)
56 return;
57
58 if (GetItemData(sel) == 0)
59 return;
60
61 wxItemResource* res = (wxItemResource*) GetItemData(sel);
62 wxString resType(res->GetType());
63 if (resType != "wxDialog" && resType != "wxDialogBox" && resType != "wxPanel")
64 return;
65
66 wxResourceEditorFrame *frame = (wxResourceEditorFrame *)wxWindow::GetParent();
67 wxResourceManager *manager = frame->manager;
68
69 manager->EditSelectedResource();
70#endif
71}
72
73void wxResourceEditorProjectTree::OnSelChanged(wxTreeEvent& event)
74{
75 long sel = GetSelection();
76 if (sel == -1)
77 return;
78
79 if (GetItemData(sel) == 0)
80 return;
81
82 if (m_invalid)
83 return;
84
85 wxItemResource* res = (wxItemResource*) GetItemData(sel);
86 wxString resType(res->GetType());
87 if (resType != "wxDialog" && resType != "wxDialogBox" && resType != "wxPanel")
88 return;
89
90 wxResourceManager::GetCurrentResourceManager()->Edit(res);
91}
92