-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathLogDisplayer.h
77 lines (61 loc) · 1.98 KB
/
LogDisplayer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef H_LIBCOMMON_GUI_LOG_DISPLAYER_H_
#define H_LIBCOMMON_GUI_LOG_DISPLAYER_H_
#include <wx/panel.h>
#include <wx/textctrl.h>
#include <wx/log.h>
class LogPanel: public wxPanel
{
public:
LogPanel(wxWindow* parent,
wxWindowID winid = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize);
~LogPanel();
void LogMessage(const wxString& content, int lines=-1);
void CleanUp();
void GetMessage(wxString& content);
void SelctAll();
protected:
void Clear();
void ConnectRightClickEvent(wxObjectEventFunction function, wxEvtHandler* eventSink);
private:
wxTextCtrl* mw_outputTC; /* the output text control */
DECLARE_EVENT_TABLE()
};
class LogDisplayer: public LogPanel
{
public:
LogDisplayer(wxWindow*parent,wxWindowID id = wxID_ANY);
virtual ~LogDisplayer();
void AddLog(std::string& log);
void AddLog(const char*log);
void Clear();
void SaveAs(const std::string& path);
protected:
void EnableWxLogChain(bool enable = true);
class wxLogCatcher:public wxLog
{
public:
wxLogCatcher(LogDisplayer* Operand);
virtual ~wxLogCatcher();
protected:
//wxLogxxx
virtual void DoLogString(const wxChar *szString, time_t t);
private:
LogDisplayer* m_displayer;
};
private:
void OnSaveAs(wxCommandEvent& evt);
void OnClear(wxCommandEvent& evt);
void OnSelectAll(wxCommandEvent& evt);
void OnRightClicked(wxMouseEvent& evt);
void OnUpdateGuiLog(wxCommandEvent& evt);
void InitWxLogChain();
//disable copying.
LogDisplayer(const LogDisplayer&);
LogDisplayer& operator=(const LogDisplayer&);
wxLogChain *m_pChain;
bool m_wxChainRedirectOn;
DECLARE_EVENT_TABLE()
};
#endif