@@ -77,7 +77,7 @@ CGTeaFrame::CGTeaFrame(const wxString& title, const wxPoint& pos, const wxSize&
77
77
availableActions.emplace_back (std::make_unique<Coloring>());
78
78
availableActions.emplace_back (std::make_unique<LineGraph>());
79
79
80
- auto menuFile = new wxMenu;
80
+ auto menuFile = std::make_unique< wxMenu>() ;
81
81
menuFile->Append (1000 , " &Open" );
82
82
menuFile->Append (1001 , " &Save" );
83
83
menuFile->AppendSeparator ();
@@ -87,7 +87,7 @@ CGTeaFrame::CGTeaFrame(const wxString& title, const wxPoint& pos, const wxSize&
87
87
Connect (1001 , wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (CGTeaFrame::Save));
88
88
Connect (wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (CGTeaFrame::OnExit));
89
89
90
- auto menuGenerate = new wxMenu;
90
+ auto menuGenerate = std::make_unique< wxMenu>() ;
91
91
int i = 1 ;
92
92
// std::apply([&](auto&&... args) {((menuGenerate->Append(i, wxString(args.name().c_str(), wxConvUTF8), wxString(args.description().c_str(), wxConvUTF8)),i++), ...);}, availableGenerators);
93
93
for (auto & gi : availableGenerators) {
@@ -97,38 +97,38 @@ CGTeaFrame::CGTeaFrame(const wxString& title, const wxPoint& pos, const wxSize&
97
97
i++;
98
98
}
99
99
100
- auto menuReport = new wxMenu;
100
+ auto menuReport = std::make_unique< wxMenu>() ;
101
101
for (auto & ri : availableReports) {
102
102
menuReport->Append (i, wxString (ri->name ().c_str (), wxConvUTF8),
103
103
wxString (ri->description ().c_str (), wxConvUTF8));
104
104
Connect (i, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (CGTeaFrame::Report));
105
105
i++;
106
106
}
107
107
108
- auto menuAction = new wxMenu;
108
+ auto menuAction = std::make_unique< wxMenu>() ;
109
109
for (auto & ai : availableActions) {
110
110
menuAction->Append (i, wxString (ai->name ().c_str (), wxConvUTF8),
111
111
wxString (ai->description ().c_str (), wxConvUTF8));
112
112
Connect (i, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (CGTeaFrame::Action));
113
113
i++;
114
114
}
115
115
116
- auto * menuLayout = new wxMenu;
116
+ auto menuLayout = std::make_unique< wxMenu>() ;
117
117
menuLayout->Append (i, " Force-directed drawing" , " Force-directed drawing" );
118
118
Connect (i, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (CGTeaFrame::Layout));
119
119
i++;
120
120
menuLayout->Append (i, " &Fit Width" , " Fit Graph to Width" );
121
121
Connect (i, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (CGTeaFrame::OnFitWidth));
122
- auto menuHelp = new wxMenu;
122
+ auto menuHelp = std::make_unique< wxMenu>() ;
123
123
menuHelp->Append (wxID_ABOUT);
124
- wxMenuBar * menuBar = new wxMenuBar;
125
- menuBar->Append (menuFile, " &File" );
126
- menuBar->Append (menuGenerate, " &Generate" );
127
- menuBar->Append (menuReport, " &Report" );
128
- menuBar->Append (menuAction, " &Action" );
129
- menuBar->Append (menuLayout, " &Layout" );
130
- menuBar->Append (menuHelp, " &Help" );
131
- SetMenuBar (menuBar);
124
+ auto menuBar = std::make_unique< wxMenuBar>() ;
125
+ menuBar->Append (menuFile. release () , " &File" );
126
+ menuBar->Append (menuGenerate. release () , " &Generate" );
127
+ menuBar->Append (menuReport. release () , " &Report" );
128
+ menuBar->Append (menuAction. release () , " &Action" );
129
+ menuBar->Append (menuLayout. release () , " &Layout" );
130
+ menuBar->Append (menuHelp. release () , " &Help" );
131
+ SetMenuBar (menuBar. release () );
132
132
CreateStatusBar ();
133
133
SetStatusText (" Welcome to CGTea!" );
134
134
@@ -147,11 +147,11 @@ CGTeaFrame::CGTeaFrame(const wxString& title, const wxPoint& pos, const wxSize&
147
147
}
148
148
}
149
149
150
- void CGTeaFrame::OnExit (wxCommandEvent& event ) {
150
+ void CGTeaFrame::OnExit (wxCommandEvent&) {
151
151
Close (true );
152
152
}
153
153
154
- void CGTeaFrame::OnAbout (wxCommandEvent& event ) {
154
+ void CGTeaFrame::OnAbout (wxCommandEvent&) {
155
155
wxMessageBox (" CGTea is a C++-version of GraphTea, a software for working with graphs." ,
156
156
" CGTea 1.0" , wxOK | wxICON_INFORMATION);
157
157
}
@@ -220,7 +220,7 @@ void CGTeaFrame::Report(wxCommandEvent& event) {
220
220
const int id = event.GetId ();
221
221
const std::string report_results = availableReports[id - availableGenerators.size () - 1 ]->report (currentGraph);
222
222
const std::string report_name = availableReports[id - availableGenerators.size () - 1 ]->name ();
223
- (( CGTeaSidebar*) this ->GetSizer ()->GetChildren ()[0 ]->GetWindow ())->statistics_text ->SetValue (report_name + " : " +report_results);
223
+ static_cast < CGTeaSidebar*>( this ->GetSizer ()->GetChildren ()[0 ]->GetWindow ())->statistics_text ->SetValue (report_name + " : " +report_results);
224
224
}
225
225
226
226
void CGTeaFrame::Action (wxCommandEvent& event) {
0 commit comments