Common architecture of Symbian applications (1)The so-called "application architecture" refers to the collection of application framework classes. Based on the required uidesign, applications can have slightly different architectures, but each architecture has some public parts, called the "core application class". 1. Let's take a look at the basic part, the detailed architecture is introduced in the second part (1) core application classes. all s60 UI applications have some basic functions: L provides a user interface for displaying information and allowing users to interact. l responds to various user-initiated events, for example, if you select a menu item l to respond to different events started by the system, for example, the window server event that causes screen re-painting l can save and restore Application Data l can uniquely mark the framework l provide the framework with descriptive information about the application, comparison labels, titles, and other classes are: View, document, application, and application UI ). A program can have only one document and multiple views. (2) Each of the following methods must be created for application initialization to provide the minimum s60 application: A. All s60 UIS implement a global function e32dll (). When the application starts, the framework will first call this function, also known as the DLL entry point, which must exist in the application. Each s60 UI application is a multi-state DLL. B. Let the framework call newapplication (). This function is the only function exported by DLL. C. Create an instance of the application class and return its pointer. Later, the framework uses this pointer to create the application. D. The Framework calls appdlluid () to return the UID of the application. This function must return the value specified in the. MMP file and be used to determine whether the application instance is running. E. The framework obtains the pointer to the newly created document class, createdocumentl (). F. newl (). For details about how to create g and obtain the pointer of the Appui class, see createappuil (). H. It is created by new (eleave) cappui. Such a brief and intuitive framework is created. (3) Important Appui Methods: The Appui provides many methods that the framework can call to notify each application of various events. L handkeyevent () is used to process user keys. l handleforegroundeventl () This function is called when the application switches to the foreground or switches from the foreground to the background. By default, the keyboard focus can be changed. L handlesystemeventl () transmits events generated by the window server l handleapplicationspecificeventl () can customize Event Notifications. By default, the color scheme change notification can be processed. L handlecommandl () is used to process the menu items selected by the user. (4) design the application UI. Term "View": l "View" is a conceptual term, the meaning is "representation of the data model on the screen". In fact, one or more UI controls derived from ccoecontrol implement views, which are organized in a hierarchical structure. A parent control is usually called a container. In addition to a parent control used to implement a view, this control is called a dialog box (DIALOG) l in the avkon view switching architecture, the term "avkon View" refers to the class registered by the view server within the system, which controls the instantiation and Analysis of the view. 2. Common Symbian application architecture: each architecture provides different ways to design the application UI-All architectures provide methods to submit "views" or visual representations of application data, it also provides a mechanism for users to interact with the architecture. First, let's take a look at it. Although the dialog box-based architecture is different from the traditional Symbian OS-based architecture, the two architectures are more similar to each other than the avkon view switching architecture. The reason is: l their feature is that they are used to generate the UI control type of the view. L The architecture is almost the same. That is to say, in these two designs, the Appui class simply "owns" View Controls and is responsible for directly managing them. The avkon view switching architecture is fundamentally different from the two methods. Its view switching is done by the system-wide view server. (1) traditional Symbian OS controls based on controls these controls are always directly inherited from ccoecontrol. The standard term used to represent the attempt class directly inherited from ccoecontrol is "container ". About "ccoecontrol": ccoecontrol can be considered as an empty tent. By inheriting this class, you can create a variety of custom controls. The functions and complexity of custom controls are limited by the programmer's ability and imagination. The only disadvantage of this flexibility is that the control is indeed similar to an empty tent because it requires a lot of coding to provide important functions. In terms of view switching, appui is responsible for processing view switching requests sent by users. Then, the final action of Appui is similar to a huge switch, which is used to activate or disable containers based on user or system input. NOTE: The container class is derived from ccoecontrol, which is the base class of all controls. In your own container class, you must implement four methods from ccoecontrol. The framework will call all these methods: l sizechanged () allows the control to respond to changes in the control size l draw () draw control l countcomponentcontrols () returns the number of controls owned by the control l componentcontrol () for each control owned by the container, the Framework calls this method to obtain. Construct the container in the Appui class according to the following code: void chelloworldappui: control () {basecontroll (); iappcontainer = chelloworldcontainer: newl (clientrect ()); iappcontainer-> setmopparent (this); // create a parent-child relationship between controls and call this method on the container. Addtostackl (iappcontainer); // push the container to the top of the Control Stack. For example, you can receive key events.
} Note: If you use this architecture to implement applications with multiple views, you can use addtostackl () and removefromstackl () to switch between different containers.