Files
OrcaSlicer/src/slic3r/GUI/SingleChoiceDialog.cpp
T
HanifKoh 1a5f91d727 Add Missing Includes Across src/slic3r/GUI (#16048)
* Add Missing Includes Across src/slic3r/GUI

Every GUI source and header now directly includes the headers declaring what it uses, rather than relying on the precompiled header or transitive includes. Generated with clang-tidy misc-include-cleaner, plus one hand edit making CalibrationPanel.hpp self-contained.

* Drop the OS-Specific Includes Added Outside Their Platform Guards

GLib, GTK, D-Bus and POSIX headers are only used inside platform #if blocks, which already include them. Added unconditionally at the top of the file they broke the Windows build.

* Add the clang-tidy Configuration That Generated These Includes

Only misc-include-cleaner's missing-include check, with the headers it must never suggest: per-platform, internal and OS-specific ones that would break other platforms or are not meant to be included directly.

* Match Windows Paths in the clang-tidy Ignore List

Header paths use backslashes on Windows, so every / in a pattern is now [/\\]. The Windows SDK headers are ignored alongside the other OS-specific ones, and the list is one pattern per line. Suggested by @raistlin7447 from a Windows clang-cl run.
2026-10-02 14:56:56 +08:00

55 lines
2.1 KiB
C++

#include "SingleChoiceDialog.hpp"
#include "GUI_App.hpp"
#include "MainFrame.hpp"
#include "Widgets/DialogButtons.hpp"
#include <wx/string.h>
#include <wx/arrstr.h>
#include "slic3r/GUI/GUI_Utils.hpp"
#include <wx/event.h>
#include <wx/gdicmn.h>
#include <wx/toplevel.h>
#include <wx/sizer.h>
#include "slic3r/GUI/Widgets/ComboBox.hpp"
#include <cstddef>
namespace Slic3r { namespace GUI {
SingleChoiceDialog::SingleChoiceDialog(const wxString &message, const wxString &caption, const wxArrayString &choices, int initialSelection, wxWindow *parent)
: DPIDialog(parent ? parent : static_cast<wxWindow *>(wxGetApp().mainframe), wxID_ANY, caption, wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX)
{
SetBackgroundColour(*wxWHITE);
const int dlg_width = 200;
wxBoxSizer *bSizer = new wxBoxSizer(wxVERTICAL);
bSizer->SetMinSize(wxSize(FromDIP(dlg_width), -1));
wxStaticText *message_text = new wxStaticText(this, wxID_ANY, message, wxDefaultPosition, wxDefaultSize, 0);
message_text->Wrap(-1);
bSizer->Add(message_text, 0, wxALL, 5);
type_comboBox = new ComboBox(this, wxID_ANY, choices[0], wxDefaultPosition, wxSize(FromDIP(dlg_width - 10), -1), 0, NULL, wxCB_READONLY);
for (const wxString &type_name : choices) { type_comboBox->Append(type_name); }
bSizer->Add(type_comboBox, 0, wxALL | wxALIGN_CENTER, 5);
bSizer->AddSpacer(FromDIP(10));
type_comboBox->SetSelection(initialSelection);
auto dlg_btns = new DialogButtons(this, {"OK", "Cancel"});
dlg_btns->GetOK()->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) { EndModal(wxID_OK); });
dlg_btns->GetCANCEL()->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) { EndModal(wxID_CANCEL); });
bSizer->Add(dlg_btns, 0, wxEXPAND);
this->SetSizer(bSizer);
this->Layout();
bSizer->Fit(this);
wxGetApp().UpdateDlgDarkUI(this);
}
SingleChoiceDialog::~SingleChoiceDialog() {}
int SingleChoiceDialog::GetSingleChoiceIndex() { return this->ShowModal() == wxID_OK ? GetTypeComboBox()->GetSelection() : -1; }
void SingleChoiceDialog::on_dpi_changed(const wxRect &suggested_rect) {}
}} // namespace Slic3r::GUI