]> git.saurik.com Git - wxWidgets.git/blob - include/wx/htmllbox.h
Include wx/file.h even when using precompiled headers
[wxWidgets.git] / include / wx / htmllbox.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/htmllbox.h
3 // Purpose: wxHtmlListBox is a listbox whose items are wxHtmlCells
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 31.05.03
7 // RCS-ID: $Id$
8 // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_HTMLLBOX_H_
13 #define _WX_HTMLLBOX_H_
14
15 #include "wx/vlbox.h" // base class
16
17 class WXDLLEXPORT wxHtmlCell;
18 class WXDLLEXPORT wxHtmlWinParser;
19 class WXDLLEXPORT wxHtmlListBoxCache;
20
21 // ----------------------------------------------------------------------------
22 // wxHtmlListBox
23 // ----------------------------------------------------------------------------
24
25 class WXDLLEXPORT wxHtmlListBox : public wxVListBox
26 {
27 public:
28 // constructors and such
29 // ---------------------
30
31 // default constructor, you must call Create() later
32 wxHtmlListBox() { Init(); }
33
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 long style = 0,
40 const wxString& name = wxVListBoxNameStr)
41 {
42 Init();
43
44 (void)Create(parent, id, pos, size, style, name);
45 }
46
47 // really creates the control and sets the initial number of items in it
48 // (which may be changed later with SetItemCount())
49 //
50 // the only special style which may be specified here is wxLB_MULTIPLE
51 //
52 // returns true on success or false if the control couldn't be created
53 bool Create(wxWindow *parent,
54 wxWindowID id = wxID_ANY,
55 const wxPoint& pos = wxDefaultPosition,
56 const wxSize& size = wxDefaultSize,
57 long style = 0,
58 const wxString& name = wxVListBoxNameStr);
59
60 // destructor cleans up whatever resources we use
61 virtual ~wxHtmlListBox();
62
63 // refresh everything
64 virtual void RefreshAll();
65
66
67 protected:
68 // this method must be implemented in the derived class and should return
69 // the body (i.e. without <html>) of the HTML for the given item
70 virtual wxString OnGetItem(size_t n) const = 0;
71
72 // this function may be overridden to decorate HTML returned by OnGetItem()
73 virtual wxString OnGetItemMarkup(size_t n) const;
74
75
76 // we implement both of these functions in terms of OnGetItem(), they are
77 // not supposed to be overridden by our descendants
78 virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const;
79 virtual wxCoord OnMeasureItem(size_t n) const;
80
81
82 // event handlers
83 void OnSize(wxSizeEvent& event);
84
85
86 // common part of all ctors
87 void Init();
88
89 // ensure that the given item is cached
90 void CacheItem(size_t n) const;
91
92 private:
93 wxHtmlListBoxCache *m_cache;
94
95 // HTML parser we use
96 wxHtmlWinParser *m_htmlParser;
97
98
99 DECLARE_EVENT_TABLE()
100 };
101
102 #endif // _WX_HTMLLBOX_H_
103