⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 statedialog.cpp

📁 Powerful and Portable GPS application -- support Linux, Windows, Windows CE GPS navigation and Map m
💻 CPP
字号:
/* *  Roadnav *  StateDialog.cpp * *  Copyright (c) 2004 - 2007 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////// Prompts the user to select one or more states./////////////////////////////////////////////////////////////////////////////////#ifdef HAVE_CONFIG_H#  include <config.h>#endif#include <wx/wx.h>#include "StateDialog.h"#include "libroadnav/MapState.h"using namespace std;BEGIN_EVENT_TABLE(StateDialog, wxDialog)	EVT_BUTTON(wxID_OK, StateDialog::OnOk)END_EVENT_TABLE()//////////////////////////////////////////////////////////////////////////////////// \brief StateDialog constructor - create controls and initialize them./////////////////////////////////////////////////////////////////////////////////StateDialog::StateDialog(wxWindow *parent)             : wxDialog(parent, -1, wxString(_T("Select States")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER){	unsigned int i;	vector<wxString> vStates;	wxArrayString asStates;		vStates = GetStateNames();    wxBoxSizer *sizerWnd = new wxBoxSizer(wxVERTICAL);	m_ctlStates = new wxListCtrl(this,									-1,									wxDefaultPosition,									wxSize(500, 400),									wxLC_LIST									);	// sort county names	for (i = 0; i < vStates.size(); i++)		asStates.Add(vStates[i].c_str());		asStates.Sort();		// put into control	for (i = 0; i < asStates.Count(); i++)		m_ctlStates->InsertItem(i, asStates[i]);	sizerWnd->Add(m_ctlStates, 1, wxGROW | wxALL, 5);    wxBoxSizer *sizerBottom = new wxBoxSizer(wxHORIZONTAL);    wxButton * btnOk = new wxButton(this, wxID_OK, _T("&OK"));    sizerBottom->Add(btnOk, 0, wxALL, 5);    wxButton * btnCancel = new wxButton(this, wxID_CANCEL, _T("&Cancel"));    sizerBottom->Add(btnCancel, 0, wxALL, 5);	sizerWnd->Add(sizerBottom, 0, wxALIGN_CENTER | wxALL, 5);	SetAutoLayout(TRUE);	SetSizer(sizerWnd);		sizerWnd->SetSizeHints(this);	sizerWnd->Fit(this);		m_ctlStates->SetFocus();	btnOk->SetDefault();		Center();}//////////////////////////////////////////////////////////////////////////////////// \brief Ok clicked - save the selection to the vector m_strSelStates/////////////////////////////////////////////////////////////////////////////////void StateDialog::OnOk(wxCommandEvent& event){	long item = -1;		m_strSelStates.clear();	item = m_ctlStates->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);	while (item >= 0)	{		wxString strStateAbbreviation = m_ctlStates->GetItemText(item);		wxString strStateName = StateAbbreviationByName(strStateAbbreviation);		m_strSelStates.push_back(strStateName);		item = m_ctlStates->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);	}		EndModal(wxID_OK);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -