Главная » Просмотр файлов » Wiley.Developing.Software.for.Symbian.OS.2nd.Edition.Dec.2007

Wiley.Developing.Software.for.Symbian.OS.2nd.Edition.Dec.2007 (779887), страница 11

Файл №779887 Wiley.Developing.Software.for.Symbian.OS.2nd.Edition.Dec.2007 (Symbian Books) 11 страницаWiley.Developing.Software.for.Symbian.OS.2nd.Edition.Dec.2007 (779887) страница 112018-01-10СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 11)

This file isthe same for both S60 and UIQ platforms, and contains just one line:#define SIMPLEEXUID 0xE000027FThis include simply assigns a macro variable to the software’s uniqueUser Identifier (UID) to be used in the C++ code as well as the registration resource file. UIDs will be discussed in more detail in Chapter 5.Suffice to say now that each application needs a unique UID. Normally UIDs are reserved and obtained through Symbian, but the range0xE0000000–0xFFFFFFFF can be randomly selected by the programmer for development-level code.At this point, you should have, in the include directory, the SimpleEx.h that corresponds to your platform as well as SimpleExUid.h.2.3.4 Resource FileNow, let’s create the resource file to define the UI elements – in this casethe menu/softkey item used to display the alert dialog.The following shows the resource files for S60 and UIQ – enter theone corresponding to your platform into a file called SimpleEx.rss,and place it in the group directory.The resource file for S60 3rd Edition is as follows:/*=====================================S60 SimpleEx Resource File=====================================*/NAME SIMP#include <eikon.rh>#include <avkon.rh>#include <avkon.rsg>#include "SimpleEx.hrh"RESOURCE RSS_SIGNATURE{}RESOURCE TBUF r_default_document_name{buf="";}RESOURCE EIK_APP_INFO{menubar = r_SimpleEx_menubar;cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT;}RESOURCE MENU_BAR r_SimpleEx_menubar{SIMPLE EXAMPLE APPLICATIONtitles ={MENU_TITLE{menu_pane = r_SimpleEx_menu;}};}RESOURCE MENU_PANE r_SimpleEx_menu{items ={MENU_ITEM{command = ESimpleExCommand;txt = "Start";}};}Below is the resource file for UIQ 3:/*=====================================UIQ SimpleEx Resource File=====================================*/NAME SIMP#include <eikon.rh>#include <qikon.rh>#include <QikCommand.rh>#include "SimpleEx.hrh"RESOURCE RSS_SIGNATURE{}RESOURCE TBUF r_default_document_name{buf="";}RESOURCE EIK_APP_INFO{}RESOURCE QIK_VIEW_CONFIGURATIONS r_simpleex_configurations{configurations ={QIK_VIEW_CONFIGURATION{ui_config_mode = KQikPenStyleTouchPortrait;command_list = r_simpleex_commands;view = r_simpleex_layout;},QIK_VIEW_CONFIGURATION{ui_config_mode = KQikSoftkeyStyleSmallPortrait;command_list = r_simpleex_commands;view = r_simpleex_layout;}};4546SYMBIAN OS QUICK START}RESOURCE QIK_COMMAND_LIST r_simpleex_commands{items ={QIK_COMMAND{id = ESimpleExCommand;type = EQikCommandTypeScreen;text = "Start";},// This command is only visible in debug mode for finding memory leaks.// Exit is not in production UIQ code.QIK_COMMAND{id = EEikCmdExit;type = ESimpleExCommand;// Indicate that this command will only be visible in debugstateFlags = EQikCmdFlagDebugOnly;text = "Exit";}};}RESOURCE QIK_VIEW r_simpleex_layout{pages = r_simpleex_layout_pages;}// Defines the pages of a view.// Only one page for this example.RESOURCE QIK_VIEW_PAGES r_simpleex_layout_pages{pages ={QIK_VIEW_PAGE{page_id = ESimpleExViewPage;}};}A resource file is a text file that defines the user interface elements ofan application.

As in other operating systems (e.g., Microsoft Windows),the developer can use explicit programming techniques to create GUIcontrols; however, the resource file provides a more manageable alternative. Historically in Symbian OS, the resource file had to be created usinga text editor; however, there is a Carbide.c++ tool (UI designer) whichcan be used as a graphical resource editor. The UI designer is available inthe Developer and Professional editions of Carbide.c++.

Unfortunately,the free Express edition of Carbide.c++ does not support UI designer.Furthermore, UIQ 3 is not supported by the UI designer. There are othertools appearing that have Symbian UI visual design capabilities. Oneexample is Wirelexsoft’s visual IDE tools that include graphical resourceSIMPLE EXAMPLE APPLICATION47editing support for UIQ 3.

Let’s skim through the highlights of the resourcefile to help understand the SimpleEx example. You will see that thereare some significant differences between the S60 and UIQ resources. Iwill point these out as I go.Resource files contain a set of RESOURCE structures to define theprogram’s GUI elements. The EIK APP INFO resource defines generalapplication attributes such as the application’s default menu, softkeysettings, tool bars, status panes, and hotkey definitions. For S60, Idefine two things in the EIK APP INFO resource for SimpleEx: thedefault menu and the default softkey definitions. For UIQ, however, theEIK APP INFO is blank.For S60, the menubar attribute of EIK APP INFO is assigned aresource of type MENU BAR, which specifies the application’s defaultmenu.

Menu bar resources have one or more menu titles (type MENUTITLE), and each menu title points to a menu pane (type MENU PANE).The menu bar in the example, r simplex menubar, has a single menutitle and this points to menu pane r simplex menu.Menu panes define the actual menu items (type MENU ITEM), whichthe user selects to invoke some operation in the application. r simplexmenu defines a menu item labeled ‘Start’ that sends the commandESimpleExCommand to the GUI command handler code when the userselects it (so the code can display the example’s dialog).For UIQ, the user-level commands are more abstracted. In otherwords, the device supplies more of the intelligence of how the useroptions appear based on the different display modes of the phone.

Thedeveloper defines a list of display modes the application will support ina QIK VIEW CONFIGURATIONS resource, and associates each of thesemodes with a list of user commands defined in a QIK COMMAND LISTresource. The QIK VIEW CONFIGRATION attribute ui config modespecifies the display mode – I specify KQikPenStyleTouchPortraitand KQikSoftkeyStyleTouchPortrait, which are two differentportrait-style display modes. The attribute command list for each ofthese points to our single QIK COMMAND LIST resource.

Chapter 12will discuss UIQ display modes in more detail.The QIK COMMAND LIST specifies selections the user can makein the application, along with the ID of the commands sent to yourapplication when the user selects them. The Start command is there,which will send the ESimpleExCommand command to the commandhandler when the user selects it. I also put an Exit command, which willonly appear on the screen on debug builds of the code (stateFlags =EQikCmdFlagDebugOnly specifies this). Normally, UIQ programs donot have exit options for the user to select and simply go to the backgroundwhen the user wants to run something else.

Having an exit is usefulwhen debugging, though, since on exit the software will generate an48SYMBIAN OS QUICK STARTexception if you have not cleaned up and freed your resources at the timeof exit.In S60, the cba attribute in the EIK APP INFO resource definesthe application’s softkeys (as default, they can be changed dynamically). Symbian refers to a set of softkeys as a command button array(CBA). In S60, there are two softkeys at the bottom of the screen. In theS60 example resource file, I set the attribute cba = R AVKON SOFTKEYS OPTIONS EXIT. This is a predefined system value, which specifies that the left softkey brings up the menu and the right one exits theapplication.In UIQ, you do not specify CBAs specifically, however, in some displaymodes, the softkeys are automatically used for presenting the commandsin the QIK COMMAND LIST resource.SimpleEx.hrhThe file SimpleEx.hrh contains the command values that the controlssend (specified in the resource file) for the application code to handle.

Inthe S60 case we have only one, used when Start is selected:/** SimpleEx enumerate command codes */enum TSimpleExIds{ESimpleExCommand = 1};For UIQ, we define an additional value to be used in the resource file’sQIK VIEW resource since UIQ requires this. Don’t worry if you do notunderstand this at this point. Here is the UIQ version of SimpleEx.hrh:/** SimpleEx enumerate command codes */enum TSimpleExIds{ESimpleExCommand = 1,ESimpleExViewPage};The .hrh file is an include file that is used by both the resource file andthe C++ code that handles the events.SimpleEx reg.rssIn Symbian OS v9, all applications are required to have a registrationresource containing a APP REGISTRATION INFO resource.

Here is theone I use for SimpleEx (it is the same for S60 3rd Edition and UIQ 3):// SimpleEx_reg.rss#include <AppInfo.rh>SIMPLE EXAMPLE APPLICATION49#include "SimpleExUid.h"UID2 KUidAppRegistrationResourceFileUID3 SIMPLEEXUID// application UIDRESOURCE APP_REGISTRATION_INFO{app_file = "SimpleEx";}All registration resources must include AppInfo.rh. UID2 shouldalways be KUidAppRegistrationResourceFile and UID3 shouldbe the unique UID3 assigned to the application. A resource APPREGISTRATION INFO must also be defined that specifies, at a minimum, the name of the application executable (without the extension),using the app file attribute (SimpleEx in our example).SimpleEx reg.rss should be put in the group directory in ourexample.2.3.5 Source FilesThis section shows the application source files for the example.

Three ofthe source files are the same for both S60 and UIQ, the other two vary.Type the code as shown into their respective files and place them in thesrc directory.SimpleEx.cppThis file is the same for both S60 and UIQ. It contains the executable entrypoint of the application (E32Main()). The NewApplication() methodis called by the Symbian OS application framework to create and return apointer to the application object that is defined in SimpleEx app.cpp.SimpleEx.cpp is as follows:/*=================================================================File: simpleEx.cpp==================================================================*/#include <eikstart.h>#include "SimpleEx.h"// Create application object, return a pointer to itEXPORT_C CApaApplication* NewApplication(){return (static_cast<CApaApplication*>(new CSimpleExApplication));}GLDEF_C TInt E32Main(){return EikStart::RunApplication( NewApplication );}SimpleEx App.cppThis file is the same for S60 and UIQ.

Характеристики

Тип файла
PDF-файл
Размер
3,36 Mb
Материал
Тип материала
Высшее учебное заведение

Список файлов книги

Свежие статьи
Популярно сейчас
Зачем заказывать выполнение своего задания, если оно уже было выполнено много много раз? Его можно просто купить или даже скачать бесплатно на СтудИзбе. Найдите нужный учебный материал у нас!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6372
Авторов
на СтудИзбе
309
Средний доход
с одного платного файла
Обучение Подробнее