From 995c1788f537c773b476ca078b220fbc126ebc12 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Wed, 23 Jan 2002 00:15:13 +0000 Subject: [PATCH] added wxGenericDirCtrl handler to XRC git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13759 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- contrib/include/wx/xrc/xh_all.h | 1 + contrib/include/wx/xrc/xh_gdctl.h | 32 ++++++++++ contrib/src/xrc/Makefile.in | 4 +- contrib/src/xrc/makefile.b32 | 2 +- contrib/src/xrc/makefile.g95 | 2 +- contrib/src/xrc/xh_gdctl.cpp | 62 +++++++++++++++++++ contrib/src/xrc/xmlrsall.cpp | 8 +-- contrib/utils/wxrcedit/df/wxGenericDirCtrl.df | 6 ++ include/wx/xrc/xh_all.h | 1 + include/wx/xrc/xh_gdctl.h | 32 ++++++++++ src/xrc/Makefile.in | 4 +- src/xrc/makefile.b32 | 2 +- src/xrc/makefile.g95 | 2 +- src/xrc/xh_gdctl.cpp | 62 +++++++++++++++++++ src/xrc/xmlrsall.cpp | 8 +-- 15 files changed, 210 insertions(+), 18 deletions(-) create mode 100644 contrib/include/wx/xrc/xh_gdctl.h create mode 100644 contrib/src/xrc/xh_gdctl.cpp create mode 100644 contrib/utils/wxrcedit/df/wxGenericDirCtrl.df create mode 100644 include/wx/xrc/xh_gdctl.h create mode 100644 src/xrc/xh_gdctl.cpp diff --git a/contrib/include/wx/xrc/xh_all.h b/contrib/include/wx/xrc/xh_all.h index 3abb40c2c6..5382b6ffb0 100644 --- a/contrib/include/wx/xrc/xh_all.h +++ b/contrib/include/wx/xrc/xh_all.h @@ -44,6 +44,7 @@ #include "wx/xrc/xh_stlin.h" #include "wx/xrc/xh_bmp.h" #include "wx/xrc/xh_unkwn.h" +#include "wx/xrc/xh_gdctl.h" #include "wx/xrc/xh_frame.h" #endif // _WX_XMLRES_H_ diff --git a/contrib/include/wx/xrc/xh_gdctl.h b/contrib/include/wx/xrc/xh_gdctl.h new file mode 100644 index 0000000000..548ecaf616 --- /dev/null +++ b/contrib/include/wx/xrc/xh_gdctl.h @@ -0,0 +1,32 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: xh_gdctl.h +// Purpose: XML resource handler for wxGenericDirCtrl +// Author: Markus Greither +// Created: 2002/01/20 +// RCS-ID: $Id$ +// Copyright: (c) 2002 Markus Greither +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_GDCTL_H_ +#define _WX_XH_GDCTL_H_ + +#ifdef __GNUG__ +#pragma interface "xh_gdctl.h" +#endif + +#include "wx/xrc/xmlres.h" + +#if wxUSE_DIRDLG + +class WXXMLDLLEXPORT wxGenericDirCtrlXmlHandler : public wxXmlResourceHandler +{ +public: + wxGenericDirCtrlXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif + +#endif // _WX_XH_GDCTL_H_ diff --git a/contrib/src/xrc/Makefile.in b/contrib/src/xrc/Makefile.in index 4f92c3d6ce..729c6f1574 100644 --- a/contrib/src/xrc/Makefile.in +++ b/contrib/src/xrc/Makefile.in @@ -24,7 +24,7 @@ HEADERS=xh_all.h xh_bttn.h xh_chckb.h xh_chckl.h xh_choic.h xh_combo.h \ xh_radbt.h xh_radbx.h xh_sizer.h xh_slidr.h xh_spin.h xh_stbmp.h \ xh_sttxt.h xh_text.h xh_listb.h xml.h xmlio.h xmlres.h xh_toolb.h \ xh_bmpbt.h xh_cald.h xh_listc.h xh_scrol.h xh_stbox.h xh_tree.h \ - xh_stlin.h xh_bmp.h xh_unkwn.h xh_frame.h + xh_stlin.h xh_bmp.h xh_unkwn.h xh_frame.h xh_gdctl.h OBJECTS=$(EXPAT_OBJECTS) \ xml.o xmlbin.o xmlbinz.o xmlexpat.o xmlwrite.o xmlres.o xmlrsall.o \ @@ -33,7 +33,7 @@ OBJECTS=$(EXPAT_OBJECTS) \ xh_radbx.o xh_sizer.o xh_slidr.o xh_spin.o xh_stbmp.o xh_sttxt.o \ xh_text.o xh_listb.o xh_toolb.o xh_stlin.o xh_bmp.o xh_unkwn.o \ xh_bmpbt.o xh_cald.o xh_listc.o xh_scrol.o xh_stbox.o xh_tree.o \ - xh_frame.o + xh_frame.o xh_gdctl.o DEPFILES=$(OBJECTS:.o=.d) APPEXTRADEFS=-I$(top_srcdir)/contrib/include $(EXPAT_DEFS) diff --git a/contrib/src/xrc/makefile.b32 b/contrib/src/xrc/makefile.b32 index 258e43c368..ba854f74e6 100644 --- a/contrib/src/xrc/makefile.b32 +++ b/contrib/src/xrc/makefile.b32 @@ -27,7 +27,7 @@ OBJECTS=$(EXPAT_OBJECTS) \ xh_radbx.obj xh_sizer.obj xh_slidr.obj xh_spin.obj xh_stbmp.obj xh_sttxt.obj \ xh_text.obj xh_listb.obj xh_toolb.obj xh_stlin.obj xh_bmp.obj \ xh_bmpbt.obj xh_cald.obj xh_listc.obj xh_scrol.obj xh_stbox.obj \ - xh_tree.obj xh_unkwn.obj xh_frame.obj + xh_tree.obj xh_unkwn.obj xh_frame.obj xh_gdctl.obj !include $(WXDIR)\src\makelib.b32 diff --git a/contrib/src/xrc/makefile.g95 b/contrib/src/xrc/makefile.g95 index 3a11d890ec..2fb8b309a5 100644 --- a/contrib/src/xrc/makefile.g95 +++ b/contrib/src/xrc/makefile.g95 @@ -28,7 +28,7 @@ OBJECTS= $(XMLPARSEDIR_OBJECTS) $(XMLTOKDIR_OBJECTS) \ xh_radbx.o xh_sizer.o xh_slidr.o xh_spin.o xh_stbmp.o xh_sttxt.o \ xh_text.o xh_listb.o xh_toolb.o xh_stlin.o xh_bmp.o xh_unkwn.o \ xh_bmpbt.o xh_cald.o xh_listc.o xh_scrol.o xh_stbox.o xh_tree.o \ - xh_frame.o + xh_frame.o xh_gdctl.o include $(WXDIR)/src/makelib.g95 diff --git a/contrib/src/xrc/xh_gdctl.cpp b/contrib/src/xrc/xh_gdctl.cpp new file mode 100644 index 0000000000..9252d60f91 --- /dev/null +++ b/contrib/src/xrc/xh_gdctl.cpp @@ -0,0 +1,62 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: xh_gdctl.cpp +// Purpose: XRC resource for wxGenericDirCtrl +// Author: Markus Greither +// Created: 2002/01/20 +// RCS-ID: +// Copyright: (c) 2002 Markus Greither +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "xh_gdctl.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#include "wx/defs.h" +#if wxUSE_DIRDLG + +#include "wx/textctrl.h" +#include "wx/xrc/xh_gdctl.h" +#include "wx/dirctrl.h" + +wxGenericDirCtrlXmlHandler::wxGenericDirCtrlXmlHandler() +: wxXmlResourceHandler() +{ + ADD_STYLE(wxDIRCTRL_DIR_ONLY); + ADD_STYLE(wxDIRCTRL_3D_INTERNAL); + ADD_STYLE(wxDIRCTRL_SELECT_FIRST); + ADD_STYLE(wxDIRCTRL_SHOW_FILTERS); + 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 diff --git a/contrib/src/xrc/xmlrsall.cpp b/contrib/src/xrc/xmlrsall.cpp index 29deb1c4ca..2e956f6ee8 100644 --- a/contrib/src/xrc/xmlrsall.cpp +++ b/contrib/src/xrc/xmlrsall.cpp @@ -29,12 +29,9 @@ void wxXmlResource::InitAllHandlers() AddHandler(new wxIconXmlHandler); AddHandler(new wxMenuXmlHandler); AddHandler(new wxMenuBarXmlHandler); - AddHandler(new wxDialogXmlHandler); AddHandler(new wxPanelXmlHandler); - AddHandler(new wxSizerXmlHandler); -//Controls AddHandler(new wxButtonXmlHandler); AddHandler(new wxBitmapButtonXmlHandler); AddHandler(new wxStaticTextXmlHandler); @@ -70,7 +67,6 @@ void wxXmlResource::InitAllHandlers() #if wxUSE_SCROLLBAR AddHandler(new wxScrollBarXmlHandler); #endif - #if wxUSE_RADIOBOX AddHandler(new wxRadioBoxXmlHandler); AddHandler(new wxRadioButtonXmlHandler); @@ -92,6 +88,8 @@ void wxXmlResource::InitAllHandlers() AddHandler(new wxStaticLineXmlHandler); #endif AddHandler(new wxUnknownWidgetXmlHandler); - +#if wxUSE_DIRDLG + AddHandler(new wxGenericDirCtrlXmlHandler); +#endif AddHandler(new wxFrameXmlHandler); } diff --git a/contrib/utils/wxrcedit/df/wxGenericDirCtrl.df b/contrib/utils/wxrcedit/df/wxGenericDirCtrl.df new file mode 100644 index 0000000000..4def31014b --- /dev/null +++ b/contrib/utils/wxrcedit/df/wxGenericDirCtrl.df @@ -0,0 +1,6 @@ +node wxGenericDirCtrl +var defaultfolder of text +var filter of text +var defaultfilter of integer +var style of flags wxDIRCTRL_DIR_ONLY,wxDIRCTRL_3D_INTERNAL,wxDIRCTRL_SELECT_FIRST,wxDIRCTRL_SHOW_FILTERS +derived from control diff --git a/include/wx/xrc/xh_all.h b/include/wx/xrc/xh_all.h index 3abb40c2c6..5382b6ffb0 100644 --- a/include/wx/xrc/xh_all.h +++ b/include/wx/xrc/xh_all.h @@ -44,6 +44,7 @@ #include "wx/xrc/xh_stlin.h" #include "wx/xrc/xh_bmp.h" #include "wx/xrc/xh_unkwn.h" +#include "wx/xrc/xh_gdctl.h" #include "wx/xrc/xh_frame.h" #endif // _WX_XMLRES_H_ diff --git a/include/wx/xrc/xh_gdctl.h b/include/wx/xrc/xh_gdctl.h new file mode 100644 index 0000000000..548ecaf616 --- /dev/null +++ b/include/wx/xrc/xh_gdctl.h @@ -0,0 +1,32 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: xh_gdctl.h +// Purpose: XML resource handler for wxGenericDirCtrl +// Author: Markus Greither +// Created: 2002/01/20 +// RCS-ID: $Id$ +// Copyright: (c) 2002 Markus Greither +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_XH_GDCTL_H_ +#define _WX_XH_GDCTL_H_ + +#ifdef __GNUG__ +#pragma interface "xh_gdctl.h" +#endif + +#include "wx/xrc/xmlres.h" + +#if wxUSE_DIRDLG + +class WXXMLDLLEXPORT wxGenericDirCtrlXmlHandler : public wxXmlResourceHandler +{ +public: + wxGenericDirCtrlXmlHandler(); + virtual wxObject *DoCreateResource(); + virtual bool CanHandle(wxXmlNode *node); +}; + +#endif + +#endif // _WX_XH_GDCTL_H_ diff --git a/src/xrc/Makefile.in b/src/xrc/Makefile.in index 4f92c3d6ce..729c6f1574 100644 --- a/src/xrc/Makefile.in +++ b/src/xrc/Makefile.in @@ -24,7 +24,7 @@ HEADERS=xh_all.h xh_bttn.h xh_chckb.h xh_chckl.h xh_choic.h xh_combo.h \ xh_radbt.h xh_radbx.h xh_sizer.h xh_slidr.h xh_spin.h xh_stbmp.h \ xh_sttxt.h xh_text.h xh_listb.h xml.h xmlio.h xmlres.h xh_toolb.h \ xh_bmpbt.h xh_cald.h xh_listc.h xh_scrol.h xh_stbox.h xh_tree.h \ - xh_stlin.h xh_bmp.h xh_unkwn.h xh_frame.h + xh_stlin.h xh_bmp.h xh_unkwn.h xh_frame.h xh_gdctl.h OBJECTS=$(EXPAT_OBJECTS) \ xml.o xmlbin.o xmlbinz.o xmlexpat.o xmlwrite.o xmlres.o xmlrsall.o \ @@ -33,7 +33,7 @@ OBJECTS=$(EXPAT_OBJECTS) \ xh_radbx.o xh_sizer.o xh_slidr.o xh_spin.o xh_stbmp.o xh_sttxt.o \ xh_text.o xh_listb.o xh_toolb.o xh_stlin.o xh_bmp.o xh_unkwn.o \ xh_bmpbt.o xh_cald.o xh_listc.o xh_scrol.o xh_stbox.o xh_tree.o \ - xh_frame.o + xh_frame.o xh_gdctl.o DEPFILES=$(OBJECTS:.o=.d) APPEXTRADEFS=-I$(top_srcdir)/contrib/include $(EXPAT_DEFS) diff --git a/src/xrc/makefile.b32 b/src/xrc/makefile.b32 index 258e43c368..ba854f74e6 100644 --- a/src/xrc/makefile.b32 +++ b/src/xrc/makefile.b32 @@ -27,7 +27,7 @@ OBJECTS=$(EXPAT_OBJECTS) \ xh_radbx.obj xh_sizer.obj xh_slidr.obj xh_spin.obj xh_stbmp.obj xh_sttxt.obj \ xh_text.obj xh_listb.obj xh_toolb.obj xh_stlin.obj xh_bmp.obj \ xh_bmpbt.obj xh_cald.obj xh_listc.obj xh_scrol.obj xh_stbox.obj \ - xh_tree.obj xh_unkwn.obj xh_frame.obj + xh_tree.obj xh_unkwn.obj xh_frame.obj xh_gdctl.obj !include $(WXDIR)\src\makelib.b32 diff --git a/src/xrc/makefile.g95 b/src/xrc/makefile.g95 index 3a11d890ec..2fb8b309a5 100644 --- a/src/xrc/makefile.g95 +++ b/src/xrc/makefile.g95 @@ -28,7 +28,7 @@ OBJECTS= $(XMLPARSEDIR_OBJECTS) $(XMLTOKDIR_OBJECTS) \ xh_radbx.o xh_sizer.o xh_slidr.o xh_spin.o xh_stbmp.o xh_sttxt.o \ xh_text.o xh_listb.o xh_toolb.o xh_stlin.o xh_bmp.o xh_unkwn.o \ xh_bmpbt.o xh_cald.o xh_listc.o xh_scrol.o xh_stbox.o xh_tree.o \ - xh_frame.o + xh_frame.o xh_gdctl.o include $(WXDIR)/src/makelib.g95 diff --git a/src/xrc/xh_gdctl.cpp b/src/xrc/xh_gdctl.cpp new file mode 100644 index 0000000000..9252d60f91 --- /dev/null +++ b/src/xrc/xh_gdctl.cpp @@ -0,0 +1,62 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: xh_gdctl.cpp +// Purpose: XRC resource for wxGenericDirCtrl +// Author: Markus Greither +// Created: 2002/01/20 +// RCS-ID: +// Copyright: (c) 2002 Markus Greither +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "xh_gdctl.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#include "wx/defs.h" +#if wxUSE_DIRDLG + +#include "wx/textctrl.h" +#include "wx/xrc/xh_gdctl.h" +#include "wx/dirctrl.h" + +wxGenericDirCtrlXmlHandler::wxGenericDirCtrlXmlHandler() +: wxXmlResourceHandler() +{ + ADD_STYLE(wxDIRCTRL_DIR_ONLY); + ADD_STYLE(wxDIRCTRL_3D_INTERNAL); + ADD_STYLE(wxDIRCTRL_SELECT_FIRST); + ADD_STYLE(wxDIRCTRL_SHOW_FILTERS); + 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 diff --git a/src/xrc/xmlrsall.cpp b/src/xrc/xmlrsall.cpp index 29deb1c4ca..2e956f6ee8 100644 --- a/src/xrc/xmlrsall.cpp +++ b/src/xrc/xmlrsall.cpp @@ -29,12 +29,9 @@ void wxXmlResource::InitAllHandlers() AddHandler(new wxIconXmlHandler); AddHandler(new wxMenuXmlHandler); AddHandler(new wxMenuBarXmlHandler); - AddHandler(new wxDialogXmlHandler); AddHandler(new wxPanelXmlHandler); - AddHandler(new wxSizerXmlHandler); -//Controls AddHandler(new wxButtonXmlHandler); AddHandler(new wxBitmapButtonXmlHandler); AddHandler(new wxStaticTextXmlHandler); @@ -70,7 +67,6 @@ void wxXmlResource::InitAllHandlers() #if wxUSE_SCROLLBAR AddHandler(new wxScrollBarXmlHandler); #endif - #if wxUSE_RADIOBOX AddHandler(new wxRadioBoxXmlHandler); AddHandler(new wxRadioButtonXmlHandler); @@ -92,6 +88,8 @@ void wxXmlResource::InitAllHandlers() AddHandler(new wxStaticLineXmlHandler); #endif AddHandler(new wxUnknownWidgetXmlHandler); - +#if wxUSE_DIRDLG + AddHandler(new wxGenericDirCtrlXmlHandler); +#endif AddHandler(new wxFrameXmlHandler); } -- 2.45.2