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

📄 preferencespageosm.cpp

📁 roadnav 内含一个基于wxWindows库的车载导航系统。编译后
💻 CPP
字号:
/*
 *  Roadnav
 *  PreferencesPageOSM.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 the OpenStreetMap page of the preferences dialog box.
///
//////////////////////////////////////////////////////////////////////////////

#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif

#ifdef _MSC_VER
#pragma warning(disable: 4786)
#pragma warning(disable: 4800)
#endif

#include <wx/wx.h>

#ifdef USE_OPENSTREETMAP

#include "App.h"
#include "PreferencesPageOSM.h"
#include "libroadnav/URLs.h"

using namespace std;

//////////////////////////////////////////////////////////////////////////////
///
/// PreferencesPageOSM event table
///
//////////////////////////////////////////////////////////////////////////////
BEGIN_EVENT_TABLE(PreferencesPageOSM, wxPanel)
END_EVENT_TABLE()

//////////////////////////////////////////////////////////////////////////////
///
/// \brief PreferencesPageOSM constructor - create controls and initialize them
///
//////////////////////////////////////////////////////////////////////////////
PreferencesPageOSM::PreferencesPageOSM(wxWindow *parent)
             : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL)
{
	wxBoxSizer * psizerWnd;
	wxFlexGridSizer * psizerGrid;
	
	psizerGrid = new wxFlexGridSizer(2, 5, 10);

	//////////////////////////////////////////////////////////////////////////
	// Username Label
	//////////////////////////////////////////////////////////////////////////
	psizerGrid->Add(
		new wxStaticText(this, -1, wxT("Username")),
		0,
		wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT,
		0
	);
	
	//////////////////////////////////////////////////////////////////////////
	// Username Entry
	//////////////////////////////////////////////////////////////////////////

	m_pctlUsername = new wxTextCtrl(this, -1, g_pConfig->Read(wxT("OSMUsername")), wxDefaultPosition, wxSize(250, -1));

	psizerGrid->Add(
		m_pctlUsername, 
		0,
		wxALIGN_LEFT,
		0
	);
	
	//////////////////////////////////////////////////////////////////////////
	// Password Label
	//////////////////////////////////////////////////////////////////////////
	psizerGrid->Add(
		new wxStaticText(this, -1, wxT("Password")),
		0,
		wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT,
		0
	);
	
	//////////////////////////////////////////////////////////////////////////
	// Password Entry
	//////////////////////////////////////////////////////////////////////////

	m_pctlPassword = new wxTextCtrl(this, -1, g_pConfig->Read(wxT("OSMPassword")), wxDefaultPosition, wxSize(250, -1), wxTE_PASSWORD);

	psizerGrid->Add(
		m_pctlPassword, 
		0,
		wxALIGN_LEFT,
		0
	);
	

	//////////////////////////////////////////////////////////////////////////
	// psizerWnd just adds a border to psizerGrid
	//////////////////////////////////////////////////////////////////////////
	
	psizerWnd = new wxBoxSizer(wxVERTICAL);
	psizerWnd->Add(
		psizerGrid,
		0,
		wxALL | wxGROW,
		10
	);
	
	//////////////////////////////////////////////////////////////////////////
	// Set up the sizer
	//////////////////////////////////////////////////////////////////////////

	m_pctlUsername->SetFocus();
	psizerWnd->Fit(this);
	SetSizer(psizerWnd);
	Layout();
	psizerWnd->SetSizeHints(this);
	
}

//////////////////////////////////////////////////////////////////////////////
///
/// \brief Ok was pressed .. save the settings
///
//////////////////////////////////////////////////////////////////////////////

void PreferencesPageOSM::OnOk(wxCommandEvent& event)
{
	g_pConfig->Write(wxT("OSMUsername"), m_pctlUsername->GetValue());
	g_pConfig->Write(wxT("OSMPassword"), m_pctlPassword->GetValue());
}

#endif

⌨️ 快捷键说明

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