Lots more work on making the frame aui stuff functional.
[dolphin.git] / Source / Core / DolphinWX / Src / LogWindow.h
blob06730be8b0d3ef17c2ace9aab5685969f51b39c7
1 // Copyright (C) 2003 Dolphin Project.
3 // This program is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, version 2.0.
7 // This program is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 // GNU General Public License 2.0 for more details.
12 // A copy of the GPL 2.0 should have been included with the program.
13 // If not, see http://www.gnu.org/licenses/
15 // Official SVN repository and contact information can be found at
16 // http://code.google.com/p/dolphin-emu/
18 #ifndef LOGWINDOW_H_
19 #define LOGWINDOW_H_
20 #include "Main.h" // for wxGetApp
21 #include "LogManager.h"
22 #include "Frame.h"
23 #include "DebuggerUIUtil.h"
25 #include "IniFile.h" // Common
26 #include "Thread.h"
27 #include <queue>
29 enum
31 IDM_LOG,
32 IDM_CLEARLOG,
33 IDM_LOGCHECKS,
34 IDM_OPTIONS,
35 IDM_TOGGLEALL,
36 IDM_WRAPLINE,
37 IDM_WRITEFILE,
38 IDM_WRITECONSOLE,
39 IDM_WRITEWINDOW,
40 IDTM_UPDATELOG,
41 IDM_VERBOSITY,
42 IDM_FONT,
43 IDM_SUBMITCMD
46 class wxTextCtrl;
47 class wxCheckListBox;
48 class wxString;
49 class CFrame;
51 // Uses multiple inheritance - only sane because LogListener is a pure virtual interface.
52 class CLogWindow : public wxPanel, LogListener
54 public:
55 CLogWindow(CFrame *parent,
56 wxWindowID id = wxID_ANY,
57 const wxPoint& pos = wxDefaultPosition,
58 const wxSize& size = wxDefaultSize,
59 long style = wxTAB_TRAVERSAL,
60 const wxString& name = wxT("Log")
62 ~CLogWindow();
63 void NotifyUpdate();
65 void SaveSettings();
66 void LoadSettings();
67 void Log(LogTypes::LOG_LEVELS, const char *text);
69 private:
70 CFrame *Parent;
71 wxFont DefaultFont, MonoSpaceFont;
72 std::vector<wxFont> Font;
73 wxTimer *m_LogTimer;
74 FileLogListener *m_fileLog;
75 ConsoleListener *m_console;
76 LogManager *m_LogManager;
77 std::queue<std::pair<u8, wxString> > msgQueue;
78 bool m_writeFile, m_writeConsole, m_writeWindow, m_LogAccess;
80 // Controls
81 wxBoxSizer *sUber, *sLeft, *sRight, *sRightBottom;
82 wxTextCtrl *m_Log, *m_cmdline;
83 wxChoice * m_FontChoice;
84 wxCheckBox *m_writeFileCB, *m_writeConsoleCB, *m_writeWindowCB;
85 wxCheckListBox* m_checks;
86 wxRadioBox *m_verbosity;
88 Common::CriticalSection m_LogSection;
90 wxCSConv m_SJISConv;
92 DECLARE_EVENT_TABLE()
94 wxTextCtrl * CreateTextCtrl(wxPanel* parent, wxWindowID id = wxID_ANY, long Style = NULL);
95 void CreateGUIControls();
96 void PopulateRight(); void UnPopulateRight();
97 void OnClose(wxCloseEvent& event);
98 void OnSubmit(wxCommandEvent& event);
99 void OnOptionsCheck(wxCommandEvent& event);
100 void OnLogCheck(wxCommandEvent& event);
101 void OnClear(wxCommandEvent& event);
102 void OnToggleAll(wxCommandEvent& event);
103 void OnLogTimer(wxTimerEvent& WXUNUSED(event));
105 void ToggleLog(int _logType, bool enable);
106 void UpdateChecks();
107 void UpdateLog();
109 // LogListener
110 const char *getName() const { return "LogWindow"; }
113 #endif /*LOGWINDOW_H_*/