-//Common styles for all controls
-if (style&wxSIMPLE_BORDER)
- s+="wxSIMPLE_BORDER|";
-if (style&wxSUNKEN_BORDER)
- s+="wxSUNKEN_BORDER|";
-if (style&wxSIMPLE_BORDER)
- s+="wxSIMPLE_BORDER|";
-if (style&wxDOUBLE_BORDER)
- s+="wxDOUBLE_BORDER|";
-if (style&wxRAISED_BORDER)
- s+="wxRAISED_BORDER|";
-if (style&wxTRANSPARENT_WINDOW)
- s+="wxTRANSPARENT_WINDOW|";
-if (style&wxWANTS_CHARS)
- s+="wxWANTS_CHARS|";
-if (style&wxNO_FULL_REPAINT_ON_RESIZE)
- s+="wxNO_FULL_REPAINT_ON_RESIZE|";
-
-if (restype=="wxDialog")
-{
- if (style&wxDIALOG_MODAL)
- s+="wxDIALOG_MODAL|";
- if (style&wxDEFAULT_DIALOG_STYLE)
- s+="wxDEFAULT_DIALOG_STYLE|";
- if (style&wxDIALOG_MODELESS)
- s+="wxDIALOG_MODELESS|";
- if (style&wxNO_3D)
- s+="wxNO_3D|";
- if (style&wxTAB_TRAVERSAL)
- s+="wxTAB_TRAVERSAL|";
- if (style&wxWS_EX_VALIDATE_RECURSIVELY)
- s+="wxWS_EX_VALIDATE_RECURSIVELY|";
- if (style&wxSTAY_ON_TOP)
- s+="wxSTAY_ON_TOP|";
- if (style&wxCAPTION)
- s+="wxCAPTION|";
- if (style&wxTHICK_FRAME)
- s+="wxTHICK_FRAME|";
- if (style&wxRESIZE_BOX)
- s+="wxRESIZE_BOX|";
- if (style&wxRESIZE_BORDER)
- s+="wxRESIZE_BORDER|";
- if (style&wxSYSTEM_MENU)
- s+="wxSYSTEM_MENU|";
- if (style&wxCLIP_CHILDREN)
- s+="wxCLIP_CHILDREN|";
-
-
-}
-
-
-
-if (restype=="wxPanel")
-{
- if (style&wxCLIP_CHILDREN)
- s+="wxCLIP_CHILDREN|";
- if (style&wxNO_3D)
- s+="wxNO_3D|";
- if (style&wxTAB_TRAVERSAL)
- s+="wxTAB_TRAVERSAL|";
- if (style&wxWS_EX_VALIDATE_RECURSIVELY)
- s+="wxWS_EX_VALIDATE_RECURSIVELY|";
-}
-
-if (restype=="wxComboBox")
-{
- if (style&wxCB_SORT)
- s+="wxCB_SORT|";
- if (style&wxCB_SIMPLE)
- s+="wxCB_SIMPLE|";
- if (style&wxCB_READONLY)
- s+="wxCB_READONLY|";
- if (style&wxCB_DROPDOWN)
- s+="wxCB_DROPDOWN|";
-}
-
-if (restype=="wxGauge")
-{
- if (style&wxGA_HORIZONTAL)
- s+="wxGA_HORIZONTAL|";
- if (style&wxGA_VERTICAL)
- s+="wxGA_VERTICAL|";
- if (style&wxGA_PROGRESSBAR)
- s+="wxGA_PROGRESSBAR|";
- // windows only
- if (style&wxGA_SMOOTH)
- s+="wxGA_SMOOTH|";
-}
-
-if (restype=="wxRadioButton")
-{
- if (style&wxRB_GROUP)
- s+="wxRB_GROUP|";
-}
-
-if (restype=="wxStaticText")
-{
- if (style&wxST_NO_AUTORESIZE)
- s+="wxST_NO_AUTORESIZEL|";
-}
-
-if (restype=="wxRadioBox")
- {
- if (style&wxRA_HORIZONTAL)
- s+="wxRA_HORIZONTAL|";
- if (style&wxRA_SPECIFY_COLS)
- s+="wxRA_SPECIFY_COLS|";
- if (style&wxRA_SPECIFY_ROWS)
- s+="wxRA_SPECIFY_ROWS|";
- if (style&wxRA_VERTICAL)
- s+="wxRA_VERTICAL|";
- }
-
-if (restype=="wxListBox")
-{
- if (style&wxLB_SINGLE)
- s+="wxLB_SINGLE|";
- if (style&wxLB_MULTIPLE)
- s+="wxLB_MULTIPLE|";
- if (style&wxLB_EXTENDED)
- s+="wxLB_EXTENDED|";
- if (style&wxLB_HSCROLL)
- s+="wxLB_HSCROLL|";
- if (style&wxLB_ALWAYS_SB)
- s+="wxLB_ALWAYS_SB|";
- if (style&wxLB_NEEDED_SB)
- s+="wxLB_NEEDED_SB|";
- if (style&wxLB_SORT)
- s+="wxLB_SORT|";
-}
-
-if (restype=="wxTextCtrl")
-{
- if (style&wxTE_PROCESS_ENTER)
- s+="wxTE_PROCESS_ENTER|";
- if (style&wxTE_PROCESS_TAB)
- s+="wxTE_PROCESS_TAB|";
- if (style&wxTE_MULTILINE)
- s+="wxTE_MULTILINE|";
- if (style&wxTE_PASSWORD)
- s+="wxTE_PASSWORD|";
- if (style&wxTE_READONLY)
- s+="wxTE_READONLY|";
- if (style&wxHSCROLL)
- s+="wxHSCROLL|";
-}
-
-int l;
-l=s.Length();
-//No styles defined
-if (l==7)
- return _T("");
-//Trim off last |
-s=s.Truncate(l-1);
-
-s+="</style>";
-return s;
-}
-
-wxString wxWxr2Xml::GetDimension(wxItemResource *res)
-{
-wxString msg;
-msg<<" <dimension>"<<res->GetValue1()<<"</dimension>";
-return msg;
-}
-
-wxString wxWxr2Xml::GenerateName(wxItemResource *res)
-{
-wxString name;
-name=_T(" name=\"");
-switch (res->GetId())
- {
- case wxID_OK:
- name+=_T("wxID_OK");
- break;
- case wxID_CANCEL:
- name+=_T("wxID_CANCEL");
- break;
- default:
- name+=res->GetName();
- }
-
-name+="\"";
-return name;
-}
-
-void wxWxr2Xml::ParseMenuBar(wxItemResource *res)
-{
- wxItemResource *child;
- wxNode *node = res->GetChildren().First();
- //Get Menu Bar Name
- m_xmlfile.Write("<menubar ");
- m_xmlfile.Write(GenerateName(res));
- m_xmlfile.Write(">\n");
- m_xmlfile.Write(" <children>\n");
- while (node)
- {
- child= (wxItemResource *)node->Data();
- ParseMenu(child);
- node = node->Next();
- }
-
- m_xmlfile.Write(" </children>\n");
- m_xmlfile.Write("</menubar> \n");
-}
-
-
-void wxWxr2Xml::ParseMenu(wxItemResource *res)
-{
- wxItemResource *child;
- wxNode *node = res->GetChildren().First();
- //Get Menu
- m_xmlfile.Write(" <menu ");
- wxString menuname;
- menuname<<"name = \"menu_"<<res->GetValue1()<<"\"";
- m_xmlfile.Write(menuname);
- m_xmlfile.Write(">\n");
- m_xmlfile.Write(" <label>"
- +FixMenuString(res->GetTitle())+"</label>\n");
- if (res->GetValue4()!="")
- m_xmlfile.Write(" <help>"+res->GetValue4()+"</help>\n");
- m_xmlfile.Write(" <children>\n");
- //Read in menu items and additional menus
- while (node)
- {
- child= (wxItemResource *)node->Data();
- if (!child->GetChildren().First())
- ParseMenuItem(child);
- else
- ParseMenu(child);
-
- node = node->Next();
- }
-m_xmlfile.Write(" </children>\n");
-m_xmlfile.Write(" </menu> \n");
-}
-
-void wxWxr2Xml::ParseMenuItem(wxItemResource *res)
-{
- //Get Menu Item or Separator
-if (res->GetTitle()=="")
- {
- m_xmlfile.Write(" <separator/>\n");
- }
-else
- {
- m_xmlfile.Write(" <menuitem ");
- wxString menuname;
- menuname<<"name = \"menuitem_"<<res->GetValue1()<<"\"";
- m_xmlfile.Write(menuname);
- m_xmlfile.Write(">\n");
- m_xmlfile.Write(" <label>"
- +FixMenuString(res->GetTitle())+"</label>\n");
- if (res->GetValue4()!="")
- m_xmlfile.Write(" <help>"+res->GetValue4()+"</help>\n");
- if (res->GetValue2())
- m_xmlfile.Write(" <checkable>1</checkable>\n");
- m_xmlfile.Write(" </menuitem> \n");
- }
-}
-
-wxString wxWxr2Xml::FixMenuString(wxString phrase)
-{
-phrase.Replace("&","$");
-return phrase;
-}
-
-void wxWxr2Xml::ParseStaticBitmap(wxItemResource *res)
-{
-m_xmlfile.Write(" <staticbitmap");
-WriteControlInfo(res);
-//value4 holds bitmap name
-wxString bitmapname;
-bitmapname=res->GetValue4();
-wxBitmap bitmap;
-bitmap= wxResourceCreateBitmap(bitmapname,&m_table);
-bitmapname+=_T(".bmp");
-bitmap.SaveFile(bitmapname,wxBITMAP_TYPE_BMP);
-m_xmlfile.Write("\n <bitmap>"+bitmapname+"</bitmap>");
-m_xmlfile.Write("</staticbitmap>\n");
-//bitmap5
-}
-
-void wxWxr2Xml::ParseBitmap(wxItemResource *res)
-{
-
-}
-
-void wxWxr2Xml::PanelStuff(wxItemResource *res)
-{
-if ((res->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0)
- m_dlgunits=TRUE;
-else
- m_dlgunits=FALSE;
-
-//If this is true ignore fonts, background color and use system
-//defaults instead
-if ((res->GetResourceStyle() & wxRESOURCE_USE_DEFAULTS) != 0)
- m_systemdefaults=TRUE;
-else
- m_systemdefaults=FALSE;
+void wxr2xml::ParseMenuBar(wxItemResource * res)
+{
+ wxItemResource *child;
+ wxNode *node = res->GetChildren().GetFirst();
+ // Get Menu Bar Name
+ m_xmlfile.Write(_T("\t<object class=\"wxMenuBar\" "));
+ m_xmlfile.Write(GenerateName(res));
+ m_xmlfile.Write(_T(">\n"));
+ while (node) {
+ child = (wxItemResource *) node->GetData();
+ ParseMenu(child);
+ node = node->GetNext();
+ }
+
+ m_xmlfile.Write(_T("\t</object> \n\n"));
+}
+
+void wxr2xml::ParseMenu(wxItemResource * res)
+{
+ wxItemResource *child;
+ wxNode *node = res->GetChildren().GetFirst();
+ // Get Menu
+ m_xmlfile.Write(_T("\t\t\t<object class=\"wxMenu\" "));
+ wxString menuname;
+ menuname << _T("name = \"menu_") << res->GetValue1() << _T("\"");
+ m_xmlfile.Write(menuname);
+ m_xmlfile.Write(_T(">\n"));
+ m_xmlfile.Write(_T("\t\t\t\t<label>")
+ + FixMenuString(res->GetTitle()) + _T("</label>\n"));
+ if (res->GetValue4() != _T(""))
+ m_xmlfile.Write(_T("\t\t\t\t<help>") + res->GetValue4() +
+ _T("</help>\n"));
+ // Read in menu items and additional menus
+ while (node) {
+ child = (wxItemResource *) node->GetData();
+ if (!child->GetChildren().GetFirst())
+ ParseMenuItem(child);
+ else
+ ParseMenu(child);
+ node = node->GetNext();
+ }
+ m_xmlfile.Write(_T("\t\t\t</object> \n"));
+}
+
+void wxr2xml::ParseMenuItem(wxItemResource * res)
+{
+ // Get Menu Item or Separator
+ if (res->GetTitle() == _T("")) {
+ m_xmlfile.Write(_T("\t\t\t<object class=\"separator\"/>\n"));
+ } else {
+ m_xmlfile.Write(_T("\t\t\t\t<object class=\"wxMenuItem\" "));
+ wxString menuname;
+ menuname << _T("name = \"menuitem_") << res->GetValue1() << _T("\"");
+ m_xmlfile.Write(menuname);
+ m_xmlfile.Write(_T(">\n"));
+ m_xmlfile.Write(_T("\t\t\t<label>")
+ + FixMenuString(res->GetTitle()) + _T("</label>\n"));
+ if (res->GetValue4() != _T(""))
+ m_xmlfile.Write(_T("\t\t\t<help>") +
+ res->GetValue4() + _T("</help>\n"));
+ if (res->GetValue2())
+ m_xmlfile.Write(_T("\t\t\t\t<checkable>1</checkable>\n"));
+ m_xmlfile.Write(_T("\t\t\t</object> \n"));
+ }
+}
+
+wxString wxr2xml::FixMenuString(wxString phrase)
+{
+ phrase.Replace(_T("&"), _T("$"));
+ return phrase;
+}
+
+void wxr2xml::ParseStaticBitmap(wxItemResource * res)
+{
+ m_xmlfile.Write(_T("\t\t\t<object class=\"wxStaticBitmap\""));
+ WriteControlInfo(res);
+ // value4 holds bitmap name
+ wxString bitmapname;
+ bitmapname = res->GetValue4();
+ wxBitmap bitmap;
+ bitmap = wxResourceCreateBitmap(bitmapname, &m_table);
+ bitmapname += _T(".bmp");
+ bitmap.SaveFile(bitmapname, wxBITMAP_TYPE_BMP);
+ m_xmlfile.Write(_T("\n\t\t\t\t<bitmap>") + bitmapname + _T("</bitmap>"));
+ m_xmlfile.Write(_T("\t\t\t</object>\n"));
+ // bitmap5
+}
+//Parse a bitmap resource
+void wxr2xml::ParseBitmap(wxItemResource * res)
+{
+ m_xmlfile.Write(_T("\t<object class=\"wxBitmap\" "));
+ m_xmlfile.Write(GenerateName(res)+_T(">"));
+ wxString bitmapname;
+ bitmapname = res->GetName();
+ wxBitmap bitmap;
+ bitmap = wxResourceCreateBitmap(bitmapname, &m_table);
+ bitmapname += _T(".bmp");
+ bitmap.SaveFile(bitmapname, wxBITMAP_TYPE_BMP);
+ m_xmlfile.Write(bitmapname);
+ m_xmlfile.Write(_T("</object>\n\n"));
+}
+
+void wxr2xml::PanelStuff(wxItemResource * res)
+{
+ if ((res->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0)
+ m_dlgunits = true;
+ else
+ m_dlgunits = false;
+
+ // If this is true ignore fonts, background color and use system
+ // defaults instead
+ if ((res->GetResourceStyle() & wxRESOURCE_USE_DEFAULTS) != 0)
+ m_systemdefaults = true;
+ else
+ m_systemdefaults = false;
+
+}
+
+wxString wxr2xml::GetValue2(wxItemResource *res)
+{
+ wxString msg;
+ msg << res->GetValue2();
+ return msg;
+}
+
+wxString wxr2xml::GetValue3(wxItemResource *res)
+{
+ wxString msg;
+ msg << res->GetValue3();
+ return msg;
+
+}
+
+wxString wxr2xml::GetValue5(wxItemResource *res)
+{
+ wxString msg;
+ msg << res->GetValue5();
+ return msg;
+
+}