os/textandloc/fontservices/textshaperplugin/test/S60HindiDemo/src/HindiDemoappui.cpp
First public contribution.
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * Series 60 version of Hindi Demo application
16 * Implementation of CHindiDemoAppUi
23 #include "HindiDemo.hrh"
24 #include "HindiDemoappui.h"
25 #include "HindiDemoview.h"
26 #include "MainViewview.h"
28 // -----------------------------------------------------------------------
29 // Method managed by IDE to construct views
30 // Please do not edit this routine as its
31 // contents are regenerated upon new view creation.
32 // -----------------------------------------------------------------------
33 void CHindiDemoAppUi::InitViewsL()
35 iHindiDemoView = CHindiDemoView::NewL();
36 AddViewL( iHindiDemoView );
37 iMainViewView = CMainViewView::NewL();
38 AddViewL( iMainViewView );
42 // -----------------------------------------------------------------------
43 // Constructs AppUI Object
44 // -----------------------------------------------------------------------
45 void CHindiDemoAppUi::ConstructL()
51 // -----------------------------------------------------------------------
52 // Show tabs for main views from resources
53 // -----------------------------------------------------------------------
54 CEikStatusPane* sp = StatusPane();
55 iNaviPane = (CAknNavigationControlContainer *)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
58 // -------------------------------------------------------------------------------
59 // Tabgroup has been read from resource and it was pushed to the navi pane.
60 // Get pointer to the navigation decorator with the ResourceDecorator() function.
61 // Application owns the decorator and it has responsibility to delete the object.
62 // -------------------------------------------------------------------------------
63 iDecoratedTabGroup = iNaviPane->ResourceDecorator();
65 if (iDecoratedTabGroup)
67 iTabGroup = (CAknTabGroup*) iDecoratedTabGroup->DecoratedControl();
72 ActivateLocalViewL(TUid::Uid(iTabGroup->ActiveTabId()));
75 // -----------------------------------------------------------------------
77 // -----------------------------------------------------------------------
78 SetDefaultViewL(*iMainViewView);
83 // -----------------------------------------------------------------------
84 // Cleanup of AppUI object
85 // -----------------------------------------------------------------------
86 CHindiDemoAppUi::~CHindiDemoAppUi()
89 delete iDecoratedTabGroup;
95 // -----------------------------------------------------------------------
96 // Key Event Handler - Primarily to automate navigation through tab groups
97 // -----------------------------------------------------------------------
98 TKeyResponse CHindiDemoAppUi::HandleKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
100 if (aType == EEventKey)
102 if (iTabGroup == NULL)
104 return EKeyWasNotConsumed;
108 TInt active = iTabGroup->ActiveTabIndex();
109 TInt count = iTabGroup->TabCount();
111 switch (aKeyEvent.iCode)
116 // -----------------------------------------------------------------------
117 // Change to usual layout
118 // -----------------------------------------------------------------------
119 TRect cr = ClientRect();
120 if (cr.iTl.iY == Kqpn_height_status_pane_idle)
122 StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL);
126 iTabGroup->SetActiveTabByIndex(active);
127 ActivateLocalViewL(TUid::Uid(iTabGroup->TabIdFromIndex(active)));
128 return EKeyWasConsumed;
133 if((active + 1) < count)
135 TRect cr = ClientRect();
136 if (cr.iTl.iY == Kqpn_height_status_pane_idle)
138 StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL);
142 iTabGroup->SetActiveTabByIndex(active);
143 ActivateLocalViewL(TUid::Uid(iTabGroup->TabIdFromIndex(active)));
144 return EKeyWasConsumed;
152 return EKeyWasNotConsumed;
157 // -----------------------------------------------------------------------
158 // Default handler of Command Events
159 // -----------------------------------------------------------------------
160 void CHindiDemoAppUi::HandleCommandL(TInt aCommand)
162 if (DispatchAppUICommandEvents(aCommand))
169 case EAknSoftkeyExit:
179 // -----------------------------------------------------------------------
180 // Here we dispatch to Command Event Handlers
182 // NOTE: This routine is managed by the C++Builder IDE - DO NOT MODIFY
183 // -----------------------------------------------------------------------
184 bool CHindiDemoAppUi::DispatchAppUICommandEvents(TInt aCommand)