diff --git a/Source/3rd Party/wx/src/xrc/descrip.mms b/Source/3rd Party/wx/src/xrc/descrip.mms new file mode 100644 index 000000000..b1c10c2e4 --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/descrip.mms @@ -0,0 +1,164 @@ +#***************************************************************************** +# * +# Make file for VMS * +# Author : J.Jansen (joukj@hrem.nano.tudelft.nl) * +# Date : 6 November 2012 * +# * +#***************************************************************************** +.first + define wx [--.include.wx] + +.ifdef __WXMOTIF__ +CXX_DEFINE = /define=(__WXMOTIF__=1)/name=(as_is,short)\ + /assume=(nostdnew,noglobal_array_new) +CC_DEFINE = /define=(__WXMOTIF__=1)/name=(as_is,short) +.else +.ifdef __WXGTK__ +CXX_DEFINE = /define=(__WXGTK__=1)/float=ieee/name=(as_is,short)/ieee=denorm\ + /assume=(nostdnew,noglobal_array_new) +CC_DEFINE = /define=(__WXGTK__=1)/float=ieee/name=(as_is,short)/ieee=denorm +.else +.ifdef __WXGTK2__ +CXX_DEFINE = /define=(__WXGTK__=1,VMS_GTK2=1)/float=ieee/name=(as_is,short)/ieee=denorm\ + /assume=(nostdnew,noglobal_array_new) +CC_DEFINE = /define=(__WXGTK__=1,VMS_GTK2=1)/float=ieee/name=(as_is,short)/ieee=denorm +.else +.ifdef __WXX11__ +CXX_DEFINE = /define=(__WXX11__=1,__WXUNIVERSAL__==1)/float=ieee\ + /name=(as_is,short)/assume=(nostdnew,noglobal_array_new) +CC_DEFINE = /define=(__WXX11__=1,__WXUNIVERSAL__==1)/float=ieee\ + /name=(as_is,short) +.else +CXX_DEFINE = +CC_DEFINE = +.endif +.endif +.endif +.endif + +.suffixes : .cpp + +.cpp.obj : + cxx $(CXXFLAGS)$(CXX_DEFINE) $(MMS$TARGET_NAME).cpp +.c.obj : + cc $(CFLAGS)$(CC_DEFINE) $(MMS$TARGET_NAME).c + +OBJECTS=xh_bmp.obj,xh_bmpbt.obj,xh_bttn.obj,xh_cald.obj,xh_chckb.obj,\ + xh_chckl.obj,xh_choic.obj,xh_combo.obj,xh_dlg.obj,xh_frame.obj,\ + xh_gauge.obj,xh_gdctl.obj,xh_html.obj,xh_listb.obj,xh_listc.obj,\ + xh_menu.obj,xh_notbk.obj,xh_panel.obj,xh_radbt.obj,xh_radbx.obj,\ + xh_scrol.obj,xh_scwin.obj,xh_sizer.obj,xh_slidr.obj,xh_spin.obj,\ + xh_split.obj,xh_statbar.obj,xh_stbmp.obj,xh_stbox.obj,xh_stlin.obj,\ + xh_sttxt.obj,xh_text.obj,xh_tglbtn.obj,xh_toolb.obj,xh_tree.obj,\ + xh_unkwn.obj,xh_wizrd.obj,xmlres.obj,xmlrsall.obj,xh_listbk.obj,\ + xh_choicbk.obj,xh_dirpicker.obj,xh_hyperlink.obj,xh_filepicker.obj,\ + xh_fontpicker.obj,xh_clrpicker.obj,xh_odcombo.obj,xh_mdi.obj,\ + xh_grid.obj,xh_datectrl.obj,xh_treebk.obj,xh_bmpcbox.obj,\ + xh_animatctrl.obj,xh_htmllbox.obj,xh_collpane.obj,xh_srchctrl.obj,\ + xh_propdlg.obj,xh_comboctrl.obj,xmladv.obj,xh_editlbox.obj,\ + xh_filectrl.obj,xh_cmdlinkbn.obj,xh_toolbk.obj,xh_bannerwindow.obj,\ + xh_timectrl.obj,xmlreshandler.obj,xh_ribbon.obj + +SOURCES =xh_bmp.cpp,xh_bmpbt.cpp,xh_bttn.cpp,xh_cald.cpp,xh_chckb.cpp,\ + xh_chckl.cpp,xh_choic.cpp,xh_combo.cpp,xh_dlg.cpp,xh_frame.cpp,\ + xh_gauge.cpp,xh_gdctl.cpp,xh_html.cpp,xh_listb.cpp,xh_listc.cpp,\ + xh_menu.cpp,xh_notbk.cpp,xh_panel.cpp,xh_radbt.cpp,xh_radbx.cpp,\ + xh_scrol.cpp,xh_scwin.cpp,xh_sizer.cpp,xh_slidr.cpp,xh_spin.cpp,\ + xh_split.cpp,xh_statbar.cpp,xh_stbmp.cpp,xh_stbox.cpp,xh_stlin.cpp,\ + xh_sttxt.cpp,xh_text.cpp,xh_tglbtn.cpp,xh_toolb.cpp,xh_tree.cpp,\ + xh_unkwn.cpp,xh_wizrd.cpp,xmlres.cpp,xmlrsall.cpp,xh_listbk.cpp,\ + xh_choicbk.cpp,xh_dirpicker.cpp,xh_hyperlink.cpp,xh_filepicker.cpp,\ + xh_fontpicker.cpp,xh_clrpicker.cpp,xh_odcombo.cpp,xh_mdi.cpp,\ + xh_grid.cpp,xh_datectrl.cpp,xh_treebk.cpp,xh_bmpcbox.cpp,\ + xh_animatctrl.cpp,xh_htmllbox.cpp,xh_collpane.cpp,xh_srchctrl.cpp,\ + xh_propdlg.cpp,xh_comboctrl.cpp,xmladv.cpp,xh_editlbox.cpp,\ + xh_filectrl.cpp,xh_cmdlinkbn.cpp,xh_toolbk.cpp,xh_bannerwindow.cpp,\ + xh_timectrl.cpp,xmlreshandler.cpp,xh_ribbon.cpp + +all : $(SOURCES) + $(MMS)$(MMSQUALIFIERS) $(OBJECTS) +.ifdef __WXMOTIF__ + library [--.lib]libwx_motif.olb $(OBJECTS) +.else +.ifdef __WXGTK__ + library [--.lib]libwx_gtk.olb $(OBJECTS) +.else +.ifdef __WXGTK2__ + library [--.lib]libwx_gtk2.olb $(OBJECTS) +.else +.ifdef __WXX11__ + library [--.lib]libwx_x11_univ.olb $(OBJECTS) +.endif +.endif +.endif +.endif + +$(OBJECTS) : [--.include.wx]setup.h + +xh_bmp.obj : xh_bmp.cpp +xh_bmpbt.obj : xh_bmpbt.cpp +xh_bttn.obj : xh_bttn.cpp +xh_cald.obj : xh_cald.cpp +xh_chckb.obj : xh_chckb.cpp +xh_chckl.obj : xh_chckl.cpp +xh_choic.obj : xh_choic.cpp +xh_combo.obj : xh_combo.cpp +xh_comboctrl.obj : xh_comboctrl.cpp +xh_dlg.obj : xh_dlg.cpp +xh_frame.obj : xh_frame.cpp +xh_gauge.obj : xh_gauge.cpp +xh_gdctl.obj : xh_gdctl.cpp +xh_html.obj : xh_html.cpp +xh_listb.obj : xh_listb.cpp +xh_listc.obj : xh_listc.cpp +xh_menu.obj : xh_menu.cpp +xh_notbk.obj : xh_notbk.cpp +xh_panel.obj : xh_panel.cpp +xh_radbt.obj : xh_radbt.cpp +xh_radbx.obj : xh_radbx.cpp +xh_scrol.obj : xh_scrol.cpp +xh_scwin.obj : xh_scwin.cpp +xh_sizer.obj : xh_sizer.cpp +xh_slidr.obj : xh_slidr.cpp +xh_spin.obj : xh_spin.cpp +xh_split.obj : xh_split.cpp +xh_statbar.obj : xh_statbar.cpp +xh_stbmp.obj : xh_stbmp.cpp +xh_stbox.obj : xh_stbox.cpp +xh_stlin.obj : xh_stlin.cpp +xh_sttxt.obj : xh_sttxt.cpp +xh_text.obj : xh_text.cpp +xh_tglbtn.obj : xh_tglbtn.cpp +xh_toolb.obj : xh_toolb.cpp +xh_tree.obj : xh_tree.cpp +xh_unkwn.obj : xh_unkwn.cpp +xh_wizrd.obj : xh_wizrd.cpp +xmlres.obj : xmlres.cpp +xmlrsall.obj : xmlrsall.cpp +xh_listbk.obj : xh_listbk.cpp +xh_choicbk.obj : xh_choicbk.cpp +xh_dirpicker.obj : xh_dirpicker.cpp +xh_hyperlink.obj : xh_hyperlink.cpp +xh_filepicker.obj : xh_filepicker.cpp +xh_fontpicker.obj : xh_fontpicker.cpp +xh_clrpicker.obj : xh_clrpicker.cpp +xh_odcombo.obj : xh_odcombo.cpp +xh_mdi.obj : xh_mdi.cpp +xh_grid.obj : xh_grid.cpp +xh_datectrl.obj : xh_datectrl.cpp +xh_treebk.obj : xh_treebk.cpp +xh_bmpcbox.obj : xh_bmpcbox.cpp +xh_animatctrl.obj : xh_animatctrl.cpp +xh_htmllbox.obj : xh_htmllbox.cpp +xh_collpane.obj : xh_collpane.cpp +xh_srchctrl.obj : xh_srchctrl.cpp +xh_propdlg.obj : xh_propdlg.cpp +xmladv.obj : xmladv.cpp +xh_editlbox.obj : xh_editlbox.cpp +xh_filectrl.obj : xh_filectrl.cpp +xh_cmdlinkbn.obj : xh_cmdlinkbn.cpp +xh_toolbk.obj : xh_toolbk.cpp +xh_bannerwindow.obj : xh_bannerwindow.cpp +xh_timectrl.obj : xh_timectrl.cpp +xmlreshandler.obj : xmlreshandler.cpp +xh_ribbon.obj : xh_ribbon.cpp diff --git a/Source/3rd Party/wx/src/xrc/xh_animatctrl.cpp b/Source/3rd Party/wx/src/xrc/xh_animatctrl.cpp new file mode 100644 index 000000000..aabcb53a7 --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_animatctrl.cpp @@ -0,0 +1,59 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_animatctrl.cpp +// Purpose: XML resource handler for wxAnimationCtrl +// Author: Francesco Montorsi +// Created: 2006-10-15 +// Copyright: (c) 2006 Francesco Montorsi +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_ANIMATIONCTRL + +#include "wx/xrc/xh_animatctrl.h" +#include "wx/animate.h" +#include "wx/scopedptr.h" + +IMPLEMENT_DYNAMIC_CLASS(wxAnimationCtrlXmlHandler, wxXmlResourceHandler) + +wxAnimationCtrlXmlHandler::wxAnimationCtrlXmlHandler() : wxXmlResourceHandler() +{ + XRC_ADD_STYLE(wxAC_NO_AUTORESIZE); + XRC_ADD_STYLE(wxAC_DEFAULT_STYLE); + AddWindowStyles(); +} + +wxObject *wxAnimationCtrlXmlHandler::DoCreateResource() +{ + XRC_MAKE_INSTANCE(ctrl, wxAnimationCtrl) + + wxScopedPtr animation(GetAnimation(wxT("animation"))); + + ctrl->Create(m_parentAsWindow, + GetID(), + animation ? *animation : wxNullAnimation, + GetPosition(), GetSize(), + GetStyle(wxT("style"), wxAC_DEFAULT_STYLE), + GetName()); + + // if no inactive-bitmap has been provided, GetBitmap() will return wxNullBitmap + // which just tells wxAnimationCtrl to use the default for inactive status + ctrl->SetInactiveBitmap(GetBitmap(wxT("inactive-bitmap"))); + + SetupWindow(ctrl); + + return ctrl; +} + +bool wxAnimationCtrlXmlHandler::CanHandle(wxXmlNode *node) +{ + return IsOfClass(node, wxT("wxAnimationCtrl")); +} + +#endif // wxUSE_XRC && wxUSE_ANIMATIONCTRL diff --git a/Source/3rd Party/wx/src/xrc/xh_auinotbk.cpp b/Source/3rd Party/wx/src/xrc/xh_auinotbk.cpp new file mode 100644 index 000000000..203578729 --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_auinotbk.cpp @@ -0,0 +1,118 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_auinotbk.cpp +// Purpose: XML resource handler for wxAuiNotebook +// Author: Steve Lamerton +// Created: 2009-06-12 +// Copyright: (c) 2009 Steve Lamerton +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_AUI + +#include "wx/xrc/xh_auinotbk.h" +#include "wx/aui/auibook.h" + +wxIMPLEMENT_DYNAMIC_CLASS(wxAuiNotebookXmlHandler, wxXmlResourceHandler); + +wxAuiNotebookXmlHandler::wxAuiNotebookXmlHandler() + : wxXmlResourceHandler() +{ + XRC_ADD_STYLE(wxAUI_NB_DEFAULT_STYLE); + XRC_ADD_STYLE(wxAUI_NB_TAB_SPLIT); + XRC_ADD_STYLE(wxAUI_NB_TAB_MOVE); + XRC_ADD_STYLE(wxAUI_NB_TAB_EXTERNAL_MOVE); + XRC_ADD_STYLE(wxAUI_NB_TAB_FIXED_WIDTH); + XRC_ADD_STYLE(wxAUI_NB_SCROLL_BUTTONS); + XRC_ADD_STYLE(wxAUI_NB_WINDOWLIST_BUTTON); + XRC_ADD_STYLE(wxAUI_NB_CLOSE_BUTTON); + XRC_ADD_STYLE(wxAUI_NB_CLOSE_ON_ACTIVE_TAB); + XRC_ADD_STYLE(wxAUI_NB_CLOSE_ON_ALL_TABS); + XRC_ADD_STYLE(wxAUI_NB_TOP); + XRC_ADD_STYLE(wxAUI_NB_BOTTOM); + + AddWindowStyles(); +} + +wxObject *wxAuiNotebookXmlHandler::DoCreateResource() +{ + if (m_class == wxT("notebookpage")) + { + wxXmlNode *anb = GetParamNode(wxT("object")); + + if (!anb) + anb = GetParamNode(wxT("object_ref")); + + if (anb) + { + bool old_ins = m_isInside; + m_isInside = false; + wxObject *item = CreateResFromNode(anb, m_notebook, NULL); + m_isInside = old_ins; + wxWindow *wnd = wxDynamicCast(item, wxWindow); + + if (wnd) + { + if ( HasParam(wxT("bitmap")) ) + { + m_notebook->AddPage(wnd, + GetText(wxT("label")), + GetBool(wxT("selected")), + GetBitmap(wxT("bitmap"), wxART_OTHER)); + } + else + { + m_notebook->AddPage(wnd, + GetText(wxT("label")), + GetBool(wxT("selected"))); + } + } + else + { + ReportError(anb, "notebookpage child must be a window"); + } + return wnd; + } + else + { + ReportError("notebookpage must have a window child"); + return NULL; + } + } + else + { + XRC_MAKE_INSTANCE(anb, wxAuiNotebook) + + anb->Create(m_parentAsWindow, + GetID(), + GetPosition(), + GetSize(), + GetStyle(wxT("style"))); + + SetupWindow(anb); + + wxAuiNotebook *old_par = m_notebook; + m_notebook = anb; + bool old_ins = m_isInside; + m_isInside = true; + CreateChildren(m_notebook, true/*only this handler*/); + m_isInside = old_ins; + m_notebook = old_par; + + return anb; + } +} + +bool wxAuiNotebookXmlHandler::CanHandle(wxXmlNode *node) +{ + return ((!m_isInside && IsOfClass(node, wxT("wxAuiNotebook"))) || + (m_isInside && IsOfClass(node, wxT("notebookpage")))); +} + +#endif // wxUSE_XRC && wxUSE_ANIMATIONCTRL diff --git a/Source/3rd Party/wx/src/xrc/xh_bannerwindow.cpp b/Source/3rd Party/wx/src/xrc/xh_bannerwindow.cpp new file mode 100644 index 000000000..acba8dd83 --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_bannerwindow.cpp @@ -0,0 +1,87 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: srx/xrc/xh_bannerwindow.h +// Purpose: Implementation of wxBannerWindow XRC handler. +// Author: Vadim Zeitlin +// Created: 2011-08-16 +// Copyright: (c) 2011 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_BANNERWINDOW + +#include "wx/xrc/xh_bannerwindow.h" +#include "wx/bannerwindow.h" + +wxIMPLEMENT_DYNAMIC_CLASS(wxBannerWindowXmlHandler, wxXmlResourceHandler) + +wxBannerWindowXmlHandler::wxBannerWindowXmlHandler() + : wxXmlResourceHandler() +{ + AddWindowStyles(); +} + +wxObject *wxBannerWindowXmlHandler::DoCreateResource() +{ + XRC_MAKE_INSTANCE(banner, wxBannerWindow) + + banner->Create(m_parentAsWindow, + GetID(), + GetDirection(wxS("direction")), + GetPosition(), + GetSize(), + GetStyle(wxS("style")), + GetName()); + + SetupWindow(banner); + + const wxColour colStart = GetColour(wxS("gradient-start")); + const wxColour colEnd = GetColour(wxS("gradient-end")); + if ( colStart.IsOk() || colEnd.IsOk() ) + { + if ( !colStart.IsOk() || !colEnd.IsOk() ) + { + ReportError + ( + "Both start and end gradient colours must be " + "specified if either one is." + ); + } + else + { + banner->SetGradient(colStart, colEnd); + } + } + + wxBitmap bitmap = GetBitmap(); + if ( bitmap.IsOk() ) + { + if ( colStart.IsOk() || colEnd.IsOk() ) + { + ReportError + ( + "Gradient colours are ignored by wxBannerWindow " + "if the background bitmap is specified." + ); + } + + banner->SetBitmap(bitmap); + } + + banner->SetText(GetText(wxS("title")), GetText(wxS("message"))); + + return banner; +} + +bool wxBannerWindowXmlHandler::CanHandle(wxXmlNode *node) +{ + return IsOfClass(node, wxS("wxBannerWindow")); +} + +#endif // wxUSE_XRC && wxUSE_BANNERWINDOW diff --git a/Source/3rd Party/wx/src/xrc/xh_bmp.cpp b/Source/3rd Party/wx/src/xrc/xh_bmp.cpp new file mode 100644 index 000000000..788f50f22 --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_bmp.cpp @@ -0,0 +1,59 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_bmp.cpp +// Purpose: XRC resource for wxBitmap and wxIcon +// Author: Vaclav Slavik +// Created: 2000/09/09 +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC + +#include "wx/xrc/xh_bmp.h" + +#ifndef WX_PRECOMP + #include "wx/bitmap.h" +#endif + +IMPLEMENT_DYNAMIC_CLASS(wxBitmapXmlHandler, wxXmlResourceHandler) + +wxBitmapXmlHandler::wxBitmapXmlHandler() + :wxXmlResourceHandler() +{ +} + +wxObject *wxBitmapXmlHandler::DoCreateResource() +{ + return new wxBitmap(GetBitmap(m_node)); +} + +bool wxBitmapXmlHandler::CanHandle(wxXmlNode *node) +{ + return IsOfClass(node, wxT("wxBitmap")); +} + +IMPLEMENT_DYNAMIC_CLASS(wxIconXmlHandler, wxXmlResourceHandler) + +wxIconXmlHandler::wxIconXmlHandler() +: wxXmlResourceHandler() +{ +} + +wxObject *wxIconXmlHandler::DoCreateResource() +{ + return new wxIcon(GetIcon(m_node)); +} + +bool wxIconXmlHandler::CanHandle(wxXmlNode *node) +{ + return IsOfClass(node, wxT("wxIcon")); +} + +#endif // wxUSE_XRC diff --git a/Source/3rd Party/wx/src/xrc/xh_bmpbt.cpp b/Source/3rd Party/wx/src/xrc/xh_bmpbt.cpp new file mode 100644 index 000000000..d5ae4ec9d --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_bmpbt.cpp @@ -0,0 +1,71 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_bmpbt.cpp +// Purpose: XRC resource for bitmap buttons +// Author: Brian Gavin +// Created: 2000/09/09 +// Copyright: (c) 2000 Brian Gavin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_BMPBUTTON + +#include "wx/xrc/xh_bmpbt.h" + +#ifndef WX_PRECOMP + #include "wx/bmpbuttn.h" +#endif + +IMPLEMENT_DYNAMIC_CLASS(wxBitmapButtonXmlHandler, wxXmlResourceHandler) + +wxBitmapButtonXmlHandler::wxBitmapButtonXmlHandler() +: wxXmlResourceHandler() +{ + XRC_ADD_STYLE(wxBU_AUTODRAW); + XRC_ADD_STYLE(wxBU_LEFT); + XRC_ADD_STYLE(wxBU_RIGHT); + XRC_ADD_STYLE(wxBU_TOP); + XRC_ADD_STYLE(wxBU_BOTTOM); + XRC_ADD_STYLE(wxBU_EXACTFIT); + AddWindowStyles(); +} + +wxObject *wxBitmapButtonXmlHandler::DoCreateResource() +{ + XRC_MAKE_INSTANCE(button, wxBitmapButton) + + button->Create(m_parentAsWindow, + GetID(), + GetBitmap(wxT("bitmap"), wxART_BUTTON), + GetPosition(), GetSize(), + GetStyle(wxT("style"), wxBU_AUTODRAW), + wxDefaultValidator, + GetName()); + if (GetBool(wxT("default"), 0)) + button->SetDefault(); + SetupWindow(button); + + if (GetParamNode(wxT("selected"))) + button->SetBitmapSelected(GetBitmap(wxT("selected"))); + if (GetParamNode(wxT("focus"))) + button->SetBitmapFocus(GetBitmap(wxT("focus"))); + if (GetParamNode(wxT("disabled"))) + button->SetBitmapDisabled(GetBitmap(wxT("disabled"))); + if (GetParamNode(wxT("hover"))) + button->SetBitmapHover(GetBitmap(wxT("hover"))); + + return button; +} + +bool wxBitmapButtonXmlHandler::CanHandle(wxXmlNode *node) +{ + return IsOfClass(node, wxT("wxBitmapButton")); +} + +#endif // wxUSE_XRC && wxUSE_BMPBUTTON diff --git a/Source/3rd Party/wx/src/xrc/xh_bmpcbox.cpp b/Source/3rd Party/wx/src/xrc/xh_bmpcbox.cpp new file mode 100644 index 000000000..533f52fd8 --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_bmpcbox.cpp @@ -0,0 +1,109 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_bmpcbox.cpp +// Purpose: XRC resource for wxBitmapComboBox +// Author: Jaakko Salli +// Created: Sep-10-2006 +// Copyright: (c) 2006 Jaakko Salli +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_BITMAPCOMBOBOX + +#include "wx/xrc/xh_bmpcbox.h" + +#ifndef WX_PRECOMP + #include "wx/intl.h" + #include "wx/log.h" +#endif + +#include "wx/bmpcbox.h" + +#include "wx/xml/xml.h" + +IMPLEMENT_DYNAMIC_CLASS(wxBitmapComboBoxXmlHandler, wxXmlResourceHandler) + +wxBitmapComboBoxXmlHandler::wxBitmapComboBoxXmlHandler() + :wxXmlResourceHandler() + ,m_combobox(NULL) + ,m_isInside(false) +{ + XRC_ADD_STYLE(wxCB_SORT); + XRC_ADD_STYLE(wxCB_READONLY); + AddWindowStyles(); +} + +wxObject *wxBitmapComboBoxXmlHandler::DoCreateResource() +{ + if (m_class == wxT("ownerdrawnitem")) + { + if ( !m_combobox ) + { + ReportError("ownerdrawnitem only allowed within a wxBitmapComboBox"); + return NULL; + } + + m_combobox->Append(GetText(wxT("text")), + GetBitmap(wxT("bitmap"))); + + return m_combobox; + } + else /*if( m_class == wxT("wxBitmapComboBox"))*/ + { + // find the selection + long selection = GetLong( wxT("selection"), -1 ); + + XRC_MAKE_INSTANCE(control, wxBitmapComboBox) + + control->Create(m_parentAsWindow, + GetID(), + GetText(wxT("value")), + GetPosition(), GetSize(), + 0, + NULL, + GetStyle(), + wxDefaultValidator, + GetName()); + + m_isInside = true; + m_combobox = control; + + wxXmlNode *children_node = GetParamNode(wxT("object")); + + wxXmlNode *n = children_node; + + while (n) + { + if ((n->GetType() == wxXML_ELEMENT_NODE) && + (n->GetName() == wxT("object"))) + { + CreateResFromNode(n, control, NULL); + } + n = n->GetNext(); + } + + m_isInside = false; + m_combobox = NULL; + + if (selection != -1) + control->SetSelection(selection); + + SetupWindow(control); + + return control; + } +} + +bool wxBitmapComboBoxXmlHandler::CanHandle(wxXmlNode *node) +{ + return ((!m_isInside && IsOfClass(node, wxT("wxBitmapComboBox"))) || + (m_isInside && IsOfClass(node, wxT("ownerdrawnitem")))); +} + +#endif // wxUSE_XRC && wxUSE_BITMAPCOMBOBOX diff --git a/Source/3rd Party/wx/src/xrc/xh_bttn.cpp b/Source/3rd Party/wx/src/xrc/xh_bttn.cpp new file mode 100644 index 000000000..fea736044 --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_bttn.cpp @@ -0,0 +1,69 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_bttn.cpp +// Purpose: XRC resource for buttons +// Author: Vaclav Slavik +// Created: 2000/03/05 +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_BUTTON + +#include "wx/xrc/xh_bttn.h" + +#ifndef WX_PRECOMP + #include "wx/button.h" +#endif + +IMPLEMENT_DYNAMIC_CLASS(wxButtonXmlHandler, wxXmlResourceHandler) + +wxButtonXmlHandler::wxButtonXmlHandler() +: wxXmlResourceHandler() +{ + XRC_ADD_STYLE(wxBU_LEFT); + XRC_ADD_STYLE(wxBU_RIGHT); + XRC_ADD_STYLE(wxBU_TOP); + XRC_ADD_STYLE(wxBU_BOTTOM); + XRC_ADD_STYLE(wxBU_EXACTFIT); + AddWindowStyles(); +} + +wxObject *wxButtonXmlHandler::DoCreateResource() +{ + XRC_MAKE_INSTANCE(button, wxButton) + + button->Create(m_parentAsWindow, + GetID(), + GetText(wxT("label")), + GetPosition(), GetSize(), + GetStyle(), + wxDefaultValidator, + GetName()); + + if (GetBool(wxT("default"), 0)) + button->SetDefault(); + + if ( GetParamNode("bitmap") ) + { + button->SetBitmap(GetBitmap("bitmap", wxART_BUTTON), + GetDirection("bitmapposition")); + } + + SetupWindow(button); + + return button; +} + +bool wxButtonXmlHandler::CanHandle(wxXmlNode *node) +{ + return IsOfClass(node, wxT("wxButton")); +} + +#endif // wxUSE_XRC && wxUSE_BUTTON diff --git a/Source/3rd Party/wx/src/xrc/xh_cald.cpp b/Source/3rd Party/wx/src/xrc/xh_cald.cpp new file mode 100644 index 000000000..28c60ecad --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_cald.cpp @@ -0,0 +1,66 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_cald.cpp +// Purpose: XRC resource for wxCalendarCtrl +// Author: Brian Gavin +// Created: 2000/09/09 +// Copyright: (c) 2000 Brian Gavin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_CALENDARCTRL + +#include "wx/xrc/xh_cald.h" + +#ifndef WX_PRECOMP + #include "wx/event.h" +#endif //WX_PRECOMP + +#include "wx/calctrl.h" + +IMPLEMENT_DYNAMIC_CLASS(wxCalendarCtrlXmlHandler, wxXmlResourceHandler) + +wxCalendarCtrlXmlHandler::wxCalendarCtrlXmlHandler() +: wxXmlResourceHandler() +{ + XRC_ADD_STYLE(wxCAL_SUNDAY_FIRST); + XRC_ADD_STYLE(wxCAL_MONDAY_FIRST); + XRC_ADD_STYLE(wxCAL_SHOW_HOLIDAYS); + XRC_ADD_STYLE(wxCAL_NO_YEAR_CHANGE); + XRC_ADD_STYLE(wxCAL_NO_MONTH_CHANGE); + XRC_ADD_STYLE(wxCAL_SEQUENTIAL_MONTH_SELECTION); + XRC_ADD_STYLE(wxCAL_SHOW_SURROUNDING_WEEKS); + + AddWindowStyles(); +} + + +wxObject *wxCalendarCtrlXmlHandler::DoCreateResource() +{ + XRC_MAKE_INSTANCE(calendar, wxCalendarCtrl); + + calendar->Create(m_parentAsWindow, + GetID(), + wxDefaultDateTime, + /*TODO: take it from resource*/ + GetPosition(), GetSize(), + GetStyle(), + GetName()); + + SetupWindow(calendar); + + return calendar; +} + +bool wxCalendarCtrlXmlHandler::CanHandle(wxXmlNode *node) +{ + return IsOfClass(node, wxT("wxCalendarCtrl")); +} + +#endif // wxUSE_XRC && wxUSE_CALENDARCTRL diff --git a/Source/3rd Party/wx/src/xrc/xh_chckb.cpp b/Source/3rd Party/wx/src/xrc/xh_chckb.cpp new file mode 100644 index 000000000..9499c652f --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_chckb.cpp @@ -0,0 +1,60 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_chckb.cpp +// Purpose: XRC resource for wxCheckBox +// Author: Bob Mitchell +// Created: 2000/03/21 +// Copyright: (c) 2000 Bob Mitchell and Verant Interactive +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_CHECKBOX + +#include "wx/xrc/xh_chckb.h" + +#ifndef WX_PRECOMP + #include "wx/checkbox.h" +#endif + +IMPLEMENT_DYNAMIC_CLASS(wxCheckBoxXmlHandler, wxXmlResourceHandler) + +wxCheckBoxXmlHandler::wxCheckBoxXmlHandler() +: wxXmlResourceHandler() +{ + XRC_ADD_STYLE(wxCHK_2STATE); + XRC_ADD_STYLE(wxCHK_3STATE); + XRC_ADD_STYLE(wxCHK_ALLOW_3RD_STATE_FOR_USER); + XRC_ADD_STYLE(wxALIGN_RIGHT); + AddWindowStyles(); +} + +wxObject *wxCheckBoxXmlHandler::DoCreateResource() +{ + XRC_MAKE_INSTANCE(control, wxCheckBox) + + control->Create(m_parentAsWindow, + GetID(), + GetText(wxT("label")), + GetPosition(), GetSize(), + GetStyle(), + wxDefaultValidator, + GetName()); + + control->SetValue(GetBool( wxT("checked"))); + SetupWindow(control); + + return control; +} + +bool wxCheckBoxXmlHandler::CanHandle(wxXmlNode *node) +{ + return IsOfClass(node, wxT("wxCheckBox")); +} + +#endif // wxUSE_XRC && wxUSE_CHECKBOX diff --git a/Source/3rd Party/wx/src/xrc/xh_chckl.cpp b/Source/3rd Party/wx/src/xrc/xh_chckl.cpp new file mode 100644 index 000000000..843571597 --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_chckl.cpp @@ -0,0 +1,111 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_chckl.cpp +// Purpose: XRC resource for wxCheckListBox +// Author: Bob Mitchell +// Created: 2000/03/21 +// Copyright: (c) 2000 Bob Mitchell and Verant Interactive +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_CHECKLISTBOX + +#include "wx/xrc/xh_chckl.h" + +#ifndef WX_PRECOMP + #include "wx/intl.h" + #include "wx/log.h" + #include "wx/checklst.h" +#endif + +#include "wx/xml/xml.h" + +IMPLEMENT_DYNAMIC_CLASS(wxCheckListBoxXmlHandler, wxXmlResourceHandler) + +wxCheckListBoxXmlHandler::wxCheckListBoxXmlHandler() +: wxXmlResourceHandler(), m_insideBox(false) +{ + // wxListBox styles: + XRC_ADD_STYLE(wxLB_SINGLE); + XRC_ADD_STYLE(wxLB_MULTIPLE); + XRC_ADD_STYLE(wxLB_EXTENDED); + XRC_ADD_STYLE(wxLB_HSCROLL); + XRC_ADD_STYLE(wxLB_ALWAYS_SB); + XRC_ADD_STYLE(wxLB_NEEDED_SB); + XRC_ADD_STYLE(wxLB_SORT); + + AddWindowStyles(); +} + +wxObject *wxCheckListBoxXmlHandler::DoCreateResource() +{ + if (m_class == wxT("wxCheckListBox")) + { + // need to build the list of strings from children + m_insideBox = true; + CreateChildrenPrivately(NULL, GetParamNode(wxT("content"))); + + XRC_MAKE_INSTANCE(control, wxCheckListBox) + + control->Create(m_parentAsWindow, + GetID(), + GetPosition(), GetSize(), + strList, + GetStyle(), + wxDefaultValidator, + GetName()); + + // step through children myself (again.) + wxXmlNode *n = GetParamNode(wxT("content")); + if (n) + n = n->GetChildren(); + int i = 0; + while (n) + { + if (n->GetType() != wxXML_ELEMENT_NODE || + n->GetName() != wxT("item")) + { n = n->GetNext(); continue; } + + // checking boolean is a bit ugly here (see GetBool() ) + wxString v = n->GetAttribute(wxT("checked"), wxEmptyString); + v.MakeLower(); + if (v == wxT("1")) + control->Check( i, true ); + + i++; + n = n->GetNext(); + } + + SetupWindow(control); + + strList.Clear(); // dump the strings + + return control; + } + else + { + // on the inside now. + // handle Label + + // add to the list + wxString str = GetNodeContent(m_node); + if (m_resource->GetFlags() & wxXRC_USE_LOCALE) + str = wxGetTranslation(str, m_resource->GetDomain()); + strList.Add(str); + return NULL; + } +} + +bool wxCheckListBoxXmlHandler::CanHandle(wxXmlNode *node) +{ + return (IsOfClass(node, wxT("wxCheckListBox")) || + (m_insideBox && node->GetName() == wxT("item"))); +} + +#endif // wxUSE_XRC && wxUSE_CHECKLISTBOX diff --git a/Source/3rd Party/wx/src/xrc/xh_choic.cpp b/Source/3rd Party/wx/src/xrc/xh_choic.cpp new file mode 100644 index 000000000..fb9b7f224 --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_choic.cpp @@ -0,0 +1,88 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_choic.cpp +// Purpose: XRC resource for wxChoice +// Author: Bob Mitchell +// Created: 2000/03/21 +// Copyright: (c) 2000 Bob Mitchell and Verant Interactive +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_CHOICE + +#include "wx/xrc/xh_choic.h" + +#ifndef WX_PRECOMP + #include "wx/intl.h" + #include "wx/choice.h" +#endif + +#include "wx/xml/xml.h" + +IMPLEMENT_DYNAMIC_CLASS(wxChoiceXmlHandler, wxXmlResourceHandler) + +wxChoiceXmlHandler::wxChoiceXmlHandler() +: wxXmlResourceHandler() , m_insideBox(false) +{ + XRC_ADD_STYLE(wxCB_SORT); + AddWindowStyles(); +} + +wxObject *wxChoiceXmlHandler::DoCreateResource() +{ + if( m_class == wxT("wxChoice")) + { + // find the selection + long selection = GetLong(wxT("selection"), -1); + + // need to build the list of strings from children + m_insideBox = true; + CreateChildrenPrivately(NULL, GetParamNode(wxT("content"))); + + XRC_MAKE_INSTANCE(control, wxChoice) + + control->Create(m_parentAsWindow, + GetID(), + GetPosition(), GetSize(), + strList, + GetStyle(), + wxDefaultValidator, + GetName()); + + if (selection != -1) + control->SetSelection(selection); + + SetupWindow(control); + + strList.Clear(); // dump the strings + + return control; + } + else + { + // on the inside now. + // handle Label + + // add to the list + wxString str = GetNodeContent(m_node); + if (m_resource->GetFlags() & wxXRC_USE_LOCALE) + str = wxGetTranslation(str, m_resource->GetDomain()); + strList.Add(str); + + return NULL; + } +} + +bool wxChoiceXmlHandler::CanHandle(wxXmlNode *node) +{ + return (IsOfClass(node, wxT("wxChoice")) || + (m_insideBox && node->GetName() == wxT("item"))); +} + +#endif // wxUSE_XRC && wxUSE_CHOICE diff --git a/Source/3rd Party/wx/src/xrc/xh_choicbk.cpp b/Source/3rd Party/wx/src/xrc/xh_choicbk.cpp new file mode 100644 index 000000000..e70bd60ae --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_choicbk.cpp @@ -0,0 +1,143 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_choicbk.cpp +// Purpose: XRC resource for wxChoicebook +// Author: Vaclav Slavik +// Created: 2000/03/21 +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_CHOICEBOOK + +#include "wx/xrc/xh_choicbk.h" + +#ifndef WX_PRECOMP + #include "wx/log.h" + #include "wx/sizer.h" +#endif + +#include "wx/choicebk.h" +#include "wx/imaglist.h" + +IMPLEMENT_DYNAMIC_CLASS(wxChoicebookXmlHandler, wxXmlResourceHandler) + +wxChoicebookXmlHandler::wxChoicebookXmlHandler() + :wxXmlResourceHandler(), + m_isInside(false), + m_choicebook(NULL) +{ + XRC_ADD_STYLE(wxBK_DEFAULT); + XRC_ADD_STYLE(wxBK_LEFT); + XRC_ADD_STYLE(wxBK_RIGHT); + XRC_ADD_STYLE(wxBK_TOP); + XRC_ADD_STYLE(wxBK_BOTTOM); + + XRC_ADD_STYLE(wxCHB_DEFAULT); + XRC_ADD_STYLE(wxCHB_LEFT); + XRC_ADD_STYLE(wxCHB_RIGHT); + XRC_ADD_STYLE(wxCHB_TOP); + XRC_ADD_STYLE(wxCHB_BOTTOM); + + AddWindowStyles(); +} + +wxObject *wxChoicebookXmlHandler::DoCreateResource() +{ + if (m_class == wxT("choicebookpage")) + { + wxXmlNode *n = GetParamNode(wxT("object")); + + if ( !n ) + n = GetParamNode(wxT("object_ref")); + + if (n) + { + bool old_ins = m_isInside; + m_isInside = false; + wxObject *item = CreateResFromNode(n, m_choicebook, NULL); + m_isInside = old_ins; + wxWindow *wnd = wxDynamicCast(item, wxWindow); + + if (wnd) + { + m_choicebook->AddPage(wnd, GetText(wxT("label")), + GetBool(wxT("selected"))); + if ( HasParam(wxT("bitmap")) ) + { + wxBitmap bmp = GetBitmap(wxT("bitmap"), wxART_OTHER); + wxImageList *imgList = m_choicebook->GetImageList(); + if ( imgList == NULL ) + { + imgList = new wxImageList( bmp.GetWidth(), bmp.GetHeight() ); + m_choicebook->AssignImageList( imgList ); + } + int imgIndex = imgList->Add(bmp); + m_choicebook->SetPageImage(m_choicebook->GetPageCount()-1, imgIndex ); + } + else if ( HasParam(wxT("image")) ) + { + if ( m_choicebook->GetImageList() ) + { + m_choicebook->SetPageImage(m_choicebook->GetPageCount()-1, + GetLong(wxT("image")) ); + } + else // image without image list? + { + ReportError(n, "image can only be used in conjunction " + "with imagelist"); + } + } + } + else + { + ReportError(n, "choicebookpage child must be a window"); + } + return wnd; + } + else + { + ReportError("choicebookpage must have a window child"); + return NULL; + } + } + + else + { + XRC_MAKE_INSTANCE(nb, wxChoicebook) + + nb->Create(m_parentAsWindow, + GetID(), + GetPosition(), GetSize(), + GetStyle(wxT("style")), + GetName()); + + wxImageList *imagelist = GetImageList(); + if ( imagelist ) + nb->AssignImageList(imagelist); + + wxChoicebook *old_par = m_choicebook; + m_choicebook = nb; + bool old_ins = m_isInside; + m_isInside = true; + CreateChildren(m_choicebook, true/*only this handler*/); + m_isInside = old_ins; + m_choicebook = old_par; + + return nb; + } +} + +bool wxChoicebookXmlHandler::CanHandle(wxXmlNode *node) +{ + return ((!m_isInside && IsOfClass(node, wxT("wxChoicebook"))) || + (m_isInside && IsOfClass(node, wxT("choicebookpage")))); +} + +#endif // wxUSE_XRC && wxUSE_CHOICEBOOK diff --git a/Source/3rd Party/wx/src/xrc/xh_clrpicker.cpp b/Source/3rd Party/wx/src/xrc/xh_clrpicker.cpp new file mode 100644 index 000000000..690275e67 --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_clrpicker.cpp @@ -0,0 +1,54 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_clrpicker.cpp +// Purpose: XML resource handler for wxColourPickerCtrl +// Author: Francesco Montorsi +// Created: 2006-04-17 +// Copyright: (c) 2006 Francesco Montorsi +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_COLOURPICKERCTRL + +#include "wx/xrc/xh_clrpicker.h" +#include "wx/clrpicker.h" + +IMPLEMENT_DYNAMIC_CLASS(wxColourPickerCtrlXmlHandler, wxXmlResourceHandler) + +wxColourPickerCtrlXmlHandler::wxColourPickerCtrlXmlHandler() : wxXmlResourceHandler() +{ + XRC_ADD_STYLE(wxCLRP_USE_TEXTCTRL); + XRC_ADD_STYLE(wxCLRP_SHOW_LABEL); + XRC_ADD_STYLE(wxCLRP_DEFAULT_STYLE); + AddWindowStyles(); +} + +wxObject *wxColourPickerCtrlXmlHandler::DoCreateResource() +{ + XRC_MAKE_INSTANCE(picker, wxColourPickerCtrl) + + picker->Create(m_parentAsWindow, + GetID(), + GetColour(wxT("value"), *wxBLACK), + GetPosition(), GetSize(), + GetStyle(wxT("style"), wxCLRP_DEFAULT_STYLE), + wxDefaultValidator, + GetName()); + + SetupWindow(picker); + + return picker; +} + +bool wxColourPickerCtrlXmlHandler::CanHandle(wxXmlNode *node) +{ + return IsOfClass(node, wxT("wxColourPickerCtrl")); +} + +#endif // wxUSE_XRC && wxUSE_COLOURPICKERCTRL diff --git a/Source/3rd Party/wx/src/xrc/xh_cmdlinkbn.cpp b/Source/3rd Party/wx/src/xrc/xh_cmdlinkbn.cpp new file mode 100644 index 000000000..396827a01 --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_cmdlinkbn.cpp @@ -0,0 +1,59 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_cmdlinkbn.cpp +// Purpose: XRC resource for command link buttons +// Author: Kinaou Herve +// Created: 2010/10/20 +// Copyright: +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_COMMANDLINKBUTTON + +#include "wx/xrc/xh_cmdlinkbn.h" + +#include "wx/commandlinkbutton.h" + +IMPLEMENT_DYNAMIC_CLASS(wxCommandLinkButtonXmlHandler, wxXmlResourceHandler) + +wxCommandLinkButtonXmlHandler::wxCommandLinkButtonXmlHandler() + : wxXmlResourceHandler() +{ + XRC_ADD_STYLE(wxBU_LEFT); + XRC_ADD_STYLE(wxBU_RIGHT); + XRC_ADD_STYLE(wxBU_TOP); + XRC_ADD_STYLE(wxBU_BOTTOM); + XRC_ADD_STYLE(wxBU_EXACTFIT); + AddWindowStyles(); +} + +wxObject *wxCommandLinkButtonXmlHandler::DoCreateResource() +{ + XRC_MAKE_INSTANCE(button, wxCommandLinkButton) + + button->Create(m_parentAsWindow, + GetID(), + GetText(wxS("label")), + GetText(wxS("note")), + GetPosition(), GetSize(), + GetStyle(), + wxDefaultValidator, + GetName()); + + SetupWindow(button); + + return button; +} + +bool wxCommandLinkButtonXmlHandler::CanHandle(wxXmlNode *node) +{ + return IsOfClass(node, wxS("wxCommandLinkButton")); +} + +#endif // wxUSE_XRC && wxUSE_COMMANDLINKBUTTON diff --git a/Source/3rd Party/wx/src/xrc/xh_collpane.cpp b/Source/3rd Party/wx/src/xrc/xh_collpane.cpp new file mode 100644 index 000000000..ae4857615 --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_collpane.cpp @@ -0,0 +1,100 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_collpane.cpp +// Purpose: XML resource handler for wxCollapsiblePane +// Author: Francesco Montorsi +// Created: 2006-10-27 +// Copyright: (c) 2006 Francesco Montorsi +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_COLLPANE + +#ifndef WX_PRECOMP + #include "wx/log.h" +#endif + +#include "wx/collpane.h" +#include "wx/xrc/xh_collpane.h" + +IMPLEMENT_DYNAMIC_CLASS(wxCollapsiblePaneXmlHandler, wxXmlResourceHandler) + +wxCollapsiblePaneXmlHandler::wxCollapsiblePaneXmlHandler() +: wxXmlResourceHandler(), m_isInside(false) +{ + XRC_ADD_STYLE(wxCP_NO_TLW_RESIZE); + XRC_ADD_STYLE(wxCP_DEFAULT_STYLE); + AddWindowStyles(); +} + +wxObject *wxCollapsiblePaneXmlHandler::DoCreateResource() +{ + if (m_class == wxT("panewindow")) // read the XRC for the pane window + { + wxXmlNode *n = GetParamNode(wxT("object")); + + if ( !n ) + n = GetParamNode(wxT("object_ref")); + + if (n) + { + bool old_ins = m_isInside; + m_isInside = false; + wxObject *item = CreateResFromNode(n, m_collpane->GetPane(), NULL); + m_isInside = old_ins; + + return item; + } + else + { + ReportError("no control within panewindow"); + return NULL; + } + } + else + { + XRC_MAKE_INSTANCE(ctrl, wxCollapsiblePane) + + wxString label = GetParamValue(wxT("label")); + if (label.empty()) + { + ReportParamError("label", "label cannot be empty"); + return NULL; + } + + ctrl->Create(m_parentAsWindow, + GetID(), + label, + GetPosition(), GetSize(), + GetStyle(wxT("style"), wxCP_DEFAULT_STYLE), + wxDefaultValidator, + GetName()); + + ctrl->Collapse(GetBool(wxT("collapsed"))); + SetupWindow(ctrl); + + wxCollapsiblePane *old_par = m_collpane; + m_collpane = ctrl; + bool old_ins = m_isInside; + m_isInside = true; + CreateChildren(m_collpane, true/*only this handler*/); + m_isInside = old_ins; + m_collpane = old_par; + + return ctrl; + } +} + +bool wxCollapsiblePaneXmlHandler::CanHandle(wxXmlNode *node) +{ + return IsOfClass(node, wxT("wxCollapsiblePane")) || + (m_isInside && IsOfClass(node, wxT("panewindow"))); +} + +#endif // wxUSE_XRC && wxUSE_COLLPANE diff --git a/Source/3rd Party/wx/src/xrc/xh_combo.cpp b/Source/3rd Party/wx/src/xrc/xh_combo.cpp new file mode 100644 index 000000000..8691c4161 --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_combo.cpp @@ -0,0 +1,95 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_combo.cpp +// Purpose: XRC resource for wxComboBox +// Author: Bob Mitchell +// Created: 2000/03/21 +// Copyright: (c) 2000 Bob Mitchell and Verant Interactive +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_COMBOBOX + +#include "wx/xrc/xh_combo.h" + +#ifndef WX_PRECOMP + #include "wx/intl.h" + #include "wx/combobox.h" + #include "wx/textctrl.h" // for wxTE_PROCESS_ENTER +#endif + +#include "wx/xml/xml.h" + +IMPLEMENT_DYNAMIC_CLASS(wxComboBoxXmlHandler, wxXmlResourceHandler) + +wxComboBoxXmlHandler::wxComboBoxXmlHandler() + :wxXmlResourceHandler() + ,m_insideBox(false) +{ + XRC_ADD_STYLE(wxCB_SIMPLE); + XRC_ADD_STYLE(wxCB_SORT); + XRC_ADD_STYLE(wxCB_READONLY); + XRC_ADD_STYLE(wxCB_DROPDOWN); + XRC_ADD_STYLE(wxTE_PROCESS_ENTER); + AddWindowStyles(); +} + +wxObject *wxComboBoxXmlHandler::DoCreateResource() +{ + if( m_class == wxT("wxComboBox")) + { + // find the selection + long selection = GetLong( wxT("selection"), -1 ); + + // need to build the list of strings from children + m_insideBox = true; + CreateChildrenPrivately(NULL, GetParamNode(wxT("content"))); + + XRC_MAKE_INSTANCE(control, wxComboBox) + + control->Create(m_parentAsWindow, + GetID(), + GetText(wxT("value")), + GetPosition(), GetSize(), + strList, + GetStyle(), + wxDefaultValidator, + GetName()); + + if (selection != -1) + control->SetSelection(selection); + + SetupWindow(control); + + strList.Clear(); // dump the strings + + return control; + } + else + { + // on the inside now. + // handle Label + + // add to the list + wxString str = GetNodeContent(m_node); + if (m_resource->GetFlags() & wxXRC_USE_LOCALE) + str = wxGetTranslation(str, m_resource->GetDomain()); + strList.Add(str); + + return NULL; + } +} + +bool wxComboBoxXmlHandler::CanHandle(wxXmlNode *node) +{ + return (IsOfClass(node, wxT("wxComboBox")) || + (m_insideBox && node->GetName() == wxT("item"))); +} + +#endif // wxUSE_XRC && wxUSE_COMBOBOX diff --git a/Source/3rd Party/wx/src/xrc/xh_comboctrl.cpp b/Source/3rd Party/wx/src/xrc/xh_comboctrl.cpp new file mode 100644 index 000000000..9becbbbe3 --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_comboctrl.cpp @@ -0,0 +1,68 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_comboctrl.cpp +// Purpose: XRC resource for wxComboCtrl +// Author: Jaakko Salli +// Created: 2009/01/25 +// Copyright: (c) 2009 Jaakko Salli +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_COMBOCTRL + +#include "wx/xrc/xh_comboctrl.h" + +#ifndef WX_PRECOMP + #include "wx/intl.h" + #include "wx/textctrl.h" // for wxTE_PROCESS_ENTER +#endif + +#include "wx/combo.h" + + +IMPLEMENT_DYNAMIC_CLASS(wxComboCtrlXmlHandler, wxXmlResourceHandler) + +wxComboCtrlXmlHandler::wxComboCtrlXmlHandler() + : wxXmlResourceHandler() +{ + XRC_ADD_STYLE(wxCB_SORT); + XRC_ADD_STYLE(wxCB_READONLY); + XRC_ADD_STYLE(wxTE_PROCESS_ENTER); + XRC_ADD_STYLE(wxCC_SPECIAL_DCLICK); + XRC_ADD_STYLE(wxCC_STD_BUTTON); + AddWindowStyles(); +} + +wxObject *wxComboCtrlXmlHandler::DoCreateResource() +{ + if( m_class == wxT("wxComboCtrl")) + { + XRC_MAKE_INSTANCE(control, wxComboCtrl) + + control->Create(m_parentAsWindow, + GetID(), + GetText(wxT("value")), + GetPosition(), GetSize(), + GetStyle(), + wxDefaultValidator, + GetName()); + + SetupWindow(control); + + return control; + } + return NULL; +} + +bool wxComboCtrlXmlHandler::CanHandle(wxXmlNode *node) +{ + return IsOfClass(node, wxT("wxComboCtrl")); +} + +#endif // wxUSE_XRC && wxUSE_COMBOBOX diff --git a/Source/3rd Party/wx/src/xrc/xh_datectrl.cpp b/Source/3rd Party/wx/src/xrc/xh_datectrl.cpp new file mode 100644 index 000000000..634bb9e84 --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_datectrl.cpp @@ -0,0 +1,56 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_datectrl.cpp +// Purpose: XML resource handler for wxDatePickerCtrl +// Author: Vaclav Slavik +// Created: 2005-02-07 +// Copyright: (c) 2005 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_DATEPICKCTRL + +#include "wx/xrc/xh_datectrl.h" +#include "wx/datectrl.h" + +IMPLEMENT_DYNAMIC_CLASS(wxDateCtrlXmlHandler, wxXmlResourceHandler) + +wxDateCtrlXmlHandler::wxDateCtrlXmlHandler() : wxXmlResourceHandler() +{ + XRC_ADD_STYLE(wxDP_DEFAULT); + XRC_ADD_STYLE(wxDP_SPIN); + XRC_ADD_STYLE(wxDP_DROPDOWN); + XRC_ADD_STYLE(wxDP_ALLOWNONE); + XRC_ADD_STYLE(wxDP_SHOWCENTURY); + AddWindowStyles(); +} + +wxObject *wxDateCtrlXmlHandler::DoCreateResource() +{ + XRC_MAKE_INSTANCE(picker, wxDatePickerCtrl) + + picker->Create(m_parentAsWindow, + GetID(), + wxDefaultDateTime, + GetPosition(), GetSize(), + GetStyle(wxT("style"), wxDP_DEFAULT | wxDP_SHOWCENTURY), + wxDefaultValidator, + GetName()); + + SetupWindow(picker); + + return picker; +} + +bool wxDateCtrlXmlHandler::CanHandle(wxXmlNode *node) +{ + return IsOfClass(node, wxT("wxDatePickerCtrl")); +} + +#endif // wxUSE_XRC && wxUSE_DATEPICKCTRL diff --git a/Source/3rd Party/wx/src/xrc/xh_dirpicker.cpp b/Source/3rd Party/wx/src/xrc/xh_dirpicker.cpp new file mode 100644 index 000000000..8fab3a7fc --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_dirpicker.cpp @@ -0,0 +1,57 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_dirpicker.cpp +// Purpose: XML resource handler for wxDirPickerCtrl +// Author: Francesco Montorsi +// Created: 2006-04-17 +// Copyright: (c) 2006 Francesco Montorsi +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_DIRPICKERCTRL + +#include "wx/xrc/xh_dirpicker.h" +#include "wx/filepicker.h" + +IMPLEMENT_DYNAMIC_CLASS(wxDirPickerCtrlXmlHandler, wxXmlResourceHandler) + +wxDirPickerCtrlXmlHandler::wxDirPickerCtrlXmlHandler() : wxXmlResourceHandler() +{ + XRC_ADD_STYLE(wxDIRP_USE_TEXTCTRL); + XRC_ADD_STYLE(wxDIRP_DIR_MUST_EXIST); + XRC_ADD_STYLE(wxDIRP_CHANGE_DIR); + XRC_ADD_STYLE(wxDIRP_SMALL); + XRC_ADD_STYLE(wxDIRP_DEFAULT_STYLE); + AddWindowStyles(); +} + +wxObject *wxDirPickerCtrlXmlHandler::DoCreateResource() +{ + XRC_MAKE_INSTANCE(picker, wxDirPickerCtrl) + + picker->Create(m_parentAsWindow, + GetID(), + GetParamValue(wxT("value")), + GetText(wxT("message")), + GetPosition(), GetSize(), + GetStyle(wxT("style"), wxDIRP_DEFAULT_STYLE), + wxDefaultValidator, + GetName()); + + SetupWindow(picker); + + return picker; +} + +bool wxDirPickerCtrlXmlHandler::CanHandle(wxXmlNode *node) +{ + return IsOfClass(node, wxT("wxDirPickerCtrl")); +} + +#endif // wxUSE_XRC && wxUSE_DIRPICKERCTRL diff --git a/Source/3rd Party/wx/src/xrc/xh_dlg.cpp b/Source/3rd Party/wx/src/xrc/xh_dlg.cpp new file mode 100644 index 000000000..3edffae5e --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_dlg.cpp @@ -0,0 +1,92 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_dlg.cpp +// Purpose: XRC resource for dialogs +// Author: Vaclav Slavik +// Created: 2000/03/05 +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC + +#include "wx/xrc/xh_dlg.h" + +#ifndef WX_PRECOMP + #include "wx/intl.h" + #include "wx/log.h" + #include "wx/frame.h" + #include "wx/dialog.h" +#endif + +IMPLEMENT_DYNAMIC_CLASS(wxDialogXmlHandler, wxXmlResourceHandler) + +wxDialogXmlHandler::wxDialogXmlHandler() : wxXmlResourceHandler() +{ + XRC_ADD_STYLE(wxSTAY_ON_TOP); + XRC_ADD_STYLE(wxCAPTION); + XRC_ADD_STYLE(wxDEFAULT_DIALOG_STYLE); + XRC_ADD_STYLE(wxSYSTEM_MENU); + XRC_ADD_STYLE(wxRESIZE_BORDER); + XRC_ADD_STYLE(wxCLOSE_BOX); + XRC_ADD_STYLE(wxDIALOG_NO_PARENT); + + XRC_ADD_STYLE(wxTAB_TRAVERSAL); + XRC_ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY); + XRC_ADD_STYLE(wxDIALOG_EX_METAL); + XRC_ADD_STYLE(wxMAXIMIZE_BOX); + XRC_ADD_STYLE(wxMINIMIZE_BOX); + XRC_ADD_STYLE(wxFRAME_SHAPED); + XRC_ADD_STYLE(wxDIALOG_EX_CONTEXTHELP); + +#if WXWIN_COMPATIBILITY_2_6 + XRC_ADD_STYLE(wxDIALOG_MODAL); + XRC_ADD_STYLE(wxTHICK_FRAME); + XRC_ADD_STYLE(wxRESIZE_BOX); + XRC_ADD_STYLE(wxDIALOG_MODELESS); + XRC_ADD_STYLE(wxNO_3D); +#endif // WXWIN_COMPATIBILITY_2_6 + + AddWindowStyles(); +} + +wxObject *wxDialogXmlHandler::DoCreateResource() +{ + XRC_MAKE_INSTANCE(dlg, wxDialog); + + dlg->Create(m_parentAsWindow, + GetID(), + GetText(wxT("title")), + wxDefaultPosition, wxDefaultSize, + GetStyle(wxT("style"), wxDEFAULT_DIALOG_STYLE), + GetName()); + + if (HasParam(wxT("size"))) + dlg->SetClientSize(GetSize(wxT("size"), dlg)); + if (HasParam(wxT("pos"))) + dlg->Move(GetPosition()); + if (HasParam(wxT("icon"))) + dlg->SetIcons(GetIconBundle(wxT("icon"), wxART_FRAME_ICON)); + + SetupWindow(dlg); + + CreateChildren(dlg); + + if (GetBool(wxT("centered"), false)) + dlg->Centre(); + + return dlg; +} + +bool wxDialogXmlHandler::CanHandle(wxXmlNode *node) +{ + return IsOfClass(node, wxT("wxDialog")); +} + +#endif // wxUSE_XRC diff --git a/Source/3rd Party/wx/src/xrc/xh_editlbox.cpp b/Source/3rd Party/wx/src/xrc/xh_editlbox.cpp new file mode 100644 index 000000000..87031b005 --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_editlbox.cpp @@ -0,0 +1,123 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_editlbox.cpp +// Purpose: implementation of wxEditableListBox XRC handler +// Author: Vadim Zeitlin +// Created: 2009-06-04 +// Copyright: (c) 2009 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// for compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_EDITABLELISTBOX + +#ifndef WX_PRECOMP + #include "wx/intl.h" +#endif // WX_PRECOMP + +#include "wx/editlbox.h" +#include "wx/xrc/xh_editlbox.h" + +#include "wx/xml/xml.h" + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +namespace +{ + +const char * const EDITLBOX_CLASS_NAME = "wxEditableListBox"; +const char * const EDITLBOX_ITEM_NAME = "item"; + +} // anonymous namespace + +// ============================================================================ +// implementation +// ============================================================================ + +IMPLEMENT_DYNAMIC_CLASS(wxEditableListBoxXmlHandler, wxXmlResourceHandler) + +wxEditableListBoxXmlHandler::wxEditableListBoxXmlHandler() +{ + m_insideBox = false; + + XRC_ADD_STYLE(wxEL_ALLOW_NEW); + XRC_ADD_STYLE(wxEL_ALLOW_EDIT); + XRC_ADD_STYLE(wxEL_ALLOW_DELETE); + XRC_ADD_STYLE(wxEL_NO_REORDER); + + AddWindowStyles(); +} + +wxObject *wxEditableListBoxXmlHandler::DoCreateResource() +{ + if ( m_class == EDITLBOX_CLASS_NAME ) + { + // create the control itself + XRC_MAKE_INSTANCE(control, wxEditableListBox) + + control->Create + ( + m_parentAsWindow, + GetID(), + GetText("label"), + GetPosition(), + GetSize(), + GetStyle(), + GetName() + ); + + SetupWindow(control); + + // if any items are given, add them to the control + wxXmlNode * const contents = GetParamNode("content"); + if ( contents ) + { + m_insideBox = true; + CreateChildrenPrivately(NULL, contents); + m_insideBox = false; + + control->SetStrings(m_items); + m_items.clear(); + } + + return control; + } + else if ( m_insideBox && m_node->GetName() == EDITLBOX_ITEM_NAME ) + { + wxString str = GetNodeContent(m_node); + if ( m_resource->GetFlags() & wxXRC_USE_LOCALE ) + str = wxGetTranslation(str, m_resource->GetDomain()); + m_items.push_back(str); + + return NULL; + } + else + { + ReportError("Unexpected node inside wxEditableListBox"); + return NULL; + } +} + +bool wxEditableListBoxXmlHandler::CanHandle(wxXmlNode *node) +{ + return IsOfClass(node, EDITLBOX_CLASS_NAME) || + (m_insideBox && node->GetName() == EDITLBOX_ITEM_NAME); +} + + +#endif // wxUSE_XRC && wxUSE_EDITABLELISTBOX diff --git a/Source/3rd Party/wx/src/xrc/xh_filectrl.cpp b/Source/3rd Party/wx/src/xrc/xh_filectrl.cpp new file mode 100644 index 000000000..da4fc940f --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_filectrl.cpp @@ -0,0 +1,58 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_filectrl.cpp +// Purpose: XML resource handler for wxFileCtrl +// Author: Kinaou Hervé +// Created: 2009-05-11 +// Copyright: (c) 2009 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_FILECTRL + +#include "wx/xrc/xh_filectrl.h" +#include "wx/filectrl.h" + +IMPLEMENT_DYNAMIC_CLASS(wxFileCtrlXmlHandler, wxXmlResourceHandler) + +wxFileCtrlXmlHandler::wxFileCtrlXmlHandler() : wxXmlResourceHandler() +{ + XRC_ADD_STYLE(wxFC_DEFAULT_STYLE); + XRC_ADD_STYLE(wxFC_OPEN); + XRC_ADD_STYLE(wxFC_SAVE); + XRC_ADD_STYLE(wxFC_MULTIPLE); + XRC_ADD_STYLE(wxFC_NOSHOWHIDDEN); + + AddWindowStyles(); +} + +wxObject *wxFileCtrlXmlHandler::DoCreateResource() +{ + XRC_MAKE_INSTANCE(filectrl, wxFileCtrl) + + filectrl->Create(m_parentAsWindow, + GetID(), + GetText(wxT("defaultdirectory")), + GetText(wxT("defaultfilename")), + GetParamValue(wxT("wildcard")), + GetStyle(wxT("style"), wxFC_DEFAULT_STYLE), + GetPosition(), + GetSize(), + GetName()); + + SetupWindow(filectrl); + return filectrl; +} + +bool wxFileCtrlXmlHandler::CanHandle(wxXmlNode *node) +{ + return IsOfClass(node, wxT("wxFileCtrl")); +} + +#endif // wxUSE_XRC && wxUSE_FILECTRL diff --git a/Source/3rd Party/wx/src/xrc/xh_filepicker.cpp b/Source/3rd Party/wx/src/xrc/xh_filepicker.cpp new file mode 100644 index 000000000..21d8e51d5 --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_filepicker.cpp @@ -0,0 +1,60 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_filepicker.cpp +// Purpose: XML resource handler for wxFilePickerCtrl +// Author: Francesco Montorsi +// Created: 2006-04-17 +// Copyright: (c) 2006 Francesco Montorsi +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_FILEPICKERCTRL + +#include "wx/xrc/xh_filepicker.h" +#include "wx/filepicker.h" + +IMPLEMENT_DYNAMIC_CLASS(wxFilePickerCtrlXmlHandler, wxXmlResourceHandler) + +wxFilePickerCtrlXmlHandler::wxFilePickerCtrlXmlHandler() : wxXmlResourceHandler() +{ + XRC_ADD_STYLE(wxFLP_OPEN); + XRC_ADD_STYLE(wxFLP_SAVE); + XRC_ADD_STYLE(wxFLP_OVERWRITE_PROMPT); + XRC_ADD_STYLE(wxFLP_FILE_MUST_EXIST); + XRC_ADD_STYLE(wxFLP_CHANGE_DIR); + XRC_ADD_STYLE(wxFLP_SMALL); + XRC_ADD_STYLE(wxFLP_DEFAULT_STYLE); + XRC_ADD_STYLE(wxFLP_USE_TEXTCTRL); + AddWindowStyles(); +} + +wxObject *wxFilePickerCtrlXmlHandler::DoCreateResource() +{ + XRC_MAKE_INSTANCE(picker, wxFilePickerCtrl) + + picker->Create(m_parentAsWindow, + GetID(), + GetParamValue(wxT("value")), + GetText(wxT("message")), + GetParamValue(wxT("wildcard")), + GetPosition(), GetSize(), + GetStyle(wxT("style"), wxFLP_DEFAULT_STYLE), + wxDefaultValidator, + GetName()); + + SetupWindow(picker); + return picker; +} + +bool wxFilePickerCtrlXmlHandler::CanHandle(wxXmlNode *node) +{ + return IsOfClass(node, wxT("wxFilePickerCtrl")); +} + +#endif // wxUSE_XRC && wxUSE_FILEPICKERCTRL diff --git a/Source/3rd Party/wx/src/xrc/xh_fontpicker.cpp b/Source/3rd Party/wx/src/xrc/xh_fontpicker.cpp new file mode 100644 index 000000000..7d7674047 --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_fontpicker.cpp @@ -0,0 +1,59 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_fontpicker.cpp +// Purpose: XML resource handler for wxFontPickerCtrl +// Author: Francesco Montorsi +// Created: 2006-04-17 +// Copyright: (c) 2006 Francesco Montorsi +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_FONTPICKERCTRL + +#include "wx/xrc/xh_fontpicker.h" +#include "wx/fontpicker.h" + +IMPLEMENT_DYNAMIC_CLASS(wxFontPickerCtrlXmlHandler, wxXmlResourceHandler) + +wxFontPickerCtrlXmlHandler::wxFontPickerCtrlXmlHandler() : wxXmlResourceHandler() +{ + XRC_ADD_STYLE(wxFNTP_USE_TEXTCTRL); + XRC_ADD_STYLE(wxFNTP_FONTDESC_AS_LABEL); + XRC_ADD_STYLE(wxFNTP_USEFONT_FOR_LABEL); + XRC_ADD_STYLE(wxFNTP_DEFAULT_STYLE); + AddWindowStyles(); +} + +wxObject *wxFontPickerCtrlXmlHandler::DoCreateResource() +{ + XRC_MAKE_INSTANCE(picker, wxFontPickerCtrl) + + wxFont f = *wxNORMAL_FONT; + if (HasParam(wxT("value"))) + f = GetFont(wxT("value")); + + picker->Create(m_parentAsWindow, + GetID(), + f, + GetPosition(), GetSize(), + GetStyle(wxT("style"), wxFNTP_DEFAULT_STYLE), + wxDefaultValidator, + GetName()); + + SetupWindow(picker); + + return picker; +} + +bool wxFontPickerCtrlXmlHandler::CanHandle(wxXmlNode *node) +{ + return IsOfClass(node, wxT("wxFontPickerCtrl")); +} + +#endif // wxUSE_XRC && wxUSE_FONTPICKERCTRL diff --git a/Source/3rd Party/wx/src/xrc/xh_frame.cpp b/Source/3rd Party/wx/src/xrc/xh_frame.cpp new file mode 100644 index 000000000..5ad0e1ee8 --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_frame.cpp @@ -0,0 +1,98 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_frame.cpp +// Purpose: XRC resource for dialogs +// Author: Vaclav Slavik & Aleks. +// Created: 2000/03/05 +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC + +#include "wx/xrc/xh_frame.h" + +#ifndef WX_PRECOMP + #include "wx/intl.h" + #include "wx/log.h" + #include "wx/frame.h" + #include "wx/dialog.h" // to get wxDEFAULT_DIALOG_STYLE +#endif + +IMPLEMENT_DYNAMIC_CLASS(wxFrameXmlHandler, wxXmlResourceHandler) + +wxFrameXmlHandler::wxFrameXmlHandler() : wxXmlResourceHandler() +{ + XRC_ADD_STYLE(wxSTAY_ON_TOP); + XRC_ADD_STYLE(wxCAPTION); + XRC_ADD_STYLE(wxDEFAULT_DIALOG_STYLE); + XRC_ADD_STYLE(wxDEFAULT_FRAME_STYLE); +#if WXWIN_COMPATIBILITY_2_6 + XRC_ADD_STYLE(wxTHICK_FRAME); +#endif // WXWIN_COMPATIBILITY_2_6 + XRC_ADD_STYLE(wxSYSTEM_MENU); + XRC_ADD_STYLE(wxRESIZE_BORDER); +#if WXWIN_COMPATIBILITY_2_6 + XRC_ADD_STYLE(wxRESIZE_BOX); +#endif // WXWIN_COMPATIBILITY_2_6 + XRC_ADD_STYLE(wxCLOSE_BOX); + + XRC_ADD_STYLE(wxFRAME_NO_TASKBAR); + XRC_ADD_STYLE(wxFRAME_SHAPED); + XRC_ADD_STYLE(wxFRAME_TOOL_WINDOW); + XRC_ADD_STYLE(wxFRAME_FLOAT_ON_PARENT); + XRC_ADD_STYLE(wxMAXIMIZE_BOX); + XRC_ADD_STYLE(wxMINIMIZE_BOX); + XRC_ADD_STYLE(wxSTAY_ON_TOP); + +#if WXWIN_COMPATIBILITY_2_6 + XRC_ADD_STYLE(wxNO_3D); +#endif // WXWIN_COMPATIBILITY_2_6 + XRC_ADD_STYLE(wxTAB_TRAVERSAL); + XRC_ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY); + XRC_ADD_STYLE(wxFRAME_EX_METAL); + XRC_ADD_STYLE(wxFRAME_EX_CONTEXTHELP); + + AddWindowStyles(); +} + +wxObject *wxFrameXmlHandler::DoCreateResource() +{ + XRC_MAKE_INSTANCE(frame, wxFrame); + + frame->Create(m_parentAsWindow, + GetID(), + GetText(wxT("title")), + wxDefaultPosition, wxDefaultSize, + GetStyle(wxT("style"), wxDEFAULT_FRAME_STYLE), + GetName()); + + if (HasParam(wxT("size"))) + frame->SetClientSize(GetSize(wxT("size"), frame)); + if (HasParam(wxT("pos"))) + frame->Move(GetPosition()); + if (HasParam(wxT("icon"))) + frame->SetIcons(GetIconBundle(wxT("icon"), wxART_FRAME_ICON)); + + SetupWindow(frame); + + CreateChildren(frame); + + if (GetBool(wxT("centered"), false)) + frame->Centre(); + + return frame; +} + +bool wxFrameXmlHandler::CanHandle(wxXmlNode *node) +{ + return IsOfClass(node, wxT("wxFrame")); +} + +#endif // wxUSE_XRC diff --git a/Source/3rd Party/wx/src/xrc/xh_gauge.cpp b/Source/3rd Party/wx/src/xrc/xh_gauge.cpp new file mode 100644 index 000000000..b30741065 --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_gauge.cpp @@ -0,0 +1,76 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_gauge.cpp +// Purpose: XRC resource for wxGauge +// Author: Bob Mitchell +// Created: 2000/03/21 +// Copyright: (c) 2000 Bob Mitchell and Verant Interactive +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_GAUGE + +#include "wx/xrc/xh_gauge.h" + +#ifndef WX_PRECOMP + #include "wx/gauge.h" +#endif + +static const long DEFAULT_RANGE = 100; + +IMPLEMENT_DYNAMIC_CLASS(wxGaugeXmlHandler, wxXmlResourceHandler) + +wxGaugeXmlHandler::wxGaugeXmlHandler() + :wxXmlResourceHandler() +{ + XRC_ADD_STYLE(wxGA_HORIZONTAL); + XRC_ADD_STYLE(wxGA_VERTICAL); +#if WXWIN_COMPATIBILITY_2_6 + XRC_ADD_STYLE(wxGA_PROGRESSBAR); +#endif // WXWIN_COMPATIBILITY_2_6 + XRC_ADD_STYLE(wxGA_SMOOTH); // windows only + AddWindowStyles(); +} + +wxObject *wxGaugeXmlHandler::DoCreateResource() +{ + XRC_MAKE_INSTANCE(control, wxGauge) + + control->Create(m_parentAsWindow, + GetID(), + GetLong(wxT("range"), DEFAULT_RANGE), + GetPosition(), GetSize(), + GetStyle(), + wxDefaultValidator, + GetName()); + + if( HasParam(wxT("value"))) + { + control->SetValue(GetLong(wxT("value"))); + } + if( HasParam(wxT("shadow"))) + { + control->SetShadowWidth(GetDimension(wxT("shadow"))); + } + if( HasParam(wxT("bezel"))) + { + control->SetBezelFace(GetDimension(wxT("bezel"))); + } + + SetupWindow(control); + + return control; +} + +bool wxGaugeXmlHandler::CanHandle(wxXmlNode *node) +{ + return IsOfClass(node, wxT("wxGauge")); +} + +#endif // wxUSE_XRC && wxUSE_GAUGE diff --git a/Source/3rd Party/wx/src/xrc/xh_gdctl.cpp b/Source/3rd Party/wx/src/xrc/xh_gdctl.cpp new file mode 100644 index 000000000..76ad6ba45 --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_gdctl.cpp @@ -0,0 +1,64 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_gdctl.cpp +// Purpose: XRC resource for wxGenericDirCtrl +// Author: Markus Greither +// Created: 2002/01/20 +// Copyright: (c) 2002 Markus Greither +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_DIRDLG + +#include "wx/xrc/xh_gdctl.h" + +#ifndef WX_PRECOMP + #include "wx/textctrl.h" +#endif + +#include "wx/dirctrl.h" + +IMPLEMENT_DYNAMIC_CLASS(wxGenericDirCtrlXmlHandler, wxXmlResourceHandler) + +wxGenericDirCtrlXmlHandler::wxGenericDirCtrlXmlHandler() +: wxXmlResourceHandler() +{ + XRC_ADD_STYLE(wxDIRCTRL_DIR_ONLY); + XRC_ADD_STYLE(wxDIRCTRL_3D_INTERNAL); + XRC_ADD_STYLE(wxDIRCTRL_SELECT_FIRST); + XRC_ADD_STYLE(wxDIRCTRL_SHOW_FILTERS); + XRC_ADD_STYLE(wxDIRCTRL_EDIT_LABELS); + XRC_ADD_STYLE(wxDIRCTRL_MULTIPLE); + AddWindowStyles(); +} + +wxObject *wxGenericDirCtrlXmlHandler::DoCreateResource() +{ + XRC_MAKE_INSTANCE(ctrl, wxGenericDirCtrl) + + ctrl->Create(m_parentAsWindow, + GetID(), + GetText(wxT("defaultfolder")), + GetPosition(), GetSize(), + GetStyle(), + GetText(wxT("filter")), + (int)GetLong(wxT("defaultfilter")), + GetName()); + + SetupWindow(ctrl); + + return ctrl; +} + +bool wxGenericDirCtrlXmlHandler::CanHandle(wxXmlNode *node) +{ + return IsOfClass(node, wxT("wxGenericDirCtrl")); +} + +#endif // wxUSE_XRC && wxUSE_DIRDLG diff --git a/Source/3rd Party/wx/src/xrc/xh_grid.cpp b/Source/3rd Party/wx/src/xrc/xh_grid.cpp new file mode 100644 index 000000000..74ccf19bc --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_grid.cpp @@ -0,0 +1,50 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_grid.cpp +// Purpose: XML resource handler for the grid control +// Author: Agron Selimaj +// Created: 2005/08/11 +// Copyright: (c) 2005 Agron Selimaj, Freepour Controls Inc. +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_GRID + +#include "wx/xrc/xh_grid.h" +#include "wx/grid.h" + +IMPLEMENT_DYNAMIC_CLASS(wxGridXmlHandler, wxXmlResourceHandler) + +wxGridXmlHandler::wxGridXmlHandler() + : wxXmlResourceHandler() +{ + AddWindowStyles(); +} + +wxObject *wxGridXmlHandler::DoCreateResource() +{ + XRC_MAKE_INSTANCE(grid, wxGrid) + + grid->Create(m_parentAsWindow, + GetID(), + GetPosition(), GetSize(), + GetStyle(wxT("style")), + GetName()); + + SetupWindow( grid); + + return grid; +} + +bool wxGridXmlHandler::CanHandle(wxXmlNode *node) +{ + return IsOfClass(node, wxT("wxGrid")); +} + +#endif // wxUSE_XRC && wxUSE_GRID diff --git a/Source/3rd Party/wx/src/xrc/xh_html.cpp b/Source/3rd Party/wx/src/xrc/xh_html.cpp new file mode 100644 index 000000000..929c1f061 --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_html.cpp @@ -0,0 +1,80 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_html.cpp +// Purpose: XRC resource for wxHtmlWindow +// Author: Bob Mitchell +// Created: 2000/03/21 +// Copyright: (c) 2000 Bob Mitchell and Verant Interactive +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_HTML + +#include "wx/xrc/xh_html.h" + +#include "wx/html/htmlwin.h" +#include "wx/filesys.h" + +IMPLEMENT_DYNAMIC_CLASS(wxHtmlWindowXmlHandler, wxXmlResourceHandler) + +wxHtmlWindowXmlHandler::wxHtmlWindowXmlHandler() +: wxXmlResourceHandler() +{ + XRC_ADD_STYLE(wxHW_SCROLLBAR_NEVER); + XRC_ADD_STYLE(wxHW_SCROLLBAR_AUTO); + XRC_ADD_STYLE(wxHW_NO_SELECTION); + AddWindowStyles(); +} + +wxObject *wxHtmlWindowXmlHandler::DoCreateResource() +{ + XRC_MAKE_INSTANCE(control, wxHtmlWindow) + + control->Create(m_parentAsWindow, + GetID(), + GetPosition(), GetSize(), + GetStyle(wxT("style"), wxHW_SCROLLBAR_AUTO), + GetName()); + + if (HasParam(wxT("borders"))) + { + control->SetBorders(GetDimension(wxT("borders"))); + } + + if (HasParam(wxT("url"))) + { + wxString url = GetParamValue(wxT("url")); + wxFileSystem& fsys = GetCurFileSystem(); + + wxFSFile *f = fsys.OpenFile(url); + if (f) + { + control->LoadPage(f->GetLocation()); + delete f; + } + else + control->LoadPage(url); + } + + else if (HasParam(wxT("htmlcode"))) + { + control->SetPage(GetText(wxT("htmlcode"))); + } + + SetupWindow(control); + + return control; +} + +bool wxHtmlWindowXmlHandler::CanHandle(wxXmlNode *node) +{ + return IsOfClass(node, wxT("wxHtmlWindow")); +} + +#endif // wxUSE_XRC && wxUSE_HTML diff --git a/Source/3rd Party/wx/src/xrc/xh_htmllbox.cpp b/Source/3rd Party/wx/src/xrc/xh_htmllbox.cpp new file mode 100644 index 000000000..f2af2a89c --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_htmllbox.cpp @@ -0,0 +1,87 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_simplehtmllbox.cpp +// Purpose: XML resource handler for wxSimpleHtmlListBox +// Author: Francesco Montorsi +// Created: 2006/10/21 +// Copyright: (c) 2006 Francesco Montorsi +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_HTML + +#include "wx/xrc/xh_htmllbox.h" + +#include "wx/htmllbox.h" +#include "wx/filesys.h" + +#include "wx/xml/xml.h" + +IMPLEMENT_DYNAMIC_CLASS(wxSimpleHtmlListBoxXmlHandler, wxXmlResourceHandler) + +wxSimpleHtmlListBoxXmlHandler::wxSimpleHtmlListBoxXmlHandler() +: wxXmlResourceHandler(), m_insideBox(false) +{ + XRC_ADD_STYLE(wxHLB_DEFAULT_STYLE); + XRC_ADD_STYLE(wxHLB_MULTIPLE); + AddWindowStyles(); +} + +wxObject *wxSimpleHtmlListBoxXmlHandler::DoCreateResource() +{ + if ( m_class == wxT("wxSimpleHtmlListBox")) + { + // find the selection + long selection = GetLong(wxT("selection"), -1); + + // need to build the list of strings from children + m_insideBox = true; + CreateChildrenPrivately(NULL, GetParamNode(wxT("content"))); + m_insideBox = false; + + XRC_MAKE_INSTANCE(control, wxSimpleHtmlListBox) + + control->Create(m_parentAsWindow, + GetID(), + GetPosition(), GetSize(), + strList, + GetStyle(wxT("style"), wxHLB_DEFAULT_STYLE), + wxDefaultValidator, + GetName()); + + if (selection != -1) + control->SetSelection(selection); + + SetupWindow(control); + strList.Clear(); // dump the strings + + return control; + } + else + { + // on the inside now. + // handle Label + + // add to the list + wxString str = GetNodeContent(m_node); + if (m_resource->GetFlags() & wxXRC_USE_LOCALE) + str = wxGetTranslation(str, m_resource->GetDomain()); + strList.Add(str); + + return NULL; + } +} + +bool wxSimpleHtmlListBoxXmlHandler::CanHandle(wxXmlNode *node) +{ + return (IsOfClass(node, wxT("wxSimpleHtmlListBox")) || + (m_insideBox && node->GetName() == wxT("item"))); +} + +#endif // wxUSE_XRC && wxUSE_HTML diff --git a/Source/3rd Party/wx/src/xrc/xh_hyperlink.cpp b/Source/3rd Party/wx/src/xrc/xh_hyperlink.cpp new file mode 100644 index 000000000..870b7b470 --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_hyperlink.cpp @@ -0,0 +1,87 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_hyperlink.cpp +// Purpose: Hyperlink control +// Author: David Norris +// Modified by: Ryan Norton, Francesco Montorsi +// Created: 04/02/2005 +// Copyright: (c) 2005 David Norris +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +//=========================================================================== +// Declarations +//=========================================================================== + +//--------------------------------------------------------------------------- +// Pre-compiled header stuff +//--------------------------------------------------------------------------- + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_HYPERLINKCTRL + +//--------------------------------------------------------------------------- +// Includes +//--------------------------------------------------------------------------- + +#include "wx/xrc/xh_hyperlink.h" + +#ifndef WX_PRECOMP +#endif + +#include "wx/hyperlink.h" +#include "wx/xrc/xmlres.h" + +//=========================================================================== +// Implementation +//=========================================================================== + +//--------------------------------------------------------------------------- +// wxHyperlinkCtrlXmlHandler +//--------------------------------------------------------------------------- + +// Register with wxWindows' dynamic class subsystem. +IMPLEMENT_DYNAMIC_CLASS(wxHyperlinkCtrlXmlHandler, wxXmlResourceHandler) + +wxHyperlinkCtrlXmlHandler::wxHyperlinkCtrlXmlHandler() +{ + XRC_ADD_STYLE(wxHL_CONTEXTMENU); + XRC_ADD_STYLE(wxHL_ALIGN_LEFT); + XRC_ADD_STYLE(wxHL_ALIGN_RIGHT); + XRC_ADD_STYLE(wxHL_ALIGN_CENTRE); + XRC_ADD_STYLE(wxHL_DEFAULT_STYLE); + + AddWindowStyles(); +} + +wxObject *wxHyperlinkCtrlXmlHandler::DoCreateResource() +{ + XRC_MAKE_INSTANCE(control, wxHyperlinkCtrl) + + control->Create + ( + m_parentAsWindow, + GetID(), + GetText(wxT("label")), + GetParamValue(wxT("url")), + GetPosition(), GetSize(), + GetStyle(wxT("style"), wxHL_DEFAULT_STYLE), + GetName() + ); + + SetupWindow(control); + + return control; +} + +bool wxHyperlinkCtrlXmlHandler::CanHandle(wxXmlNode *node) +{ + return IsOfClass(node, wxT("wxHyperlinkCtrl")); +} + +#endif // wxUSE_XRC && wxUSE_HYPERLINKCTRL diff --git a/Source/3rd Party/wx/src/xrc/xh_listb.cpp b/Source/3rd Party/wx/src/xrc/xh_listb.cpp new file mode 100644 index 000000000..cde163372 --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_listb.cpp @@ -0,0 +1,95 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_listb.cpp +// Purpose: XRC resource for wxListBox +// Author: Bob Mitchell & Vaclav Slavik +// Created: 2000/07/29 +// Copyright: (c) 2000 Bob Mitchell and Verant Interactive +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_LISTBOX + +#include "wx/xrc/xh_listb.h" + +#ifndef WX_PRECOMP + #include "wx/intl.h" + #include "wx/listbox.h" +#endif + +#include "wx/xml/xml.h" + +IMPLEMENT_DYNAMIC_CLASS(wxListBoxXmlHandler, wxXmlResourceHandler) + +wxListBoxXmlHandler::wxListBoxXmlHandler() + : wxXmlResourceHandler(), + m_insideBox(false) +{ + XRC_ADD_STYLE(wxLB_SINGLE); + XRC_ADD_STYLE(wxLB_MULTIPLE); + XRC_ADD_STYLE(wxLB_EXTENDED); + XRC_ADD_STYLE(wxLB_HSCROLL); + XRC_ADD_STYLE(wxLB_ALWAYS_SB); + XRC_ADD_STYLE(wxLB_NEEDED_SB); + XRC_ADD_STYLE(wxLB_SORT); + AddWindowStyles(); +} + +wxObject *wxListBoxXmlHandler::DoCreateResource() +{ + if ( m_class == wxT("wxListBox")) + { + // find the selection + long selection = GetLong(wxT("selection"), -1); + + // need to build the list of strings from children + m_insideBox = true; + CreateChildrenPrivately(NULL, GetParamNode(wxT("content"))); + m_insideBox = false; + + XRC_MAKE_INSTANCE(control, wxListBox) + + control->Create(m_parentAsWindow, + GetID(), + GetPosition(), GetSize(), + strList, + GetStyle(), + wxDefaultValidator, + GetName()); + + if (selection != -1) + control->SetSelection(selection); + + SetupWindow(control); + strList.Clear(); // dump the strings + + return control; + } + else + { + // on the inside now. + // handle Label + + // add to the list + wxString str = GetNodeContent(m_node); + if (m_resource->GetFlags() & wxXRC_USE_LOCALE) + str = wxGetTranslation(str, m_resource->GetDomain()); + strList.Add(str); + + return NULL; + } +} + +bool wxListBoxXmlHandler::CanHandle(wxXmlNode *node) +{ + return (IsOfClass(node, wxT("wxListBox")) || + (m_insideBox && node->GetName() == wxT("item"))); +} + +#endif // wxUSE_XRC && wxUSE_LISTBOX diff --git a/Source/3rd Party/wx/src/xrc/xh_listbk.cpp b/Source/3rd Party/wx/src/xrc/xh_listbk.cpp new file mode 100644 index 000000000..f7bf2c58b --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_listbk.cpp @@ -0,0 +1,143 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_listbk.cpp +// Purpose: XRC resource for wxListbook +// Author: Vaclav Slavik +// Created: 2000/03/21 +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_LISTBOOK + +#include "wx/xrc/xh_listbk.h" + +#ifndef WX_PRECOMP + #include "wx/log.h" + #include "wx/sizer.h" +#endif + +#include "wx/listbook.h" +#include "wx/imaglist.h" + +IMPLEMENT_DYNAMIC_CLASS(wxListbookXmlHandler, wxXmlResourceHandler) + +wxListbookXmlHandler::wxListbookXmlHandler() + :wxXmlResourceHandler(), + m_isInside(false), + m_listbook(NULL) +{ + XRC_ADD_STYLE(wxBK_DEFAULT); + XRC_ADD_STYLE(wxBK_LEFT); + XRC_ADD_STYLE(wxBK_RIGHT); + XRC_ADD_STYLE(wxBK_TOP); + XRC_ADD_STYLE(wxBK_BOTTOM); + + XRC_ADD_STYLE(wxLB_DEFAULT); + XRC_ADD_STYLE(wxLB_LEFT); + XRC_ADD_STYLE(wxLB_RIGHT); + XRC_ADD_STYLE(wxLB_TOP); + XRC_ADD_STYLE(wxLB_BOTTOM); + + AddWindowStyles(); +} + +wxObject *wxListbookXmlHandler::DoCreateResource() +{ + if (m_class == wxT("listbookpage")) + { + wxXmlNode *n = GetParamNode(wxT("object")); + + if ( !n ) + n = GetParamNode(wxT("object_ref")); + + if (n) + { + bool old_ins = m_isInside; + m_isInside = false; + wxObject *item = CreateResFromNode(n, m_listbook, NULL); + m_isInside = old_ins; + wxWindow *wnd = wxDynamicCast(item, wxWindow); + + if (wnd) + { + m_listbook->AddPage(wnd, GetText(wxT("label")), + GetBool(wxT("selected"))); + if ( HasParam(wxT("bitmap")) ) + { + wxBitmap bmp = GetBitmap(wxT("bitmap"), wxART_OTHER); + wxImageList *imgList = m_listbook->GetImageList(); + if ( imgList == NULL ) + { + imgList = new wxImageList( bmp.GetWidth(), bmp.GetHeight() ); + m_listbook->AssignImageList( imgList ); + } + int imgIndex = imgList->Add(bmp); + m_listbook->SetPageImage(m_listbook->GetPageCount()-1, imgIndex ); + } + else if ( HasParam(wxT("image")) ) + { + if ( m_listbook->GetImageList() ) + { + m_listbook->SetPageImage(m_listbook->GetPageCount()-1, + GetLong(wxT("image")) ); + } + else // image without image list? + { + ReportError(n, "image can only be used in conjunction " + "with imagelist"); + } + } + } + else + { + ReportError(n, "listbookpage child must be a window"); + } + return wnd; + } + else + { + ReportError("listbookpage must have a window child"); + return NULL; + } + } + + else + { + XRC_MAKE_INSTANCE(nb, wxListbook) + + nb->Create(m_parentAsWindow, + GetID(), + GetPosition(), GetSize(), + GetStyle(wxT("style")), + GetName()); + + wxImageList *imagelist = GetImageList(); + if ( imagelist ) + nb->AssignImageList(imagelist); + + wxListbook *old_par = m_listbook; + m_listbook = nb; + bool old_ins = m_isInside; + m_isInside = true; + CreateChildren(m_listbook, true/*only this handler*/); + m_isInside = old_ins; + m_listbook = old_par; + + return nb; + } +} + +bool wxListbookXmlHandler::CanHandle(wxXmlNode *node) +{ + return ((!m_isInside && IsOfClass(node, wxT("wxListbook"))) || + (m_isInside && IsOfClass(node, wxT("listbookpage")))); +} + +#endif // wxUSE_XRC && wxUSE_LISTBOOK diff --git a/Source/3rd Party/wx/src/xrc/xh_listc.cpp b/Source/3rd Party/wx/src/xrc/xh_listc.cpp new file mode 100644 index 000000000..c4fb4e446 --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_listc.cpp @@ -0,0 +1,265 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_listc.cpp +// Purpose: XRC resource for wxListCtrl +// Author: Brian Gavin, Kinaou Hervé, Vadim Zeitlin +// Created: 2000/09/09 +// Copyright: (c) 2000 Brian Gavin +// (c) 2009 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_LISTCTRL + +#include "wx/xrc/xh_listc.h" + +#ifndef WX_PRECOMP + #include "wx/textctrl.h" +#endif + +#include "wx/listctrl.h" +#include "wx/imaglist.h" + +namespace +{ + +const char *LISTCTRL_CLASS_NAME = "wxListCtrl"; +const char *LISTITEM_CLASS_NAME = "listitem"; +const char *LISTCOL_CLASS_NAME = "listcol"; + +} // anonymous namespace + + +IMPLEMENT_DYNAMIC_CLASS(wxListCtrlXmlHandler, wxXmlResourceHandler) + +wxListCtrlXmlHandler::wxListCtrlXmlHandler() + : wxXmlResourceHandler() +{ + // wxListItem styles + XRC_ADD_STYLE(wxLIST_FORMAT_LEFT); + XRC_ADD_STYLE(wxLIST_FORMAT_RIGHT); + XRC_ADD_STYLE(wxLIST_FORMAT_CENTRE); + XRC_ADD_STYLE(wxLIST_MASK_STATE); + XRC_ADD_STYLE(wxLIST_MASK_TEXT); + XRC_ADD_STYLE(wxLIST_MASK_IMAGE); + XRC_ADD_STYLE(wxLIST_MASK_DATA); + XRC_ADD_STYLE(wxLIST_MASK_WIDTH); + XRC_ADD_STYLE(wxLIST_MASK_FORMAT); + XRC_ADD_STYLE(wxLIST_STATE_FOCUSED); + XRC_ADD_STYLE(wxLIST_STATE_SELECTED); + + // wxListCtrl styles + XRC_ADD_STYLE(wxLC_LIST); + XRC_ADD_STYLE(wxLC_REPORT); + XRC_ADD_STYLE(wxLC_ICON); + XRC_ADD_STYLE(wxLC_SMALL_ICON); + XRC_ADD_STYLE(wxLC_ALIGN_TOP); + XRC_ADD_STYLE(wxLC_ALIGN_LEFT); + XRC_ADD_STYLE(wxLC_AUTOARRANGE); + XRC_ADD_STYLE(wxLC_USER_TEXT); + XRC_ADD_STYLE(wxLC_EDIT_LABELS); + XRC_ADD_STYLE(wxLC_NO_HEADER); + XRC_ADD_STYLE(wxLC_SINGLE_SEL); + XRC_ADD_STYLE(wxLC_SORT_ASCENDING); + XRC_ADD_STYLE(wxLC_SORT_DESCENDING); + XRC_ADD_STYLE(wxLC_VIRTUAL); + XRC_ADD_STYLE(wxLC_HRULES); + XRC_ADD_STYLE(wxLC_VRULES); + XRC_ADD_STYLE(wxLC_NO_SORT_HEADER); + AddWindowStyles(); +} + +wxObject *wxListCtrlXmlHandler::DoCreateResource() +{ + if ( m_class == LISTITEM_CLASS_NAME ) + { + HandleListItem(); + } + else if ( m_class == LISTCOL_CLASS_NAME ) + { + HandleListCol(); + } + else + { + wxASSERT_MSG( m_class == LISTCTRL_CLASS_NAME, + "can't handle unknown node" ); + + return HandleListCtrl(); + } + + return m_parentAsWindow; +} + +bool wxListCtrlXmlHandler::CanHandle(wxXmlNode *node) +{ + return IsOfClass(node, LISTCTRL_CLASS_NAME) || + IsOfClass(node, LISTITEM_CLASS_NAME) || + IsOfClass(node, LISTCOL_CLASS_NAME); +} + +void wxListCtrlXmlHandler::HandleCommonItemAttrs(wxListItem& item) +{ + if (HasParam(wxT("align"))) + item.SetAlign((wxListColumnFormat)GetStyle(wxT("align"))); + if (HasParam(wxT("text"))) + item.SetText(GetText(wxT("text"))); +} + +void wxListCtrlXmlHandler::HandleListCol() +{ + wxListCtrl * const list = wxDynamicCast(m_parentAsWindow, wxListCtrl); + wxCHECK_RET( list, "must have wxListCtrl parent" ); + + if ( !list->HasFlag(wxLC_REPORT) ) + { + ReportError("Only report mode list controls can have columns."); + return; + } + + wxListItem item; + + HandleCommonItemAttrs(item); + if (HasParam(wxT("width"))) + item.SetWidth((int)GetLong(wxT("width"))); + if (HasParam(wxT("image"))) + item.SetImage((int)GetLong(wxT("image"))); + + list->InsertColumn(list->GetColumnCount(), item); +} + +void wxListCtrlXmlHandler::HandleListItem() +{ + wxListCtrl * const list = wxDynamicCast(m_parentAsWindow, wxListCtrl); + wxCHECK_RET( list, "must have wxListCtrl parent" ); + + wxListItem item; + + HandleCommonItemAttrs(item); + + if (HasParam(wxT("bg"))) + item.SetBackgroundColour(GetColour(wxT("bg"))); + if (HasParam(wxT("col"))) + item.SetColumn((int)GetLong(wxT("col"))); + if (HasParam(wxT("data"))) + item.SetData(GetLong(wxT("data"))); + if (HasParam(wxT("font"))) + item.SetFont(GetFont(wxT("font"), list)); + if (HasParam(wxT("state"))) + item.SetState(GetStyle(wxT("state"))); + if (HasParam(wxT("textcolour"))) + item.SetTextColour(GetColour(wxT("textcolour"))); + if (HasParam(wxT("textcolor"))) + item.SetTextColour(GetColour(wxT("textcolor"))); + + // the list control icon style, may be 0 + int image; + if ( list->HasFlag(wxLC_ICON) ) + image = GetImageIndex(list, wxIMAGE_LIST_NORMAL); + else if ( list->HasFlag(wxLC_SMALL_ICON) || list->HasFlag(wxLC_REPORT) || list->HasFlag(wxLC_LIST) ) + image = GetImageIndex(list, wxIMAGE_LIST_SMALL); + else + image = wxNOT_FOUND; + + if ( image != wxNOT_FOUND ) + item.SetImage(image); + + // append the list item to the control + item.SetId(list->GetItemCount()); + + list->InsertItem(item); +} + +wxListCtrl *wxListCtrlXmlHandler::HandleListCtrl() +{ + XRC_MAKE_INSTANCE(list, wxListCtrl) + + list->Create(m_parentAsWindow, + GetID(), + GetPosition(), GetSize(), + GetStyle(), + wxDefaultValidator, + GetName()); + + // we can optionally have normal and/or small image lists + wxImageList *imagelist; + imagelist = GetImageList(wxT("imagelist")); + if ( imagelist ) + list->AssignImageList(imagelist, wxIMAGE_LIST_NORMAL); + imagelist = GetImageList(wxT("imagelist-small")); + if ( imagelist ) + list->AssignImageList(imagelist, wxIMAGE_LIST_SMALL); + + CreateChildrenPrivately(list); + SetupWindow(list); + + return list; +} + +long wxListCtrlXmlHandler::GetImageIndex(wxListCtrl *listctrl, int which) +{ + // use different tag names depending on whether we need a normal or small + // image + wxString + bmpParam("bitmap"), + imgParam("image"); + switch ( which ) + { + case wxIMAGE_LIST_SMALL: + bmpParam += "-small"; + imgParam += "-small"; + break; + + case wxIMAGE_LIST_NORMAL: + // nothing to do + break; + + default: + wxFAIL_MSG( "unsupported image list kind" ); + return wxNOT_FOUND; + } + + // look for either bitmap or image tags + int imgIndex = wxNOT_FOUND; + if ( HasParam(bmpParam) ) + { + // we implicitly construct an image list containing the specified + // bitmaps + wxBitmap bmp = GetBitmap(bmpParam, wxART_OTHER); + + // create the image list on demand for the first bitmap + wxImageList *imgList = listctrl->GetImageList(which); + if ( !imgList ) + { + imgList = new wxImageList( bmp.GetWidth(), bmp.GetHeight() ); + listctrl->AssignImageList( imgList, which ); + } + + imgIndex = imgList->Add(bmp); + } + + if ( HasParam(imgParam) ) + { + if ( imgIndex != wxNOT_FOUND ) + { + // TODO: we should really check that only bitmap or only image tags + // are used across all items of the control, not just in this + // one + ReportError(wxString::Format( + "listitem %s attribute ignored because %s is also specified", + bmpParam, imgParam)); + } + + // just use the specified index directly + imgIndex = GetLong(imgParam); + } + + return imgIndex; +} + +#endif // wxUSE_XRC && wxUSE_LISTCTRL diff --git a/Source/3rd Party/wx/src/xrc/xh_mdi.cpp b/Source/3rd Party/wx/src/xrc/xh_mdi.cpp new file mode 100644 index 000000000..021934231 --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_mdi.cpp @@ -0,0 +1,138 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_mdi.cpp +// Purpose: XRC resource for wxMDI +// Author: David M. Falkinder & Vaclav Slavik +// Created: 14/02/2005 +// Copyright: (c) 2005 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_MDI + +#include "wx/xrc/xh_mdi.h" +#include "wx/mdi.h" + +#ifndef WX_PRECOMP + #include "wx/intl.h" + #include "wx/log.h" + #include "wx/dialog.h" // to get wxDEFAULT_DIALOG_STYLE +#endif + +IMPLEMENT_DYNAMIC_CLASS(wxMdiXmlHandler, wxXmlResourceHandler) + +wxMdiXmlHandler::wxMdiXmlHandler() : wxXmlResourceHandler() +{ + XRC_ADD_STYLE(wxSTAY_ON_TOP); + XRC_ADD_STYLE(wxCAPTION); + XRC_ADD_STYLE(wxDEFAULT_DIALOG_STYLE); + XRC_ADD_STYLE(wxDEFAULT_FRAME_STYLE); +#if WXWIN_COMPATIBILITY_2_6 + XRC_ADD_STYLE(wxTHICK_FRAME); +#endif // WXWIN_COMPATIBILITY_2_6 + XRC_ADD_STYLE(wxSYSTEM_MENU); + XRC_ADD_STYLE(wxRESIZE_BORDER); +#if WXWIN_COMPATIBILITY_2_6 + XRC_ADD_STYLE(wxRESIZE_BOX); +#endif // WXWIN_COMPATIBILITY_2_6 + XRC_ADD_STYLE(wxCLOSE_BOX); + + XRC_ADD_STYLE(wxFRAME_NO_TASKBAR); + XRC_ADD_STYLE(wxFRAME_SHAPED); + XRC_ADD_STYLE(wxFRAME_TOOL_WINDOW); + XRC_ADD_STYLE(wxFRAME_FLOAT_ON_PARENT); + XRC_ADD_STYLE(wxMAXIMIZE_BOX); + XRC_ADD_STYLE(wxMINIMIZE_BOX); + XRC_ADD_STYLE(wxSTAY_ON_TOP); + +#if WXWIN_COMPATIBILITY_2_6 + XRC_ADD_STYLE(wxNO_3D); +#endif // WXWIN_COMPATIBILITY_2_6 + XRC_ADD_STYLE(wxTAB_TRAVERSAL); + XRC_ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY); + XRC_ADD_STYLE(wxFRAME_EX_METAL); + + XRC_ADD_STYLE(wxHSCROLL); + XRC_ADD_STYLE(wxVSCROLL); + XRC_ADD_STYLE(wxMAXIMIZE); + XRC_ADD_STYLE(wxFRAME_NO_WINDOW_MENU); + + AddWindowStyles(); +} + +wxWindow *wxMdiXmlHandler::CreateFrame() +{ + if (m_class == wxT("wxMDIParentFrame")) + { + XRC_MAKE_INSTANCE(frame, wxMDIParentFrame); + + frame->Create(m_parentAsWindow, + GetID(), + GetText(wxT("title")), + wxDefaultPosition, wxDefaultSize, + GetStyle(wxT("style"), + wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL), + GetName()); + return frame; + } + else // wxMDIChildFrame + { + wxMDIParentFrame *mdiParent = wxDynamicCast(m_parent, wxMDIParentFrame); + + if ( !mdiParent ) + { + ReportError("parent of wxMDIChildFrame must be wxMDIParentFrame"); + return NULL; + } + + XRC_MAKE_INSTANCE(frame, wxMDIChildFrame); + + frame->Create(mdiParent, + GetID(), + GetText(wxT("title")), + wxDefaultPosition, wxDefaultSize, + GetStyle(wxT("style"), wxDEFAULT_FRAME_STYLE), + GetName()); + + return frame; + } +} + +wxObject *wxMdiXmlHandler::DoCreateResource() +{ + wxWindow *frame = CreateFrame(); + + if (HasParam(wxT("size"))) + frame->SetClientSize(GetSize()); + if (HasParam(wxT("pos"))) + frame->Move(GetPosition()); + if (HasParam(wxT("icon"))) + { + wxFrame* f = wxDynamicCast(frame, wxFrame); + if (f) + f->SetIcons(GetIconBundle(wxT("icon"), wxART_FRAME_ICON)); + } + + SetupWindow(frame); + + CreateChildren(frame); + + if (GetBool(wxT("centered"), false)) + frame->Centre(); + + return frame; +} + +bool wxMdiXmlHandler::CanHandle(wxXmlNode *node) +{ + return (IsOfClass(node, wxT("wxMDIParentFrame")) || + IsOfClass(node, wxT("wxMDIChildFrame"))); +} + +#endif // wxUSE_XRC && wxUSE_MDI diff --git a/Source/3rd Party/wx/src/xrc/xh_menu.cpp b/Source/3rd Party/wx/src/xrc/xh_menu.cpp new file mode 100644 index 000000000..0865063dc --- /dev/null +++ b/Source/3rd Party/wx/src/xrc/xh_menu.cpp @@ -0,0 +1,180 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/xrc/xh_menu.cpp +// Purpose: XRC resource for menus and menubars +// Author: Vaclav Slavik +// Created: 2000/03/05 +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_XRC && wxUSE_MENUS + +#include "wx/xrc/xh_menu.h" + +#ifndef WX_PRECOMP + #include "wx/frame.h" + #include "wx/log.h" + #include "wx/menu.h" +#endif + +IMPLEMENT_DYNAMIC_CLASS(wxMenuXmlHandler, wxXmlResourceHandler) + +wxMenuXmlHandler::wxMenuXmlHandler() : + wxXmlResourceHandler(), m_insideMenu(false) +{ + XRC_ADD_STYLE(wxMENU_TEAROFF); +} + +wxObject *wxMenuXmlHandler::DoCreateResource() +{ + if (m_class == wxT("wxMenu")) + { + wxMenu *menu = m_instance ? wxStaticCast(m_instance, wxMenu) + : new wxMenu(GetStyle()); + + wxString title = GetText(wxT("label")); + wxString help = GetText(wxT("help")); + + bool oldins = m_insideMenu; + m_insideMenu = true; + CreateChildren(menu, true/*only this handler*/); + m_insideMenu = oldins; + + wxMenuBar *p_bar = wxDynamicCast(m_parent, wxMenuBar); + if (p_bar) + { + p_bar->Append(menu, title); + } + else + { + wxMenu *p_menu = wxDynamicCast(m_parent, wxMenu); + if (p_menu) + { + p_menu->Append(GetID(), title, menu, help); + if (HasParam(wxT("enabled"))) + p_menu->Enable(GetID(), GetBool(wxT("enabled"))); + } + } + + return menu; + } + + else + { + wxMenu *p_menu = wxDynamicCast(m_parent, wxMenu); + + if (m_class == wxT("separator")) + p_menu->AppendSeparator(); + else if (m_class == wxT("break")) + p_menu->Break(); + else /*wxMenuItem*/ + { + int id = GetID(); + wxString label = GetText(wxT("label")); + wxString accel = GetText(wxT("accel"), false); + wxString fullLabel = label; + if (!accel.empty()) + fullLabel << wxT("\t") << accel; + + wxItemKind kind = wxITEM_NORMAL; + if (GetBool(wxT("radio"))) + kind = wxITEM_RADIO; + if (GetBool(wxT("checkable"))) + { + if ( kind != wxITEM_NORMAL ) + { + ReportParamError + ( + "checkable", + "menu item can't have both and properties" + ); + } + + kind = wxITEM_CHECK; + } + + wxMenuItem *mitem = new wxMenuItem(p_menu, id, fullLabel, + GetText(wxT("help")), kind); + +#if (!defined(__WXMSW__) && !defined(__WXPM__)) || wxUSE_OWNER_DRAWN + if (HasParam(wxT("bitmap"))) + { + // currently only wxMSW has support for using different checked + // and unchecked bitmaps for menu items +#ifdef __WXMSW__ + if (HasParam(wxT("bitmap2"))) + mitem->SetBitmaps(GetBitmap(wxT("bitmap2"), wxART_MENU), + GetBitmap(wxT("bitmap"), wxART_MENU)); + else +#endif // __WXMSW__ + mitem->SetBitmap(GetBitmap(wxT("bitmap"), wxART_MENU)); + } +#endif + p_menu->Append(mitem); + mitem->Enable(GetBool(wxT("enabled"), true)); + if (kind == wxITEM_CHECK) + mitem->Check(GetBool(wxT("checked"))); + } + return NULL; + } +} + + + +bool wxMenuXmlHandler::CanHandle(wxXmlNode *node) +{ + return IsOfClass(node, wxT("wxMenu")) || + (m_insideMenu && + (IsOfClass(node, wxT("wxMenuItem")) || + IsOfClass(node, wxT("break")) || + IsOfClass(node, wxT("separator"))) + ); +} + +IMPLEMENT_DYNAMIC_CLASS(wxMenuBarXmlHandler, wxXmlResourceHandler) + +wxMenuBarXmlHandler::wxMenuBarXmlHandler() : wxXmlResourceHandler() +{ + XRC_ADD_STYLE(wxMB_DOCKABLE); +} + +wxObject *wxMenuBarXmlHandler::DoCreateResource() +{ + wxMenuBar *menubar = NULL; + + const int style = GetStyle(); + wxASSERT_MSG(!style || !m_instance, + "cannot use