Fix gray window background on Windows

This commit is contained in:
Epicalert 2021-07-19 23:17:40 +08:00
parent 2205287e58
commit 739f13adf9
No known key found for this signature in database
GPG key ID: CAA46F858D0979BD

View file

@ -51,15 +51,16 @@ ConfigurationFrame::ConfigurationFrame() : wxFrame(NULL, wxID_ANY, "Configure "
modelArray[i] = wxString(modelVec[i]);
}
wxPanel* panel = new wxPanel(this);
// define all controls and labels
useHaarCheckBox = new wxCheckBox(this , wxID_ANY, "Disable DNN face detection");
showCameraCheckBox = new wxCheckBox(this , wxID_ANY, "Show camera feed");
noEyesCheckBox = new wxCheckBox(this , wxID_ANY, "Disable eye tracking");
wxStaticText* modelNameText = new wxStaticText(this, wxID_ANY, "Model name:");
modelNameChoice = new wxChoice(this , wxID_ANY, wxDefaultPosition, wxDefaultSize, modelVec.size(), modelArray);
wxStaticText* cameraText = new wxStaticText(this , wxID_ANY, "Camera ID:");
cameraSpinCtrl = new wxSpinCtrl(this);
useHaarCheckBox = new wxCheckBox(panel, wxID_ANY, "Disable DNN face detection");
showCameraCheckBox = new wxCheckBox(panel, wxID_ANY, "Show camera feed");
noEyesCheckBox = new wxCheckBox(panel, wxID_ANY, "Disable eye tracking");
wxStaticText* modelNameText = new wxStaticText(panel, wxID_ANY, "Model name:");
modelNameChoice = new wxChoice(panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, modelVec.size(), modelArray);
wxStaticText* cameraText = new wxStaticText(panel, wxID_ANY, "Camera ID:");
cameraSpinCtrl = new wxSpinCtrl(panel);
wxBoxSizer* modelSizer = new wxBoxSizer(wxHORIZONTAL); // need to put label next to dropdown
modelSizer->Add(modelNameText, 0, wxALIGN_CENTER | wxALL, 5);
@ -79,19 +80,19 @@ ConfigurationFrame::ConfigurationFrame() : wxFrame(NULL, wxID_ANY, "Configure "
// General section
wxStaticBoxSizer* generalBoxSizer = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, "General"), wxVERTICAL);
wxStaticBoxSizer* generalBoxSizer = new wxStaticBoxSizer(new wxStaticBox(panel, wxID_ANY, "General"), wxVERTICAL);
generalBoxSizer->Add(modelSizer, 0, wxALL, 5);
generalBoxSizer->Add(cameraSizer, 0, wxALL, 5);
generalBoxSizer->Add(showCameraCheckBox, 0, wxALL, 5);
// Performance section
wxStaticBoxSizer* performanceBoxSizer = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, "Performance"), wxVERTICAL);
wxStaticBoxSizer* performanceBoxSizer = new wxStaticBoxSizer(new wxStaticBox(panel, wxID_ANY, "Performance"), wxVERTICAL);
performanceBoxSizer->Add(useHaarCheckBox, 0, wxALL, 5);
performanceBoxSizer->Add(noEyesCheckBox, 0, wxALL, 5);
// define bottom buttons (Cancel and Apply) and their sizer
wxButton* cancelButton = new wxButton(this, wxID_CANCEL, "Cancel");
wxButton* applyButton = new wxButton(this, wxID_APPLY, "Apply settings");
wxButton* cancelButton = new wxButton(panel, wxID_CANCEL, "Cancel");
wxButton* applyButton = new wxButton(panel, wxID_APPLY, "Apply settings");
wxBoxSizer* bottomButtonSizer = new wxBoxSizer(wxHORIZONTAL);
bottomButtonSizer->Add(cancelButton, 0, wxALL, 5);
bottomButtonSizer->Add(applyButton, 0, wxALL, 5);
@ -103,7 +104,14 @@ ConfigurationFrame::ConfigurationFrame() : wxFrame(NULL, wxID_ANY, "Configure "
sizer->AddStretchSpacer(1);
sizer->Add(bottomButtonSizer, 0, wxALIGN_RIGHT | wxALL, 10);
SetSizerAndFit(sizer);
panel->SetSizer(sizer);
// define top sizer which only contains the panel
// a panel is needed for proper background on Microsoft Windows
wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
topSizer->Add(panel, 1, wxEXPAND);
SetSizerAndFit(topSizer);
Bind(wxEVT_BUTTON, &ConfigurationFrame::OnApply, this, wxID_APPLY);
Bind(wxEVT_BUTTON, &ConfigurationFrame::OnExit, this, wxID_CANCEL);