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

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

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

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

To build the example, just enter the listings that applyto your chosen target platform, as well as the common code listings.It is instructive, however, to compare the platform-specific portions ofthe code, to get an idea of variations between platforms, and buildingthe example for both would be ideal. Furthermore, note that it wouldbe simpler to generate this application for both platforms using theCarbide.c++ project wizards, and again I think it is instructive to enterthe code manually, as discussed, for a better learning experience.SIMPLE EXAMPLE APPLICATION39This chapter will not examine the code in a lot of detail – that willbe done in later chapters. Some description is provided; however, don’tworry if you do not understand it all. It will be explained in due course.For now, the main goal is to get a feel for developing a basic applicationby actually building and running one on the emulator and a phone.2.3.1Application ComponentsHere are the minimum classes required for a Symbian application.

Youwill be creating them for your example application:•Application View. The root GUI control, this class implements themain window and acts as a container for the other application controls.•Application UI. This class instantiates the application view and handles the commands sent from the application’s GUI controls.•Application document. This class handles the non-GUI data aspectsof the application – the application data. It also instantiates the application’s UI class.•Application. The main application class starts the application byinstantiating and starting the document class. It also sets the application’s UID (a unique identifier that is required for each application – for more information, see Chapter 4).2.3.2 Overview of SimpleExThis section presents an example GUI application called SimpleEx.When launched, the example displays the text ‘Simple Example’ in thecenter of the window. It also has a menu item labeled ‘Start’ that displaysan alert dialog when selected (which displays ‘Start selected!’).The example for both platforms contains the following files organizedin the directories as shown:\includeSimpleEx.hSimpleEx.hrhSimpleExUid.h\srcSimpleEx.cppSimpleEx_app.cppSimpleEx_doc.cppSimpleEx_ui.cppSimpleEx_view.cpp\groupbld.infSimpleEx.rssSimpleEx_reg.rssSimpleEx.mmpSimpleEx.pkg40SYMBIAN OS QUICK STARTTo create the example you will perform the following steps:1.Create the application header files.2.Create the resource (RSS) and resource command header (HRH) files.3.Create the registration resource file.4.Create the source code for the application classes.5.Create the project definition file (SimpleEx.mmp) and build file(bld.inf).6.Build and run the example on the PC-based emulator.7.Create the target package definition (PKG) file.8.Generate the installation package (SIS file) and install it on a smartphone.9.Execute the SimpleEx application on the smartphone.2.3.3 Header FilesThis section describes the main header file for our example (SimpleEx.h), defined for S60 and UIQ platforms and the header file itincludes (SimpleExUid.h).

Put the header file for your particular platform in a file named SimpleEx.h and place it in the include directory(e.g., \SimpleEx\S60\include for the S60 headers).The following is this header for S60 3rd Edition:#ifndef __SIMP_H#define __SIMP_H/*==========================================S60 SimpleEx Header File==========================================*/#include <eikenv.h>#include <eikon.hrh>#include "SimpleEx.hrh"#include <akndoc.h>#include <aknapp.h>#include <aknappui.h>#include "SimpleExUid.h"const TUid KUidSimpleExApp = {SIMPLEEXUID};// The Application Classclass CSimpleExApplication : public CAknApplication{private:CApaDocument* CreateDocumentL();TUid AppDllUid() const;};// The Application View Classclass CSimpleExAppView : public CCoeControlSIMPLE EXAMPLE APPLICATION41{public:static CSimpleExAppView* NewL(const TRect& aRect);static CSimpleExAppView* CSimpleExAppView::NewLC(const TRect& aRect);void ConstructL(const TRect& aRect);private:void Draw(const TRect&) const;};// The UI Classclass CSimpleExAppUi : public CAknAppUi{public:void ConstructL();~CSimpleExAppUi();private:void HandleCommandL(TInt aCommand);CSimpleExAppView* iAppView;};// The Application Document Classclass CSimpleExDocument : public CAknDocument{public:CSimpleExDocument(CEikApplication& aApp): CAknDocument (aApp) { }private:CEikAppUi* CreateAppUiL();};#endifHere is the same version of the code for SimpleEx.h for UIQ 3:/*==========================================UIQ SimpleEx Header File==========================================*/#ifndef __SIMP_H#define __SIMP_H#include <eikenv.h>#include <eikon.hrh>#include "SimpleEx.hrh"#include <qikdocument.h>#include <qikapplication.h>#include <qikappui.h>#include <QikViewBase.h>#include "SimpleExUid.h"const TUid KUidSimpleExApp = {SIMPLEEXUID};/**Identifies the hello world application’s view.Each view need an unique UID in the application.*/const TUid KUidSimpleExView = {0x00000001};/*------------------------------------------The Application Class--------------------------------------------*/class CSimpleExApplication : public CQikApplication{private:42SYMBIAN OS QUICK STARTCApaDocument* CreateDocumentL();TUid AppDllUid() const;};/*-------------------------------------------The Application View Class---------------------------------------------*/class CSimpleExAppView : public CQikViewBase{public:static CSimpleExAppView* NewL(CQikAppUi& aAppUi);static CSimpleExAppView* CSimpleExAppView::NewLC(CQikAppUi& aAppUi);void ConstructL();// from CQikViewBaseTVwsViewId ViewId()const;void ViewConstructL();void HandleCommandL(CQikCommand& aCommand);private:void Draw(const TRect&) const;CSimpleExAppView(CQikAppUi& aAppUi);};/*----------------------------------------------The UI Class-----------------------------------------------*/class CSimpleExAppUi : public CQikAppUi{public:void ConstructL();private:CSimpleExAppView* iAppView;};/*---------------------------------------------The Application Document Class----------------------------------------------*/class CSimpleExDocument : public CQikDocument{public:CSimpleExDocument(CEikApplication& aApp) : CQikDocument(aApp) { };private:CEikAppUi* CreateAppUiL();};#endifNotice from the header files that the application, document, and UIclasses are derived from different base classes for each of the platforms(the differences are shown in bold text).

For example, the application UIclass is derived from CAknAppUI for S60, and CQikAppUI for UIQ.Figures 2.8 and 2.9 show the class hierarchy for SimpleEx, for S60and UIQ, respectively.Notice that the platform classes for S60 and UIQ derive from the samecore Symbian OS base application classes. Fortunately, the applicationplatform classes for the different platforms are similar from a developmentperspective due to their abstracted interface. Note also that while in UIQI inherit the view class from the UIQ view class CQikViewBase sinceall applications in UIQ should do that, I inherit the S60 application classSIMPLE EXAMPLE APPLICATION43Symbian OS base application classesCEikApplicationCEikAppUiCEikDocumentCCoeControlS60 platform layerCAknApplicationCAknAppUiCAknDocumentCSimpleExApplicationCSimpleExAppUiCSimpleExDocumentCSimpleExAppViewS60 SimpleExFigure 2.8 SimpleEx Class Hierarchy for S60Symbian OS base application classesCEikApplicationCEikAppUiCEikDocumentCCoeControlUIQ platform layerCQikApplicationCQikAppUiCSimpleExApplicationCSimpleExAppUiCQikDocumentCQikViewBaseCSimpleExDocumentCSimpleExAppViewUIQ SimpleExFigure 2.9SimpleEx Class Hierarchy for UIQ44SYMBIAN OS QUICK STARTdirectly from CCoeControl, which is fine for applications with a singleview such as this one.Although, for this example, I have put all the classes in one header file,it is common to separate each class into its own header file.Note also that SimpleEx.h includes SimpleExUid.h.

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

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

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

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