-//---------------------------------------------------------------------------
-
-// This class holds XML resources from one or more .xml files
-// (or derived forms, either binary or zipped -- see manual for
-// details).
-
-class wxXmlResource : public wxObject
-{
-public:
- // Ctor. If use_locale is TRUE, translatable strings are
- // translated via _(). You can disable it by passing use_locale=FALSE
- // (for example if you provide resource file for each locale)
- %name(wxXmlResourceEmpty)wxXmlResource(bool use_locale = TRUE); // TODO, a better %name
-
- %addmethods {
- wxXmlResource(const wxString* filemask, bool use_locale = TRUE) {
- wxXmlResource* res = new wxXmlResource(*filemask, use_locale);
- res->InitAllHandlers();
- return res;
- }
- }
-
- ~wxXmlResource();
-
-
- // Loads resources from XML files that match given filemask.
- // This method understands VFS (see filesys.h).
- bool Load(const wxString& filemask);
-
- // Initialize handlers for all supported controls/windows. This will
- // make the executable quite big because it forces linking against
- // most of wxWin library
- void InitAllHandlers();
-
- // Initialize only specific handler (or custom handler). Convention says
- // that handler name is equal to control's name plus 'XmlHandler', e.g.
- // wxTextCtrlXmlHandler, wxHtmlWindowXmlHandler. XML resource compiler
- // (xmlres) can create include file that contains initialization code for
- // all controls used within the resource.
- void AddHandler(wxXmlResourceHandler *handler);
-
- // Removes all handlers
- void ClearHandlers();
-
- // Loads menu from resource. Returns NULL on failure.
- wxMenu *LoadMenu(const wxString& name);
-
- // Loads menubar from resource. Returns NULL on failure.
- wxMenuBar *LoadMenuBar(const wxString& name);
-
- // Loads toolbar
- wxToolBar *LoadToolBar(wxWindow *parent, const wxString& name);
-
- // Loads dialog. dlg points to parent window (if any). Second form
- // is used to finish creation of already existing instance (main reason
- // for this is that you may want to use derived class with new event table)
- // Example (typical usage):
- // MyDialog dlg;
- // wxTheXmlResource->LoadDialog(&dlg, mainFrame, "my_dialog");
- // dlg->ShowModal();
- wxDialog *LoadDialog(wxWindow *parent, const wxString& name);
- %name(LoadOnDialog)bool LoadDialog(wxDialog *dlg, wxWindow *parent, const wxString& name);
-
- // Loads panel. panel points to parent window (if any). Second form
- // is used to finish creation of already existing instance.
- wxPanel *LoadPanel(wxWindow *parent, const wxString& name);
- %name(LoadOnPanel)bool LoadPanel(wxPanel *panel, wxWindow *parent, const wxString& name);
-
- bool LoadFrame(wxFrame* frame, wxWindow *parent, const wxString& name);
-
- // Loads bitmap or icon resource from file:
- wxBitmap LoadBitmap(const wxString& name);
- wxIcon LoadIcon(const wxString& name);