UIQ Technology
Symbian OS Library

UIQ 3.1 SDK        UIQ developer portal

[Index] [Spacer] [Previous] [Next]



3 Application framework


3.1 Application

As in UIQ 2.1, your application class should be derived from the CQikApplication class.

Since the application target has been changed from .app, which was loaded dynamically by the framework as a normal DLL, to an executable (.exe), the application entry point also has been changed.

The E32Dll() entry function, normally placed in the CQikApplication derived class, is now replaced by E32Main().

UIQ 2.1:

EXPORT_C CApaApplication* NewApplication()
    {
    return new CHelloWorldApplication;
    }

// Required DLL attach function
GLDEF_C TInt E32Dll(TDllReason)
    {
    return KErrNone;
    }

UIQ 3:

EXPORT_C CApaApplication* NewApplication()
    {
    return new CHelloWorldApplication;
    }

// Program startup main function, passes the application creation method pointer to EikStart
GLDEF_C TInt E32Main()
    {
    return EikStart::RunApplication(NewApplication);
    }

[Top]


3.2 Document

As in UIQ 2.1, your document class should be derived from the CQikDocument class.

No changes are required to migrate the Document class to UIQ 3.

[Top]


3.3 AppUi

As in UIQ 2.1, your AppUi class inherits from CQikAppUi. However, creating a view is simplified after the introduction of the new view base classes, see Views below.


3.3.1 View creation

UIQ 2.1:

void CMyAppUi::ConstructL()
{
   CQikAppUi::ConstructL();

   CMyView* myView = CMyView::NewLC(*this);
    RegisterViewL(*view);
    AddToStackL(view);
    SetDefaultViewL(view);
   CleanupStack::Pop(myView);
}

CMyAppUi::~CMyAppUi()
{
     […]
     RemoveFromStack(view);
     DeregisterView(*view);
     delete view;
     […]
}

UIQ 3:

void CMyAppUi::ConstructL()
{
   CQikAppUi::ConstructL();

   CMyView* myView = CMyView::NewLC(*this);
   AddViewL(*myView);
   CleanupStack::Pop(myView);
}
            

In UIQ 3 you should use QikAppUi::AddViewL() to add the view to the application. AddViewL() registers the view and puts it on the control stack. Ownership of the view is transferred to CQikAppUi so you do not need to unregister and delete the view yourself. This is handled by the destructor of CQikAppUi.


3.3.2 Command handling

In UIQ 2.1, commands were mainly handled by the AppUi method HandleCommandL(TInt aCommandId). This method has been deprecated in UIQ 3.0. Instead, the HandleCommandL(CQikCommand &aCommand) is used. With the introduction of the new View classes in UIQ 3.0, handling commands can now be delegated to each of the application’s views by implementing the HandleCommandL(CQikCommand &aCommand) in the view class implementation.

[Top]


3.4 Views

UIQ 3.0 introduces two new view classes, CQikViewBase and CQikMultiPageViewBase. Application views are derived from either of these two base classes instead of from the CCoeControl and MCoeView as was the case in UIQ 2.1.

The CQikViewBase class is the base class for all views and all UIQ views should be derived from it. This class handles much of the new functionality found in UIQ 3:

The CQikMultiPageViewBase class is a base class for views with multiple pages.

Also related to views is the new dialog class CQikViewDialog. This class implements a view which can be invoked as a dialog. See the section on dialogs.

UIQ 2.1:

class CMyView : public MCoeView, public CCoeControl

UIQ 3:

class CMyView : public CQikViewBase

class CMyView : public CQikMultiPageViewBase

For detailed information on how to use the new view classes see the Programmer’s guide.