Symbian, Blog, Innovation

ScreenShot源代码研究–跨平台

09月 20th, 2007

如何写一个Symbian平台的应用,如S60第一二版,S60第三版,UIQ,这是一个框架方面的东西。

下面的代码在symbianvariant.h文件中,是用来跨S60和UIQ平台的

#define __S60__ 300

// #define __UIQ__ 210

这个东西是用来定义SDK的版本的,因为有些资源或其他的东西各SDK还是有差别的,所以代码中用这个宏来确定编译时所需要的资源。

如下面的资源定义:

#if (__S60__ < 300)
  
 items =
  {
  AVKON_SETTING_ITEM
            {
            identifier = EBencoolenDlgLocation;
            setting_page_resource = r_bencoolen_binary_location_page;
            associated_resource = r_bencoolen_binary_location_resource;
            name = string_bencoolen_dialog_location;
            }
  };
  
#else
  
 items =
  {
        AVKON_SETTING_ITEM
            {
            identifier = EBencoolenDlgLocation;
            setting_page_resource = r_bencoolen_memory_selection_dialog;
            name = string_bencoolen_dialog_location;
            }
        };
       
#endif

 由于S60和UIQ 的Application,Document和UI是从不同基类继承的。

这么一定义,所有的都能用CSymbianXXX来定义了!但是View是没有办法的,只能写各自不同的文件

#ifdef __S60__

#define CSymbianApplication CAknApplication
#define CSymbianDocument CAknDocument
#define CSymbianAppUi  CAknAppUi

#else

#define CSymbianApplication CQikApplication
#define CSymbianDocument CQikDocument
#define CSymbianAppUi  CQikAppUi

#endif

在mmp文件中:第一部分是S60和UIQ平台公用的,代码在src目录下;

第二部分是所有S60平台专用的,代码在s60目录下。

UIQ第二部分的代码在uiq目录下。

SOURCEPATH           ..\..\src
SOURCE               BencoolenApp.cpp
SOURCE               BencoolenAppui.cpp
SOURCE               BencoolenDocument.cpp
SOURCE               BencoolenAppContainer.cpp
SOURCE               ScreenShot.cpp
SOURCE               ScreenShotData.cpp

SOURCEPATH           ..\..\src\s60
SOURCE               BencoolenAppView.cpp
SOURCE               BencoolenSettingsView.cpp
SOURCE               BencoolenSettingsListBox.cpp
SOURCE               BencoolenAboutDlg.cpp

Popularity: 5% [?]

Entry Filed under: Symbian代码研究, Symbian开发

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


标签

Calendar

09月 2007
    Oct »
 12
3456789
10111213141516
17181920212223
24252627282930

Most Recent Posts