This repository has been archived by the owner on Feb 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
wxrc.patch
84 lines (83 loc) · 3.03 KB
/
wxrc.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
diff --git a/utils/wxrc/wxrc.cpp b/utils/wxrc/wxrc.cpp
index 3e7c724..c21f0e1 100644
--- a/utils/wxrc/wxrc.cpp
+++ b/utils/wxrc/wxrc.cpp
@@ -118,9 +118,6 @@ public:
name == _T("notebookpage") ||
name == _T("separator") ||
name == _T("sizeritem") ||
- name == _T("wxMenu") ||
- name == _T("wxMenuBar") ||
- name == _T("wxMenuItem") ||
name.EndsWith(_T("Sizer")) )
{
return false;
@@ -137,7 +134,7 @@ public:
for(i=0;i<m_wdata.Count();++i)
{
const XRCWidgetData& w = m_wdata.Item(i);
- if( !IsRealClass(w.GetClass()) ) continue;
+ if( !IsRealClass(w.GetClass())) continue;
if( w.GetName().Length() == 0 ) continue;
file.Write(
_T(" ") + w.GetClass() + _T("* ") + w.GetName()
@@ -149,18 +146,53 @@ public:
+ _T("\"), _T(\"")
+ m_parentClassName
+ _T("\"));\n"));
+ wxString menuBarName = _T("");
for(i=0;i<m_wdata.Count();++i)
{
const XRCWidgetData& w = m_wdata.Item(i);
+
if( !IsRealClass(w.GetClass()) ) continue;
if( w.GetName().Length() == 0 ) continue;
- file.Write( _T(" ")
- + w.GetName()
- + _T(" = XRCCTRL(*this,\"")
- + w.GetName()
- + _T("\",")
- + w.GetClass()
- + _T(");\n"));
+ if( w.GetClass() == _T("wxMenuBar"))
+ {
+ menuBarName = w.GetName();
+ file.Write( _T(" ")
+ + w.GetName()
+ + _T(" = GetMenuBar();\n"));
+ continue;
+ }
+ else if( w.GetClass() == _T("wxMenu"))
+ {
+ if( menuBarName.Length() > 0 )
+ {
+ file.Write( _T(" ")
+ + w.GetName()
+ + _T(" = 0;\n"));
+ }
+ }
+ else if( w.GetClass() == _T("wxMenuItem"))
+ {
+ if( menuBarName.Length() > 0 )
+ {
+ file.Write( _T(" ")
+ + w.GetName()
+ + _T(" = ")
+ + menuBarName
+ + _T("->FindItem(XRCID(\"")
+ + w.GetName()
+ + _T("\"));\n"));
+ }
+ }
+ else
+ {
+ file.Write( _T(" ")
+ + w.GetName()
+ + _T(" = XRCCTRL(*this,\"")
+ + w.GetName()
+ + _T("\",")
+ + w.GetClass()
+ + _T(");\n"));
+ }
}
file.Write(_T(" }\n"));