00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef __CHMLISTCTRL_H_
00026 #define __CHMLISTCTRL_H_
00027
00028 #include <wx/listbox.h>
00029 #include <wx/listctrl.h>
00030 #include <wx/string.h>
00031 #include <wx/dynarray.h>
00032
00033
00034
00035 class CHMHtmlNotebook;
00036
00037
00039 struct CHMListPairItem {
00041 CHMListPairItem(const wxString& title, const wxString& url)
00042 : _title(title), _url(url) {}
00043
00045 wxString _title;
00047 wxString _url;
00048 };
00049
00050
00052 WX_DEFINE_SORTED_ARRAY(CHMListPairItem *, ItemPairArray);
00053
00055 int CompareItemPairs(CHMListPairItem *item1, CHMListPairItem *item2);
00056
00057
00064
00065 class CHMListCtrl : public wxListCtrl {
00066
00067 public:
00076 CHMListCtrl(wxWindow *parent, CHMHtmlNotebook *nbhtml,
00077 wxWindowID id = -1);
00078
00080 ~CHMListCtrl();
00081
00082 public:
00084 void Reset();
00085
00093 void AddPairItem(const wxString& title, const wxString& url);
00094
00096 void LoadSelected();
00097
00099 void UpdateUI();
00100
00105 void FindBestMatch(const wxString& title);
00106
00107 protected:
00109 void OnSize(wxSizeEvent& event);
00110
00112 wxString OnGetItemText(long item, long column) const;
00113
00114 private:
00116 void ResetItems();
00117
00118 private:
00119 ItemPairArray _items;
00120 CHMHtmlNotebook *_nbhtml;
00121 int _currentSize;
00122
00123 private:
00124 DECLARE_EVENT_TABLE()
00125 };
00126
00127
00128 #endif // __CHMLISTCTRL_H_
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143