资源描述
Symbian程序结构分析,主要内容,程序结构工程组织应用图标及启动资源文件打包图片打包文件格式多视图程序,程序结构,S60应用框架MVC设计模式,程序结构,GUI应用运行分析代码分析应用类文档类AppUi类启动代码运行分析,工程组织,bld.infPRJ_PLATFORMSWINSCWARMV5GCCEPRJ_MMPFILESgnumakefileicons_scalable_dc.mkgnumakefile.helpbuild_help.mkExam0303NewGui.mmp,工程组织,工程组织文件*.mmpTARGETExam0303NewGui_0 xE2F675DA.exeTARGETTYPEexeUID0 x100039CE0 xE2F675DASOURCEPATH.srcSOURCEExam0303NewGui.cppSOURCEExam0303NewGuiApplication.cpp,工程组织,SOURCEPATH.dataSTARTRESOURCEExam0303NewGui.rssHEADERTARGETExam0303NewGui_0 xE2F675DATARGETPATHresourceappsEND/RESOURCESTARTRESOURCEExam0303NewGui_reg.rssTARGETExam0303NewGui_0 xE2F675DA_regTARGETPATHprivate10003a3fappsEND/RESOURCE,工程组织,USERINCLUDE.incUSERINCLUDE.helpSYSTEMINCLUDEepoc32includeLIBRARYeuser.libLIBRARYapparc.libLIBRARYcone.libLANGSCVENDORID0SECUREID0 xE2F675DACAPABILITYReadUserData,应用图标及启动,注册表资源文件1.#includeExam0303NewGui.hrh2.#includeExam0303NewGui.rls3.#include4.#include5.6.UID2KUidAppRegistrationResourceFile7.UID3_UID38.9.RESOURCEAPP_REGISTRATION_INFO10.11.app_file=Exam0303NewGui_0 xE2F675DA;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_infoshort_caption=qtn_caption_string;caption_and_icon=CAPTION_AND_ICON_INFOcaption=qtn_caption_string;number_of_icons=1;icon_file=resourceappsExam0303NewGui_0 xE2F675DA.mif;,打包图片,打包矢量图片使用*.mk文件例子Icons_scalable_dc.mk1.ifeq(WINS,$(findstringWINS,$(PLATFORM)2.ZDIR=$(EPOCROOT)epoc32release$(PLATFORM)$(CFG)Z3.else4.ZDIR=$(EPOCROOT)epoc32dataz5.endif6.7.TARGETDIR=$(ZDIR)resourceapps8.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_namebuf=EXAM;/代码块5定义应用默认的菜单和CBA栏按钮RESOURCEEIK_APP_INFOmenubar=r_menubar;cba=R_AVKON_SOFTKEYS_OPTIONS_EXIT;,资源文件,资源文件体RESOURCESTRUCTNAMEres_nameresource-initializer-list,资源文件,编译资源文件,资源文件,定义菜单1.RESOURCEMENU_BARr_menubar2.3.titles=4.5.MENU_TITLEmenu_pane=r_menu;6.;8.9.,资源文件,定义菜单10./r_menu11./MenuforOptions12.RESOURCEMENU_PANEr_menu13.14.items=15.16./addedthenewOptionsmenucommandhere17.MENU_ITEM18.mand=ECommand1;20.txt=“Message”;21.,22.MENU_ITEM23.mand=ECommand2;25.txt=qtn_command2;26.,2728.;29.,资源文件,处理菜单命令voidCExam0303NewGuiAppUi:HandleCommandL(TIntaCommand)switch(aCommand)caseEEikCmdExit:caseEAknSoftkeyExit:Exit();break;caseECommand1:/break;default:Panic(EExam0303NewGuiUi);break;,资源文件,定义CBA栏RESOURCECBAr_confirmation_softkeys_ok_cancelbuttons=CBA_BUTTONid=EAknSoftkeyOk;txt=“ok”;,CBA_BUTTONid=EAknSoftkeyCancel;txt=“cancel”;,资源文件,定义字符串资源定义本地化字符串资源#defineqtn_caption_stringExam0303NewGui定义资源RESOURCETBUF32r_caption_stringbuf=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.mbmHEADERTARGETPATHresourceappsSOURCEPATH.lookandfeelbmpSOURCEc12vas_icon.bmpSOURCEc12vas_icon_mask.bmpSOURCEc12vas_title.bmpSOURCEc12vas_title_mask.bmpEND,打包文件格式,1.;程序支持的语言定义2.安装的文件17.Symbian9.1S60_3rd_MREpoc32releasegcceurelExam0303NewGui_0 xE2F675DA.exe-!:sysbinExam0303NewGui_0 xE2F675DA.exe18.,打包文件格式,S60平台UID对照表,
展开阅读全文