📄 saveassettingsdialog.cpp
字号:
/* * Roadnav * SaveAsSettingsDialog.cpp * * Copyright (c) 2004 - 2006 Richard L. Lynch <rllynch@users.sourceforge.net> * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public License * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *////////////////////////////////////////////////////////////////////////////////// \file////// Contains SaveAsSettingsDialog - a dialog box prompting the user for/// file->save as settings like how big the map should be, AA level, etc./////////////////////////////////////////////////////////////////////////////////#ifdef HAVE_CONFIG_H# include <config.h>#endif#include <wx/wx.h>#ifdef _MSC_VER#pragma warning(disable: 4786)#endif#include "App.h"#include "SaveAsSettingsDialog.h"#include <vector>using namespace std;//////////////////////////////////////////////////////////////////////////////// button IDs//////////////////////////////////////////////////////////////////////////////enum{};BEGIN_EVENT_TABLE(SaveAsSettingsDialog, wxDialog) EVT_BUTTON(wxID_OK, SaveAsSettingsDialog::OnOk)END_EVENT_TABLE()//////////////////////////////////////////////////////////////////////////////////// \brief Constructor - creates all of the controls and initializes them with/// default values from the registry./////////////////////////////////////////////////////////////////////////////////SaveAsSettingsDialog::SaveAsSettingsDialog(wxWindow *parent) : wxDialog(parent, -1, wxString(wxT("Save File As Settings"))){ wxBoxSizer * psizerWnd; wxFlexGridSizer * psizerGrid; int i; m_iWidth = 0; m_iHeight = 0; psizerGrid = new wxFlexGridSizer(2, 5, 10); ////////////////////////////////////////////////////////////////////////// // Width text ////////////////////////////////////////////////////////////////////////// psizerGrid->Add( new wxStaticText(this, -1, wxT("Width")), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT, 0 ); ////////////////////////////////////////////////////////////////////////// // Width spinner ////////////////////////////////////////////////////////////////////////// m_pctlWidth = new wxSpinCtrl(this, -1); g_pConfig->Read(wxT("SaveAsWidth"), &i, 1024); m_pctlWidth->SetRange(1, 8192); m_pctlWidth->SetValue(i); psizerGrid->Add( m_pctlWidth, 0, wxALIGN_LEFT, 0 ); ////////////////////////////////////////////////////////////////////////// // Height text ////////////////////////////////////////////////////////////////////////// psizerGrid->Add( new wxStaticText(this, -1, wxT("Height")), 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT, 0 ); ////////////////////////////////////////////////////////////////////////// // Height spinner ////////////////////////////////////////////////////////////////////////// m_pctlHeight = new wxSpinCtrl(this, -1); g_pConfig->Read(wxT("SaveAsHeight"), &i, 768); m_pctlHeight->SetRange(1, 8192); m_pctlHeight->SetValue(i); psizerGrid->Add( m_pctlHeight, 0, wxALIGN_LEFT, 0 ); ////////////////////////////////////////////////////////////////////////// // psizerWnd just adds a border to psizerGrid ////////////////////////////////////////////////////////////////////////// psizerWnd = new wxBoxSizer(wxVERTICAL); psizerWnd->Add( psizerGrid, 0, wxALL | wxGROW, 10 ); ////////////////////////////////////////////////////////////////////////////// // ok and cancel button ////////////////////////////////////////////////////////////////////////////// wxBoxSizer *sizerBottom = new wxBoxSizer(wxHORIZONTAL); wxButton * btnOk = new wxButton(this, wxID_OK, wxT("&OK")); sizerBottom->Add(btnOk, 0, wxALIGN_CENTER | wxALL, 5); wxButton * btnCancel = new wxButton(this, wxID_CANCEL, wxT("&Cancel")); sizerBottom->Add(btnCancel, 0, wxALIGN_CENTER | wxALL, 5); psizerWnd->Add(sizerBottom, 0, wxALIGN_CENTER, 0); ////////////////////////////////////////////////////////////////////////// // Set up the sizer ////////////////////////////////////////////////////////////////////////// psizerWnd->Fit(this); SetSizer(psizerWnd); Layout(); psizerWnd->SetSizeHints(this); btnOk->SetDefault(); Center();}//////////////////////////////////////////////////////////////////////////////////// \brief Ok pressed/////////////////////////////////////////////////////////////////////////////////void SaveAsSettingsDialog::OnOk(wxCommandEvent& event){ m_iWidth = m_pctlWidth->GetValue(); m_iHeight = m_pctlHeight->GetValue(); EndModal(wxID_OK);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -