X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bd330a69c9555c29c6fc448a61e58e0d49402c47..75d9e502238df95fa53c0030b1fac0d4f43e4025:/docs/latex/wx/xmlres.tex diff --git a/docs/latex/wx/xmlres.tex b/docs/latex/wx/xmlres.tex index ed5913cd23..15efa2a074 100644 --- a/docs/latex/wx/xmlres.tex +++ b/docs/latex/wx/xmlres.tex @@ -11,10 +11,6 @@ The class holds XML resources from one or more .xml files, binary files or zip a See \helpref{XML-based resource system overview}{xrcoverview} for details. -{\bf NOTE:} XRC is not yet a part of the core wxWindows library, so -please see the overview for how to compile and link it. Otherwise if you -try to use it, you will get link errors. - \wxheading{Derived from} \helpref{wxObject}{wxobject} @@ -23,21 +19,25 @@ try to use it, you will get link errors. -\wxheading{Data structures} +\wxheading{Constants} -\begin{enumerate} +\begin{verbatim} enum wxXmlResourceFlags { wxXRC_USE_LOCALE = 1, - wxXRC_NO_SUBCLASSING = 2 + wxXRC_NO_SUBCLASSING = 2, + wxXRC_NO_RELOADING = 4 }; -\end{enumerate} +\end{verbatim} \latexignore{\rtfignore{\wxheading{Members}}} -\membersection{wxXmlResource::wxXmlResource}\label{wxxmlresourcewxxmlresource} -\func{}{wxXmlResource}{\param{const wxString\& }{filemask}, \param{int }{flags = wxXRC\_USE\_LOCALE}} +\membersection{wxXmlResource::wxXmlResource}\label{wxxmlresourcector} + +\func{}{wxXmlResource}{\param{const wxString\& }{filemask}, + \param{int }{flags = wxXRC\_USE\_LOCALE}, + \param{const wxString& }{domain = wxEmptyString}} Constructor. @@ -48,13 +48,27 @@ load all resource files inside a zip archive.} wxXRC\_NO\_SUBCLASSING: subclass property of object nodes will be ignored (useful for previews in XRC editors).} -\func{}{wxXmlResource}{\param{int }{flags = wxXRC\_USE\_LOCALE}} +\docparam{domain}{The name of the gettext catalog to search for + translatable strings. By default all loaded catalogs will be + searched. This provides a way to allow the strings to only come + from a specific catalog.} + +\func{}{wxXmlResource}{\param{int }{flags = wxXRC\_USE\_LOCALE}, + \param{const wxString& }{domain = wxEmptyString}} Constructor. \docparam{flags}{wxXRC\_USE\_LOCALE: translatable strings will be translated via \_(). wxXRC\_NO\_SUBCLASSING: subclass property of object nodes will be ignored -(useful for previews in XRC editors).} +(useful for previews in XRC editors). wxXRC\_NO\_RELOADING will prevent the +XRC files from being reloaded from disk in case they have been modified there +since being last loaded (may slightly speed up loading them).} + +\docparam{domain}{The name of the gettext catalog to search for + translatable strings. By default all loaded catalogs will be + searched. This provides a way to allow the strings to only come + from a specific catalog.} + \membersection{wxXmlResource::\destruct{wxXmlResource}}\label{wxxmlresourcedtor} @@ -62,6 +76,7 @@ wxXRC\_NO\_SUBCLASSING: subclass property of object nodes will be ignored Destructor. + \membersection{wxXmlResource::AddHandler}\label{wxxmlresourceaddhandler} \func{void}{AddHandler}{\param{wxXmlResourceHandler* }{handler}} @@ -70,7 +85,10 @@ Initializes only a specific handler (or custom handler). Convention says that the handler name is equal to the control's name plus 'XmlHandler', for example wxTextCtrlXmlHandler, wxHtmlWindowXmlHandler. The XML resource compiler (wxxrc) can create include file that contains initialization code for -all controls used within the resource. +all controls used within the resource. Note that this handler should be +allocated on the heap, since it will be delete by +\helpref{ClearHandlers}{wxxmlresourceclearhandlers} later. + \membersection{wxXmlResource::AttachUnknownControl}\label{wxxmlresourceattachunknowncontrol} @@ -79,11 +97,14 @@ all controls used within the resource. Attaches an unknown control to the given panel/window/dialog. Unknown controls are used in conjunction with . + \membersection{wxXmlResource::ClearHandlers}\label{wxxmlresourceclearhandlers} \func{void}{ClearHandlers}{\void} -Removes all handlers. +Removes all handlers and deletes them (this means that any handlers added using +\helpref{AddHandler}{wxxmlresourceaddhandler} must be allocated on the heap). + \membersection{wxXmlResource::CompareVersion}\label{wxxmlresourcecompareversion} @@ -92,23 +113,6 @@ Removes all handlers. Compares the XRC version to the argument. Returns -1 if the XRC version is less than the argument, +1 if greater, and 0 if they equal. -\membersection{wxXmlResource::CreateResFromNode}\label{wxxmlresourcecreateresfromnode} - -\func{wxObject*}{CreateResFromNode}{\param{wxXmlNode* }{node}, \param{wxObject* }{parent}, \param{wxObject* }{instance = NULL}} - -Creates a resource from information in the given node. - -\membersection{wxXmlResource::DoFindResource}\label{wxxmlresourcedofindresource} - -\func{wxXmlNode*}{DoFindResource}{\param{wxXmlNode* }{parent}, \param{const wxString\& }{name}, \param{const wxString\& }{classname}, \param{bool }{recursive}} - -Helper function: finds a resource (calls UpdateResources) and returns a node containing it. - -\membersection{wxXmlResource::FindResource}\label{wxxmlresourcefindresource} - -\func{wxXmlNode*}{FindResource}{\param{const wxString\& }{name}, \param{const wxString\& }{classname}, \param{bool }{recursive = FALSE}} - -Finds a resource (calls UpdateResources) and returns a node containing it. \membersection{wxXmlResource::Get}\label{wxxmlresourceget} @@ -116,25 +120,31 @@ Finds a resource (calls UpdateResources) and returns a node containing it. Gets the global resources object or creates one if none exists. + \membersection{wxXmlResource::GetFlags}\label{wxxmlresourcegetflags} \func{int}{GetFlags}{\void} Returns flags, which may be a bitlist of wxXRC\_USE\_LOCALE and wxXRC\_NO\_SUBCLASSING. + \membersection{wxXmlResource::GetVersion}\label{wxxmlresourcegetversion} \constfunc{long}{GetVersion}{\void} -Returns version information (a.b.c.d = d+ 256*c + 256\verb|^|2*b + 256\verb|^|3*a). +Returns version information (a.b.c.d = d+ 256*c + 256\textasciicircum2*b + 256\textasciitilde3*a). + -\membersection{wxXmlResource::GetXMLID}\label{wxxmlresourcegetxmlid} +\membersection{wxXmlResource::GetXRCID}\label{wxxmlresourcegetxmlid} -\func{int}{GetXMLID}{\param{const wxChar* }{str\_id}} +\func{int}{GetXRCID}{\param{const wxString\& }{str\_id}, \param{int }{value\_if\_not\_found = -2}} Returns a numeric ID that is equivalent to the string ID used in an XML -resource. To be used in event tables. -The macro \verb$XMLID(name)$ is provided for convenience. +resource. If an unknown \arg{str\_id} is requested (i.e. other than wxID\_XXX +or integer), a new record is created which associates the given string with +a number. If \arg{value\_if\_not\_found} is \texttt{wxID\_NONE}, the number is obtained via +\helpref{wxNewId()}{wxnewid}. Otherwise \arg{value\_if\_not\_found} is used. +Macro {\tt XRCID(name)} is provided for convenient use in event tables. \membersection{wxXmlResource::InitAllHandlers}\label{wxxmlresourceinitallhandlers} @@ -142,7 +152,8 @@ The macro \verb$XMLID(name)$ is provided for convenience. Initializes handlers for all supported controls/windows. This will make the executable quite big because it forces linking against -most of the wxWindows library. +most of the wxWidgets library. + \membersection{wxXmlResource::Load}\label{wxxmlresourceload} @@ -151,12 +162,14 @@ most of the wxWindows library. Loads resources from XML files that match given filemask. This method understands VFS (see filesys.h). + \membersection{wxXmlResource::LoadBitmap}\label{wxxmlresourceloadbitmap} \func{wxBitmap}{LoadBitmap}{\param{const wxString\& }{name}} Loads a bitmap resource from a file. + \membersection{wxXmlResource::LoadDialog}\label{wxxmlresourceloaddialog} \func{wxDialog*}{LoadDialog}{\param{wxWindow* }{parent}, \param{const wxString\& }{name}} @@ -178,24 +191,28 @@ Example: dlg->ShowModal(); \end{verbatim} + \membersection{wxXmlResource::LoadFrame}\label{wxxmlresourceloadframe} \func{bool}{LoadFrame}{\param{wxFrame* }{frame}, \param{wxWindow* }{parent}, \param{const wxString\& }{name}} Loads a frame. + \membersection{wxXmlResource::LoadIcon}\label{wxxmlresourceloadicon} \func{wxIcon}{LoadIcon}{\param{const wxString\& }{name}} Loads an icon resource from a file. + \membersection{wxXmlResource::LoadMenu}\label{wxxmlresourceloadmenu} \func{wxMenu*}{LoadMenu}{\param{const wxString\& }{name}} Loads menu from resource. Returns NULL on failure. + \membersection{wxXmlResource::LoadMenuBar}\label{wxxmlresourceloadmenubar} \func{wxMenuBar*}{LoadMenuBar}{\param{wxWindow* }{parent}, \param{const wxString\& }{name}} @@ -206,6 +223,7 @@ Loads a menubar from resource. Returns NULL on failure. Loads a menubar from resource. Returns NULL on failure. + \membersection{wxXmlResource::LoadPanel}\label{wxxmlresourceloadpanel} \func{wxPanel*}{LoadPanel}{\param{wxWindow* }{parent}, \param{const wxString\& }{name}} @@ -217,22 +235,52 @@ Loads a panel. {\it panel} points to parent window (if any). Loads a panel. {\it panel} points to parent window (if any). This form is used to finish creation of an already existing instance. + \membersection{wxXmlResource::LoadToolBar}\label{wxxmlresourceloadtoolbar} \func{wxToolBar*}{LoadToolBar}{\param{wxWindow* }{parent}, \param{const wxString\& }{name}} Loads a toolbar. + \membersection{wxXmlResource::Set}\label{wxxmlresourceset} \func{wxXmlResource*}{Set}{\param{wxXmlResource* }{res}} Sets the global resources object and returns a pointer to the previous one (may be NULL). -\membersection{wxXmlResource::UpdateResources}\label{wxxmlresourceupdateresources} -\func{void}{UpdateResources}{\void} +\membersection{wxXmlResource::SetFlags}\label{wxxmlresourcesetflags} + +\func{void}{SetFlags}{\param{int }{flags}} + +Sets flags (bitlist of wxXRC\_USE\_LOCALE and wxXRC\_NO\_SUBCLASSING). + + +\membersection{wxXmlResource::Unload}\label{wxxmlresourceunload} + +\func{bool}{Unload}{\param{const wxString\& }{filename}} + +This function unloads a resource previously loaded by +\helpref{Load()}{wxxmlresourceload}. + +Returns \true if the resource was successfully unloaded and \false if it hasn't +been found in the list of loaded resources. + + + +\membersection{wxXmlResource::GetDomain}\label{wxxmlresourcegetdomain} + +\func{wxChar*}{GetDomain}{} + +Returns the domain (message catalog) that will be used to load +translatable strings in the XRC. + + +\membersection{wxXmlResource::SetDomain}\label{wxxmlresourcesetdomain} + +\func{wxChar*}{SetDomain}{\param{const wxChar* }{domain}} -Scans the resources list for unloaded files and loads them. Also reloads -files that have been modified since the last load. +Sets the domain (message catalog) that will be used to load +translatable strings in the XRC.