1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxHtmlListBox is a listbox whose items are wxHtmlCells
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_HTMLLBOX_H_
13 #define _WX_HTMLLBOX_H_
15 #include "wx/vlbox.h" // base class
17 class WXDLLEXPORT wxHtmlCell
;
18 class WXDLLEXPORT wxHtmlWinParser
;
19 class WXDLLEXPORT wxHtmlListBoxCache
;
21 // ----------------------------------------------------------------------------
23 // ----------------------------------------------------------------------------
25 class WXDLLEXPORT wxHtmlListBox
: public wxVListBox
28 // constructors and such
29 // ---------------------
31 // default constructor, you must call Create() later
32 wxHtmlListBox() { Init(); }
34 // normal constructor which calls Create() internally
35 wxHtmlListBox(wxWindow
*parent
,
36 wxWindowID id
= wxID_ANY
,
37 const wxPoint
& pos
= wxDefaultPosition
,
38 const wxSize
& size
= wxDefaultSize
,
39 size_t countItems
= 0,
41 const wxString
& name
= wxVListBoxNameStr
)
45 (void)Create(parent
, id
, pos
, size
, countItems
, style
, name
);
48 // really creates the control and sets the initial number of items in it
49 // (which may be changed later with SetItemCount())
51 // there are no special styles defined for wxVListBox
53 // returns true on success or false if the control couldn't be created
54 bool Create(wxWindow
*parent
,
55 wxWindowID id
= wxID_ANY
,
56 const wxPoint
& pos
= wxDefaultPosition
,
57 const wxSize
& size
= wxDefaultSize
,
58 size_t countItems
= 0,
60 const wxString
& name
= wxVListBoxNameStr
);
62 // destructor cleans up whatever resources we use
63 virtual ~wxHtmlListBox();
66 // this method must be implemented in the derived class and should return
67 // the body (i.e. without <html>) of the HTML for the given item
68 virtual wxString
OnGetItem(size_t n
) const = 0;
70 // this function may be overridden to decorate HTML returned by OnGetItem()
71 virtual wxString
OnGetItemMarkup(size_t n
) const;
74 // we implement both of these functions in terms of OnGetItem(), they are
75 // not supposed to be overridden by our descendants
76 virtual void OnDrawItem(wxDC
& dc
, const wxRect
& rect
, size_t n
) const;
77 virtual wxCoord
OnMeasureItem(size_t n
) const;
80 // common part of all ctors
83 // ensure that the given item is cached
84 void CacheItem(size_t n
) const;
87 wxHtmlListBoxCache
*m_cache
;
90 wxHtmlWinParser
*m_htmlParser
;
93 #endif // _WX_HTMLLBOX_H_