minimal.cpp

来自「Powerful and Portable GPS application --」· C++ 代码 · 共 114 行

CPP
114
字号
/* *  LibRoadnav *  minimal.cpp * *  Copyright (c) 2004 - 2005 Richard L. Lynch <rllynch@users.sourceforge.net> * *  This program is free software; you can redistribute it and/or *  modify it under the terms of the GNU Lesser General Public *  License as published by the Free Software Foundation; either *  version 2.1 of the License, or (at your option) any later version. * *  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 Lesser General Public License for more details. * *  You should have received a copy of the GNU Lesser General Public *  License along with this library; if not, write to the Free Software *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */#ifdef HAVE_CONFIG_H#  include <config.h>#endif#ifdef _MSC_VER#pragma warning(disable: 4786)#endif#include <wx/wx.h>#include <wx/image.h>#include <wx/fs_zip.h>#include <wx/fs_inet.h>#include <wx/socket.h>#include "libroadnav/Map.h"#include "libroadnav/MapControl.h"#include "libroadnav/MapControlData_Tiles.h"#define TIMER_INIT		1class MyApp : public wxApp{	public:		virtual bool OnInit();};class MyFrame : public wxFrame{	public:		MyFrame(const wxString& title);		~MyFrame();	private:		void OnTimerInit(wxTimerEvent& event);		MapControl * m_pctlMap;		MapAppearanceSettings m_cMapAppearanceSettings;		MapControlData_Tiles m_cMapRecords;		wxTimer * m_ptmrInit;		DECLARE_EVENT_TABLE()};BEGIN_EVENT_TABLE(MyFrame, wxFrame)	EVT_TIMER(TIMER_INIT, MyFrame::OnTimerInit)END_EVENT_TABLE()IMPLEMENT_APP(MyApp)bool MyApp::OnInit(){	wxInitAllImageHandlers();	wxFileSystem::AddHandler(new wxZipFSHandler);	wxFileSystem::AddHandler(new wxInternetFSHandler);	MyFrame * pFrame = new MyFrame(wxT("Minimal LibRoadnav App"));	pFrame->Show(true);	return true;}MyFrame::MyFrame(const wxString& title) : wxFrame(NULL, -1, title){	m_ptmrInit = new wxTimer(this, TIMER_INIT);	m_ptmrInit->Start(1, true);	m_pctlMap = new MapControl	(								&m_cMapRecords, 								&m_cMapAppearanceSettings, 								this, 								-1, 								wxDefaultPosition,								wxDefaultSize								);	m_pctlMap->SetDetailLevel(0);	m_pctlMap->SetCenterCoordinates(Point(-71, 43));}void MyFrame::OnTimerInit(wxTimerEvent& event){	MapInit();}MyFrame::~MyFrame(){	delete m_ptmrInit;}

⌨️ 快捷键说明

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