-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFlipProgramLog.cpp
More file actions
36 lines (30 loc) · 1.11 KB
/
FlipProgramLog.cpp
File metadata and controls
36 lines (30 loc) · 1.11 KB
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
#include "FlipProgramLog.h"
FlipProgramLog::FlipProgramLog(wxWindow *parent)
: ProgramLog(parent)
{
Bind(wxEVT_CLOSE_WINDOW, &FlipProgramLog::OnClose, this);
}
wxString FlipProgramLog::timeNow()
{
return wxDateTime::Now().FormatISOTime();
}
void FlipProgramLog::LogMessage(const wxString &message)
{
// this is where we send messages to the Program Log wxTextCtrl wdiget
this->wxtextCtrl_programLog->AppendText("[" + timeNow() + "] " + message + "\n");
}
void FlipProgramLog::LogMessage(const wxString &message, FlipProgramLog &targetWidget)
{
// Cast targetWidget to FlipProgramLog to access the inherited wxTextCtrl
FlipProgramLog *logFrame = static_cast<FlipProgramLog *>(&targetWidget);
// Assuming the wxTextCtrl is named `wxtextCtrl_programLog` in the generated ProgramLog class
if (logFrame->wxtextCtrl_programLog)
{
logFrame->wxtextCtrl_programLog->AppendText("[" + FlipProgramLog::timeNow() + "] " + message + "\n");
}
}
void FlipProgramLog::OnClose(wxCloseEvent &event)
{
LogMessage("Hiding Program Log window");
Hide(); // Hide the frame instead of closing it
}