From d958c9bd1754393a2b2e35a95df4df4e74bcd3c4 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Wed, 23 Jan 2002 15:17:44 +0000 Subject: [PATCH] Added first cut at XRC docs; added font spec for wxWindows manual (new Tex2RTF feature!); removed section on porting from 1.x. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13766 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/body.tex | 99 +------- docs/latex/wx/category.tex | 12 + docs/latex/wx/classes.tex | 2 + docs/latex/wx/manual.tex | 5 +- docs/latex/wx/tex2rtf.ini | 3 + docs/latex/wx/topics.tex | 1 + docs/latex/wx/tresourc.tex | 5 +- docs/latex/wx/txrc.tex | 464 +++++++++++++++++++++++++++++++++++++ docs/latex/wx/xmlres.tex | 250 ++++++++++++++++++++ docs/latex/wx/xmlresh.tex | 257 ++++++++++++++++++++ 10 files changed, 998 insertions(+), 100 deletions(-) create mode 100644 docs/latex/wx/txrc.tex create mode 100644 docs/latex/wx/xmlres.tex create mode 100644 docs/latex/wx/xmlresh.tex diff --git a/docs/latex/wx/body.tex b/docs/latex/wx/body.tex index d511845a0c..19c62daf94 100644 --- a/docs/latex/wx/body.tex +++ b/docs/latex/wx/body.tex @@ -103,70 +103,7 @@ them to the clipboard. \item Built-in support for many file formats (BMP, PNG, JPEG, GIF, XPM, PNM, PCX). \end{itemize} -\section{Changes from version 1.xx}\label{versionchanges} - -These are a few of the major differences between versions 1.xx and 2.0. - -Removals: - -\begin{itemize}\itemsep=0pt -\item XView is no longer supported; -\item all controls (panel items) no longer have labels attached to them; -\item wxForm has been removed; -\item wxCanvasDC, wxPanelDC removed (replaced by wxClientDC, wxWindowDC, wxPaintDC which -can be used for any window); -\item wxMultiText, wxTextWindow, wxText removed and replaced by wxTextCtrl; -\item classes no longer divided into generic and platform-specific parts, for efficiency. -\end{itemize} - -Additions and changes: - -\begin{itemize}\itemsep=0pt -\item class hierarchy changed, and restrictions about subwindow nesting lifted; -\item header files reorganized to conform to normal C++ standards; -\item classes less dependent on each another, to reduce executable size; -\item wxString used instead of char* wherever possible; -\item the number of separate but mandatory utilities reduced; -\item the event system has been overhauled, with -virtual functions and callbacks being replaced with MFC-like event tables; -\item new controls, such as wxTreeCtrl, wxListCtrl, wxSpinButton; -\item less inconsistency about what events can be handled, so for example -mouse clicks or key presses on controls can now be intercepted; -\item the status bar is now a separate class, wxStatusBar, and is -implemented in generic wxWindows code; -\item some renaming of controls for greater consistency; -\item wxBitmap has the notion of bitmap handlers to allow for extension to new formats -without ifdefing; -\item new dialogs: wxPageSetupDialog, wxFileDialog, wxDirDialog, -wxMessageDialog, wxSingleChoiceDialog, wxTextEntryDialog; -\item GDI objects are reference-counted and are now passed to most functions -by reference, making memory management far easier; -\item wxSystemSettings class allows querying for various system-wide properties -such as dialog font, colours, user interface element sizes, and so on; -\item better platform look and feel conformance; -\item toolbar functionality now separated out into a family of classes with the -same API; -\item device contexts are no longer accessed using wxWindow::GetDC - they are created -temporarily with the window as an argument; -\item events from sliders and scrollbars can be handled more flexibly; -\item the handling of window close events has been changed in line with the new -event system; -\item the concept of {\it validator} has been added to allow much easier coding of -the relationship between controls and application data; -\item the documentation has been revised, with more cross-referencing. -\end{itemize} - -Platform-specific changes: - -\begin{itemize}\itemsep=0pt -\item The Windows header file (windows.h) is no longer included by wxWindows headers; -\item wx.dll supported under Visual C++; -\item the full range of Windows 95 window decorations are supported, such as modal frame -borders; -\item MDI classes brought out of wxFrame into separate classes, and made more flexible. -\end{itemize} - - +\begin{comment} \section{Changes from version 2.0}\label{versionchanges20} These are a few of the differences between versions 2.0 and 2.2. @@ -194,7 +131,7 @@ Additions and changes: \item Improved support for ODBC databases. \item Improved tab traversal in dialogs. \end{itemize} - +\end{comment} \section{wxWindows requirements}\label{requirements} @@ -235,14 +172,7 @@ from ftp://www.remstar.com/pub/wxwin and/or http://www.wxwindows.org.} from \urlref{ftp://www.remstar.com/pub/wxwin}{ftp://www.remstar.com/pub/wxwin} and/or \urlref{http://www.wxwindows.org}{http://www.wxwindows.org}.} -You can also buy a CD-ROM using the form on the Web site, or by contacting: - -Julian Smart\\ -12 North Street West\\ -Uppingham\\ -Rutland\\ -LE15 9SG\\ -julian.smart@btopenworld.com +You can also buy a CD-ROM using the form on the Web site. \section{Acknowledgments} @@ -651,29 +581,6 @@ possibilities. See the separate manual and the directory utils/wxtree. -\section{wxGraphLayout} - -The wxGraphLayout class is based on a tool called `graphplace' by Dr. -Jos T.J. van Eijndhoven of Eindhoven University of Technology. Given a -(possibly cyclic) directed graph, it does its best to lay out the nodes -in a sensible manner. There are many applications (such as diagramming) -where it is required to display a graph with no human intervention. Even -if manual repositioning is later required, this algorithm can make a good -first attempt. - -See the separate manual and the directory utils/wxgraph. - -\section{Colours}\label{coloursampler} - -A colour sampler for viewing colours and their names on each -platform. - -% -\chapter{Tutorial}\label{tutorial} -\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}% -\setfooter{\thepage}{}{}{}{}{\thepage}% - -To be written. \end{comment} \chapter{Programming strategies}\label{strategies} diff --git a/docs/latex/wx/category.tex b/docs/latex/wx/category.tex index 70f9bab3c9..081b96b179 100644 --- a/docs/latex/wx/category.tex +++ b/docs/latex/wx/category.tex @@ -509,6 +509,18 @@ used internally by the HTML classes. \twocolitem{\helpref{wxFileSystemHandler}{wxfilesystemhandler}}{Class used to announce file system type} \end{twocollist} +{\large {\bf XML-based resource system classes}} + +\overview{XML-based resource system overview}{xrcoverview} + +Resources allow your application to create controls and other user interface elements +from specifications stored in an XML format. + +\begin{twocollist}\itemsep=0pt +\twocolitem{\helpref{wxXmlResource}{wxxmlresource}}{The main class for working with resources.} +\twocolitem{\helpref{wxXmlResourceHandler}{wxxmlresourcehandler}}{The base class for XML resource handlers.} +\end{twocollist} + {\large {\bf Online help}} \begin{twocollist}\itemsep=0pt diff --git a/docs/latex/wx/classes.tex b/docs/latex/wx/classes.tex index fb0995f4b2..c05cb882fd 100644 --- a/docs/latex/wx/classes.tex +++ b/docs/latex/wx/classes.tex @@ -338,6 +338,8 @@ \input wizard.tex \input wizevt.tex \input wizpage.tex +\input xmlres.tex +\input xmlresh.tex \input zipstrm.tex \input strmzlib.tex \input function.tex diff --git a/docs/latex/wx/manual.tex b/docs/latex/wx/manual.tex index ff33f153a2..7aaac88a56 100644 --- a/docs/latex/wx/manual.tex +++ b/docs/latex/wx/manual.tex @@ -658,7 +658,6 @@ That's all there is to it! \input{wxhtml.tex} \input{proplist.tex} \input{wxPython.tex} -\input{porting.tex} \begin{comment} \newpage @@ -672,14 +671,14 @@ That's all there is to it! \nocite{smart95a}% \nocite{smart95b}% -\end{comment} - \bibliography{refs} \addcontentsline{toc}{chapter}{Bibliography} \setheader{{\it REFERENCES}}{}{}{}{}{{\it REFERENCES}}% \setfooter{\thepage}{}{}{}{}{\thepage}% +\end{comment} \newpage + % Note: In RTF, the \printindex must come before the % change of header/footer, since the \printindex inserts % the RTF \sect command which divides one chapter from diff --git a/docs/latex/wx/tex2rtf.ini b/docs/latex/wx/tex2rtf.ini index 4027cea01e..1de028eee2 100644 --- a/docs/latex/wx/tex2rtf.ini +++ b/docs/latex/wx/tex2rtf.ini @@ -24,6 +24,9 @@ combineSubSections = yes htmlWorkshopFiles = true htmlIndex = true +; Finally, a way to specify face names +htmlFaceName = "Arial, Lucida, Helvetica" + ;\overview [2] {\rtfonly{See also }\settransparency{on}\sethotspotcolour{off}\sethotspotunderline{on}\winhelponly{\image{}{books.bmp}\settransparency{off}} ;\htmlonly{\image{}{books.gif}}\helpref{#1}{#2} ;\sethotspotcolour{on}\sethotspotunderline{on}} diff --git a/docs/latex/wx/topics.tex b/docs/latex/wx/topics.tex index 1c246e3404..81adae4cb0 100644 --- a/docs/latex/wx/topics.tex +++ b/docs/latex/wx/topics.tex @@ -31,6 +31,7 @@ This chapter contains a selection of topic overviews, first things first: \input tvalidat.tex \input tconstr.tex \input tresourc.tex +\input txrc.tex \input tscroll.tex \input tbitmap.tex \input tdc.tex diff --git a/docs/latex/wx/tresourc.tex b/docs/latex/wx/tresourc.tex index 695403e2ef..22b6c8933a 100644 --- a/docs/latex/wx/tresourc.tex +++ b/docs/latex/wx/tresourc.tex @@ -4,7 +4,10 @@ wxWindows has an optional {\it resource file} facility, which allows separation of dialog, menu, bitmap and icon specifications from the application code. -It is similar in principle to the Windows resource file (whose ASCII form is +{\bf NOTE:} this format is now deprecated in favour of the XML-based \helpref{XRC resource system}{xrcoverview}. +However it is still available if wxUSE\_RESOURCES is enabled. + +The format is similar in principle to the Windows resource file (whose ASCII form is suffixed .RC and whose binary form is suffixed .RES). The wxWindows resource file is currently ASCII-only, suffixed .WXR. Note that under Windows, the .WXR file does not {\it replace} the native Windows resource file, diff --git a/docs/latex/wx/txrc.tex b/docs/latex/wx/txrc.tex new file mode 100644 index 0000000000..ed3d65c95a --- /dev/null +++ b/docs/latex/wx/txrc.tex @@ -0,0 +1,464 @@ +\section{XML-based resource system overview}\label{xrcoverview} + +Classes: \helpref{wxXmlResource}{wxxmlresource}, \helpref{wxXmlResourceHandler}{wxxmlresourcehandler} + +The XML-based resource system, known as XRC, allows user interface elements such as +dialogs, menu bars and toolbars, to be stored in text files and loaded into +the application at run-time. XRC files can also be compiled into binary XRS files or C++ +code, so an XML parser does not need to be linked with the application and load times +are faster. + +There are several advantages to using XRC resources. + +\begin{itemize}\itemsep=0pt +\item Recompiling and linking an application is not necessary if the +resources change. +\item If you use a dialog designers that generates C++ code, it can be hard +to reintegrate this into existing C++ code. Separation of resources and code +is a more elegant solution. +\item You can choose between different alternative resource files at run time, if necessary. +\item The XRC format uses sizers for flexibility, allowing dialogs to be resizable +and highly portable. +\item The XRC format is a wxWindows standard, +and can be generated or postprocessed by any program that understands it. As it is based +on the XML standard, existing XML editors can be used for simple editing purposes. +\end{itemize} + +XRC was written by Vaclav Slavik. + +\subsection{Compiling and using XRC}\label{compilingxrc} + +XRC can be found under the 'contrib' hierarchy, in the following directories: + +\begin{verbatim} + contrib/src/xrc ; XRC source + contrib/include/wx/xrc ; XRC headers + contrib/samples/xrc ; XRC sample + contrib/utils/wxrc ; XRC resource compiler + contrib/utils/wxrcedit ; XRC editor (in progress) +\end{verbatim} + +To compile XRC: + +\begin{itemize}\itemsep=0pt +\item Under Windows using VC++, open the contrib/src/xrc/XrcVC.dsw project +and compile. Also compile contrib/utils/wxrc using wxBase if you wish to compile +resource files. +\item Under Unix, XRC should be configured when you configured +wxWindows. Make XRC by changing directory to contrib/src/xrc and +type 'make'. Similarly compile contrib/utils/wxrc using wxBase if you wish to compile +resource files. {\bf Note:} there is currently a +problem with the wxWindows build system that means that +only the static version of library can be built at present. +\end{itemize} + +To use XRC: + +\begin{itemize}\itemsep=0pt +\item Under Windows using VC++, link with wxxrc[d].lib. +\item Under Unix, link with libwxxrc[d].a. +\end{itemize} + +\subsection{XRC concepts}\label{xrcconcepts} + +These are the typical steps for using XRC files in your application. + +\begin{itemize}\itemsep=0pt +\item Include the appropriate headers: normally "wx/xrc/xmlres.h" will suffice; +\item call \verb$wxXmlResource::Get()->InitAllHandlers()$ from your wxApp::OnInit function, +and then call \verb$wxXmlResource::Get()->Load("myfile.xrc")$ to load the resource file; +\item to create a dialog from a resource, create it using the default constructor, and then +load using for example \verb$wxXmlResource::Get()->LoadDialog(&dlg, this, "dlg1")$; +\item set up event tables as usual but use the \verb$XMLID(str)$ macro to translate from XRC string names +to a suitable integer identifier, for example \verb$EVT_MENU(XMLID("quit"), MyFrame::OnQuit)$. +\end{itemize} + +To create an XRC file, use one of the following methods. + +\begin{itemize}\itemsep=0 +\item Create the file by hand; +\item use \urlref{wxDesigner}{http://www.roebling.de}; +\item use wxWorkshop (not yet available); +\item use wxrcedit (the status of this tool is unknown); +\item convert WIN32 RC files with the tool in contrib/utils/convertrc (the status of this tool is +unknown). +\end{itemize} + +It is highly recommended that you use a tool such as wxDesigner, since it's fiddly writing +XRC files by hand. + +You can use \helpref{wxXmlResource::Load}{wxxmlresourceload} in a number of ways. +You can pass an XRC file (XML-based text resource file), an XMB file (compiled binary file) +or a zip-compressed file (extension ZIP or RSC) containing other XRC or XMB files. + +TODO: is the compiled binary format XMB or XRS? How do you handle a C++ resource file? + +\subsection{Using binary resource files}\label{binaryresourcefiles} + +To compile binary resource files, use the command-line wxrc utility. It takes a single file parameter (the +input XRC file) and the following switches and options. + +\begin{itemize}\itemsep=0 +\item -h (--help): show a help message +\item -v (--verbose): show verbose logging information +\item -c (--cpp-code): write C++ source rather than a RSC file +\item -u (--uncompressed): do not compress XML files (C++ only) +\item -g (--gettext): output .po catalog (to stdout, or a file if -o is used) +\item -n (--function) : specify C++ function name (use with -c) +\item -o (--output) : specify the output file, such as resource.xrs or resource.cpp +\item -l (--list-of-handlers) : output a list of necessary handlers to this file +\end{itemize} + +For example: + +\begin{verbatim} + % wxrc resource.wrc + % wxrc resource.wrc -o resource.wrs + % wxrc resource.wrc -v -c -o resource.cpp +\end{verbatim} + +\subsection{XRC C++ sample}\label{xrccppsample} + +This is the C++ source file (xrcdemo.cpp) for the XRC sample. + +\begin{verbatim} +///////////////////////////////////////////////////////////////////////////// +// Name: xmldemo.cpp +// Purpose: XML resources sample +// Author: Vaclav Slavik +// RCS-ID: $Id$ +// Copyright: (c) Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- +#ifdef __GNUG__ + #pragma implementation "xrcdemo.cpp" + #pragma interface "xrcdemo.cpp" +#endif + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +// for all others, include the necessary headers (this file is usually all you +// need because it includes almost all "standard" wxWindows headers) +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif + +#include "wx/image.h" +#include "wx/xrc/xmlres.h" + +// ---------------------------------------------------------------------------- +// resources +// ---------------------------------------------------------------------------- +// the application icon +#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__) + #include "rc/appicon.xpm" +#endif + +// ---------------------------------------------------------------------------- +// private classes +// ---------------------------------------------------------------------------- + +// Define a new application type, each program should derive a class from wxApp +class MyApp : public wxApp +{ +public: + // override base class virtuals + // ---------------------------- + + // this one is called on application startup and is a good place for the app + // initialization (doing it here and not in the ctor allows to have an error + // return: if OnInit() returns false, the application terminates) + virtual bool OnInit(); +}; + +// Define a new frame type: this is going to be our main frame +class MyFrame : public wxFrame +{ +public: + // ctor(s) + MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size); + + // event handlers (these functions should _not_ be virtual) + void OnQuit(wxCommandEvent& event); + void OnAbout(wxCommandEvent& event); + void OnDlg1(wxCommandEvent& event); + void OnDlg2(wxCommandEvent& event); + +private: + // any class wishing to process wxWindows events must use this macro + DECLARE_EVENT_TABLE() +}; + +// ---------------------------------------------------------------------------- +// event tables and other macros for wxWindows +// ---------------------------------------------------------------------------- + +// the event tables connect the wxWindows events with the functions (event +// handlers) which process them. It can be also done at run-time, but for the +// simple menu events like this the static method is much simpler. +BEGIN_EVENT_TABLE(MyFrame, wxFrame) + EVT_MENU(XMLID("menu_quit"), MyFrame::OnQuit) + EVT_MENU(XMLID("menu_about"), MyFrame::OnAbout) + EVT_MENU(XMLID("menu_dlg1"), MyFrame::OnDlg1) + EVT_MENU(XMLID("menu_dlg2"), MyFrame::OnDlg2) +END_EVENT_TABLE() + +// Create a new application object: this macro will allow wxWindows to create +// the application object during program execution (it's better than using a +// static object for many reasons) and also declares the accessor function +// wxGetApp() which will return the reference of the right type (i.e. MyApp and +// not wxApp) +IMPLEMENT_APP(MyApp) + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// the application class +// ---------------------------------------------------------------------------- + +// 'Main program' equivalent: the program execution "starts" here +bool MyApp::OnInit() +{ + wxImage::AddHandler(new wxGIFHandler); + wxXmlResource::Get()->InitAllHandlers(); + wxXmlResource::Get()->Load("rc/resource.xrc"); + + MyFrame *frame = new MyFrame("XML resources demo", + wxPoint(50, 50), wxSize(450, 340)); + frame->Show(TRUE); + return TRUE; +} + +// ---------------------------------------------------------------------------- +// main frame +// ---------------------------------------------------------------------------- + +// frame constructor +MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) + : wxFrame((wxFrame *)NULL, -1, title, pos, size) +{ + SetIcon(wxICON(appicon)); + + SetMenuBar(wxXmlResource::Get()->LoadMenuBar("mainmenu")); + SetToolBar(wxXmlResource::Get()->LoadToolBar(this, "toolbar")); +} + + +// event handlers + +void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) +{ + // TRUE is to force the frame to close + Close(TRUE); +} + +void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) +{ + wxString msg; + msg.Printf( _T("This is the about dialog of XML resources demo.\n") + _T("Welcome to %s"), wxVERSION_STRING); + + wxMessageBox(msg, "About XML resources demo", wxOK | wxICON_INFORMATION, this); +} + +void MyFrame::OnDlg1(wxCommandEvent& WXUNUSED(event)) +{ + wxDialog dlg; + wxXmlResource::Get()->LoadDialog(&dlg, this, "dlg1"); + dlg.ShowModal(); +} + + +void MyFrame::OnDlg2(wxCommandEvent& WXUNUSED(event)) +{ + wxDialog dlg; + wxXmlResource::Get()->LoadDialog(&dlg, this, "dlg2"); + dlg.ShowModal(); +} +\end{verbatim} + +\subsection{XRC resource file sample}\label{xrcsample} + +This is the XML file (resource.xrc) for the XRC sample. + +\begin{verbatim} + + + + + + + + + + filesave.gif + + + + + + + + + + + + + + + + + 2,2 + + fileopen.gif + Open catalog + + + filesave.gif + Save catalog + + + update.gif + Update catalog - synchronize it with sources + + + + quotes.gif + 1 + Display quotes around the string? + + + + fuzzy.gif + Toggled if selected string is fuzzy translation + 1 + + + + + + + fuzzy.gif + fileopen.gif + + + + + + + + + + wxALIGN_CENTER + + + + + + 10d + wxALL + + + + <h1>Hi,</h1>man + 100,45d + + + + + + + + + + Hello, we are inside a <u>NOTEBOOK</u>... + 50,50d + + + + + + + + + + + + + Hello, we are inside a <u>NOTEBOOK</u>... + 50,50d + + + + + + + 1 + + wxEXPAND + + wxVERTICAL + + + + + wxVERTICAL + + + 200,200d + + Hello, this is an ordinary multiline\n textctrl.... + + + wxEXPAND|wxALL + 10 + + + + + + + 1 + + + + + + + 10 + wxLEFT + + + wxLEFT|wxRIGHT|wxBOTTOM|wxALIGN_RIGHT + 10 + + + Second testing dialog + + +\end{verbatim} + +\subsection{XRC file format}\label{xrcfileformat} + +This section to be written. + +\subsection{Adding new resource handlers}\label{newresourcehandlers} + +This section to be written. + + diff --git a/docs/latex/wx/xmlres.tex b/docs/latex/wx/xmlres.tex new file mode 100644 index 0000000000..214f28ef24 --- /dev/null +++ b/docs/latex/wx/xmlres.tex @@ -0,0 +1,250 @@ +% +% automatically generated by HelpGen $Revision$ from +% xmlres.h at 22/Jan/02 23:08:28 +% + + +\section{\class{wxXmlResource}}\label{wxxmlresource} + + +This class holds XML resources from one or more .xml files +(or derived forms, either binary or zipped -- see manual for +details). + +\wxheading{Derived from} + +\helpref{wxObject}{wxobject} + +\wxheading{Include files} + + + +\wxheading{Data structures} + +\latexignore{\rtfignore{\wxheading{Members}}} + + +\membersection{wxXmlResource::wxXmlResource}\label{wxxmlresourcewxxmlresource} + +\func{}{wxXmlResource}{\param{const wxString\& }{filemask}, \param{int }{flags = wxXRC\_USE\_LOCALE}} + +Constructor. +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) + + +\func{}{wxXmlResource}{\param{int }{flags = wxXRC\_USE\_LOCALE}} + +Constructor. +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) + + +\membersection{wxXmlResource::\destruct{wxXmlResource}}\label{wxxmlresourcedtor} + +\func{}{\destruct{wxXmlResource}}{\void} + +Destructor. + + +\membersection{wxXmlResource::AddHandler}\label{wxxmlresourceaddhandler} + +\func{void}{AddHandler}{\param{wxXmlResourceHandler* }{handler}} + +Initialize only a specific handler (or custom handler). Convention says +that handler name is equal to the control's name plus 'XmlHandler', for example +wxTextCtrlXmlHandler, wxHtmlWindowXmlHandler. The XML resource compiler +(xmlres) can create include file that contains initialization code for +all controls used within the resource. + + +\membersection{wxXmlResource::AttachUnknownControl}\label{wxxmlresourceattachunknowncontrol} + +\func{bool}{AttachUnknownControl}{\param{const wxString\& }{name}, \param{wxWindow* }{control}, \param{wxWindow* }{parent = NULL}} + +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 + + +\membersection{wxXmlResource::CompareVersion}\label{wxxmlresourcecompareversion} + +\constfunc{int}{CompareVersion}{\param{int }{major}, \param{int }{minor}, \param{int }{release}, \param{int }{revision}} + +Compares resources version to argument. Returns -1 if resources 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} + +\func{wxXmlResource*}{Get}{\void} + +Singleton accessors. +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). + + +\membersection{wxXmlResource::GetXMLID}\label{wxxmlresourcegetxmlid} + +\func{int}{GetXMLID}{\param{const wxChar* }{str\_id}} + +Returns a numeric ID that is equivalent to the string id used in an XML +resource. To be used in event tables. +Macro XMLID is provided for convenience + + +\membersection{wxXmlResource::InitAllHandlers}\label{wxxmlresourceinitallhandlers} + +\func{void}{InitAllHandlers}{\void} + +Initialize handlers for all supported controls/windows. This will +make the executable quite big because it forces linking against +most of the wxWindows library. + + +\membersection{wxXmlResource::Load}\label{wxxmlresourceload} + +\func{bool}{Load}{\param{const wxString\& }{filemask}} + +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}} + +Loads a dialog. dlg points to parent window (if any). + + +\func{bool}{LoadDialog}{\param{wxDialog* }{dlg}, \param{wxWindow* }{parent}, \param{const wxString\& }{name}} + +Loads a dialog. dlg points to parent window (if any). This 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(); + + +\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}} + +Loads menubar from resource. Returns NULL on failure. + + +\func{wxMenuBar*}{LoadMenuBar}{\param{const wxString\& }{name}} + +Loads menubar from resource. Returns NULL on failure. + + +\membersection{wxXmlResource::LoadPanel}\label{wxxmlresourceloadpanel} + +\func{wxPanel*}{LoadPanel}{\param{wxWindow* }{parent}, \param{const wxString\& }{name}} + +Loads a panel. panel points to parent window (if any). + + +\func{bool}{LoadPanel}{\param{wxPanel* }{panel}, \param{wxWindow* }{parent}, \param{const wxString\& }{name}} + +Loads a panel. panel points to parent window (if any). This form +is used to finish creation of 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} + +Scans the resources list for unloaded files and loads them. Also reloads +files that have been modified since last loading. + diff --git a/docs/latex/wx/xmlresh.tex b/docs/latex/wx/xmlresh.tex new file mode 100644 index 0000000000..518e558bf1 --- /dev/null +++ b/docs/latex/wx/xmlresh.tex @@ -0,0 +1,257 @@ +% +% automatically generated by HelpGen $Revision$ from +% xmlres.h at 22/Jan/02 23:08:28 +% + +\section{\class{wxXmlResourceHandler}}\label{wxxmlresourcehandler} + +wxXmlResourceHandler is an abstract base class for resource handlers +capable of creating a control from an XML node. + +\wxheading{Derived from} + +\helpref{wxObject}{wxobject} + +\wxheading{Include files} + + + +\wxheading{Data structures} + +\latexignore{\rtfignore{\wxheading{Members}}} + + +\membersection{wxXmlResourceHandler::wxXmlResourceHandler}\label{wxxmlresourcehandlerwxxmlresourcehandler} + +\func{}{wxXmlResourceHandler}{\void} + +Constructor. + + +\membersection{wxXmlResourceHandler::\destruct{wxXmlResourceHandler}}\label{wxxmlresourcehandlerdtor} + +\func{}{\destruct{wxXmlResourceHandler}}{\void} + +Destructor. + + +\membersection{wxXmlResourceHandler::AddStyle}\label{wxxmlresourcehandleraddstyle} + +\func{void}{AddStyle}{\param{const wxString\& }{name}, \param{int }{value}} + +Add a style flag (e.g. wxMB\_DOCKABLE) to the list of flags +understood by this handler. + + +\membersection{wxXmlResourceHandler::AddWindowStyles}\label{wxxmlresourcehandleraddwindowstyles} + +\func{void}{AddWindowStyles}{\void} + +Add styles common to all wxWindow-derived classes. + + +\membersection{wxXmlResourceHandler::CanHandle}\label{wxxmlresourcehandlercanhandle} + +\func{bool}{CanHandle}{\param{wxXmlNode* }{node}} + +Returns TRUE if it understands this node and can create +a resource from it, FALSE otherwise. + + +\membersection{wxXmlResourceHandler::CreateChildren}\label{wxxmlresourcehandlercreatechildren} + +\func{void}{CreateChildren}{\param{wxObject* }{parent}, \param{bool }{this\_hnd\_only = FALSE}} + +Creates children. + + +\membersection{wxXmlResourceHandler::CreateChildrenPrivately}\label{wxxmlresourcehandlercreatechildrenprivately} + +\func{void}{CreateChildrenPrivately}{\param{wxObject* }{parent}, \param{wxXmlNode* }{rootnode = NULL}} + +Helper function. + + +\membersection{wxXmlResourceHandler::CreateResFromNode}\label{wxxmlresourcehandlercreateresfromnode} + +\func{wxObject*}{CreateResFromNode}{\param{wxXmlNode* }{node}, \param{wxObject* }{parent}, \param{wxObject* }{instance = NULL}} + +Creates a resource from a node. + + +\membersection{wxXmlResourceHandler::CreateResource}\label{wxxmlresourcehandlercreateresource} + +\func{wxObject*}{CreateResource}{\param{wxXmlNode* }{node}, \param{wxObject* }{parent}, \param{wxObject* }{instance}} + +Creates an object (menu, dialog, control, ...) from an XML node. +Should check for validity. +parent is a higher-level object (usually window, dialog or panel) +that is often neccessary to create the resource. +If instance is non-NULL it should not create a new instance via 'new' but +should rather use this one, and call its Create method. + + +\membersection{wxXmlResourceHandler::DoCreateResource}\label{wxxmlresourcehandlerdocreateresource} + +\func{wxObject*}{DoCreateResource}{\void} + +This one is called from CreateResource after variables +were filled. + + +\membersection{wxXmlResourceHandler::GetBitmap}\label{wxxmlresourcehandlergetbitmap} + +\func{wxBitmap}{GetBitmap}{\param{const wxString\& }{param = wxT("bitmap")}, \param{wxSize }{size = wxDefaultSize}} + +Gets a bitmap. + + +\membersection{wxXmlResourceHandler::GetBool}\label{wxxmlresourcehandlergetbool} + +\func{bool}{GetBool}{\param{const wxString\& }{param}, \param{bool }{defaultv = FALSE}} + +Gets a bool flag (1, t, yes, on, true are TRUE, everything else is FALSE). + + +\membersection{wxXmlResourceHandler::GetColour}\label{wxxmlresourcehandlergetcolour} + +\func{wxColour}{GetColour}{\param{const wxString\& }{param}} + +Gets colour in HTML syntax (\#RRGGBB). + + +\membersection{wxXmlResourceHandler::GetCurFileSystem}\label{wxxmlresourcehandlergetcurfilesystem} + +\func{wxFileSystem\&}{GetCurFileSystem}{\void} + + +\membersection{wxXmlResourceHandler::GetDimension}\label{wxxmlresourcehandlergetdimension} + +\func{wxCoord}{GetDimension}{\param{const wxString\& }{param}, \param{wxCoord }{defaultv = 0}} + +Gets a dimension (may be in dialog units). + + +\membersection{wxXmlResourceHandler::GetFont}\label{wxxmlresourcehandlergetfont} + +\func{wxFont}{GetFont}{\param{const wxString\& }{param = wxT("font")}} + +Gets a font. + + +\membersection{wxXmlResourceHandler::GetID}\label{wxxmlresourcehandlergetid} + +\func{int}{GetID}{\void} + +Returns the XMLID. + + +\membersection{wxXmlResourceHandler::GetIcon}\label{wxxmlresourcehandlergeticon} + +\func{wxIcon}{GetIcon}{\param{const wxString\& }{param = wxT("icon")}, \param{wxSize }{size = wxDefaultSize}} + +Gets an icon. + + +\membersection{wxXmlResourceHandler::GetLong}\label{wxxmlresourcehandlergetlong} + +\func{long}{GetLong}{\param{const wxString\& }{param}, \param{long }{defaultv = 0}} + +Gets the integer value from the parameter. + + +\membersection{wxXmlResourceHandler::GetName}\label{wxxmlresourcehandlergetname} + +\func{wxString}{GetName}{\void} + +Returns the resource name. + + +\membersection{wxXmlResourceHandler::GetNodeContent}\label{wxxmlresourcehandlergetnodecontent} + +\func{wxString}{GetNodeContent}{\param{wxXmlNode* }{node}} + +Gets node content from wxXML\_ENTITY\_NODE +The problem is, content is represented as +wxXML\_ENTITY\_NODE name="tag", content="" +|-- wxXML\_TEXT\_NODE or +wxXML\_CDATA\_SECTION\_NODE name="" content="content" + + +\membersection{wxXmlResourceHandler::GetParamNode}\label{wxxmlresourcehandlergetparamnode} + +\func{wxXmlNode*}{GetParamNode}{\param{const wxString\& }{param}} + +Finds the node or returns NULL. + + +\membersection{wxXmlResourceHandler::GetParamValue}\label{wxxmlresourcehandlergetparamvalue} + +\func{wxString}{GetParamValue}{\param{const wxString\& }{param}} + +Finds the parameter value or returns the empty string. + + +\membersection{wxXmlResourceHandler::GetPosition}\label{wxxmlresourcehandlergetposition} + +\func{wxPoint}{GetPosition}{\param{const wxString\& }{param = wxT("pos")}} + +Gets the position (may be in dialog units). + + +\membersection{wxXmlResourceHandler::GetSize}\label{wxxmlresourcehandlergetsize} + +\func{wxSize}{GetSize}{\param{const wxString\& }{param = wxT("size")}} + +Gets the size (may be in dialog units). + + +\membersection{wxXmlResourceHandler::GetStyle}\label{wxxmlresourcehandlergetstyle} + +\func{int}{GetStyle}{\param{const wxString\& }{param = wxT("style")}, \param{int }{defaults = 0}} + +Gets style flags from text in form "flag | flag2| flag3 |..." +Only understads flags added with AddStyle + + +\membersection{wxXmlResourceHandler::GetText}\label{wxxmlresourcehandlergettext} + +\func{wxString}{GetText}{\param{const wxString\& }{param}} + +Gets text from param and does some conversions: + +\begin{itemize}\itemsep=0pt +\item replaces $\backslash$n, $\backslash$r, $\backslash$t by respective characters (according to C syntax) +\item replaces \verb+$+ by \verb+\&+ and \verb+\$\$+ by \verb+\$+ (needed for \verb+\$File+ to \verb+\&File+ +translation because of XML syntax) +\item calls wxGetTranslations (unless disabled in wxXmlResource) +\end{itemize} + +\membersection{wxXmlResourceHandler::HasParam}\label{wxxmlresourcehandlerhasparam} + +\func{bool}{HasParam}{\param{const wxString\& }{param}} + +Check to see if a parameter exists. + + +\membersection{wxXmlResourceHandler::IsOfClass}\label{wxxmlresourcehandlerisofclass} + +\func{bool}{IsOfClass}{\param{wxXmlNode* }{node}, \param{const wxString\& }{classname}} + +Convenience function. Returns true if the node has a property class equal to classname, +e.g. . + + +\membersection{wxXmlResourceHandler::SetParentResource}\label{wxxmlresourcehandlersetparentresource} + +\func{void}{SetParentResource}{\param{wxXmlResource* }{res}} + +Sets the parent resource. + + +\membersection{wxXmlResourceHandler::SetupWindow}\label{wxxmlresourcehandlersetupwindow} + +\func{void}{SetupWindow}{\param{wxWindow* }{wnd}} + +Sets common window options. + -- 2.45.2