#ifndef _WX_XMLRES_H_
#define _WX_XMLRES_H_
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(__APPLE__)
#pragma interface "xmlres.h"
#endif
#include "wx/filesys.h"
#include "wx/bitmap.h"
#include "wx/icon.h"
+#include "wx/artprov.h"
#include "wx/xrc/xml.h"
// Destructor.
~wxXmlResource();
-
+
// Loads resources from XML files that match given filemask.
// This method understands VFS (see filesys.h).
bool Load(const wxString& filemask);
// all controls used within the resource.
void AddHandler(wxXmlResourceHandler *handler);
+ // Add a new handler at the begining of the handler list
+ void InsertHandler(wxXmlResourceHandler *handler);
+
// Removes all handlers
void ClearHandlers();
bool LoadPanel(wxPanel *panel, wxWindow *parent, const wxString& name);
// Loads a frame.
+ wxFrame *LoadFrame(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.
wxBitmap LoadBitmap(const wxString& name);
int CompareVersion(int major, int minor, int release, int revision) const
{ return GetVersion() -
(major*256*256*256 + minor*256*256 + release*256 + revision); }
-
+
//// Singleton accessors.
-
+
// Gets the global resources object or creates one if none exists.
static wxXmlResource *Get();
// Sets the global resources object and returns a pointer to the previous one (may be NULL).
static wxXmlResource *Set(wxXmlResource *res);
+ // Returns flags, which may be a bitlist of wxXRC_USE_LOCALE and wxXRC_NO_SUBCLASSING.
+ int GetFlags() { return m_flags; }
+
protected:
// Scans the resources list for unloaded files and loads them. Also reloads
// files that have been modified since last loading.
// Creates a resource from information in the given node.
wxObject *CreateResFromNode(wxXmlNode *node, wxObject *parent, wxObject *instance = NULL);
- // Returns flags, which may be a bitlist of wxXRC_USE_LOCALE and wxXRC_NO_SUBCLASSING.
- int GetFlags() { return m_flags; }
-
private:
long m_version;
#endif
friend class wxXmlResourceHandler;
-
+
// singleton instance:
static wxXmlResource *ms_instance;
};
// Gets text from param and does some conversions:
// - replaces \n, \r, \t by respective chars (according to C syntax)
- // - replaces $ by & and $$ by $ (needed for $File => &File because of XML)
+ // - replaces _ by & and __ by _ (needed for _File => &File because of XML)
// - calls wxGetTranslations (unless disabled in wxXmlResource)
- wxString GetText(const wxString& param);
+ wxString GetText(const wxString& param, bool translate = TRUE);
// Returns the XRCID.
int GetID();
// Gets a bitmap.
wxBitmap GetBitmap(const wxString& param = wxT("bitmap"),
+ const wxArtClient& defaultArtClient = wxART_OTHER,
wxSize size = wxDefaultSize);
// Gets an icon.
wxIcon GetIcon(const wxString& param = wxT("icon"),
+ const wxArtClient& defaultArtClient = wxART_OTHER,
wxSize size = wxDefaultSize);
// Gets a font.
void wxXmlInitResourceModule();
-/* -------------------------------------------------------------------------
+/* -------------------------------------------------------------------------
Backward compatibility macros. Do *NOT* use, they may disappear in future
versions of the XRC library!
------------------------------------------------------------------------- */
#define wxTheXmlResource wxXmlResource::Get()
#define XMLID XRCID
#define XMLCTRL XRCCTRL
+#define GetXMLID GetXRCID
#endif // _WX_XMLRES_H_