X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/704a4b7524e05d7bf4d208eb1b30be9989abef4c..b25753b8023decff3e77ec9a4eb3248773e0d94d:/docs/latex/wx/htwinprs.tex diff --git a/docs/latex/wx/htwinprs.tex b/docs/latex/wx/htwinprs.tex index 7737ad0a82..9e32372545 100644 --- a/docs/latex/wx/htwinprs.tex +++ b/docs/latex/wx/htwinprs.tex @@ -6,25 +6,26 @@ \section{\class{wxHtmlWinParser}}\label{wxhtmlwinparser} - -This class is derived from \helpref{wxHtmlParser}{wxhtmlparser} and +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 +\helpref{wxHtmlWindow}{wxhtmlwindow}. It uses 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} - \wxheading{Derived from} \helpref{wxHtmlParser}{wxhtmlparser} + +\wxheading{Include files} + + + \wxheading{See Also} \helpref{Handlers overview}{handlers} @@ -40,18 +41,44 @@ its mail goal is to parse HTML input so that it can be displayed in Constructor. Don't use the default one, use constructor with {\it wnd} paremeter ({\it wnd} is pointer to associated \helpref{wxHtmlWindow}{wxhtmlwindow}) +\membersection{wxHtmlWinParser::AddModule}\label{wxhtmlwinparseraddmodule} -\membersection{wxHtmlWinParser::SetDC}\label{wxhtmlwinparsersetdc} +\func{static void}{AddModule}{\param{wxHtmlTagsModule }{*module}} -\func{virtual void}{SetDC}{\param{wxDC }{*dc}} +Adds \helpref{module}{handlers} to the list of wxHtmlWinParser tag handler. -Sets the DC. This must be called before \helpref{Parse}{wxhtmlparserparse}! +\membersection{wxHtmlWinParser::CloseContainer}\label{wxhtmlwinparserclosecontainer} -\membersection{wxHtmlWinParser::GetDC}\label{wxhtmlwinparsergetdc} +\func{wxHtmlContainerCell*}{CloseContainer}{\void} -\func{wxDC*}{GetDC}{\void} +Closes the container, sets actual container to the parent one +and returns pointer to it (see \helpref{Overview}{cells}). -Returns pointer to the DC used during parsing. +\membersection{wxHtmlWinParser::CreateCurrentFont}\label{wxhtmlwinparsercreatecurrentfont} + +\func{virtual wxFont*}{CreateCurrentFont}{\void} + +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::GetActualColor}\label{wxhtmlwinparsergetactualcolor} + +\constfunc{const wxColour\&}{GetActualColor}{\void} + +Returns actual text color. + +\membersection{wxHtmlWinParser::GetAlign}\label{wxhtmlwinparsergetalign} + +\constfunc{int}{GetAlign}{\void} + +Returns default horizontal alignment. \membersection{wxHtmlWinParser::GetCharHeight}\label{wxhtmlwinparsergetcharheight} @@ -59,8 +86,8 @@ Returns pointer to the DC used during parsing. Returns (average) char height in standard font. It's used as DC-independent metrics. -{\bf Note:} This function doesn't return {\it actual} height. If you wanna -know height of current font, call {\tt GetDC -> GetCharHeight()} +{\bf Note:} This function doesn't return {\it actual} height. If you want to +know the height of the current font, call {\tt GetDC -> GetCharHeight()}. \membersection{wxHtmlWinParser::GetCharWidth}\label{wxhtmlwinparsergetcharwidth} @@ -68,65 +95,59 @@ know height of current font, call {\tt GetDC -> GetCharHeight()} Returns average char width in standard font. It's used as DC-independent metrics. -{\bf Note:} This function doesn't return {\it actual} width. If you wanna -know height of current font, call {\tt GetDC -> GetCharWidth()} +{\bf Note:} This function doesn't return {\it actual} width. If you want to +know the height of the current font, call {\tt GetDC -> GetCharWidth()} -\membersection{wxHtmlWinParser::GetWindow}\label{wxhtmlwinparsergetwindow} +\membersection{wxHtmlWinParser::GetContainer}\label{wxhtmlwinparsergetcontainer} -\func{wxWindow*}{GetWindow}{\void} +\constfunc{wxHtmlContainerCell*}{GetContainer}{\void} -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) +Returns pointer to the currectly opened container (see \helpref{Overview}{cells}). +Common use: +\begin{verbatim} +m_WParser -> GetContainer() -> InsertCell(new ...); +\end{verbatim} -\membersection{wxHtmlWinParser::SetFonts}\label{wxhtmlwinparsersetfonts} +\membersection{wxHtmlWinParser::GetDC}\label{wxhtmlwinparsergetdc} -\func{void}{SetFonts}{\param{wxString }{normal\_face}, \param{int }{normal\_italic\_mode}, \param{wxString }{fixed\_face}, \param{int }{fixed\_italic\_mode}, \param{int }{*sizes}} +\func{wxDC*}{GetDC}{\void} -Sets fonts. This method is identical to \helpref{wxHtmlWindow::SetFonts}{wxhtmlwindowsetfonts} +Returns pointer to the DC used during parsing. -\membersection{wxHtmlWinParser::AddModule}\label{wxhtmlwinparseraddmodule} +\membersection{wxHtmlWinParser::GetEncodingConverter}\label{wxhtmlwinparsergetencodingconverter} -\func{static void}{AddModule}{\param{wxHtmlTagsModule }{*module}} +\constfunc{wxEncodingConverter *}{GetEncodingConverter}{\void} -Adds \helpref{module}{handlers} to the list of wxHtmlWinParser tag handler. +Returns \helpref{wxEncodingConverter}{wxencodingconverter} class used +to do conversion between \helpref{input encoding}{wxhtmlwinparsergetinputencoding} +and \helpref{output encoding}{wxhtmlwinparsergetoutputencoding}. +\membersection{wxHtmlWinParser::GetFontBold}\label{wxhtmlwinparsergetfontbold} -\membersection{wxHtmlWinParser::GetContainer}\label{wxhtmlwinparsergetcontainer} +\constfunc{int}{GetFontBold}{\void} -\constfunc{wxHtmlContainerCell*}{GetContainer}{\void} +Returns TRUE if actual font is bold, FALSE otherwise. -Returns pointer to the currectly opened container (see \helpref{Overview}{cells}). -Common use: +\membersection{wxHtmlWinParser::GetFontFace}\label{wxhtmlwinparsergetfontface} -\begin{verbatim} -m_WParser -> GetContainer() -> InsertCell(new ...); -\end{verbatim} +\constfunc{wxString}{GetFontFace}{\void} -\membersection{wxHtmlWinParser::OpenContainer}\label{wxhtmlwinparseropencontainer} +Returns actual font face name. -\func{wxHtmlContainerCell*}{OpenContainer}{\void} -Opens new container and returns pointer to it (see \helpref{Overview}{cells}). +\membersection{wxHtmlWinParser::GetFontFixed}\label{wxhtmlwinparsergetfontfixed} -% -%\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. -% +\constfunc{int}{GetFontFixed}{\void} -\membersection{wxHtmlWinParser::CloseContainer}\label{wxhtmlwinparserclosecontainer} +Returns TRUE if actual font is fixed face, FALSE otherwise. -\func{wxHtmlContainerCell*}{CloseContainer}{\void} +\membersection{wxHtmlWinParser::GetFontItalic}\label{wxhtmlwinparsergetfontitalic} -Closes the container, sets actual container to the parent one -and returns pointer to it (see \helpref{Overview}{cells}). +\constfunc{int}{GetFontItalic}{\void} +Returns TRUE if actual font is italic, FALSE otherwise. \membersection{wxHtmlWinParser::GetFontSize}\label{wxhtmlwinparsergetfontsize} @@ -135,127 +156,161 @@ and returns pointer to it (see \helpref{Overview}{cells}). Returns actual font size (HTML size varies from -2 to +4) -\membersection{wxHtmlWinParser::SetFontSize}\label{wxhtmlwinparsersetfontsize} - -\func{void}{SetFontSize}{\param{int }{s}} - -Sets actual font size (HTML size varies from -2 to +4) +\membersection{wxHtmlWinParser::GetFontUnderlined}\label{wxhtmlwinparsergetfontunderlined} -\membersection{wxHtmlWinParser::GetFontBold}\label{wxhtmlwinparsergetfontbold} +\constfunc{int}{GetFontUnderlined}{\void} -\constfunc{int}{GetFontBold}{\void} +Returns TRUE if actual font is underlined, FALSE otherwise. -Returns TRUE if actual font is bold, FALSE otherwise. +\membersection{wxHtmlWinParser::GetInputEncoding}\label{wxhtmlwinparsergetinputencoding} -\membersection{wxHtmlWinParser::SetFontBold}\label{wxhtmlwinparsersetfontbold} +\constfunc{wxFontEncoding}{GetInputEncoding}{\void} -\func{void}{SetFontBold}{\param{int }{x}} +Returns input encoding. -Sets bold flag of actualfont. {\it x} is either TRUE of FALSE. -\membersection{wxHtmlWinParser::GetFontItalic}\label{wxhtmlwinparsergetfontitalic} +\membersection{wxHtmlWinParser::GetLink}\label{wxhtmlwinparsergetlink} -\constfunc{int}{GetFontItalic}{\void} +\constfunc{const wxHtmlLinkInfo\&}{GetLink}{\void} -Returns TRUE if actual font is italic, FALSE otherwise. +Returns actual hypertext link. (This value has non-empty +\helpref{Href}{wxhtmllinkinfogethref} string +if the parser is between {\tt } and {\tt } tags, +wxEmptyString otherwise.) -\membersection{wxHtmlWinParser::SetFontItalic}\label{wxhtmlwinparsersetfontitalic} +\membersection{wxHtmlWinParser::GetLinkColor}\label{wxhtmlwinparsergetlinkcolor} -\func{void}{SetFontItalic}{\param{int }{x}} +\constfunc{const wxColour\&}{GetLinkColor}{\void} -Sets italic flag of actualfont. {\it x} is either TRUE of FALSE. +Returns color of hypertext link text. -\membersection{wxHtmlWinParser::GetFontUnderlined}\label{wxhtmlwinparsergetfontunderlined} -\constfunc{int}{GetFontUnderlined}{\void} +\membersection{wxHtmlWinParser::GetOutputEncoding}\label{wxhtmlwinparsergetoutputencoding} -Returns TRUE if actual font is underlined, FALSE otherwise. +\constfunc{wxFontEncoding}{GetOutputEncoding}{\void} -\membersection{wxHtmlWinParser::SetFontUnderlined}\label{wxhtmlwinparsersetfontunderlined} +Returns output encoding, i.e. closest match to document's input encoding +that is supported by operating system. -\func{void}{SetFontUnderlined}{\param{int }{x}} +\membersection{wxHtmlWinParser::GetWindow}\label{wxhtmlwinparsergetwindow} -Sets underlined flag of actualfont. {\it x} is either TRUE of FALSE. +\func{wxWindow*}{GetWindow}{\void} -\membersection{wxHtmlWinParser::GetFontFixed}\label{wxhtmlwinparsergetfontfixed} +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}{GetFontFixed}{\void} -Returns TRUE if actual font is fixed face, FALSE otherwise. +\membersection{wxHtmlWinParser::OpenContainer}\label{wxhtmlwinparseropencontainer} -\membersection{wxHtmlWinParser::SetFontFixed}\label{wxhtmlwinparsersetfontfixed} +\func{wxHtmlContainerCell*}{OpenContainer}{\void} -\func{void}{SetFontFixed}{\param{int }{x}} +Opens new container and returns pointer to it (see \helpref{Overview}{cells}). -Sets fixed face flag of actualfont. {\it x} is either TRUE of FALSE. -\membersection{wxHtmlWinParser::GetAlign}\label{wxhtmlwinparsergetalign} +\membersection{wxHtmlWinParser::SetActualColor}\label{wxhtmlwinparsersetactualcolor} -\constfunc{int}{GetAlign}{\void} +\func{void}{SetActualColor}{\param{const wxColour\& }{clr}} -Returns default horizontal alignment. +Sets actual text color. Note: this DOESN'T change the color! +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} -\constfunc{const wxColour\&}{GetLinkColor}{\void} +\membersection{wxHtmlWinParser::SetContainer}\label{wxhtmlwinparsersetcontainer} -Returns color of hypertext link text. +\func{wxHtmlContainerCell*}{SetContainer}{\param{wxHtmlContainerCell *}{c}} -\membersection{wxHtmlWinParser::SetLinkColor}\label{wxhtmlwinparsersetlinkcolor} +Allows you to directly set opened container. This is not recommended - you should use OpenContainer +whereever possible. -\func{void}{SetLinkColor}{\param{const wxColour\& }{clr}} -Sets color of hypertext link. +\membersection{wxHtmlWinParser::SetDC}\label{wxhtmlwinparsersetdc} -\membersection{wxHtmlWinParser::GetActualColor}\label{wxhtmlwinparsergetactualcolor} +\func{virtual void}{SetDC}{\param{wxDC }{*dc}, \param{double }{pixel\_scale = 1.0}} -\constfunc{const wxColour\&}{GetActualColor}{\void} +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.) -Returns actual text color. -\membersection{wxHtmlWinParser::SetActualColor}\label{wxhtmlwinparsersetactualcolor} +\membersection{wxHtmlWinParser::SetFontBold}\label{wxhtmlwinparsersetfontbold} -\func{void}{SetActualColor}{\param{const wxColour\& }{clr}} +\func{void}{SetFontBold}{\param{int }{x}} -Sets actual text color. Note: this DOESN'T change the color! -You must create \helpref{wxHtmlColourCell}{wxhtmlcolourcell} yourself. +Sets bold flag of actualfont. {\it x} is either TRUE of FALSE. -\membersection{wxHtmlWinParser::GetLink}\label{wxhtmlwinparsergetlink} +\membersection{wxHtmlWinParser::SetFontFace}\label{wxhtmlwinparsersetfontface} -\constfunc{const wxString\&}{GetLink}{\void} +\func{void}{SetFontFace}{\param{const wxString\& }{face}} -Returns actual hypertext link. (This value is non-empty string -if the parser is between {\tt } and {\tt } tags, -wxEmptyString otherwise. +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::SetFontFixed}\label{wxhtmlwinparsersetfontfixed} + +\func{void}{SetFontFixed}{\param{int }{x}} + +Sets fixed face flag of actualfont. {\it x} is either TRUE of FALSE. + +\membersection{wxHtmlWinParser::SetFontItalic}\label{wxhtmlwinparsersetfontitalic} + +\func{void}{SetFontItalic}{\param{int }{x}} + +Sets italic flag of actualfont. {\it x} is either TRUE of FALSE. + + +\membersection{wxHtmlWinParser::SetFontSize}\label{wxhtmlwinparsersetfontsize} + +\func{void}{SetFontSize}{\param{int }{s}} + +Sets actual font size (HTML size varies from 1 to 7) + +\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}} + +Sets fonts. This method is identical to \helpref{wxHtmlWindow::SetFonts}{wxhtmlwindowsetfonts} + + +\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 wxString\& }{link}} +\func{void}{SetLink}{\param{const wxHtmlLinkInfo\& }{link}} -Sets actual hypertext link. wxEmptyString means no link. +Sets actual hypertext link. Empty link is represented +by \helpref{wxHtmlLinkInfo}{wxhtmllinkinfo} with {\it Href} equal +to wxEmptyString. -\membersection{wxHtmlWinParser::CreateCurrentFont}\label{wxhtmlwinparsercreatecurrentfont} +\membersection{wxHtmlWinParser::SetLinkColor}\label{wxhtmlwinparsersetlinkcolor} -\func{virtual wxFont*}{CreateCurrentFont}{\void} +\func{void}{SetLinkColor}{\param{const wxColour\& }{clr}} + +Sets color of hypertext link. -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.) -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!