📄 versionpage.cpp
字号:
/* VersionPage.cpp *//******************************************************************************************* Copyright 2002-2003 ATMEL Corporation. This file is part of ATMEL Wireless LAN Drivers. ATMEL Wireless LAN Drivers is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. ATMEL Wireless LAN Drivers 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 ATMEL Wireless LAN Drivers; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA*******************************************************************************************/#include "VersionPage.h"#include "Decls.h"#include "Accessor.h"#include "WinterFrame.h"#include "WinterModel.h"#include "WinterData.h"#include "Device.h"#ifndef __WXMSW__#include "atmel.xpm"#endif // __WXMSW__#include <wx/bitmap.h>CVersionPage::CVersionPage( wxWindow *parent, int id, const wxPoint &pos, const wxSize &size, long style ) : CWinterPage( parent, id, pos ){ //version page setup wxBoxSizer *sz_curline; int border = 30; wxSize page_labelsize( 200, -1 ); wxSize page_labelsize_2( 180, -1 ); wxStaticBox *sb_statusbox = new wxStaticBox( this, ID_SB_STATUS, _( "Driver Information" ) ); //atmel box group wxBoxSizer *sz_firstbox = new wxBoxSizer( wxVERTICAL ); //atmel bitmap wxBitmap bmp_atmel_logo( wxBITMAP( BMP_ATMEL_LOGO ) );#ifdef __WXMSW__ wxMask *msk_atmel_logo = new wxMask( bmp_atmel_logo, wxColour( 255, 255, 255 ) ); bmp_atmel_logo.SetMask( msk_atmel_logo );#endif // __WXMSW__ wxStaticBitmap *sbmp_atmellogo = new wxStaticBitmap( this, ID_SBMP_ATMELLOGO, bmp_atmel_logo ); sz_firstbox->Add( 1, 1, 1, wxEXPAND, 0 ); sz_firstbox->Add( sbmp_atmellogo, 0, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 0 ); sz_firstbox->Add( 1, 1, 1, wxEXPAND, 0 ); //status box group wxStaticBoxSizer *sz_secondbox = new wxStaticBoxSizer( sb_statusbox, wxVERTICAL ); //DriverVersion sz_curline = new wxBoxSizer( wxHORIZONTAL ); sz_secondbox->Add( 1, 10, 0, 1 ); sz_curline->Add( 1, 10, 1, 0 ); sz_curline->Add( new wxStaticText( this, ID_ST_DRIVERVERSION, _( "Driver Version" ), wxDefaultPosition, page_labelsize ), 0, wxALIGN_CENTER_VERTICAL, 0 ); sz_curline->Add( new wxTextCtrl( this, ID_TX_DRIVERVERSION_NUM, wxT( "" ), wxDefaultPosition, wxDefaultSize, wxTE_READONLY | wxTE_CENTRE ), 0, wxALIGN_CENTER_VERTICAL, 0 ); sz_curline->Add( 1, 10, 1, 0 ); sz_secondbox->Add( sz_curline, 0, wxEXPAND | wxALL, border ); //FirmwareVersion sz_curline = new wxBoxSizer( wxHORIZONTAL ); sz_curline->Add( 1, 10, 1, 0 ); sz_curline->Add( new wxStaticText( this, ID_ST_FIRMWAREVERSION, _( "Firmware Version" ), wxDefaultPosition, page_labelsize ), 0, wxALIGN_CENTER_VERTICAL, 0 ); sz_curline->Add( new wxTextCtrl( this, ID_TX_FIRMWAREVERSION_NUM, wxT( "" ), wxDefaultPosition, wxDefaultSize, wxTE_READONLY | wxTE_CENTRE ), 0, wxALIGN_CENTER_VERTICAL, 0 ); sz_curline->Add( 1, 10, 1, 0 ); sz_secondbox->Add( sz_curline, 0, wxEXPAND | wxALL, border ); //applicationVersion sz_curline = new wxBoxSizer( wxHORIZONTAL ); sz_curline->Add( 1, 10, 1, 0 ); sz_curline->Add( new wxStaticText( this, ID_ST_APPLICATIONVERSION, _( "Application Version" ), wxDefaultPosition, page_labelsize ), 0, wxALIGN_CENTER_VERTICAL, 0 ); sz_curline->Add( new wxTextCtrl( this, ID_TX_APPLICATIONVERSION_NUM, wxT( "" ), wxDefaultPosition, wxDefaultSize, wxTE_READONLY | wxTE_CENTRE ), 0, wxALIGN_CENTER_VERTICAL, 0 ); sz_curline->Add( 1, 10, 1, 0 ); sz_secondbox->Add( sz_curline, 0, wxEXPAND | wxALL, border ); //Version page sizer wxBoxSizer *sz_page_version = new wxBoxSizer( wxVERTICAL ); sz_page_version->Add( sz_firstbox, 1, wxEXPAND | wxALL, 5 ); sz_page_version->Add( sz_secondbox, 3, wxEXPAND | wxALL, 5 ); SetSizer( sz_page_version ); SetAutoLayout( true );}CVersionPage::~CVersionPage( ){}// Higher update levelvoid CVersionPage::UpdateWinterPage( ){ CWinterModel *model = ( CWinterModel * ) CAccessor::Access( AID_CURRENTMODEL ); CVnetDeviceBase *device = ( CVnetDeviceBase * ) CAccessor::Access( AID_CURRENTDEVICE ); CVersionInfoData *data = ( CVersionInfoData * ) model->GetChild( MC_VERSIONINFODATA ); if( device->GetVersionInfo( data ) == false ) { ::wxMessageBox( _( "Failed to read version info." ), wxT( "Winter" ), wxICON_HAND, ( CWinterFrame * ) CAccessor::Access( AID_FRAME ) ); return; } TransferToControls( ); return;}int CVersionPage::TestControlValues( ){ return 0;}int CVersionPage::TransferToControls( CWinterModel *model ){ if( model == NULL ) { model = ( CWinterModel * ) CAccessor::Access( AID_CURRENTMODEL ); } CVersionInfoData *version_data = ( CVersionInfoData * ) model->GetChild( MC_VERSIONINFODATA ); ( ( wxTextCtrl * )FindWindowById( ID_TX_DRIVERVERSION_NUM ) )->SetValue( wxString::Format( wxT( "%d.%d.%d.%d" ), version_data->GetDriverMajorVersion( ), version_data->GetDriverMinorVersion( ), version_data->GetDriverSubVersion( ), version_data->GetDriverBuild( ) ) ); ( ( wxTextCtrl * )FindWindowById( ID_TX_FIRMWAREVERSION_NUM ) )->SetValue( wxString::Format( wxT( "%d.%d.%d.%d" ), version_data->GetFwMajorVersion( ), version_data->GetFwMinorVersion( ), version_data->GetFwSubVersion( ), version_data->GetFwBuild( ) ) ); ( ( wxTextCtrl * )FindWindowById( ID_TX_APPLICATIONVERSION_NUM ) )->SetValue( wxString::Format( wxT( "%d.%d.%d.%d" ), WINTER_VERSION_MAJOR, WINTER_VERSION_MINOR, WINTER_VERSION_SUB, WINTER_VERSION_BUILD ) ); return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -