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:
@@ -111,7 +111,7 @@ public:
|
|||||||
|
|
||||||
// Destructor.
|
// Destructor.
|
||||||
~wxXmlResource();
|
~wxXmlResource();
|
||||||
|
|
||||||
// Loads resources from XML files that match given filemask.
|
// Loads resources from XML files that match given filemask.
|
||||||
// This method understands VFS (see filesys.h).
|
// This method understands VFS (see filesys.h).
|
||||||
bool Load(const wxString& filemask);
|
bool Load(const wxString& filemask);
|
||||||
@@ -128,6 +128,9 @@ public:
|
|||||||
// all controls used within the resource.
|
// all controls used within the resource.
|
||||||
void AddHandler(wxXmlResourceHandler *handler);
|
void AddHandler(wxXmlResourceHandler *handler);
|
||||||
|
|
||||||
|
// Add a new handler at the begining of the handler list
|
||||||
|
void InsertHandler(wxXmlResourceHandler *handler);
|
||||||
|
|
||||||
// Removes all handlers
|
// Removes all handlers
|
||||||
void ClearHandlers();
|
void ClearHandlers();
|
||||||
|
|
||||||
@@ -165,8 +168,20 @@ public:
|
|||||||
bool LoadPanel(wxPanel *panel, wxWindow *parent, const wxString& name);
|
bool LoadPanel(wxPanel *panel, wxWindow *parent, const wxString& name);
|
||||||
|
|
||||||
// Loads a frame.
|
// Loads a frame.
|
||||||
|
wxFrame *LoadFrame(wxWindow* parent, const wxString& name);
|
||||||
bool LoadFrame(wxFrame* frame, wxWindow *parent, const wxString& name);
|
bool LoadFrame(wxFrame* frame, wxWindow *parent, const wxString& name);
|
||||||
|
|
||||||
|
// Load an object from the resource specifying both the resource name and
|
||||||
|
// the classname. This lets you load nonstandard container windows.
|
||||||
|
wxObject *LoadObject(wxWindow *parent, const wxString& name,
|
||||||
|
const wxString& classname);
|
||||||
|
|
||||||
|
// Load an object from the resource specifying both the resource name and
|
||||||
|
// the classname. This form lets you finish the creation of an existing
|
||||||
|
// instance.
|
||||||
|
bool LoadObject(wxObject *instance, wxWindow *parent, const wxString& name,
|
||||||
|
const wxString& classname);
|
||||||
|
|
||||||
// Loads a bitmap resource from a file.
|
// Loads a bitmap resource from a file.
|
||||||
wxBitmap LoadBitmap(const wxString& name);
|
wxBitmap LoadBitmap(const wxString& name);
|
||||||
|
|
||||||
@@ -191,9 +206,9 @@ public:
|
|||||||
int CompareVersion(int major, int minor, int release, int revision) const
|
int CompareVersion(int major, int minor, int release, int revision) const
|
||||||
{ return GetVersion() -
|
{ return GetVersion() -
|
||||||
(major*256*256*256 + minor*256*256 + release*256 + revision); }
|
(major*256*256*256 + minor*256*256 + release*256 + revision); }
|
||||||
|
|
||||||
//// Singleton accessors.
|
//// Singleton accessors.
|
||||||
|
|
||||||
// Gets the global resources object or creates one if none exists.
|
// Gets the global resources object or creates one if none exists.
|
||||||
static wxXmlResource *Get();
|
static wxXmlResource *Get();
|
||||||
|
|
||||||
@@ -229,7 +244,7 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
friend class wxXmlResourceHandler;
|
friend class wxXmlResourceHandler;
|
||||||
|
|
||||||
// singleton instance:
|
// singleton instance:
|
||||||
static wxXmlResource *ms_instance;
|
static wxXmlResource *ms_instance;
|
||||||
};
|
};
|
||||||
@@ -423,7 +438,7 @@ protected:
|
|||||||
void wxXmlInitResourceModule();
|
void wxXmlInitResourceModule();
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------
|
/* -------------------------------------------------------------------------
|
||||||
Backward compatibility macros. Do *NOT* use, they may disappear in future
|
Backward compatibility macros. Do *NOT* use, they may disappear in future
|
||||||
versions of the XRC library!
|
versions of the XRC library!
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
// Copyright: (c) 2000 Vaclav Slavik
|
// Copyright: (c) 2000 Vaclav Slavik
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation "xh_dlg.h"
|
#pragma implementation "xh_dlg.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -46,11 +46,9 @@ wxDialogXmlHandler::wxDialogXmlHandler() : wxXmlResourceHandler()
|
|||||||
}
|
}
|
||||||
|
|
||||||
wxObject *wxDialogXmlHandler::DoCreateResource()
|
wxObject *wxDialogXmlHandler::DoCreateResource()
|
||||||
{
|
{
|
||||||
wxDialog *dlg = wxDynamicCast(m_instance, wxDialog);
|
XRC_MAKE_INSTANCE(dlg, wxDialog);
|
||||||
|
|
||||||
wxASSERT_MSG(dlg, _("XRC resource: Cannot create dialog without instance."));
|
|
||||||
|
|
||||||
dlg->Create(m_parentAsWindow,
|
dlg->Create(m_parentAsWindow,
|
||||||
GetID(),
|
GetID(),
|
||||||
GetText(wxT("title")),
|
GetText(wxT("title")),
|
||||||
@@ -66,10 +64,10 @@ wxObject *wxDialogXmlHandler::DoCreateResource()
|
|||||||
SetupWindow(dlg);
|
SetupWindow(dlg);
|
||||||
|
|
||||||
CreateChildren(dlg);
|
CreateChildren(dlg);
|
||||||
|
|
||||||
if (GetBool(wxT("centered"), FALSE))
|
if (GetBool(wxT("centered"), FALSE))
|
||||||
dlg->Centre();
|
dlg->Centre();
|
||||||
|
|
||||||
return dlg;
|
return dlg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
// Copyright: (c) 2000 Vaclav Slavik
|
// Copyright: (c) 2000 Vaclav Slavik
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation "xh_frame.h"
|
#pragma implementation "xh_frame.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -51,11 +51,9 @@ wxFrameXmlHandler::wxFrameXmlHandler() : wxXmlResourceHandler()
|
|||||||
}
|
}
|
||||||
|
|
||||||
wxObject *wxFrameXmlHandler::DoCreateResource()
|
wxObject *wxFrameXmlHandler::DoCreateResource()
|
||||||
{
|
{
|
||||||
wxFrame *frame = wxDynamicCast(m_instance, wxFrame);
|
XRC_MAKE_INSTANCE(frame, wxFrame);
|
||||||
|
|
||||||
wxASSERT_MSG(frame, _("XRC resource: Cannot create dialog without instance."));
|
|
||||||
|
|
||||||
frame->Create(m_parentAsWindow,
|
frame->Create(m_parentAsWindow,
|
||||||
GetID(),
|
GetID(),
|
||||||
GetText(wxT("title")),
|
GetText(wxT("title")),
|
||||||
@@ -71,10 +69,10 @@ wxObject *wxFrameXmlHandler::DoCreateResource()
|
|||||||
SetupWindow(frame);
|
SetupWindow(frame);
|
||||||
|
|
||||||
CreateChildren(frame);
|
CreateChildren(frame);
|
||||||
|
|
||||||
if (GetBool(wxT("centered"), FALSE))
|
if (GetBool(wxT("centered"), FALSE))
|
||||||
frame->Centre();
|
frame->Centre();
|
||||||
|
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -132,6 +132,12 @@ void wxXmlResource::AddHandler(wxXmlResourceHandler *handler)
|
|||||||
handler->SetParentResource(this);
|
handler->SetParentResource(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxXmlResource::InsertHandler(wxXmlResourceHandler *handler)
|
||||||
|
{
|
||||||
|
m_handlers.Insert(handler);
|
||||||
|
handler->SetParentResource(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void wxXmlResource::ClearHandlers()
|
void wxXmlResource::ClearHandlers()
|
||||||
@@ -188,6 +194,11 @@ bool wxXmlResource::LoadPanel(wxPanel *panel, wxWindow *parent, const wxString&
|
|||||||
return CreateResFromNode(FindResource(name, wxT("wxPanel")), parent, panel) != NULL;
|
return CreateResFromNode(FindResource(name, wxT("wxPanel")), parent, panel) != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxFrame *wxXmlResource::LoadFrame(wxWindow* parent, const wxString& name)
|
||||||
|
{
|
||||||
|
return (wxFrame*)CreateResFromNode(FindResource(name, wxT("wxFrame")), parent, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
bool wxXmlResource::LoadFrame(wxFrame* frame, wxWindow *parent, const wxString& name)
|
bool wxXmlResource::LoadFrame(wxFrame* frame, wxWindow *parent, const wxString& name)
|
||||||
{
|
{
|
||||||
return CreateResFromNode(FindResource(name, wxT("wxFrame")), parent, frame) != NULL;
|
return CreateResFromNode(FindResource(name, wxT("wxFrame")), parent, frame) != NULL;
|
||||||
@@ -213,6 +224,18 @@ wxIcon wxXmlResource::LoadIcon(const wxString& name)
|
|||||||
return rt;
|
return rt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxObject *wxXmlResource::LoadObject(wxWindow *parent, const wxString& name, const wxString& classname)
|
||||||
|
{
|
||||||
|
return CreateResFromNode(FindResource(name, classname), parent, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxXmlResource::LoadObject(wxObject *instance, wxWindow *parent, const wxString& name, const wxString& classname)
|
||||||
|
{
|
||||||
|
return CreateResFromNode(FindResource(name, classname), parent, instance) != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool wxXmlResource::AttachUnknownControl(const wxString& name,
|
bool wxXmlResource::AttachUnknownControl(const wxString& name,
|
||||||
wxWindow *control, wxWindow *parent)
|
wxWindow *control, wxWindow *parent)
|
||||||
{
|
{
|
||||||
@@ -756,7 +779,7 @@ wxColour wxXmlResourceHandler::GetColour(const wxString& param)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
wxBitmap wxXmlResourceHandler::GetBitmap(const wxString& param,
|
wxBitmap wxXmlResourceHandler::GetBitmap(const wxString& param,
|
||||||
const wxArtClient& defaultArtClient,
|
const wxArtClient& defaultArtClient,
|
||||||
wxSize size)
|
wxSize size)
|
||||||
{
|
{
|
||||||
@@ -768,7 +791,7 @@ wxBitmap wxXmlResourceHandler::GetBitmap(const wxString& param,
|
|||||||
if ( !sid.empty() )
|
if ( !sid.empty() )
|
||||||
{
|
{
|
||||||
wxString scl = bmpNode->GetPropVal(wxT("stock_client"), defaultArtClient);
|
wxString scl = bmpNode->GetPropVal(wxT("stock_client"), defaultArtClient);
|
||||||
wxBitmap stockArt =
|
wxBitmap stockArt =
|
||||||
wxArtProvider::GetBitmap(wxART_MAKE_ART_ID_FROM_STR(sid),
|
wxArtProvider::GetBitmap(wxART_MAKE_ART_ID_FROM_STR(sid),
|
||||||
wxART_MAKE_CLIENT_ID_FROM_STR(scl),
|
wxART_MAKE_CLIENT_ID_FROM_STR(scl),
|
||||||
size);
|
size);
|
||||||
@@ -777,9 +800,9 @@ wxBitmap wxXmlResourceHandler::GetBitmap(const wxString& param,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ...or load the bitmap from file: */
|
/* ...or load the bitmap from file: */
|
||||||
wxString name = GetParamValue(param);
|
wxString name = GetParamValue(param);
|
||||||
if (name.IsEmpty()) return wxNullBitmap;
|
if (name.IsEmpty()) return wxNullBitmap;
|
||||||
#if wxUSE_FILESYSTEM
|
#if wxUSE_FILESYSTEM
|
||||||
wxFSFile *fsfile = GetCurFileSystem().OpenFile(name);
|
wxFSFile *fsfile = GetCurFileSystem().OpenFile(name);
|
||||||
if (fsfile == NULL)
|
if (fsfile == NULL)
|
||||||
@@ -805,7 +828,7 @@ wxBitmap wxXmlResourceHandler::GetBitmap(const wxString& param,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
wxIcon wxXmlResourceHandler::GetIcon(const wxString& param,
|
wxIcon wxXmlResourceHandler::GetIcon(const wxString& param,
|
||||||
const wxArtClient& defaultArtClient,
|
const wxArtClient& defaultArtClient,
|
||||||
wxSize size)
|
wxSize size)
|
||||||
{
|
{
|
||||||
|
@@ -111,7 +111,7 @@ public:
|
|||||||
|
|
||||||
// Destructor.
|
// Destructor.
|
||||||
~wxXmlResource();
|
~wxXmlResource();
|
||||||
|
|
||||||
// Loads resources from XML files that match given filemask.
|
// Loads resources from XML files that match given filemask.
|
||||||
// This method understands VFS (see filesys.h).
|
// This method understands VFS (see filesys.h).
|
||||||
bool Load(const wxString& filemask);
|
bool Load(const wxString& filemask);
|
||||||
@@ -128,6 +128,9 @@ public:
|
|||||||
// all controls used within the resource.
|
// all controls used within the resource.
|
||||||
void AddHandler(wxXmlResourceHandler *handler);
|
void AddHandler(wxXmlResourceHandler *handler);
|
||||||
|
|
||||||
|
// Add a new handler at the begining of the handler list
|
||||||
|
void InsertHandler(wxXmlResourceHandler *handler);
|
||||||
|
|
||||||
// Removes all handlers
|
// Removes all handlers
|
||||||
void ClearHandlers();
|
void ClearHandlers();
|
||||||
|
|
||||||
@@ -165,8 +168,20 @@ public:
|
|||||||
bool LoadPanel(wxPanel *panel, wxWindow *parent, const wxString& name);
|
bool LoadPanel(wxPanel *panel, wxWindow *parent, const wxString& name);
|
||||||
|
|
||||||
// Loads a frame.
|
// Loads a frame.
|
||||||
|
wxFrame *LoadFrame(wxWindow* parent, const wxString& name);
|
||||||
bool LoadFrame(wxFrame* frame, wxWindow *parent, const wxString& name);
|
bool LoadFrame(wxFrame* frame, wxWindow *parent, const wxString& name);
|
||||||
|
|
||||||
|
// Load an object from the resource specifying both the resource name and
|
||||||
|
// the classname. This lets you load nonstandard container windows.
|
||||||
|
wxObject *LoadObject(wxWindow *parent, const wxString& name,
|
||||||
|
const wxString& classname);
|
||||||
|
|
||||||
|
// Load an object from the resource specifying both the resource name and
|
||||||
|
// the classname. This form lets you finish the creation of an existing
|
||||||
|
// instance.
|
||||||
|
bool LoadObject(wxObject *instance, wxWindow *parent, const wxString& name,
|
||||||
|
const wxString& classname);
|
||||||
|
|
||||||
// Loads a bitmap resource from a file.
|
// Loads a bitmap resource from a file.
|
||||||
wxBitmap LoadBitmap(const wxString& name);
|
wxBitmap LoadBitmap(const wxString& name);
|
||||||
|
|
||||||
@@ -191,9 +206,9 @@ public:
|
|||||||
int CompareVersion(int major, int minor, int release, int revision) const
|
int CompareVersion(int major, int minor, int release, int revision) const
|
||||||
{ return GetVersion() -
|
{ return GetVersion() -
|
||||||
(major*256*256*256 + minor*256*256 + release*256 + revision); }
|
(major*256*256*256 + minor*256*256 + release*256 + revision); }
|
||||||
|
|
||||||
//// Singleton accessors.
|
//// Singleton accessors.
|
||||||
|
|
||||||
// Gets the global resources object or creates one if none exists.
|
// Gets the global resources object or creates one if none exists.
|
||||||
static wxXmlResource *Get();
|
static wxXmlResource *Get();
|
||||||
|
|
||||||
@@ -229,7 +244,7 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
friend class wxXmlResourceHandler;
|
friend class wxXmlResourceHandler;
|
||||||
|
|
||||||
// singleton instance:
|
// singleton instance:
|
||||||
static wxXmlResource *ms_instance;
|
static wxXmlResource *ms_instance;
|
||||||
};
|
};
|
||||||
@@ -423,7 +438,7 @@ protected:
|
|||||||
void wxXmlInitResourceModule();
|
void wxXmlInitResourceModule();
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------
|
/* -------------------------------------------------------------------------
|
||||||
Backward compatibility macros. Do *NOT* use, they may disappear in future
|
Backward compatibility macros. Do *NOT* use, they may disappear in future
|
||||||
versions of the XRC library!
|
versions of the XRC library!
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
// Copyright: (c) 2000 Vaclav Slavik
|
// Copyright: (c) 2000 Vaclav Slavik
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation "xh_dlg.h"
|
#pragma implementation "xh_dlg.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -46,11 +46,9 @@ wxDialogXmlHandler::wxDialogXmlHandler() : wxXmlResourceHandler()
|
|||||||
}
|
}
|
||||||
|
|
||||||
wxObject *wxDialogXmlHandler::DoCreateResource()
|
wxObject *wxDialogXmlHandler::DoCreateResource()
|
||||||
{
|
{
|
||||||
wxDialog *dlg = wxDynamicCast(m_instance, wxDialog);
|
XRC_MAKE_INSTANCE(dlg, wxDialog);
|
||||||
|
|
||||||
wxASSERT_MSG(dlg, _("XRC resource: Cannot create dialog without instance."));
|
|
||||||
|
|
||||||
dlg->Create(m_parentAsWindow,
|
dlg->Create(m_parentAsWindow,
|
||||||
GetID(),
|
GetID(),
|
||||||
GetText(wxT("title")),
|
GetText(wxT("title")),
|
||||||
@@ -66,10 +64,10 @@ wxObject *wxDialogXmlHandler::DoCreateResource()
|
|||||||
SetupWindow(dlg);
|
SetupWindow(dlg);
|
||||||
|
|
||||||
CreateChildren(dlg);
|
CreateChildren(dlg);
|
||||||
|
|
||||||
if (GetBool(wxT("centered"), FALSE))
|
if (GetBool(wxT("centered"), FALSE))
|
||||||
dlg->Centre();
|
dlg->Centre();
|
||||||
|
|
||||||
return dlg;
|
return dlg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
// Copyright: (c) 2000 Vaclav Slavik
|
// Copyright: (c) 2000 Vaclav Slavik
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation "xh_frame.h"
|
#pragma implementation "xh_frame.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -51,11 +51,9 @@ wxFrameXmlHandler::wxFrameXmlHandler() : wxXmlResourceHandler()
|
|||||||
}
|
}
|
||||||
|
|
||||||
wxObject *wxFrameXmlHandler::DoCreateResource()
|
wxObject *wxFrameXmlHandler::DoCreateResource()
|
||||||
{
|
{
|
||||||
wxFrame *frame = wxDynamicCast(m_instance, wxFrame);
|
XRC_MAKE_INSTANCE(frame, wxFrame);
|
||||||
|
|
||||||
wxASSERT_MSG(frame, _("XRC resource: Cannot create dialog without instance."));
|
|
||||||
|
|
||||||
frame->Create(m_parentAsWindow,
|
frame->Create(m_parentAsWindow,
|
||||||
GetID(),
|
GetID(),
|
||||||
GetText(wxT("title")),
|
GetText(wxT("title")),
|
||||||
@@ -71,10 +69,10 @@ wxObject *wxFrameXmlHandler::DoCreateResource()
|
|||||||
SetupWindow(frame);
|
SetupWindow(frame);
|
||||||
|
|
||||||
CreateChildren(frame);
|
CreateChildren(frame);
|
||||||
|
|
||||||
if (GetBool(wxT("centered"), FALSE))
|
if (GetBool(wxT("centered"), FALSE))
|
||||||
frame->Centre();
|
frame->Centre();
|
||||||
|
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -132,6 +132,12 @@ void wxXmlResource::AddHandler(wxXmlResourceHandler *handler)
|
|||||||
handler->SetParentResource(this);
|
handler->SetParentResource(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxXmlResource::InsertHandler(wxXmlResourceHandler *handler)
|
||||||
|
{
|
||||||
|
m_handlers.Insert(handler);
|
||||||
|
handler->SetParentResource(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void wxXmlResource::ClearHandlers()
|
void wxXmlResource::ClearHandlers()
|
||||||
@@ -188,6 +194,11 @@ bool wxXmlResource::LoadPanel(wxPanel *panel, wxWindow *parent, const wxString&
|
|||||||
return CreateResFromNode(FindResource(name, wxT("wxPanel")), parent, panel) != NULL;
|
return CreateResFromNode(FindResource(name, wxT("wxPanel")), parent, panel) != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxFrame *wxXmlResource::LoadFrame(wxWindow* parent, const wxString& name)
|
||||||
|
{
|
||||||
|
return (wxFrame*)CreateResFromNode(FindResource(name, wxT("wxFrame")), parent, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
bool wxXmlResource::LoadFrame(wxFrame* frame, wxWindow *parent, const wxString& name)
|
bool wxXmlResource::LoadFrame(wxFrame* frame, wxWindow *parent, const wxString& name)
|
||||||
{
|
{
|
||||||
return CreateResFromNode(FindResource(name, wxT("wxFrame")), parent, frame) != NULL;
|
return CreateResFromNode(FindResource(name, wxT("wxFrame")), parent, frame) != NULL;
|
||||||
@@ -213,6 +224,18 @@ wxIcon wxXmlResource::LoadIcon(const wxString& name)
|
|||||||
return rt;
|
return rt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxObject *wxXmlResource::LoadObject(wxWindow *parent, const wxString& name, const wxString& classname)
|
||||||
|
{
|
||||||
|
return CreateResFromNode(FindResource(name, classname), parent, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxXmlResource::LoadObject(wxObject *instance, wxWindow *parent, const wxString& name, const wxString& classname)
|
||||||
|
{
|
||||||
|
return CreateResFromNode(FindResource(name, classname), parent, instance) != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool wxXmlResource::AttachUnknownControl(const wxString& name,
|
bool wxXmlResource::AttachUnknownControl(const wxString& name,
|
||||||
wxWindow *control, wxWindow *parent)
|
wxWindow *control, wxWindow *parent)
|
||||||
{
|
{
|
||||||
@@ -756,7 +779,7 @@ wxColour wxXmlResourceHandler::GetColour(const wxString& param)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
wxBitmap wxXmlResourceHandler::GetBitmap(const wxString& param,
|
wxBitmap wxXmlResourceHandler::GetBitmap(const wxString& param,
|
||||||
const wxArtClient& defaultArtClient,
|
const wxArtClient& defaultArtClient,
|
||||||
wxSize size)
|
wxSize size)
|
||||||
{
|
{
|
||||||
@@ -768,7 +791,7 @@ wxBitmap wxXmlResourceHandler::GetBitmap(const wxString& param,
|
|||||||
if ( !sid.empty() )
|
if ( !sid.empty() )
|
||||||
{
|
{
|
||||||
wxString scl = bmpNode->GetPropVal(wxT("stock_client"), defaultArtClient);
|
wxString scl = bmpNode->GetPropVal(wxT("stock_client"), defaultArtClient);
|
||||||
wxBitmap stockArt =
|
wxBitmap stockArt =
|
||||||
wxArtProvider::GetBitmap(wxART_MAKE_ART_ID_FROM_STR(sid),
|
wxArtProvider::GetBitmap(wxART_MAKE_ART_ID_FROM_STR(sid),
|
||||||
wxART_MAKE_CLIENT_ID_FROM_STR(scl),
|
wxART_MAKE_CLIENT_ID_FROM_STR(scl),
|
||||||
size);
|
size);
|
||||||
@@ -777,9 +800,9 @@ wxBitmap wxXmlResourceHandler::GetBitmap(const wxString& param,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ...or load the bitmap from file: */
|
/* ...or load the bitmap from file: */
|
||||||
wxString name = GetParamValue(param);
|
wxString name = GetParamValue(param);
|
||||||
if (name.IsEmpty()) return wxNullBitmap;
|
if (name.IsEmpty()) return wxNullBitmap;
|
||||||
#if wxUSE_FILESYSTEM
|
#if wxUSE_FILESYSTEM
|
||||||
wxFSFile *fsfile = GetCurFileSystem().OpenFile(name);
|
wxFSFile *fsfile = GetCurFileSystem().OpenFile(name);
|
||||||
if (fsfile == NULL)
|
if (fsfile == NULL)
|
||||||
@@ -805,7 +828,7 @@ wxBitmap wxXmlResourceHandler::GetBitmap(const wxString& param,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
wxIcon wxXmlResourceHandler::GetIcon(const wxString& param,
|
wxIcon wxXmlResourceHandler::GetIcon(const wxString& param,
|
||||||
const wxArtClient& defaultArtClient,
|
const wxArtClient& defaultArtClient,
|
||||||
wxSize size)
|
wxSize size)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user