00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __CHMLISTCTRL_H_
00025 #define __CHMLISTCTRL_H_
00026
00027 #include <wx/listbox.h>
00028 #include <wx/listctrl.h>
00029 #include <wx/string.h>
00030 #include <wx/dynarray.h>
00031
00032
00033
00034 class CHMHtmlWindow;
00035
00036
00038 struct CHMListPairItem {
00040 CHMListPairItem(const wxString& title, const wxString& url)
00041 : _title(title), _url(url) {}
00042
00044 wxString _title;
00046 wxString _url;
00047 };
00048
00049
00051 WX_DEFINE_SORTED_ARRAY(CHMListPairItem *, ItemPairArray);
00052
00054 int CompareItemPairs(CHMListPairItem *item1, CHMListPairItem *item2);
00055
00056
00063
00064 class CHMListCtrl : public wxListCtrl {
00065
00066 public:
00075 CHMListCtrl(wxWindow *parent, CHMHtmlWindow *html,
00076 wxWindowID id = -1);
00077
00079 ~CHMListCtrl();
00080
00081 public:
00083 void Reset();
00084
00092 void AddPairItem(const wxString& title, const wxString& url);
00093
00095 void LoadSelected();
00096
00098 void UpdateUI();
00099
00104 void FindBestMatch(const wxString& title);
00105
00106 protected:
00108 void OnSize(wxSizeEvent& event);
00109
00111 wxString OnGetItemText(long item, long column) const;
00112
00113 private:
00115 void ResetItems();
00116
00117 private:
00118 ItemPairArray _items;
00119 CHMHtmlWindow *_html;
00120 int _currentSize;
00121
00122 private:
00123 DECLARE_EVENT_TABLE()
00124 };
00125
00126
00127 #endif // __CHMLISTCTRL_H_
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142