Symbian程序结构分析主要内容程序结构工程组织应用图标及启动资源文件打包图片打包文件格式多视图程序程序结构S60应用框架MVC设计模式ApplicationDocumentAppUiViewModel程序结构GUI应用运行分析代码分析应用类文档类AppUi类启动代码运行分析工程组织bld.infPRJ_PLATFORMSWINSCWARMV5GCCEPRJ_MMPFILESgnumakefileicons_scalable_dc.mkgnumakefile..\help\build_help.mkExam0303NewGui.mmp工程组织工程组织文件*.mmpTARGETExam0303NewGui_0xE2F675DA.exeTARGETTYPEexeUID0x100039CE0xE2F675DASOURCEPATH..\srcSOURCEExam0303NewGui.cppSOURCEExam0303NewGuiApplication.cpp工程组织SOURCEPATH..\dataSTARTRESOURCEExam0303NewGui.rssHEADERTARGETExam0303NewGui_0xE2F675DATARGETPATHresource\appsEND//RESOURCESTARTRESOURCEExam0303NewGui_reg.rssTARGETExam0303NewGui_0xE2F675DA_regTARGETPATH\private\10003a3f\appsEND//RESOURCE工程组织USERINCLUDE..\incUSERINCLUDE..\helpSYSTEMINCLUDE\epoc32\includeLIBRARYeuser.libLIBRARYapparc.libLIBRARYcone.libLANGSCVENDORID0SECUREID0xE2F675DACAPABILITYReadUserData应用图标及启动注册表资源文件1.#includeExam0303NewGui.hrh2.#includeExam0303NewGui.rls3.#include4.#include5.6.UID2KUidAppRegistrationResourceFile7.UID3_UID38.9.RESOURCEAPP_REGISTRATION_INFO10.{11.app_file=Exam0303NewGui_0xE2F675DA;12.localisable_resource_file=qtn_loc_resource_file_1;13.localisable_resource_id=R_LOCALISABLE_APP_INFO;14.15.embeddability=KAppNotEmbeddable;16.newfile=KAppDoesNotSupportNewFile;17.}应用图标及启动在程序资源文件中定义下面的资源RESOURCELOCALISABLE_APP_INFOr_localisable_app_info{short_caption=qtn_caption_string;caption_and_icon=CAPTION_AND_ICON_INFO{caption=qtn_caption_string;number_of_icons=1;icon_file=\\resource\\apps\\Exam0303NewGui_0xE2F675DA.mif;};}打包图片打包矢量图片使用*.mk文件例子Icons_scalable_dc.mk1.ifeq(WINS,$(findstringWINS,$(PLATFORM)))2.ZDIR=$(EPOCROOT)epoc32\release\$(PLATFORM)\$(CFG)\Z3.else4.ZDIR=$(EPOCROOT)epoc32\data\z5.endif6.7.TARGETDIR=$(ZDIR)\resource\apps8.ICONTARGETFILENAME=$(TARGETDIR)\ImiChatApp.mif9.11.ICONDIR=..\gfx12.......13.RESOURCE:$(ICONTARGETFILENAME)14.15.$(ICONTARGETFILENAME):$(ICONDIR)\qgn_menu_ImiChat.svg16.mifconv$(ICONTARGETFILENAME)\17./c32$(ICONDIR)\qgn_menu_ImiChat.svg18.......资源文件程序资源文件格式资源文件头资源文件体资源文件资源文件头//代码块1资源标识符NAMEEXAM//4letterID//代码块2INCLUDES#include#include//代码块3定义资源文件签名,这个资源应该是空的RESOURCERSS_SIGNATURE{}//代码块4缺省的文档名称RESOURCETBUFr_default_document_name{buf=EXAM;}//代码块5定义应用默认的菜单和CBA栏按钮RESOURCEEIK_APP_INFO{menubar=r_menubar;cba=R_AVKON_SOFTKEYS_OPTIONS_EXIT;}资源文件资源文件体RESOURCESTRUCTNAMEres_name{resource-initializer-list}资源文件编译资源文件资源文件定义菜单1.RESOURCEMENU_BARr_menubar2.{3.titles=4.{5.MENU_TITLE{menu_pane=r_menu;}6.};8.}9.资源文件定义菜单10.//r_menu11.//MenuforOptions12.RESOURCEMENU_PANEr_menu13.{14.items=15.{16.//addedthenewOptionsmenucommandhere17.MENU_ITEM18.{19.command=ECommand1;20.txt=“Message”;21.},22.MENU_ITEM23.{24.command=ECommand2;25.txt=qtn_command2;26.},27.……28.};29.}资源文件处理菜单命令voidCExam0303NewGuiAppUi::HandleCommandL(TIntaCommand){switch(aCommand){caseEEikCmdExit:caseEAknSoftkeyExit:Exit();break;caseECommand1://break;default:Panic(EExam0303NewGuiUi);break;}}资源文件定义CBA栏RESOURCECBAr_confirmation_softkeys_ok_cancel{buttons={CBA_BUTTON{id=EAknSoftkeyOk;txt=“ok”;},CBA_BUTTON{id=EAknSoftkeyCancel;txt=“cancel”;}};}资源文件定义字符串资源定义本地化字符串资源#defineqtn_caption_stringExam0303NewGui定义资源RESOURCETBUF32r_caption_string{buf=qtn_caption_string;}使用字符串定义HBufC*textResource=StringLoader::LoadLC(R_CAPTION_STRING);CAknInformationNote*informationNote;informationNote=new(ELeave)CAknInformationNote;informationNote->ExecuteLD(*textResource);CleanupStack::PopAndDestroy(textResource);BMP图片打包在mmp文件中打包位图STARTBITMAPvas.mbmHEADERTARGETPATH\resource\appsSOURCEPATH..\lookandfeel\bmpSOURCEc12vas_icon.bmpSOURCEc12vas_icon_mask.bmpSOURCEc12vas_title.bmpSOURCEc12vas_title_mask.bmpEND打包文件格式1.;程序支持的语言定义2.&EN3.4.;标准SIS文件头5.#{Exam0303NewGui},(0xE2F675DA),1,0,06.7.;本地开发商名称8.%{Vendor-EN}9.10.;开发商名称11.:Vendor12.13.;安装程序支持的S60版本14.[0x101F7961],0,0,0,{Series60ProductID}15.16.;安装的文件17.\Symbian\9.1\S60_3rd_MR\Epoc32\release\gcce\urel\Exam0303NewGui_0xE2F675DA.exe-!:\sys\bin\Exam0303NewGui_0xE2F675DA.exe18.……打包文件格式S60平台UID对照表
本文标题:symbian 入门教程04
链接地址:https://www.777doc.com/doc-1524 .html