chmlistctrl.h

00001 /*
00002 
00003   Copyright (C) 2003  Razvan Cojocaru <razvanco@gmx.net>
00004   ListDirty() patch contributed by Iulian Dragos
00005   <dragosiulian@users.sourceforge.net>
00006  
00007   This program is free software; you can redistribute it and/or modify
00008   it under the terms of the GNU General Public License as published by
00009   the Free Software Foundation; either version 2 of the License, or
00010   (at your option) any later version.
00011   
00012   This program is distributed in the hope that it will be useful,
00013   but WITHOUT ANY WARRANTY; without even the implied warranty of
00014   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015   GNU General Public License for more details.
00016   
00017   You should have received a copy of the GNU General Public License
00018   along with this program; if not, write to the Free Software
00019   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
00020   MA 02110-1301, USA.
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 // Forward declarations.
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   Local Variables:
00133   mode: c++
00134   c-basic-offset: 8
00135   tab-width: 8
00136   c-indent-comments-syntactically-p: t
00137   c-tab-always-indent: t
00138   indent-tabs-mode: t
00139   End:
00140 */
00141 
00142 // vim:shiftwidth=8:autoindent:tabstop=8:noexpandtab:softtabstop=8
00143 

Generated on Tue Apr 14 19:43:38 2009 for xCHM by  doxygen 1.5.4