Главная » Просмотр файлов » Wiley.Symbian.OS.C.plus.plus.for.Mobile.Phones.Aug.2007

Wiley.Symbian.OS.C.plus.plus.for.Mobile.Phones.Aug.2007 (779890), страница 69

Файл №779890 Wiley.Symbian.OS.C.plus.plus.for.Mobile.Phones.Aug.2007 (Symbian Books) 69 страницаWiley.Symbian.OS.C.plus.plus.for.Mobile.Phones.Aug.2007 (779890) страница 692018-01-10СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

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

id is an optional symbolic resource ID. If specified,it must be in lower-case, starting with a letter, and containing letters,digits and underscores, but not spaces. member_initializer_listconsists of a list of member initializers, separated by semicolons, andenclosed in braces {}.The following example shows a resource constructed for S60, usingthe DIALOG struct defined above.RESOURCE DIALOG r messages_dialog{title = "Title text";flags = EAknDialogSelectionList;buttons = R_AVKON_SOFTKEYS_OK_CANCEL;items ={DLG_LINE{type = EAknCtSingleListBox;id = EListControl;control = LISTBOXSOURCE FILE SYNTAX371{flags = EAknListBoxSelectionList;array_id = r_message_list;};}};}In this case the items array contains only one item, which is itselfa DLG_LINE struct.

It is not necessary for the resource to declare theinitializers in the same order as they were specified in the correspondingstruct. The resource in this example does not provide initializers for theDIALOG struct’s pages and form items, so their values will take thedefault values specified in the struct.The punctuation rules for a RESOURCE statement are quite simple:• assignment statements, of any type, are terminated by a semicolon• items in a list are separated by commas• at the end of a structure, no punctuation is required.For example:RESOURCE ARRAY r_message_list{items ={LBUF{txt= "\tMessage 1";// Rule 1},// Rule 2LBUF{txt= "\tMessage from file"; // Rule}// Rule};// Rule}// Rule1213The rules apply regardless of whether or not the punctuation occursafter a closing brace.ENUM StatementsTo ensure that your resource script and C++ program use the same valuesfor symbolic constants, the resource compiler supports both enum and#define definitions of constants, with a syntax similar that of C++.

Byconvention, these definitions are contained in HRH include files. The.hrh extension is intended to convey that the file is suitable for inclusioneither as a .h file in C++ source, or as a .rh file in resource scripts.372RESOURCE FILESThe NAME StatementA resource script must contain a single NAME statement, which mustappear before the first RESOURCE statement. The NAME keyword mustbe followed by a name, in upper case, containing a maximum of fourcharacters, for example:NAME HELOThe NAME is used in generating symbolic IDs for the resources, asdiscussed in Section 13.7.13.3Bitmaps and IconsWhen your application is installed on a phone, you want it to have aneasily recognizable icon for the user to select.

Such icons are created bythe bitmap conversion process that is illustrated in Figure 13.1..cpp.mbgWindowsImageEditor.bmpApplicationbuild process(bmconv).rss.mbmFigure 13.1 Bitmap conversionThe first step of the process is to create Windows bitmaps and convertthem into the specific file format used by Symbian OS, called a ‘multibitmap’ file or MBM. The MBM file, together with an associated MBG filewhich contains an ID for each bitmap in the corresponding MBM file,is constructed from one or more Windows BMP files using the bmconv(bitmap converter) tool, which is called during the main application buildprocess.The MBM format is also used when icons are required elsewhere inyour application – for example, a splash screen on startup.Windows programmers may find it easier to think of a MBM file as anaddition to the application’s resource file, and a MBG as an addition tothe RSG generated header, containing symbolic IDs for the resources.BITMAPS AND ICONS373Under Windows, bitmaps and other resources are incorporated directlyinto resource files.

Under Symbian OS, they are treated separately becausethe tools used to create MBMs and resource files are different. This alsopermits finer control over the content of these files – for example, someSymbian OS phones may compress resource file text strings to savespace, but leave bitmaps uncompressed to avoid performance overheadsat display time.As illustrated in Figure 13.2, the application icon should be createdfrom two Windows bitmaps: the icon itself, and a mask which is black inthe area of the icon.(a)(b)Figure 13.2 Icon and mask bitmapsOnly the regions of the bitmap corresponding to the black regions ofthe mask are copied to the screen. Everything else is ignored – the whiteareas of the mask are effectively transparent, regardless of the color in thecorresponding parts of the data bitmap.The application icon is used in a number of places by the UI.

Forexample, on the UIQ main application launcher screen, the size of theicon is increased when it is selected, as shown in Figure 13.3.Figure 13.3Icon size increases when selectedIt is necessary to supply the application icon in a number of differentsizes, so that the UI can select the best one to display. A good initialselection of sizes is shown in Table 13.3.UIs support different color depths for items shown on screen. SymbianOS provides support from 1-bit up to 24-bit color, and individual phonesvary in terms of the color depth supported by their hardware.Bitmap icons are easy to produce, and at this stage you can simplycreate them using a suitable graphics package.To show how to add the icons to our application, we assume threeicons, with corresponding icon masks, have been created and placed in374RESOURCE FILESTable 13.3 Icon SizesUser Interfaceicon sizeUIQS60Small18x1832x32Medium40x4040x40Large64x6464x64the \images folder within the application directory. These are named:OandX_xLarge.bmp and OandX_xLarge_mask.bmp,OandX_Large.bmp and OandX_Large_mask.bmp,OandX_Small.bmp and OandX_Small_mask.bmp.These six bitmaps must be turned into a single MBM file, along withits associated MBG.Converting the BitmapsThe next step is to add the bitmap conversion information to the application build process for the Noughts and Crosses example.

You do this byincluding the following text in the project’s MMP file:START BITMAP OandX.mbmHEADERTARGETPATH \Resource\AppsSOURCEPATH ..\imagesSOURCE c24 OandX_Small.bmpSOURCE 8OandX_Small_mask.bmpSOURCE c24 OandX_Large.bmpSOURCE 8OandX_Large_mask.bmpSOURCE c24 OandX_xLarge.bmpSOURCE 8OandX_xLarge_mask.bmpEND // BITMAPThe statements have the following meanings:• START BITMAP: marks the start of the bitmap conversion data andspecifies the MBM multi-bitmap filename.• HEADER: specifies that a symbolic ID file, OandX.mbg, is to becreated (in the \epoc32\include folder).• SOURCEPATH: specifies the location of the original Windows bitmaps.• TARGETPATH: specifies the location where the MBM file is to begenerated.BITMAPS AND ICONS375• SOURCE: specifies the color depth and the names of one or moreWindows bitmaps to be included in the MBM.• END: marks the end of the bitmap conversion data.The MBM is generated in the \Resource\Apps directory.

It’s standardpractice to specify the MBM name to be the same as that of the EXE file.Symbian OS developers conventionally specify only one bitmap fileper SOURCE statement, and specify each mask file immediately after itscorresponding bitmap file. The ordering of the statements does not reallymatter, but the color-depth value does. A value of c24 specifies 24-bitcolor (the default for UIQ 3).The recommended value to be specified for each mask is 1, the lowestcolor depth.

Since masks contain only black, they need not be stored witha high color depth, and specifying this value may save valuable storagespace for the resulting MBM, as well as RAM usage when the MBM isloaded at run time.Depending on circumstances, and particularly if bitmaps are stored incompressed form, using a color depth of 1 may not save on memoryusage. Also, if your icon and mask are to be used in a speed-criticaloperation (an animation, for example) you may want to include boththe icon and mask at the same color depth as used by the phone itself.Since the Window Server will not need to convert the images betweenthe display mode of the phone and the color-depth in which they arestored, you will sacrifice some storage space and RAM for a bit of extraspeed.

For general use, however, the first approach is recommended.The format of the generated OandX.mbg file is as follows://////////oandx.mbgGenerated by BitmapCompilerCopyright (c) 1998-2005 Symbian Software Ltd. All rightsreserved.enum TMbmOandx{EMbmOandxOandx_small,EMbmOandxOandx_small_mask,EMbmOandxOandx_large,EMbmOandxOandx_large_mask,EMbmOandxOandx_xlarge,EMbmOandxOandx_xlarge_mask};The file contains an enumeration whose type name includes the MBMfilename, and several enumerated constants whose names are made upfrom the MBM filename and the source bitmap filename.376RESOURCE FILESYou need to include the enumerations generated in this file in yourapplication’s resource file, as follows:#include <oandx.mbg>The bmconv ToolThe bitmap converter tool, bmconv, can also be used as a stand-aloneapplication, either to package bitmaps into a single MBM file, or to extractbitmaps from a multi-bitmap file.To convert bitmaps into a single MBM file, use a command such asthe following:bmconv /h file.mbg file.mbm icon1.bmp icon2.bmp icon1mask.bmpicon2mask.bmpThis gives a verbose log (which can be suppressed using the /q switch):BMCONV version 114.Compiling...Multiple bitmap store type: File storeEpoc file: file.mbmBitmap fileBitmap fileBitmap fileBitmap fileSuccess.1234::::icon.bmpicon2.bmpiconmask.bmpicon2mask.bmpTo extract BMP files from a multi-bitmap file, specify the /u flag afterthe bmconv command:bmconv /u file.mbm icon.bmp icon2.bmp iconmask.bmp icon2mask.bmpOne useful application of this facility is to capture a screen from theemulator using Ctrl, Alt, Shift, S.

This results in an MBM file containing asingle entry. Once you have extracted the bitmap, you can display andmanipulate it using a graphics editor.You can also view the contents of an MBM file by specifying the /vflag after the command:bmconv /v file.mbmTo see the full set of supported options, just type bmconv on thecommand line.UPDATING THE RESOURCE FILES377Scalable Vector GraphicsRecent SDKs have introduced support for a new format for icons, knownas Scalable Vector Graphics-Tiny (SVG-T).

This format can be used foricons and themes instead of bitmaps, and removes the need to supplyyour icons in different sizes as discussed above. Using SVG-T alleviatesone of the main disadvantages of bitmapped graphics formats, namelythat image quality is often lost when the image is scaled up.To support this format, the S60 SDK contains two additional tools, theconverter tool and mifconv. The SVG to SVG-T converter tool (installedfrom the directory \S60Tools\svg2svgt) takes a standard SVG fileas input and generates an equivalent SVG-T file.

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

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

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

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