Symbian OS development basic manual (3) four basic classes in Gui programs
Source: Internet
Author: User
The helloworld of the graphic interface is much more complicated than the text version! Windows graphics and command line Program People can easily understand this point. There are four classes in helloworld. They are four basic classes that are indispensable for any graphic program in Symbian OS. They have built a basic framework for graphic interfaces, making it easy for programmers to know Code Where should we put it? For example, the drawing code should be placed in the view. Similarly, when we read a program, if we care about the data structure of the program, let's look at the implementation of the document class.
Cexampleapplication
The application class has two functions: the first is to set the attributes of the application, such as uid. Each application has its unique uid. const tuid kuidhelloworld = {0x10008ace}; kuidhelloworld is the UID of helloworld ., appdlluid () provides the UID of the application to the high-level framework, which is used to identify our program. Another example is to create a document class. Therefore, we only need two functions: appdlluid and createdocument. Cexampleapplication is inherited from ceikapplication. Many functions that do not need to be defined are included in ceikapplication.
Cexampledocument
The document class is the data model of an application. If the program is file-based, it is responsible for file operations of the program. Our helloworl does not involve any files, but we still need this class because it is also responsible for manufacturing UI class instances.
Cexampleappui
Although the UI class is named "User Interface", it is not a visible component. It creates a View class instance, and its more important task is to dispatch commands and events, for example, the menu command is determined by the UI, which class and function are assigned. Another example is that the keyboard event is determined by the UI and assigned to the control for processing. Handlecommandl () is used to process commands.
Cexampleappview
The View class is a visual control that displays on the screen and provides functions to respond to related events. The code used for plotting is placed in the draw function.
The declarations of these four classes are placed in the corresponding header file and implemented in the corresponding CPP. In addition, you will find another source file: helloworldbasic. cpp. This file is the entry to helloworld, and its function is very simple. It is to create an application class instance. Therefore, this file is similar in most GUI projects, but the name of the application class must be changed accordingly.
In this lesson, we will talk about four basic classes and program portals in the Symbian OS graphics program. In the next lesson, we will talk about the MMP file and PKG file in helloworldbasic. Then we will outline how to generate the sisfile, that is, the installation file of the mobile phone. Finally, we can run helloworld on mobile phones that support Symbian!
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.