KiCad PCB EDA Suite
confirm.h File Reference

This file is part of the common library. More...

#include <wx/window.h>
#include <vector>

Go to the source code of this file.

Functions

int DisplayExitDialog (wxWindow *aParent, const wxString &aMessage)
 Function DisplayExitDialog displays a dialog with 3 buttons: Save and Exit Cancel Exit without save. More...
 
void DisplayError (wxWindow *parent, const wxString &aMessage, int displaytime=0)
 Function DisplayError displays an error or warning message box with aMessage. More...
 
void DisplayErrorMessage (wxWindow *aParent, const wxString &aMessage, const wxString aExtraInfo=wxEmptyString)
 Function DisplayErrorMessage displays an error message with aMessage. More...
 
void DisplayInfoMessage (wxWindow *parent, const wxString &aMessage, const wxString aExtraInfo=wxEmptyString)
 Function DisplayInfoMessage displays an informational message box with aMessage. More...
 
bool IsOK (wxWindow *aParent, const wxString &aMessage)
 Function IsOK displays a yes/no dialog with aMessage and returns the user response. More...
 
int YesNoCancelDialog (wxWindow *aParent, const wxString &aPrimaryMessage, const wxString &aSecondaryMessage, const wxString &aYesButtonText=wxEmptyString, const wxString &aNoButtonText=wxEmptyString, const wxString &aCancelButtonText=wxEmptyString)
 Function YesNoCancelDialog displays a yes/no/cancel dialog with aMessage and returns the user response. More...
 
void DisplayHtmlInfoMessage (wxWindow *parent, const wxString &title, const wxString &aMessage, const wxSize &size=wxDefaultSize)
 Function DisplayHtmlInforMessage displays aMessage in HTML format. More...
 
int SelectSingleOption (wxWindow *aParent, const wxString &aTitle, const wxString &aMessage, const wxArrayString &aOptions)
 Displays a dialog with radioboxes asking the user to select an option. More...
 
std::pair< bool, std::vector< int > > SelectMultipleOptions (wxWindow *aParent, const wxString &aTitle, const wxString &aMessage, const wxArrayString &aOptions, bool aDefaultState=false)
 Displays a dialog with checkboxes asking the user to select one or more options. More...
 
std::pair< bool, std::vector< int > > SelectMultipleOptions (wxWindow *aParent, const wxString &aTitle, const wxString &aMessage, const std::vector< std::string > &aOptions, bool aDefaultState=false)
 

Detailed Description

This file is part of the common library.

See also
common.h

Definition in file confirm.h.

Function Documentation

void DisplayError ( wxWindow *  parent,
const wxString &  aMessage,
int  displaytime = 0 
)

Function DisplayError displays an error or warning message box with aMessage.

Warning
Setting displaytime does not work. Do not use it.

Definition at line 73 of file confirm.cpp.

Referenced by DIALOG_COPPER_ZONE::AcceptOptions(), DIALOG_KEEPOUT_AREA_PROPERTIES::AcceptOptionsForKeepOut(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddAliasOfPart(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddFootprintFilter(), LIB_EDIT_FRAME::addLibraryFile(), NETLIST_EXPORTER::addPinToComponentPinList(), PCBNEW_CONTROL::AppendBoard(), SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), LIB_EDIT_FRAME::backupFile(), PCB_EDIT_FRAME::Begin_Self(), DIALOG_TRACK_VIA_SIZE::check(), DIALOG_TRACK_VIA_PROPERTIES::check(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), SCH_EDIT_FRAME::ConvertPart(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), create_backup_file(), PCB_EDIT_FRAME::Create_MuWaveComponent(), PCB_EDIT_FRAME::Create_MuWavePolygonShape(), SCH_EDIT_FRAME::CreateArchiveLibrary(), DIALOG_GEN_MODULE_POSITION::CreateFiles(), LIB_EDIT_FRAME::CreateGraphicItem(), MICROWAVE_TOOL::createInductorBetween(), SPICE_SIMULATOR::CreateInstance(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), SCH_EDIT_FRAME::CreateNewText(), PCB_EDIT_FRAME::Delete_Drawings_All_Layer(), FOOTPRINT_EDIT_FRAME::Delete_Edge_Module(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAliasOfPart(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllAliasOfPart(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary(), FOOTPRINT_EDIT_FRAME::DlgGlobalChange_PadSettings(), PCB_EDIT_FRAME::DlgGlobalChange_PadSettings(), PCB_EDIT_FRAME::Edit_Gap(), SCH_EDIT_FRAME::EditSheet(), ExecuteFile(), FOOTPRINT_EDIT_FRAME::Export_Module(), GBR_TO_PCB_EXPORTER::ExportPcb(), DIALOG_SVG_PRINT::ExportSVGFile(), PCB_EDIT_FRAME::ExportToGenCAD(), PCB_EDIT_FRAME::Files_io_from_id(), FootprintWriteShape(), NETLIST_EXPORTER_PSPICE::Format(), PCB_EDIT_FRAME::GenD356File(), DIALOG_GENDRILL::GenDrillAndMapFiles(), DIALOG_SPICE_MODEL::generatePowerSource(), PCB_EDIT_FRAME::GenFootprintsReport(), genPlacementRoutingMatrix(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), GetAssociatedDocument(), PCB_BASE_FRAME::GlobalChange_PadSettings(), EDA_DRAW_FRAME::HandleBlockBegin(), FOOTPRINT_EDIT_FRAME::HandleBlockEnd(), LIB_EDIT_FRAME::HandleBlockEnd(), PCB_EDIT_FRAME::HandleBlockEnd(), SCH_EDIT_FRAME::HandleBlockEnd(), FOOTPRINT_EDIT_FRAME::HandleBlockPlace(), LIB_EDIT_FRAME::HandleBlockPlace(), PCB_EDIT_FRAME::HandleBlockPlace(), SCH_EDIT_FRAME::HandleBlockPlace(), FOOTPRINT_EDIT_FRAME::Import_Module(), SCH_EDIT_FRAME::ImportFile(), ALIGN_DISTRIBUTE_TOOL::Init(), POINT_EDITOR::Init(), POSITION_RELATIVE_TOOL::Init(), EDIT_TOOL::Init(), PCB_EDIT_FRAME::ListAndSelectModuleName(), SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile(), LIB_EDIT_FRAME::LoadOneSymbol(), LIB_EDIT_FRAME::loadPart(), SIM_PLOT_FRAME::menuOpenWorkbook(), SIM_PLOT_FRAME::menuSaveWorkbook(), PCB_EDIT_FRAME::MuWaveCommand(), DIALOG_ENV_VAR_CONFIG::OnAddButton(), DIALOG_CONFIG_EQUFILES::OnAddFiles(), DIALOG_DESIGN_RULES::OnAddNetclassClick(), DIALOG_FIND::onButtonFindItemClick(), DIALOG_FIND::onButtonFindMarkerClick(), FOOTPRINT_EDIT_FRAME::OnCloseWindow(), LIB_EDIT_FRAME::OnCreateNewPart(), LIB_EDIT_FRAME::OnExportPart(), LIB_EDIT_FRAME::OnImportPart(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), DIALOG_DRC_CONTROL::OnListUnconnectedClick(), SCH_EDIT_FRAME::OnNewProject(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick(), DIALOG_NON_COPPER_ZONES_EDITOR::OnOkClick(), DIALOG_DIMENSION_EDITOR::OnOKClick(), EDA_DRAW_PANEL_GAL::onPaint(), PCB_EDIT_FRAME::OnPlaceOrRouteFootprints(), DIALOG_PRINT_FOR_MODEDIT::OnPrintButtonClick(), DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick(), DIALOG_PRINT_FOR_MODEDIT::OnPrintPreview(), DIALOG_PRINT_USING_PRINTER::OnPrintPreview(), FOOTPRINT_EDIT_FRAME::OnRightClick(), FOOTPRINT_EDIT_FRAME::OnSaveLibraryAs(), SCH_EDIT_FRAME::OnSaveProject(), DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar(), KICAD_MANAGER_FRAME::OnSelectPreferredPdfBrowser(), SIM_PLOT_FRAME::onSettings(), DIALOG_DRC_CONTROL::OnStartdrcClick(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnTestChipName(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), SCH_EDIT_FRAME::OnUpdatePCB(), PCB_EDIT_FRAME::OnUpdatePCBFromSch(), FOOTPRINT_EDIT_FRAME::OnVerticalToolbar(), ROUTER_TOOL::onViaCommand(), WIZARD_3DSHAPE_LIBS_DOWNLOADER::OnWizardFinished(), WIZARD_FPLIB_TABLE::OnWizardFinished(), OpenPDF(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), PCB_PARSER::parseZONE_CONTAINER(), SYMBOL_GRID_TRICKS::paste_text(), FP_GRID_TRICKS::paste_text(), SCH_EDIT_FRAME::PasteListOfItems(), DIALOG_PLOT::Plot(), DIALOG_BOM::pluginInit(), ROUTER_TOOL::prepareInteractive(), DIALOG_PRINT_USING_PRINTER::PreparePrintPrms(), LIB_EDIT_FRAME::Process_Config(), SCH_EDIT_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Config(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), LIB_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::ProcessMuWaveFunctions(), NETLIST_EXPORTER_PSPICE::ProcessNetlist(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), GERBVIEW_FRAME::Read_EXCELLON_File(), GERBVIEW_FRAME::Read_GERBER_File(), MWAVE_POLYGONAL_SHAPE_DLG::ReadDataShapeDescr(), PCB_EDIT_FRAME::RecreateBOMFileFromBoard(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), FOOTPRINT_EDIT_FRAME::RemoveStruct(), PCB_EDIT_FRAME::RemoveStruct(), KIGFX::VERTEX_MANAGER::Reserve(), Retrace(), MODULE::RunOnChildren(), FOOTPRINT_EDIT_FRAME::SaveCurrentModule(), SCH_EDIT_FRAME::SaveEEFile(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), LIB_EDIT_FRAME::saveLibrary(), LIB_EDIT_FRAME::SaveOneSymbol(), PCB_EDIT_FRAME::SavePcbCopy(), PCB_EDIT_FRAME::SavePcbFile(), PCB_BASE_FRAME::SelectFootprint(), SCH_BASE_FRAME::SelectLibraryFromList(), KIGFX::GPU_MANAGER::SetShader(), PCB_EDIT_FRAME::SpreadFootprints(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), SIM_PLOT_FRAME::StartSimulation(), EDA_DRAW_PANEL_GAL::SwitchBackend(), DIALOG_LAYERS_SETUP::testLayerNames(), DIALOG_LABEL_EDITOR::TextPropertiesAccept(), FOOTPRINT_EDIT_FRAME::ToPrinter(), PCB_EDIT_FRAME::ToPrinter(), GERBVIEW_FRAME::ToPrinter(), DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::TransferDataFromWindow(), DialogEditModuleText::TransferDataFromWindow(), DIALOG_EDIT_ONE_FIELD::TransferDataFromWindow(), DIALOG_SIM_SETTINGS::TransferDataFromWindow(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_ENV_VAR_SINGLE::TransferDataFromWindow(), DIALOG_MODULE_MODULE_EDITOR::TransferDataFromWindow(), DIALOG_MODULE_BOARD_EDITOR::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), DIALOG_LAYERS_SETUP::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::transferDataToPad(), SPICE_VALIDATOR::Validate(), KIGFX::VERTEX_MANAGER::Vertex(), KIGFX::VERTEX_MANAGER::Vertices(), NETLIST_EXPORTER_ORCADPCB2::WriteNetlist(), NETLIST_EXPORTER_KICAD::WriteNetlist(), NETLIST_EXPORTER_CADSTAR::WriteNetlist(), LEGACY_RESCUER::WriteRescueLibrary(), and PCB_EDITOR_CONTROL::ZoneDuplicate().

74 {
75  wxMessageDialog* dialog;
76 
77  int icon = displaytime > 0 ? wxICON_INFORMATION : wxICON_ERROR;
78 
79  dialog = new wxMessageDialog( parent, text, _( "Warning" ),
80  wxOK | wxCENTRE | wxRESIZE_BORDER | icon );
81 
82  dialog->ShowModal();
83  dialog->Destroy();
84 }
void DisplayErrorMessage ( wxWindow *  aParent,
const wxString &  aMessage,
const wxString  aExtraInfo = wxEmptyString 
)

Function DisplayErrorMessage displays an error message with aMessage.

Parameters
aParentis the parent window
aMessageis the message text to display
aExtraInfois extra data that can be optionally displayed in a collapsible pane

Definition at line 87 of file confirm.cpp.

Referenced by PCB_EDIT_FRAME::AppendBoardFile(), SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::Begin_Zone(), checkGlError(), copy_pro_file_template(), SCH_EDIT_FRAME::CreateArchiveLibrary(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), SCH_BASE_FRAME::DisplayListComponentsInLib(), PCB_EDIT_FRAME::duplicateZone(), DIALOG_ENV_VAR_CONFIG::EditSelectedEntry(), SCH_EDIT_FRAME::EditSheet(), PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines(), PCB_EDIT_FRAME::End_Zone(), PCB_EDIT_FRAME::ExportSpecctraFile(), PCB_EDIT_FRAME::ImportSpecctraSession(), LIB_EDIT_FRAME::LoadComponentFromCurrentLib(), LIB_EDIT_FRAME::OnExportPart(), PCB_EDIT_FRAME::OnExportSTEP(), LIB_EDIT_FRAME::OnImportPart(), CV::IFACE::OnKifaceStart(), SCH::IFACE::OnKifaceStart(), PCB::IFACE::OnKifaceStart(), PCB_EDIT_FRAME::OnLeftDClick(), KICAD_MANAGER_FRAME::OnNewProject(), SCH_EDIT_FRAME::OnOpenLibraryEditor(), PCB_EDIT_FRAME::OnSelectOptionToolbar(), PCB_EDIT_FRAME::OpenProjectFiles(), PROJECT::PcbFootprintLibs(), PCB_EDIT_FRAME::Process_Config(), PCB_EDIT_FRAME::Remove_Zone_Corner(), LIB_EDIT_FRAME::saveLibrary(), SchGetLibAlias(), FOOTPRINT_EDIT_FRAME::ToolOnRightClick(), and SYMBOL_LIB_TABLE_RESCUER::WriteRescueLibrary().

88 {
89  wxRichMessageDialog* dlg;
90 
91  dlg = new wxRichMessageDialog( aParent, aText, _( "Error" ),
92  wxOK | wxCENTRE | wxRESIZE_BORDER | wxICON_ERROR );
93 
94  if( !aExtraInfo.IsEmpty() )
95  {
96  dlg->ShowDetailedText( aExtraInfo );
97  }
98 
99  dlg->ShowModal();
100  dlg->Destroy();
101 }
int DisplayExitDialog ( wxWindow *  aParent,
const wxString &  aMessage 
)

Function DisplayExitDialog displays a dialog with 3 buttons: Save and Exit Cancel Exit without save.

Parameters
aParent= the parent window
aMessage= the main message to put in dialog If empty, the standard message will be shown: Save the changes before closing?
Returns
wxID_YES, wxID_CANCEL, wxID_NO.

Definition at line 61 of file confirm.cpp.

Referenced by DIALOG_BOM_EDITOR::CanCloseDialog(), FOOTPRINT_EDIT_FRAME::OnCloseWindow(), PL_EDITOR_FRAME::OnCloseWindow(), CVPCB_MAINFRAME::OnCloseWindow(), SCH_EDIT_FRAME::OnCloseWindow(), and PCB_EDIT_FRAME::OnCloseWindow().

62 {
63  DIALOG_EXIT dlg( parent, aMessage );
64 
65  int ret = dlg.ShowModal();
66 
67  // Returns wxID_YES, wxID_NO, or wxID_CANCEL
68  return ret;
69 }
void DisplayHtmlInfoMessage ( wxWindow *  parent,
const wxString &  title,
const wxString &  aMessage,
const wxSize &  size = wxDefaultSize 
)

Function DisplayHtmlInforMessage displays aMessage in HTML format.

Definition at line 121 of file confirm.cpp.

References HTML_MESSAGE_BOX::AddHTML_Text().

Referenced by DisplayHotkeyList(), DIALOG_ENV_VAR_CONFIG::OnHelpButton(), and DIALOG_ENV_VAR_SINGLE::onHelpClick().

123 {
124  HTML_MESSAGE_BOX dlg( parent, title, wxDefaultPosition, size );
125 
126  dlg.AddHTML_Text( text );
127  dlg.ShowModal();
128 }
Class HTML_MESSAGE_BOX.
void DisplayInfoMessage ( wxWindow *  parent,
const wxString &  aMessage,
const wxString  aExtraInfo = wxEmptyString 
)

Function DisplayInfoMessage displays an informational message box with aMessage.

Parameters
aParentis the parent window
aMessageis the message text to display
aExtraInfois the extra data that can be optionally displayed in a collapsible pane

Definition at line 104 of file confirm.cpp.

Referenced by SCH_EDIT_FRAME::AnnotateComponents(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), PCB_BASE_FRAME::CreateNewModule(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary(), PCB_EDIT_FRAME::duplicateZone(), FOOTPRINT_EDIT_FRAME::Export_Module(), GERBVIEW_FRAME::ExportDataInPcbnewFormat(), PCB_EDIT_FRAME::Files_io_from_id(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), PGM_BASE::GetEditorName(), SCH_EDIT_FRAME::ImportSheetPin(), SIM_PLOT_FRAME::onAddSignal(), LIB_EDIT_FRAME::OnCheckComponent(), CV::IFACE::OnKifaceStart(), PCB::IFACE::OnKifaceStart(), FOOTPRINT_EDIT_FRAME::OnSaveLibraryAs(), PCB_EDIT_FRAME::OnSelectTool(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnTestChipName(), DIALOG_NETLIST::OnTestFootprintsClick(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), DIALOG_PLOT::Plot(), SCH_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), FOOTPRINT_EDIT_FRAME::SaveCurrentModule(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), PCB_EDIT_FRAME::SavePcbCopy(), PCB_BASE_FRAME::SelectCopperLayerPair(), DIALOG_PRINT_USING_PRINTER::SetPrintParameters(), SIM_PLOT_FRAME::StartSimulation(), PCBNEW_CONTROL::ToBeDone(), and FOOTPRINT_EDIT_FRAME::Transform().

105 {
106  wxRichMessageDialog* dlg;
107 
108  dlg = new wxRichMessageDialog( aParent, aMessage, _( "Info" ),
109  wxOK | wxCENTRE | wxRESIZE_BORDER | wxICON_INFORMATION );
110 
111  if( !aExtraInfo.IsEmpty() )
112  {
113  dlg->ShowDetailedText( aExtraInfo );
114  }
115 
116  dlg->ShowModal();
117  dlg->Destroy();
118 }
bool IsOK ( wxWindow *  aParent,
const wxString &  aMessage 
)

Function IsOK displays a yes/no dialog with aMessage and returns the user response.

Parameters
aParentis the parent window. NULL can be used if the parent is the top level window.
aMessageis the message to display in the dialog box.
Returns
True if user selected the yes button, otherwise false.

Definition at line 131 of file confirm.cpp.

Referenced by DIALOG_COPPER_ZONE::AcceptOptions(), DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::AutoPlaceModule(), DIALOG_EXCHANGE_MODULE::changeAllFootprints(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::ChangeNbUnitsPerPackage(), DIALOG_EXCHANGE_MODULE::changeSameFootprints(), SELECTION_TOOL::CheckLock(), GERBVIEW_FRAME::Clear_DrawLayers(), FOOTPRINT_EDIT_FRAME::Clear_Pcb(), PCB_EDIT_FRAME::Clear_Pcb(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), CVPCB_MAINFRAME::DelAssociations(), PCB_EDIT_FRAME::Delete_Drawings_All_Layer(), PCB_EDIT_FRAME::Delete_net(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllAliasOfPart(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllFootprintFilter(), deleteItem(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary(), PCB_BASE_FRAME::DeletePad(), FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer(), SCH_EDIT_FRAME::EditSheet(), GERBVIEW_FRAME::Erase_Current_DrawLayer(), PL_EDITOR_FRAME::Files_io(), PCB_EDIT_FRAME::Files_io_from_id(), getOptimalModulePlacement(), PGM_BASE::InitPgm(), ROUTER_TOOL::InlineDrag(), PCB_EDIT_FRAME::InstallNetlistFrame(), LIB_EDIT_FRAME::LoadComponentAndSelectLib(), FOOTPRINT_EDIT_FRAME::LoadModuleFromBoard(), SCH_EDIT_FRAME::OnAppendProject(), LIB_EDIT_FRAME::OnEditPin(), LIB_EDIT_FRAME::OnExportPart(), PL_EDITOR_FRAME::OnFileHistory(), KICAD_MANAGER_FRAME::OnImportEagleFiles(), KICAD_MANAGER_FRAME::OnNewProject(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnOkClick(), PCB_EDIT_FRAME::OnPlaceOrRouteFootprints(), DIALOG_NETLIST::OnReadNetlistFileClick(), LIB_EDIT_FRAME::OnRemovePart(), DIALOG_BOM_EDITOR::OnRevertFieldChanges(), LIB_EDIT_FRAME::OnRevertLibrary(), DIALOG_PAGES_SETTINGS::OnWksFileSelection(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), ROUTER_TOOL::performDragging(), LIB_EDIT_FRAME::PlacePin(), SCH_EDIT_FRAME::prepareForNetlist(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::Process_Special_Functions(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::SetUnsetConvert(), PCB_EDIT_FRAME::Solve(), DIALOG_GENCAD_EXPORT_OPTIONS::TransferDataFromWindow(), DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::TransferDataFromWindow(), and DIALOG_LAYERS_SETUP::TransferDataFromWindow().

132 {
133  wxMessageDialog dlg( aParent, aMessage, _( "Confirmation" ),
134  wxYES_NO | wxCENTRE | wxICON_QUESTION );
135 
136  return dlg.ShowModal() == wxID_YES;
137 }
std::pair<bool, std::vector<int> > SelectMultipleOptions ( wxWindow *  aParent,
const wxString &  aTitle,
const wxString &  aMessage,
const wxArrayString &  aOptions,
bool  aDefaultState = false 
)

Displays a dialog with checkboxes asking the user to select one or more options.

Parameters
aParentis the parent window.
aTitleis the dialog title.
aMessageis a text label displayed in the first row of the dialog.
aOptionsis a vector of possible options.
aDefaultStateis the default state for the checkboxes.
Returns
Vector containing indices of the selected option.

Definition at line 313 of file confirm.cpp.

References DIALOG_MULTI_OPTIONS::GetSelection(), and DIALOG_MULTI_OPTIONS::SetCheckboxes().

Referenced by LIB_EDIT_FRAME::saveAllLibraries(), and SelectMultipleOptions().

315 {
316  std::vector<int> ret;
317  bool clickedOk;
318  DIALOG_MULTI_OPTIONS dlg( aParent, aTitle, aMessage, aOptions );
319  dlg.SetCheckboxes( aDefaultState );
320 
321  if( dlg.ShowModal() == wxID_OK )
322  {
323  ret = dlg.GetSelection();
324  clickedOk = true;
325  }
326  else
327  {
328  clickedOk = false;
329  }
330 
331  return std::make_pair( clickedOk, ret );
332 }
std::pair<bool, std::vector<int> > SelectMultipleOptions ( wxWindow *  aParent,
const wxString &  aTitle,
const wxString &  aMessage,
const std::vector< std::string > &  aOptions,
bool  aDefaultState = false 
)

Definition at line 335 of file confirm.cpp.

References SelectMultipleOptions().

337 {
338  wxArrayString array;
339 
340  for( const auto& option : aOptions )
341  array.Add( option );
342 
343  return SelectMultipleOptions( aParent, aTitle, aMessage, array, aDefaultState );
344 }
std::pair< bool, std::vector< int > > SelectMultipleOptions(wxWindow *aParent, const wxString &aTitle, const wxString &aMessage, const wxArrayString &aOptions, bool aDefaultState)
Displays a dialog with checkboxes asking the user to select one or more options.
Definition: confirm.cpp:313
int SelectSingleOption ( wxWindow *  aParent,
const wxString &  aTitle,
const wxString &  aMessage,
const wxArrayString &  aOptions 
)

Displays a dialog with radioboxes asking the user to select an option.

Parameters
aParentis the parent window.
aTitleis the dialog title.
aMessageis a text label displayed in the first row of the dialog.
aOptionsis a vector of possible options.
Returns
Index of the selected option or -1 when the dialog has been cancelled.

Definition at line 182 of file confirm.cpp.

Referenced by LIB_EDIT_FRAME::selectSymLibTable().

183 {
184  int ret = -1;
185  wxDialog* dlg = new wxDialog( aParent, wxID_ANY, aTitle );
186 
187  wxBoxSizer* boxSizer = new wxBoxSizer( wxVERTICAL );
188 
189  if( !aMessage.IsEmpty() )
190  boxSizer->Add( new wxStaticText( dlg, wxID_ANY, aMessage ), 0, wxEXPAND | wxALL, 5 );
191 
192  std::vector<wxRadioButton*> radioButtons;
193  radioButtons.reserve( aOptions.Count() );
194 
195  for( const wxString& option : aOptions )
196  {
197  radioButtons.emplace_back( new wxRadioButton( dlg, wxID_ANY, _( option ) ) );
198  boxSizer->Add( radioButtons.back(), 0, wxEXPAND | wxALL, 5 );
199  }
200 
201  wxStdDialogButtonSizer* m_sdboxSizer = new wxStdDialogButtonSizer();
202  m_sdboxSizer->AddButton( new wxButton( dlg, wxID_OK ) );
203  m_sdboxSizer->AddButton( new wxButton( dlg, wxID_CANCEL ) );
204  m_sdboxSizer->Realize();
205  boxSizer->Add( m_sdboxSizer, 1, wxEXPAND | wxALL, 5 );
206 
207  dlg->SetSizer( boxSizer );
208  dlg->Layout();
209  boxSizer->Fit( dlg );
210  boxSizer->SetSizeHints( dlg );
211  dlg->Centre( wxBOTH );
212 
213  if( dlg->ShowModal() == wxID_OK )
214  {
215  for( unsigned int i = 0; i < radioButtons.size(); ++i )
216  {
217  if( radioButtons[i]->GetValue() )
218  {
219  ret = i;
220  break;
221  }
222  }
223  }
224  else
225  {
226  ret = -1;
227  }
228 
229  dlg->Destroy();
230 
231  return ret;
232 }
int YesNoCancelDialog ( wxWindow *  aParent,
const wxString &  aPrimaryMessage,
const wxString &  aSecondaryMessage,
const wxString &  aYesButtonText = wxEmptyString,
const wxString &  aNoButtonText = wxEmptyString,
const wxString &  aCancelButtonText = wxEmptyString 
)

Function YesNoCancelDialog displays a yes/no/cancel dialog with aMessage and returns the user response.

Parameters
aParentis the parent window. NULL can be used if the parent is the top level window.
aPrimaryMessageis the message to display in the top part of the dialog box using a bold font.
aSecondaryMessageis the message to display in the lower part of the dialog box using the default system UI font.
aYesButtonTextis the text to display in the yes button when defined.
aNoButtonTextis the text to display in the no button when defiend.
aCancelButtonTextis the text to display in the cancel button when defined.
Returns
wxID_YES, wxID_NO, or wxID_CANCEL depending on the button the user selected.

Definition at line 168 of file confirm.cpp.

Referenced by SCH_EDIT_FRAME::AskToSaveChanges(), and PCB_EDIT_FRAME::OpenProjectFiles().

174 {
175  DIALOG_YES_NO_CANCEL dlg( aParent, aPrimaryMessage, aSecondaryMessage,
176  aYesButtonText, aNoButtonText, aCancelButtonText );
177 
178  return dlg.ShowModal();
179 }