|
|
|
The role of the application UI is to create and initialize the application views. Application UI has support for categories.
To create a minimal application UI class:
Derive an App UI class from
CQikAppUi.
Declare a pointer member variable for the view class or classes; views are typically owned by the application UI class.
Overload the function CQikAppUi::ConstructL().
This function is called by the application architecture to second-phase construct the App UI object. Function implementations must call
CQikAppUi::ConstructL(), and should also allocate and
construct the view class.
Note that UIQ applications can have more than one view and the App UI class needs to add the application's views to itself. See "How to construct and register views" below.
The definition and implementation of a minimal App UI class is given below.
The class implements a second-phase constructor. It also has a pointer to a view object,
which is constructed in ConstructL().
class CExampleAppUi : public CQikAppUi
{
public:
// Second-phase constructor.
void ConstructL();
private:
CExampleAppView* iAppView;
};
The implementation of the second-phase constructor
ConstructL() is as follows:
The constructor calls CQikAppUi::ConstructL() to load the
application's resource file and create its menu.
Create and allocate any application specific resources. Note that this task can also be handled in the View's ViewConstructL(), depending on the situation.
Create and register views; see "How to construct and register views" below.
Destruction is not needed in UIQ 3 since the framework takes care of deleting the views that are registered.
Views should be created, that is first-stage construction, and registered in the App UI
ConstructL() function. Additionally, you can call the view's second constructor, ConstructL(), also in the App UI's ConstructL() function.
The first view that is registered becomes the standard view in the application.
To construct and register a view you need to derive your new view class from CQikViewBase. You must implement ViewId and ViewConstructL. You may also implement ViewActivatedL and HandleCommandL. ViewId should just return the UID for this view.
In your App UI you need to construct an instance of this view. Call AddViewL(CQikViewBase &aView) to add and register
the view aView in the view server and create a new control stack
for it
Example:
//Create the ListView and attach it.
//This will become the default view since we add it first
CExampleAppView* iListView = CExampleApptView::NewLC(*this, KNullViewId, Model);
AddViewL(*iListView);
CleanupStack::Pop(iListView);