Added generic LoadObject methods that can load any classtype from a

resources and return it as a wxObject (Assuming there is a handler for
it.)

Enabled wxFrames and wxDialogs to be loaded using a new instance
rather than only with existing instances.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16720 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2002-08-24 02:26:13 +00:00
parent cdb105516c
commit 92e898b0b4
8 changed files with 120 additions and 52 deletions

View File

@@ -7,7 +7,7 @@
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_frame.h"
#endif
@@ -51,11 +51,9 @@ wxFrameXmlHandler::wxFrameXmlHandler() : wxXmlResourceHandler()
}
wxObject *wxFrameXmlHandler::DoCreateResource()
{
wxFrame *frame = wxDynamicCast(m_instance, wxFrame);
wxASSERT_MSG(frame, _("XRC resource: Cannot create dialog without instance."));
{
XRC_MAKE_INSTANCE(frame, wxFrame);
frame->Create(m_parentAsWindow,
GetID(),
GetText(wxT("title")),
@@ -71,10 +69,10 @@ wxObject *wxFrameXmlHandler::DoCreateResource()
SetupWindow(frame);
CreateChildren(frame);
if (GetBool(wxT("centered"), FALSE))
frame->Centre();
return frame;
}