1 #ifndef MANFRAME_H
2 #define MANFRAME_H
3 
4 #include <vector>
5 
6 #include <wx/stattext.h>
7 #include <wx/textctrl.h>
8 #include <wx/button.h>
9 #include <wx/bmpbuttn.h>
10 #include <wx/wxhtml.h>
11 #include <wx/string.h>
12 #include <wx/html/htmlwin.h>
13 #include <wx/bitmap.h>
14 
15 class MANFrame : public wxPanel
16 {
17     private:
18         wxTextCtrl *m_entry;
19         wxButton *m_search;
20         wxBitmapButton *m_zoomIn;
21         wxBitmapButton *m_zoomOut;
22         wxHtmlWindow *m_htmlWindow;
23         std::vector<wxString> m_dirsVect;
24         int m_baseFontSize;
25         wxString m_tmpfile;
26 
27     public:
28         MANFrame(wxWindow *parent = 0, wxWindowID id = wxID_ANY, const wxBitmap &zoomInBmp = wxNullBitmap, const wxBitmap &zoomOutBmp = wxNullBitmap);
29         ~MANFrame();
30         bool SearchManPage(const wxString &keyword);
31         void SetBaseFontSize(int newsize);
GetBaseFontSize()32         int GetBaseFontSize() const { return m_baseFontSize; }
33         void SetDirs(const wxString &dirs);
34         void LoadPage(const wxString &file);
35 
36     private:
37         void GetMatches(const wxString &keyword, std::vector<wxString> *files_found);
38         wxString GetManPage(wxString filename, int depth = 0);
39         wxString CreateLinksPage(const std::vector<wxString> &files);
40         bool Decompress(const wxString& filename, const wxString& tmpfile);
41         void SetPage(const wxString &contents);
42         void OnSearch(wxCommandEvent &event);
43         void OnZoomIn(wxCommandEvent &event);
44         void OnZoomOut(wxCommandEvent &event);
45         void OnLinkClicked(wxHtmlLinkEvent &event);
46 
47     DECLARE_EVENT_TABLE()
48 };
49 
50 #endif
51