1 #ifndef FILEZILLA_INTERFACE_CUSTOM_HEIGHT_LISTCTRL_HEADER
2 #define FILEZILLA_INTERFACE_CUSTOM_HEIGHT_LISTCTRL_HEADER
3 
4 #include <wx/scrolwin.h>
5 
6 #include <set>
7 #include <vector>
8 
9 class wxCustomHeightListCtrl final : public wxScrolledWindow
10 {
11 public:
12 	wxCustomHeightListCtrl() = default;
13 
14 	wxCustomHeightListCtrl(wxWindow* parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxHSCROLL | wxVSCROLL, const wxString& name = _T("scrolledWindow"));
15 
16 	void SetLineHeight(int height);
17 
18 	virtual void SetFocus();
19 
20 	void ClearSelection();
21 
22 	std::set<size_t> GetSelection() const;
23 	size_t GetRowCount() const;
24 	void SelectLine(size_t line);
25 
26 	void AllowSelection(bool allow_selection);
27 
28 	void InsertRow(wxSizer* sizer, size_t pos);
29 	void DeleteRow(size_t pos);
30 	void DeleteRow(wxSizer *sizer);
31 	void ClearRows();
32 
33 protected:
34 	void AdjustView();
35 
36 	virtual void OnDraw(wxDC& dc);
37 
38 	DECLARE_EVENT_TABLE()
39 	void OnMouseEvent(wxMouseEvent& event);
40 	void OnSize(wxSizeEvent& event);
41 
42 	int m_lineHeight{20};
43 
44 	std::vector<wxSizer*> m_rows;
45 
46 	std::set<size_t> m_selectedLines;
47 
48 	static size_t const npos{static_cast<size_t>(-1)};
49 
50 	size_t m_focusedLine{npos};
51 
52 	bool m_allow_selection{true};
53 };
54 
55 #endif
56