X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/22d6efa851642c6a69174278fc50f712f41e2271..933b675ed41f626e6573a0c9c402acbc0283d2da:/docs/latex/wx/htwinprs.tex?ds=sidebyside diff --git a/docs/latex/wx/htwinprs.tex b/docs/latex/wx/htwinprs.tex index 0fa178d9df..5260ccd2d4 100644 --- a/docs/latex/wx/htwinprs.tex +++ b/docs/latex/wx/htwinprs.tex @@ -5,23 +5,23 @@ \section{\class{wxHtmlWinParser}}\label{wxhtmlwinparser} -This class is derived from \helpref{wxHtmlParser}{wxhtmlparser} and -its mail goal is to parse HTML input so that it can be displayed in -\helpref{wxHtmlWindow}{wxhtmlwindow}. It uses special +This class is derived from \helpref{wxHtmlParser}{wxhtmlparser} and +its main goal is to parse HTML input so that it can be displayed in +\helpref{wxHtmlWindow}{wxhtmlwindow}. It uses a special \helpref{wxHtmlWinTagHandler}{wxhtmlwintaghandler}. \wxheading{Notes} -\begin{enumerate} -\item Product of parsing is wxHtmlCell (resp. wxHtmlContainer) object. -\item This parser produces temporary data! You should call -\helpref{delete GetTempData()}{wxhtmlparsergettempdata}! -\end{enumerate} +The product of parsing is a wxHtmlCell (resp. wxHtmlContainer) object. \wxheading{Derived from} \helpref{wxHtmlParser}{wxhtmlparser} +\wxheading{Include files} + + + \wxheading{See Also} \helpref{Handlers overview}{handlers} @@ -32,223 +32,267 @@ its mail goal is to parse HTML input so that it can be displayed in \func{}{wxHtmlWinParser}{\void} -\func{}{wxHtmlWinParser}{\param{wxWindow }{*wnd}} +\func{}{wxHtmlWinParser}{\param{wxHtmlWindow }{*wnd}} Constructor. Don't use the default one, use constructor with -{\it wnd} paremeter ({\it wnd} is pointer to associated \helpref{wxHtmlWindow}{wxhtmlwindow}) +{\it wnd} parameter ({\it wnd} is pointer to associated \helpref{wxHtmlWindow}{wxhtmlwindow}) -\membersection{wxHtmlWinParser::SetDC}\label{wxhtmlwinparsersetdc} +\membersection{wxHtmlWinParser::AddModule}\label{wxhtmlwinparseraddmodule} -\func{virtual void}{SetDC}{\param{wxDC }{*dc}} +\func{static void}{AddModule}{\param{wxHtmlTagsModule }{*module}} -Sets the DC. This must be called before \helpref{Parse}{wxhtmlparserparse}! +Adds \helpref{module}{handlers} to the list of wxHtmlWinParser tag handler. -\membersection{wxHtmlWinParser::GetDC}\label{wxhtmlwinparsergetdc} +\membersection{wxHtmlWinParser::CloseContainer}\label{wxhtmlwinparserclosecontainer} -\func{wxDC*}{GetDC}{\void} +\func{wxHtmlContainerCell*}{CloseContainer}{\void} -Returns pointer to the DC used during parsing. +Closes the container, sets actual container to the parent one +and returns pointer to it (see \helpref{Overview}{cells}). -\membersection{wxHtmlWinParser::GetCharHeight}\label{wxhtmlwinparsergetcharheight} +\membersection{wxHtmlWinParser::CreateCurrentFont}\label{wxhtmlwinparsercreatecurrentfont} -\constfunc{int}{GetCharHeight}{\void} +\func{virtual wxFont*}{CreateCurrentFont}{\void} -Returns (average) char height in standard font. It's used as DC-independent metrics. +Creates font based on current setting (see +\helpref{SetFontSize}{wxhtmlwinparsersetfontsize}, +\helpref{SetFontBold}{wxhtmlwinparsersetfontbold}, +\helpref{SetFontItalic}{wxhtmlwinparsersetfontitalic}, +\helpref{SetFontFixed}{wxhtmlwinparsersetfontfixed}, +\helpref{SetFontUnderlined}{wxhtmlwinparsersetfontunderlined}) +and returns pointer to it. +If the font was already created only a pointer is returned. -{\bf Note:} This function doesn't return {\it actual} height. If you wanna -know height of current font, call {\tt GetDC -> GetCharHeight()} -\membersection{wxHtmlWinParser::GetCharWidth}\label{wxhtmlwinparsergetcharwidth} +\membersection{wxHtmlWinParser::GetActualColor}\label{wxhtmlwinparsergetactualcolor} -\constfunc{int}{GetCharWidth}{\void} +\constfunc{const wxColour\&}{GetActualColor}{\void} -Returns average char width in standard font. It's used as DC-independent metrics. +Returns actual text colour. -{\bf Note:} This function doesn't return {\it actual} width. If you wanna -know height of current font, call {\tt GetDC -> GetCharWidth()} +\membersection{wxHtmlWinParser::GetAlign}\label{wxhtmlwinparsergetalign} -\membersection{wxHtmlWinParser::GetWindow}\label{wxhtmlwinparsergetwindow} +\constfunc{int}{GetAlign}{\void} -\func{wxWindow*}{GetWindow}{\void} +Returns default horizontal alignment. -Returns associated window (wxHtmlWindow). This may be NULL! (You should always -test if it is non-NULL. For example {\tt TITLE} handler sets window -title only if some window is associated, otherwise it does nothing) +\membersection{wxHtmlWinParser::GetCharHeight}\label{wxhtmlwinparsergetcharheight} +\constfunc{int}{GetCharHeight}{\void} -\membersection{wxHtmlWinParser::SetFonts}\label{wxhtmlwinparsersetfonts} +Returns (average) char height in standard font. It is used as DC-independent metrics. -\func{void}{SetFonts}{\param{wxString }{normal\_face}, \param{int }{normal\_italic\_mode}, \param{wxString }{fixed\_face}, \param{int }{fixed\_italic\_mode}, \param{int }{*sizes}} +{\bf Note:} This function doesn't return the {\it actual} height. If you want to +know the height of the current font, call {\tt GetDC -> GetCharHeight()}. -Sets fonts. This method is identical to \helpref{wxHtmlWindow::SetFonts}{wxhtmlwindowsetfonts} +\membersection{wxHtmlWinParser::GetCharWidth}\label{wxhtmlwinparsergetcharwidth} -\membersection{wxHtmlWinParser::AddModule}\label{wxhtmlwinparseraddmodule} +\constfunc{int}{GetCharWidth}{\void} -\func{static void}{AddModule}{\param{wxHtmlTagsModule }{*module}} +Returns average char width in standard font. It is used as DC-independent metrics. -Adds \helpref{module}{handlers} to the list of wxHtmlWinParser tag handler. +{\bf Note:} This function doesn't return the {\it actual} width. If you want to +know the height of the current font, call {\tt GetDC -> GetCharWidth()} \membersection{wxHtmlWinParser::GetContainer}\label{wxhtmlwinparsergetcontainer} \constfunc{wxHtmlContainerCell*}{GetContainer}{\void} -Returns pointer to the currectly opened container (see \helpref{Overview}{cells}). +Returns pointer to the currently opened container (see \helpref{Overview}{cells}). Common use: \begin{verbatim} m_WParser -> GetContainer() -> InsertCell(new ...); \end{verbatim} -\membersection{wxHtmlWinParser::OpenContainer}\label{wxhtmlwinparseropencontainer} +\membersection{wxHtmlWinParser::GetDC}\label{wxhtmlwinparsergetdc} -\func{wxHtmlContainerCell*}{OpenContainer}{\void} +\func{wxDC*}{GetDC}{\void} -Opens new container and returns pointer to it (see \helpref{Overview}{cells}). +Returns pointer to the DC used during parsing. -% -%\membersection{wxHtmlWinParser::SetContainer}\label{wxhtmlwinparsersetcontainer} -% -%\func{wxHtmlContainerCell*}{SetContainer}{\param{wxHtmlContainerCell *}{c}} -% -%Allows you to directly set opened container. This is not recommended - you should use OpenContainer -%whereever possible. -% +\membersection{wxHtmlWinParser::GetEncodingConverter}\label{wxhtmlwinparsergetencodingconverter} -\membersection{wxHtmlWinParser::CloseContainer}\label{wxhtmlwinparserclosecontainer} +\constfunc{wxEncodingConverter *}{GetEncodingConverter}{\void} -\func{wxHtmlContainerCell*}{CloseContainer}{\void} +Returns \helpref{wxEncodingConverter}{wxencodingconverter} class used +to do conversion between \helpref{input encoding}{wxhtmlwinparsergetinputencoding} +and \helpref{output encoding}{wxhtmlwinparsergetoutputencoding}. -Closes the container, sets actual container to the parent one -and returns pointer to it (see \helpref{Overview}{cells}). +\membersection{wxHtmlWinParser::GetFontBold}\label{wxhtmlwinparsergetfontbold} -\membersection{wxHtmlWinParser::GetFontSize}\label{wxhtmlwinparsergetfontsize} +\constfunc{int}{GetFontBold}{\void} -\constfunc{int}{GetFontSize}{\void} +Returns true if actual font is bold, false otherwise. -Returns actual font size (HTML size varies from -2 to +4) +\membersection{wxHtmlWinParser::GetFontFace}\label{wxhtmlwinparsergetfontface} -\membersection{wxHtmlWinParser::SetFontSize}\label{wxhtmlwinparsersetfontsize} +\constfunc{wxString}{GetFontFace}{\void} -\func{void}{SetFontSize}{\param{int }{s}} +Returns actual font face name. -Sets actual font size (HTML size varies from -2 to +4) +\membersection{wxHtmlWinParser::GetFontFixed}\label{wxhtmlwinparsergetfontfixed} -\membersection{wxHtmlWinParser::GetFontBold}\label{wxhtmlwinparsergetfontbold} +\constfunc{int}{GetFontFixed}{\void} -\constfunc{int}{GetFontBold}{\void} +Returns true if actual font is fixed face, false otherwise. -Returns TRUE if actual font is bold, FALSE otherwise. +\membersection{wxHtmlWinParser::GetFontItalic}\label{wxhtmlwinparsergetfontitalic} -\membersection{wxHtmlWinParser::SetFontBold}\label{wxhtmlwinparsersetfontbold} +\constfunc{int}{GetFontItalic}{\void} -\func{void}{SetFontBold}{\param{int }{x}} +Returns true if actual font is italic, false otherwise. -Sets bold flag of actualfont. {\it x} is either TRUE of FALSE. +\membersection{wxHtmlWinParser::GetFontSize}\label{wxhtmlwinparsergetfontsize} -\membersection{wxHtmlWinParser::GetFontItalic}\label{wxhtmlwinparsergetfontitalic} +\constfunc{int}{GetFontSize}{\void} -\constfunc{int}{GetFontItalic}{\void} +Returns actual font size (HTML size varies from -2 to +4) -Returns TRUE if actual font is italic, FALSE otherwise. +\membersection{wxHtmlWinParser::GetFontUnderlined}\label{wxhtmlwinparsergetfontunderlined} +\constfunc{int}{GetFontUnderlined}{\void} -\membersection{wxHtmlWinParser::SetFontItalic}\label{wxhtmlwinparsersetfontitalic} +Returns true if actual font is underlined, false otherwise. -\func{void}{SetFontItalic}{\param{int }{x}} +\membersection{wxHtmlWinParser::GetInputEncoding}\label{wxhtmlwinparsergetinputencoding} -Sets italic flag of actualfont. {\it x} is either TRUE of FALSE. +\constfunc{wxFontEncoding}{GetInputEncoding}{\void} -\membersection{wxHtmlWinParser::GetFontUnderlined}\label{wxhtmlwinparsergetfontunderlined} +Returns input encoding. -\constfunc{int}{GetFontUnderlined}{\void} +\membersection{wxHtmlWinParser::GetLink}\label{wxhtmlwinparsergetlink} -Returns TRUE if actual font is underlined, FALSE otherwise. +\constfunc{const wxHtmlLinkInfo\&}{GetLink}{\void} -\membersection{wxHtmlWinParser::SetFontUnderlined}\label{wxhtmlwinparsersetfontunderlined} +Returns actual hypertext link. (This value has a non-empty +\helpref{Href}{wxhtmllinkinfogethref} string +if the parser is between {\tt } and {\tt } tags, +wxEmptyString otherwise.) -\func{void}{SetFontUnderlined}{\param{int }{x}} +\membersection{wxHtmlWinParser::GetLinkColor}\label{wxhtmlwinparsergetlinkcolor} -Sets underlined flag of actualfont. {\it x} is either TRUE of FALSE. +\constfunc{const wxColour\&}{GetLinkColor}{\void} -\membersection{wxHtmlWinParser::GetFontFixed}\label{wxhtmlwinparsergetfontfixed} +Returns the colour of hypertext link text. -\constfunc{int}{GetFontFixed}{\void} +\membersection{wxHtmlWinParser::GetOutputEncoding}\label{wxhtmlwinparsergetoutputencoding} -Returns TRUE if actual font is fixed face, FALSE otherwise. +\constfunc{wxFontEncoding}{GetOutputEncoding}{\void} -\membersection{wxHtmlWinParser::SetFontFixed}\label{wxhtmlwinparsersetfontfixed} +Returns output encoding, i.e. closest match to document's input encoding +that is supported by operating system. -\func{void}{SetFontFixed}{\param{int }{x}} +\membersection{wxHtmlWinParser::GetWindow}\label{wxhtmlwinparsergetwindow} -Sets fixed face flag of actualfont. {\it x} is either TRUE of FALSE. +\func{wxHtmlWindow*}{GetWindow}{\void} -\membersection{wxHtmlWinParser::GetAlign}\label{wxhtmlwinparsergetalign} +Returns associated window (wxHtmlWindow). This may be NULL! (You should always +test if it is non-NULL. For example {\tt TITLE} handler sets window +title only if some window is associated, otherwise it does nothing) -\constfunc{int}{GetAlign}{\void} +\membersection{wxHtmlWinParser::OpenContainer}\label{wxhtmlwinparseropencontainer} -Returns default horizontal alignment. +\func{wxHtmlContainerCell*}{OpenContainer}{\void} + +Opens new container and returns pointer to it (see \helpref{Overview}{cells}). + +\membersection{wxHtmlWinParser::SetActualColor}\label{wxhtmlwinparsersetactualcolor} + +\func{void}{SetActualColor}{\param{const wxColour\& }{clr}} + +Sets actual text colour. Note: this DOESN'T change the colour! +You must create \helpref{wxHtmlColourCell}{wxhtmlcolourcell} yourself. \membersection{wxHtmlWinParser::SetAlign}\label{wxhtmlwinparsersetalign} \func{void}{SetAlign}{\param{int }{a}} -Sets default horizontal alignment (see \helpref{wxHtmlContainerCell::SetAlignHor}{wxhtmlcontainercellsetalignhor}. +Sets default horizontal alignment (see +\helpref{wxHtmlContainerCell::SetAlignHor}{wxhtmlcontainercellsetalignhor}.) Alignment of newly opened container is set to this value. -\membersection{wxHtmlWinParser::GetLinkColor}\label{wxhtmlwinparsergetlinkcolor} +\membersection{wxHtmlWinParser::SetContainer}\label{wxhtmlwinparsersetcontainer} -\constfunc{const wxColour\&}{GetLinkColor}{\void} +\func{wxHtmlContainerCell*}{SetContainer}{\param{wxHtmlContainerCell *}{c}} -Returns color of hypertext link text. +Allows you to directly set opened container. This is not recommended - you should use OpenContainer +wherever possible. -\membersection{wxHtmlWinParser::SetLinkColor}\label{wxhtmlwinparsersetlinkcolor} +\membersection{wxHtmlWinParser::SetDC}\label{wxhtmlwinparsersetdc} -\func{void}{SetLinkColor}{\param{const wxColour\& }{clr}} +\func{virtual void}{SetDC}{\param{wxDC }{*dc}, \param{double }{pixel\_scale = 1.0}} -Sets color of hypertext link. +Sets the DC. This must be called before \helpref{Parse}{wxhtmlparserparse}! +{\it pixel\_scale} can be used when rendering to high-resolution +DCs (e.g. printer) to adjust size of pixel metrics. (Many dimensions in +HTML are given in pixels -- e.g. image sizes. 300x300 image would be only one +inch wide on typical printer. With pixel\_scale = 3.0 it would be 3 inches.) -\membersection{wxHtmlWinParser::GetActualColor}\label{wxhtmlwinparsergetactualcolor} +\membersection{wxHtmlWinParser::SetFontBold}\label{wxhtmlwinparsersetfontbold} -\constfunc{const wxColour\&}{GetActualColor}{\void} +\func{void}{SetFontBold}{\param{int }{x}} -Returns actual text color. +Sets bold flag of actualfont. {\it x} is either true of false. -\membersection{wxHtmlWinParser::SetActualColor}\label{wxhtmlwinparsersetactualcolor} +\membersection{wxHtmlWinParser::SetFontFace}\label{wxhtmlwinparsersetfontface} -\func{void}{SetActualColor}{\param{const wxColour\& }{clr}} +\func{void}{SetFontFace}{\param{const wxString\& }{face}} -Sets actual text color. Note: this DOESN'T change the color! -You must create \helpref{wxHtmlColourCell}{wxhtmlcolourcell} yourself. +Sets current font face to {\it face}. This affects either fixed size +font or proportional, depending on context (whether the parser is +inside {\tt } tag or not). -\membersection{wxHtmlWinParser::GetLink}\label{wxhtmlwinparsergetlink} +\membersection{wxHtmlWinParser::SetFontFixed}\label{wxhtmlwinparsersetfontfixed} -\constfunc{const wxString\&}{GetLink}{\void} +\func{void}{SetFontFixed}{\param{int }{x}} -Returns actual hypertext link. (This value is non-empty string -if the parser is between {\tt } and {\tt } tags, -wxEmptyString otherwise. +Sets fixed face flag of actualfont. {\it x} is either true of false. +\membersection{wxHtmlWinParser::SetFontItalic}\label{wxhtmlwinparsersetfontitalic} -\membersection{wxHtmlWinParser::SetLink}\label{wxhtmlwinparsersetlink} +\func{void}{SetFontItalic}{\param{int }{x}} -\func{void}{SetLink}{\param{const wxString\& }{link}} +Sets italic flag of actualfont. {\it x} is either true of false. -Sets actual hypertext link. wxEmptyString means no link. +\membersection{wxHtmlWinParser::SetFontSize}\label{wxhtmlwinparsersetfontsize} -\membersection{wxHtmlWinParser::CreateCurrentFont}\label{wxhtmlwinparsercreatecurrentfont} +\func{void}{SetFontSize}{\param{int }{s}} -\func{virtual wxFont*}{CreateCurrentFont}{\void} +Sets actual font size (HTML size varies from 1 to 7) -Creates font based on current setting (see -\helpref{SetFontSize}{wxhtmlwinparsersetfontsize}, -\helpref{SetFontBold}{wxhtmlwinparsersetfontbold}, -\helpref{SetFontItalic}{wxhtmlwinparsersetfontitalic}, -\helpref{SetFontFixed}{wxhtmlwinparsersetfontfixed}, -\helpref{SetFontUnderlined}{wxhtmlwinparsersetfontunderlined}) -and returns pointer to it. -(If the font was already created only a pointer is returned.) +\membersection{wxHtmlWinParser::SetFontUnderlined}\label{wxhtmlwinparsersetfontunderlined} + +\func{void}{SetFontUnderlined}{\param{int }{x}} + +Sets underlined flag of actualfont. {\it x} is either true of false. + +\membersection{wxHtmlWinParser::SetFonts}\label{wxhtmlwinparsersetfonts} + +\func{void}{SetFonts}{\param{wxString }{normal\_face}, \param{wxString }{fixed\_face}, \param{const int }{*sizes = NULL}} + +Sets fonts. See \helpref{wxHtmlWindow::SetFonts}{wxhtmlwindowsetfonts} for +detailed description. + +\membersection{wxHtmlWinParser::SetInputEncoding}\label{wxhtmlwinparsersetinputencoding} + +\func{void}{SetInputEncoding}{\param{wxFontEncoding }{enc}} + +Sets input encoding. The parser uses this information to build conversion +tables from document's encoding to some encoding supported by operating +system. + +\membersection{wxHtmlWinParser::SetLink}\label{wxhtmlwinparsersetlink} + +\func{void}{SetLink}{\param{const wxHtmlLinkInfo\& }{link}} + +Sets actual hypertext link. Empty link is represented +by \helpref{wxHtmlLinkInfo}{wxhtmllinkinfo} with {\it Href} equal +to wxEmptyString. + +\membersection{wxHtmlWinParser::SetLinkColor}\label{wxhtmlwinparsersetlinkcolor} + +\func{void}{SetLinkColor}{\param{const wxColour\& }{clr}} -Fonts created during parsing are temporary data and are not freed on DoneParser. -You must call \helpref{delete myparser->GetTempData();}{wxhtmlparsergettempdata} -to free the memory! +Sets colour of hypertext link.