]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/htmllbox.tex
added TGA handler (somewhat modified patch 1393912)
[wxWidgets.git] / docs / latex / wx / htmllbox.tex
CommitLineData
e0c6027b
VZ
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Name: htmllbox.tex
9ebb7cad 3%% Purpose: wxHtmlListBox and wxSimpleHtmlListBox documentation
e0c6027b
VZ
4%% Author: Vadim Zeitlin
5%% Modified by:
6%% Created: 01.06.03
7%% RCS-ID: $Id$
8%% Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
8795498c 9%% License: wxWindows license
e0c6027b
VZ
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12\section{\class{wxHtmlListBox}}\label{wxhtmllistbox}
13
14wxHtmlListBox is an implementation of \helpref{wxVListBox}{wxvlistbox} which
15shows HTML content in the listbox rows. This is still an abstract base class
16and you will need to derive your own class from it (see htlbox sample for the
410bfc93 17example) but you will only need to override a single
e0c6027b
VZ
18\helpref{OnGetItem()}{wxhtmllistboxongetitem} function.
19
20\wxheading{Derived from}
21
410bfc93
WS
22\helpref{wxVListBox}{wxvlistbox}\\
23\helpref{wxVScrolledWindow}{wxvscrolledwindow}\\
24\helpref{wxPanel}{wxpanel}\\
25\helpref{wxWindow}{wxwindow}\\
26\helpref{wxEvtHandler}{wxevthandler}\\
27\helpref{wxObject}{wxobject}
e0c6027b
VZ
28
29\wxheading{Include files}
30
31<wx/htmllbox.h>
32
9ebb7cad
VZ
33\wxheading{See also}
34
35\helpref{wxSimpleHtmlListBox}{wxsimplehtmllistbox}
36
e0c6027b
VZ
37
38\latexignore{\rtfignore{\wxheading{Members}}}
39
40
41\membersection{wxHtmlListBox::wxHtmlListBox}\label{wxhtmllistboxwxhtmllistbox}
42
9ebb7cad 43\func{}{wxHtmlListBox}{\param{wxWindow* }{parent}, \param{wxWindowID }{id = wxID\_ANY}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize}, \param{long }{style = 0}, \param{const wxString\& }{name = wxHtmlListBoxNameStr}}
e0c6027b
VZ
44
45Normal constructor which calls \helpref{Create()}{wxhtmllistboxcreate}
46internally.
47
48\func{}{wxHtmlListBox}{\void}
49
50Default constructor, you must call \helpref{Create()}{wxhtmllistboxcreate}
51later.
52
53
54\membersection{wxHtmlListBox::\destruct{wxHtmlListBox}}\label{wxhtmllistboxdtor}
55
56\func{}{\destruct{wxHtmlListBox}}{\void}
57
58Destructor cleans up whatever resources we use.
59
60
61\membersection{wxHtmlListBox::Create}\label{wxhtmllistboxcreate}
62
9ebb7cad 63\func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID }{id = wxID\_ANY}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize}, \param{long }{style = 0}, \param{const wxString\& }{name = wxHtmlListBoxNameStr}}
e0c6027b
VZ
64
65Creates the control and optionally sets the initial number of items in it
410bfc93 66(it may also be set or changed later with
e0c6027b
VZ
67\helpref{SetItemCount()}{wxvlistboxsetitemcount}).
68
69There are no special styles defined for wxHtmlListBox, in particular the
9ebb7cad 70wxListBox styles (with the exception of {\tt wxLB_MULTIPLE}) can not be used here.
e0c6027b
VZ
71
72Returns {\tt true} on success or {\tt false} if the control couldn't be created
73
74
2d814c19
VZ
75\membersection{wxHtmlListBox::GetFileSystem}\label{wxhtmllistboxgetfilesystem}
76
77\func{wxFileSystem\&}{GetFileSystem}{\void}
78
79\constfunc{const wxFileSystem\&}{GetFileSystem}{\void}
80
81Returns the \helpref{wxFileSystem}{wxfilesystem} used by the HTML parser of
82this object. The file system object is used to resolve the paths in HTML
410bfc93 83fragments displayed in the control and you should use
2d814c19
VZ
84\helpref{wxFileSystem::ChangePathTo}{wxfilesystemchangepathto} if you use
85relative paths for the images or other resources embedded in your HTML.
86
87
9a9b4940
VZ
88\membersection{wxHtmlListBox::GetSelectedTextBgColour}\label{wxhtmllistboxgetselectedtextbgcolour}
89
90\constfunc{wxColour}{GetSelectedTextBgColour}{\param{const wxColour\& }{colBg}}
91
92This virtual function may be overridden to change the appearance of the
410bfc93 93background of the selected cells in the same way as
9a9b4940
VZ
94\helpref{GetSelectedTextColour}{wxhtmllistboxgetselectedtextcolour}.
95
410bfc93 96It should be rarely, if ever, used because
9a9b4940
VZ
97\helpref{SetSelectionBackground}{wxvlistboxsetselectionbackground} allows to
98change the selection background for all cells at once and doing anything more
99fancy is probably going to look strangely.
100
101\wxheading{See also}
102
103\helpref{GetSelectedTextColour}{wxhtmllistboxgetselectedtextcolour}
104
105
106\membersection{wxHtmlListBox::GetSelectedTextColour}\label{wxhtmllistboxgetselectedtextcolour}
107
108\constfunc{wxColour}{GetSelectedTextColour}{\param{const wxColour\& }{colFg}}
109
110This virtual function may be overridden to customize the appearance of the
111selected cells. It is used to determine how the colour {\it colFg} is going to
112look inside selection. By default all original colours are completely ignored
113and the standard, system-dependent, selection colour is used but the program
114may wish to override this to achieve some custom appearance.
115
116\wxheading{See also}
117
118\helpref{GetSelectedTextBgColour}{wxhtmllistboxgetselectedtextbgcolour},\\
119\helpref{SetSelectionBackground}{wxvlistboxsetselectionbackground},\\
120\helpref{wxSystemSettings::GetColour}{wxsystemsettingsgetcolour}
121
e0c6027b
VZ
122
123\membersection{wxHtmlListBox::OnGetItem}\label{wxhtmllistboxongetitem}
124
125\constfunc{wxString}{OnGetItem}{\param{size\_t }{n}}
126
127This method must be implemented in the derived class and should return
128the body (i.e. without {\tt <html>} nor {\tt <body>} tags) of the HTML fragment
129for the given item.
130
9ebb7cad
VZ
131Note that this function should always return a text fragment for the \arg{n} item
132which renders with the same height both when it is selected and when it's not:
133i.e. if you call, inside your OnGetItem() implementation, {\tt IsSelected(n)} to
134make the items appear differently when they are selected, then you should make sure
135that the returned HTML fragment will render with the same height or else you'll
136see some artifacts when the user selects an item.
e0c6027b
VZ
137
138\membersection{wxHtmlListBox::OnGetItemMarkup}\label{wxhtmllistboxongetitemmarkup}
139
140\constfunc{wxString}{OnGetItemMarkup}{\param{size\_t }{n}}
141
142This function may be overridden to decorate HTML returned by
143\helpref{OnGetItem()}{wxhtmllistboxongetitem}.
144
bc55e31b
VS
145\membersection{wxHtmlListBox::OnLinkClicked}\label{wxhtmlistboxonlinkclicked}
146
147\func{virtual void}{OnLinkClicked}{\param{size\_t }{n}, \param{const wxHtmlLinkInfo\& }{link}}
148
149Called when the user clicks on hypertext link. Does nothing by default.
150
151\wxheading{Parameters}
152
153\docparam{n}{Index of the item containing the link.}
154
155\docparam{link}{Description of the link.}
156
157\wxheading{See also}
158
159See also \helpref{wxHtmlLinkInfo}{wxhtmllinkinfo}.
b67a86d5 160
9ebb7cad
VZ
161
162
163
164
165
166
167%
168% wxSimpleHtmlListBox
169%
170
171
172\section{\class{wxSimpleHtmlListBox}}\label{wxsimplehtmllistbox}
173
174wxSimpleHtmlListBox is an implementation of \helpref{wxHtmlListBox}{wxhtmllistbox} which
175shows HTML content in the listbox rows.
176
177Unlike \helpref{wxHtmlListBox}{wxhtmllistbox}, this is not an abstract class and thus it
178has the advantage that you can use it without deriving your own class from it.
179However, it also has the disadvantage that this is not a virtual control and thus it's not
180well-suited for those cases where you need to show a huge number of items: every time you
181add/insert a string, it will be stored internally and thus will take memory.
182
183The interface exposed by wxSimpleHtmlListBox fully implements the
184\helpref{wxControlWithItems}{wxcontrolwithitems} interface, thus you should refer to
185\helpref{wxControlWithItems}{wxcontrolwithitems}'s documentation for the API reference
186for adding/removing/retrieving items in the listbox.
187Also note that the \helpref{wxVListBox::SetItemCount}{wxvlistboxsetitemcount} function is
188{\tt protected} in wxSimpleHtmlListBox's context so that you cannot call it directly,
189wxSimpleHtmlListBox will do it for you.
190
191Note: in case you need to append a lot of items to the control at once, make sure to use the
192\helpref{Append(const wxArrayString \&)}{wxcontrolwithitemsappend} function.
193
194Thus the only difference between a \helpref{wxListBox}{wxlistbox} and a wxSimpleHtmlListBox
195is that the latter stores strings which can contain HTML fragments (see the list of
196\helpref{tags supported by wxHTML}{htmltagssupported}).
197
198Note that the HTML strings you fetch to wxSimpleHtmlListBox should not contain the {\tt <html>}
199or {\tt <body>} tags.
200
201
202\wxheading{Derived from}
203
204\helpref{wxHtmlListBox}{wxhtmllistbox}, \helpref{wxControlWithItems}{wxcontrolwithitems}\\
205\helpref{wxVListBox}{wxvlistbox}\\
206\helpref{wxVScrolledWindow}{wxvscrolledwindow}\\
207\helpref{wxPanel}{wxpanel}\\
208\helpref{wxWindow}{wxwindow}\\
209\helpref{wxEvtHandler}{wxevthandler}\\
210\helpref{wxObject}{wxobject}
211
212\wxheading{Include files}
213
214<wx/htmllbox.h>
215
216\wxheading{Window styles}
217
218\twocolwidtha{5cm}%
219\begin{twocollist}\itemsep=0pt
220\twocolitem{\windowstyle{wxHLB\_DEFAULT\_STYLE}}{The default style: wxSUNKEN_BORDER}
221\twocolitem{\windowstyle{wxHLB\_MULTIPLE}}{Multiple-selection list: the user can toggle multiple
222items on and off.}
223\end{twocollist}
224
225See also \helpref{window styles overview}{windowstyles}.
226
227\wxheading{Event handling}
228
229A wxSimpleHtmlListBox emits the same events used by \helpref{wxListBox}{wxlistbox}:
230
231\twocolwidtha{7cm}
232\begin{twocollist}\itemsep=0pt
233\twocolitem{{\bf EVT\_LISTBOX(id, func)}}{Process a wxEVT\_COMMAND\_LISTBOX\_SELECTED event,
234when an item on the list is selected.}
235\twocolitem{{\bf EVT\_LISTBOX\_DCLICK(id, func)}}{Process a wxEVT\_COMMAND\_LISTBOX\_DOUBLECLICKED event,
236when the listbox is double-clicked.}
237\end{twocollist}
238
239
240\latexignore{\rtfignore{\wxheading{Members}}}
241
242
243\membersection{wxSimpleHtmlListBox::wxSimpleHtmlListBox}\label{wxsimplehtmllistboxctor}
244
245\func{}{wxHtmlListBox}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp
246\param{const wxPoint\&}{ pos = wxDefaultPosition}, \param{const wxSize\&}{ size = wxDefaultSize},\rtfsp
247\param{int}{ n = 0}, \param{const wxString }{choices[] = NULL},\rtfsp
248\param{long}{ style = wxHLB\_DEFAULT\_STYLE}, \param{const wxValidator\& }{validator = wxDefaultValidator},\rtfsp
249\param{const wxString\& }{name = ``simpleHtmlListBox"}}
250
251\func{}{wxHtmlListBox}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp
252\param{const wxPoint\&}{ pos}, \param{const wxSize\&}{ size},\rtfsp
253\param{const wxArrayString\& }{choices},\rtfsp
254\param{long}{ style = wxHLB\_DEFAULT\_STYLE}, \param{const wxValidator\& }{validator = wxDefaultValidator},\rtfsp
255\param{const wxString\& }{name = ``simpleHtmlListBox"}}
256
257Constructor, creating and showing the HTML list box.
258
259\wxheading{Parameters}
260
261\docparam{parent}{Parent window. Must not be NULL.}
262
263\docparam{id}{Window identifier. A value of -1 indicates a default value.}
264
265\docparam{pos}{Window position.}
266
267\docparam{size}{Window size. If the default size (-1, -1) is specified then the window is sized
268appropriately.}
269
270\docparam{n}{Number of strings with which to initialise the control.}
271
272\docparam{choices}{An array of strings with which to initialise the control.}
273
274\docparam{style}{Window style. See {\tt wxHLB\_*} flags.}
275
276\docparam{validator}{Window validator.}
277
278\docparam{name}{Window name.}
279
280\wxheading{See also}
281
282\helpref{wxSimpleHtmlListBox::Create}{wxsimplehtmllistboxcreate}
283
284
285
286\func{}{wxSimpleHtmlListBox}{\void}
287
288Default constructor, you must call \helpref{Create()}{wxsimplehtmllistboxcreate}
289later.
290
291
292\membersection{wxSimpleHtmlListBox::\destruct{wxSimpleHtmlListBox}}\label{wxsimplehtmllistboxdtor}
293
294\func{}{\destruct{wxSimpleHtmlListBox}}{\void}
295
296Frees the array of stored items and relative client data.
297
298
299\membersection{wxSimpleHtmlListBox::Create}\label{wxsimplehtmllistboxcreate}
300
301\func{bool}{Create}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp
302\param{const wxPoint\&}{ pos = wxDefaultPosition}, \param{const wxSize\&}{ size = wxDefaultSize},\rtfsp
303\param{int}{ n}, \param{const wxString }{choices[] = NULL},\rtfsp
304\param{long}{ style = wxHLB\_DEFAULT\_STYLE}, \param{const wxValidator\& }{validator = wxDefaultValidator},\rtfsp
305\param{const wxString\& }{name = ``simpleHtmlListBox"}}
306
307\func{bool}{Create}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp
308\param{const wxPoint\&}{ pos}, \param{const wxSize\&}{ size},\rtfsp
309\param{const wxArrayString\& }{choices},\rtfsp
310\param{long}{ style = wxHLB\_DEFAULT\_STYLE}, \param{const wxValidator\& }{validator = wxDefaultValidator},\rtfsp
311\param{const wxString\& }{name = ``simpleHtmlListBox"}}
312
313Creates the HTML listbox for two-step construction.
314See \helpref{wxSimpleHtmlListBox::wxSimpleHtmlListBox}{wxsimplehtmllistboxctor} for further details.
315