javauis/lcdui_akn/lcdui/src/CMIDDisplayable.cpp
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:33:18 +0100
branchRCL_3
changeset 66 2455ef1f5bbc
child 77 7cee158cb8cd
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: v2.2.11 Kit: 201035
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
66
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     1
/*
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     2
* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     3
* All rights reserved.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     8
*
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     9
* Initial Contributors:
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    11
*
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    12
* Contributors:
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    13
*
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    14
* Description:  Implementation of the CMIDDisplayable class
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    15
*
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    16
*/
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    17
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    18
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    19
#include <bldvariant.hrh>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    20
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    21
#include <memory>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    22
#include <apgwgnam.h>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    23
#include <eikenv.h>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    24
#include <coecntrl.h>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    25
#include <uikon.hrh>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    26
// using BaflUtils::CopyWithTruncation in PopulateMenuItemsWithListL function
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    27
#include <bautils.h>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    28
// using MMIDImage and MMIDBitmapImage
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    29
#include <lcdgr.h>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    30
// macros definitions for resources
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    31
#include <lcdui.rsg>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    32
// using TMifLcdui enumeration
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    33
#include <lcdui.mbg>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    34
// Used for Avkon toolbar disabling
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    35
#include <akntoolbar.h>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    36
// Layout data
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    37
#include <layoutmetadata.cdl.h>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    38
#include <aknlayoutscalable_avkon.cdl.h>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    39
#include <e32property.h>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    40
//#include <SysStartup.h>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    41
#include <aknappui.h>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    42
// using CAknTitlePane in ShowTitleL() function
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    43
#include <akntitle.h>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    44
// using CAknContextPane in SetMIDletIconL() function to show midlet icon
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    45
#include <akncontext.h>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    46
// used for label converting for commands (in PopulateMenuItemsWithListL function)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    47
#include <AknBidiTextUtils.h>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    48
#include <avkon.hrh>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    49
#include <avkon.rsg>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    50
#include <AvkonInternalCRKeys.h>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    51
#include <aknstyluspopupmenu.h>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    52
#include <eiklabel.h>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    53
#ifdef RD_SCALABLE_UI_V2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    54
// For requiring available keyboards in the device
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    55
#include <PtiEngine.h>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    56
#include <PtiDefs.h>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    57
#endif // RD_SCALABLE_UI_V2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    58
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    59
// OMJ storage
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    60
#include <applicationinfo.h>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    61
#include <javastorageentry.h>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    62
#include <javastorage.h>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    63
#include <javastoragenames.h>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    64
#include <javauid.h>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    65
#include <javasymbianoslayer.h>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    66
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    67
#include "CMIDDisplayable.h"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    68
// API used in several places (iAppUi is member)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    69
#include "CMIDAppUi.h"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    70
#include "CMIDCanvas.h"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    71
// used in SetComponentL function
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    72
#include "CMIDDefaultBackground.h"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    73
// API for ticker on displayable
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    74
#include "CMIDTicker.h"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    75
#include "CMIDComponentFactory.h"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    76
// used for setting iMenuHandler from iUIManager (MenuHandler)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    77
#include "CMIDUIManager.h"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    78
#include "CMIDCommand.h"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    79
#include "CMIDForm.h"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    80
// using CMIDUtils::CopyBitmapL in SetMIDletIconL() function
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    81
#include "CMIDUtils.h"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    82
// used in SetComponentL function
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    83
// and used in several place for actions specific for Alert (SetTitleL, ContentSize, HandleCurrentL)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    84
#include "CMIDAlert.h"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    85
#include "CMIDAlertDialog.h"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    86
#include "CMIDEdwin.h"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    87
// used in SetComponentL function
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    88
// used in HandleCurrentL function
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    89
#include "CMIDTextBoxControl.h"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    90
#include "CMIDTextBoxDialogControl.h"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    91
// used in SetComponentL function
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    92
#include "CMIDList.h"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    93
// using API for softkeys and their commands
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    94
#include "CMIDSoftKey.h"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    95
#include "CMIDCanvasKeypad.h"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    96
#include "CMIDTicker.h"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    97
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    98
#include "coreuiavkonlcdui.h"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    99
#include "coreuiappui.h"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   100
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   101
#include <j2me/jdebug.h>
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   102
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   103
/** This macro is executed each time a trapped call returns an error code different than KErrNone */
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   104
#undef  TRAP_INSTRUMENTATION_LEAVE
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   105
#define TRAP_INSTRUMENTATION_LEAVE(aResult) DEBUG_INT2("In CMIDDisplayable.cpp, trapped method was called at line %D and got exception %D", __LINE__, aResult);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   106
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   107
const TGulBorder::TBorderType KMIDLetBorder = TGulBorder::EThickDeepRaisedWithOutline;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   108
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   109
const TInt KCommandIdNotFound = -10000;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   110
const TInt KCommandIdBase = 7000;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   111
const TInt KItemCommandIdBase = 8000; // must be greater than KCommandIdBase
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   112
// Special ID for built-in MSK commands. Handling of them is different because
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   113
// built-in commands are not visible in menus, only in MSK. Built-in MSK commands
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   114
// are commands that are set using SetMSKCommand method, but are not found in
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   115
// command lists.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   116
const TInt KBuiltInMSKCommandId = 9000;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   117
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   118
// Index of the MSK in CBA, to be used when adding MSK command to CBA
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   119
const TInt KMSKPositionInCBA = 3;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   120
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   121
/** The maximum number of softkeys on the device.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   122
*/
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   123
const TInt KMaxNumberOfSoftKeys = 2;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   124
const TInt KListLongTapAnimationDelay = 400000;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   125
const TInt KListLongTapDelay = 800000;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   126
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   127
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   128
/*
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   129
 * The allowed command types for softkeys,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   130
 *   -1 means we have run out of allowed types.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   131
 * More restrictive sks, eg the right sk, should come
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   132
 * before more permissive sks. This array is used to
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   133
 * initialise iSoftkeys.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   134
 */
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   135
const TInt KAllowedCommandTypesForSoftkeys[KMaxNumberOfSoftKeys][9] =
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   136
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   137
    // Right softkey
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   138
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   139
        MMIDCommand::EStop,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   140
        MMIDCommand::ECancel,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   141
        MMIDCommand::EBack,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   142
        MMIDCommand::EExit,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   143
        -1,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   144
        -1,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   145
        -1,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   146
        -1,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   147
        -1
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   148
    },
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   149
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   150
    // Left softkey
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   151
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   152
        MMIDCommand::EStop,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   153
        MMIDCommand::EOk,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   154
        MMIDCommand::ECancel,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   155
        MMIDCommand::EItem,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   156
        MMIDCommand::EScreen,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   157
        MMIDCommand::EBack,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   158
        MMIDCommand::EHelp,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   159
        MMIDCommand::EExit,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   160
        -1
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   161
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   162
};
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   163
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   164
/**
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   165
  The CBA that can have an options menu if commands are available.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   166
  This is used as a zero-based index in iSoftkeys and must be
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   167
  less than KMaxNumberOfSoftKeys.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   168
*/
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   169
const TInt KOptionsMenuCBAIndex = 1; //left sk
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   170
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   171
/**
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   172
  The sk position in the CBA. Must use the same ordering as
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   173
  KAllowedCommandTypesForSoftkeys and is used to initialise
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   174
  iSoftkeys.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   175
*/
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   176
const TInt KPositionsInCBAForSoftkeys[KMaxNumberOfSoftKeys] =
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   177
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   178
    2, //Right softkey
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   179
    0 //Left softkey
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   180
};
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   181
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   182
// One ticker can be added more than one displayable. So keep track of all of them
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   183
const TInt KAddDisplayable = 1; // add the displable to the list in ticker
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   184
const TInt KRemoveDisplayable = 0; // Remove the displable from the list in ticker
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   185
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   186
const TInt KSoftKeyLabelPropertyPositionsMSKIndex = 2;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   187
const TInt KSoftKeyLabelPropertyPositionsInCBA[ KSoftKeyLabelPropertyNumberOfSoftKeys ] =
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   188
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   189
    0,  //LSK
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   190
    2,  //RSK
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   191
    3   //MSK
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   192
};
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   193
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   194
// class CMIDDisplayable
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   195
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   196
CMIDDisplayable* CMIDDisplayable::NewL(MMIDEnv& aEnv,CMIDUIManager& aUIManager)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   197
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   198
    CMIDDisplayable* displayable = new(ELeave)CMIDDisplayable(aEnv,aUIManager);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   199
    CleanupStack::PushL(displayable);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   200
    displayable->ConstructL();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   201
    CleanupStack::Pop(displayable);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   202
    return displayable;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   203
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   204
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   205
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   206
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   207
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   208
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   209
void CMIDDisplayable::ConstructL()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   210
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   211
    DEBUG("+ CMIDDisplayable::ConstructL");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   212
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   213
    // Menu/commands
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   214
    // NOTE: Menu handler member variable has to be valid before
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   215
    // the <code>CCoeContol::MakeVisible</code> method is called
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   216
    // because the <code>CMIDDisplayable::MopSupplyObject</code> method
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   217
    // might be called because of that.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   218
    iMenuHandler = iUIManager->OpenMenuHandlerL();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   219
    iCommandList = new(ELeave) CMIDCommandList();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   220
    iCommandList->SetCommandOffset(KCommandIdBase);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   221
    iMSKCommand = NULL;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   222
    iDisplayableBehindPopup = NULL;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   223
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   224
    iEnv.AddObserverL(*this);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   225
    CreateWindowL(&iEikonEnv->RootWin());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   226
    SetMopParent(java::ui::CoreUiAvkonLcdui::getInstance().getJavaAknAppUi());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   227
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   228
    //All windows are created invisible and then made visible
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   229
    //in SetComponentL(), except for Alerts (dialogs)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   230
    MakeVisible(EFalse);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   231
    Window().SetOrdinalPosition(-1);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   232
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   233
    Window().EnableOnEvents(EEventControlOnlyWhenVisible);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   234
    EnableDragEvents();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   235
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   236
    // Long tap detection
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   237
    iLongTapDetector = CAknLongTapDetector::NewL(this);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   238
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   239
    // SoftKeys
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   240
    for (TInt i = 0; i < KMaxNumberOfSoftKeys; i++)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   241
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   242
        CMIDSoftKey* softKey = CMIDSoftKey::NewLC(i, &(KAllowedCommandTypesForSoftkeys[i][0]),
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   243
                               KPositionsInCBAForSoftkeys[i]);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   244
        User::LeaveIfError(iSoftKeys.Append(softKey));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   245
        CleanupStack::Pop(softKey);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   246
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   247
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   248
    // CBA
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   249
    iCba = iMenuHandler->Cba();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   250
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   251
    UpdateDisplayableRect();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   252
    SetRect(iDisplayableRect);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   253
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   254
    iBorder = TGulBorder::ENone;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   255
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   256
    SetComponentsToInheritVisibility();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   257
    // for Skin Support, Create background control context:
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   258
    iBackGroundControlContext = CAknsBasicBackgroundControlContext::NewL(
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   259
                                    KAknsIIDQsnBgAreaMain,  // Default mainpane skinning
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   260
                                    Rect(),                 // Layout to the entire client rect
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   261
                                    EFalse);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   262
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   263
    iAppUi->Displayables().AppendL(this);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   264
    iAppUi->SetEnv(iEnv);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   265
    ActivateL();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   266
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   267
    //Read JAD attribute value for On-Screen Keypad softkeys visual appearence with HW QWERTY keypad
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   268
    if (iEnv.MidletAttributeIsSetToVal(
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   269
                LcduiMidletAttributes::KAttribOskSoftkeysInQwerty,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   270
                LcduiMidletAttributeValues::KPositionBottom))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   271
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   272
        iSKPositionWithQwerty = ESoftkeysBottom;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   273
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   274
    else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   275
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   276
        //default value
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   277
        iSKPositionWithQwerty = ESoftkeysRight;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   278
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   279
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   280
    // initialization of keypad information
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   281
    ReadOnScreenKeypadTypeFromSuiteSettings();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   282
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   283
    DEBUG("- CMIDDisplayable::ConstructL");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   284
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   285
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   286
CMIDDisplayable::CMIDDisplayable(MMIDEnv& aEnv,CMIDUIManager& aUIManager)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   287
        :CEikBorderedControl(TGulBorder(KMIDLetBorder)),
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   288
        iUIManager(&aUIManager),iEnv(aEnv),
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   289
        iIsFullScreenMode(EFalse),iActive(EFalse), iSelectCommand(NULL), iSelectCommandEnabled(ETrue),
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   290
        iFullscreenCanvasLabelCacheIsValid(EFalse)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   291
#ifdef RD_TACTILE_FEEDBACK
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   292
        ,iPenInputServerConnected(EFalse)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   293
#endif //RD_TACTILE_FEEDBACK
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   294
        ,iIdOfMSKCommand(KErrNotFound)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   295
        ,iRestoreOrientation(EFalse)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   296
        ,iReleaseCnt(0)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   297
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   298
#ifdef RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   299
    iSplitScreenKeyboard = EFalse;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   300
#endif // RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   301
    iAppUi = (CMIDAppUi*)java::ui::CoreUiAvkonLcdui::getInstance().getJavaUiAppUi()->getLcduiChild();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   302
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   303
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   304
CMIDDisplayable::~CMIDDisplayable()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   305
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   306
    DEBUG("+ CMIDDisplayable::CMIDDisplayable");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   307
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   308
    // iPropertyWatch is CPropertyWatch object,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   309
    // delete member call desctructor of CPropertyWatch
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   310
    // and remove active object form active scheduler
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   311
    if (iPropertyWatch)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   312
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   313
        delete iPropertyWatch;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   314
        iPropertyWatch = NULL;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   315
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   316
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   317
    // Informing iEnv about deleting this
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   318
    iEnv.DisplayableIsDestructed(this);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   319
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   320
    // Remove this from iEnv observer
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   321
    iEnv.RemoveObserver(*this);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   322
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   323
    if (iAppUi)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   324
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   325
        iAppUi->RemoveFromStack(iContentControl);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   326
        TInt index = iAppUi->Displayables().Find(this);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   327
        if (index != KErrNotFound)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   328
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   329
            iAppUi->Displayables().Remove(index);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   330
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   331
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   332
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   333
    delete iLongTapDetector;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   334
    delete iStylusPopupMenu;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   335
    delete iTitle;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   336
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   337
#ifdef RD_SCALABLE_UI_V2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   338
    iUIManager->CloseCanvasKeypad(iCanvasKeypad);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   339
    iCanvasKeypad = NULL;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   340
#endif //RD_SCALABLE_UI_V2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   341
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   342
#ifdef RD_TACTILE_FEEDBACK
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   343
    if (iPenInputServerConnected)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   344
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   345
        iPenInputServer.Close();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   346
        iPenInputServerConnected = EFalse;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   347
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   348
#endif //RD_TACTILE_FEEDBACK
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   349
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   350
    // if ticker is present in this displayable and displayable is
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   351
    // deleted but ticker is not, tell the ticker that displayable is
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   352
    // garbage collected.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   353
    if (iTicker)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   354
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   355
        TRAP_IGNORE(iTicker->SetDisplayableL(this, KRemoveDisplayable));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   356
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   357
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   358
    delete iBackGroundControlContext;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   359
    iBackGroundControlContext = NULL;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   360
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   361
    iSoftKeys.ResetAndDestroy();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   362
    delete iCommandList;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   363
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   364
    if (iMenuHandler->GetDisplayable() == this)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   365
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   366
        //this may happen when the application is exiting
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   367
        iMenuHandler->SetDisplayable(NULL);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   368
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   369
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   370
    DEBUG("- CMIDDisplayable::CMIDDisplayable");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   371
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   372
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   373
/**
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   374
 * This means we are being deleted java side. We delete ourselves.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   375
 * However before doing this we call ReplaceBehindAlertIfNeeded().
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   376
 **/
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   377
void CMIDDisplayable::Dispose()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   378
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   379
    ReplaceBehindAlertIfNeeded();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   380
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   381
    delete this;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   382
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   383
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   384
/**
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   385
 * This method is called when we are deleted java side, from Dispose().
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   386
 * This code should only execute when java side they decide to delete the
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   387
 * displayable immeditately behind a showing alert. We check if we are a
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   388
 * displayable behind an alert. If so we find another displayable (the
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   389
 * one with lowest ordinal position, ie the top most displayable except us
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   390
 * and the alert). If we find one we make it visible so that the alert will
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   391
 * not end up with a white background.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   392
 **/
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   393
void CMIDDisplayable::ReplaceBehindAlertIfNeeded()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   394
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   395
    if ((this != iUIManager->GetDefaultDisplayable())
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   396
            && IsVisible()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   397
            && (iMenuHandler->GetDisplayable())
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   398
            && (iMenuHandler->GetDisplayable()->Component()->Type() == EAlert))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   399
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   400
        // In this case we are a faded displayable behind a dialog
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   401
        TInt numDisplayables = iAppUi->Displayables().Count();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   402
        TInt index = -1;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   403
        TInt currentPosition = 999;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   404
        for (TInt i = 0; i < numDisplayables; i++)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   405
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   406
            CMIDDisplayable* disp = iAppUi->Displayables()[i];
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   407
            if ((disp != this) && (disp->DrawableWindow()->OrdinalPosition() < currentPosition)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   408
                    && (disp->Component()->Type() != EAlert))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   409
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   410
                currentPosition = disp->DrawableWindow()->OrdinalPosition();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   411
                index = i;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   412
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   413
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   414
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   415
        if (index != -1)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   416
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   417
            CMIDDisplayable* disp = iAppUi->Displayables()[index];
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   418
            disp->MakeVisible(ETrue);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   419
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   420
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   421
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   422
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   423
void CMIDDisplayable::Draw(const TRect& aRect) const
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   424
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   425
    CWindowGc& gc = SystemGc();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   426
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   427
    // Set up update region - preventing DSA to be destroyed by redrawing
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   428
    if (!iDirectContentsRegion.IsEmpty())
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   429
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   430
        gc.CancelClippingRect();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   431
        iUpdateRegion.Clear();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   432
        iUpdateRegion.AddRect(aRect);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   433
        // Remove occupied areas out from update region
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   434
        iUpdateRegion.SubRegion(iDirectContentsRegion);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   435
        // Set the update region for the context
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   436
        gc.SetClippingRegion(iUpdateRegion);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   437
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   438
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   439
    if (iContent->Type() != ECanvas)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   440
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   441
        // Draw background
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   442
        MAknsSkinInstance* skin = AknsUtils::SkinInstance();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   443
        AknsDrawUtils::Background(skin, iBackGroundControlContext, this, gc, aRect);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   444
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   445
    iBorder.Draw(gc, Rect());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   446
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   447
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   448
TInt CMIDDisplayable::CountComponentControls() const
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   449
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   450
    TInt count=0;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   451
    if (iContentControl)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   452
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   453
        ++count;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   454
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   455
    return count;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   456
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   457
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   458
CCoeControl* CMIDDisplayable::ComponentControl(TInt aIndex) const
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   459
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   460
    switch (aIndex)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   461
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   462
    case 0:
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   463
        return iContentControl ? iContentControl: 0;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   464
    default:
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   465
        return 0;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   466
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   467
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   468
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   469
void CMIDDisplayable::SizeChanged()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   470
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   471
    if (iBackGroundControlContext)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   472
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   473
        iBackGroundControlContext->SetRect(Rect());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   474
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   475
    Layout();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   476
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   477
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   478
/**
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   479
 * Use the commands in aCommandList to create menu items and add them to aItems.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   480
 */
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   481
void CMIDDisplayable::PopulateMenuItemsWithListL
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   482
(
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   483
    const CMIDMenuHandler::TMenuType& aMenuType, //The type of menu
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   484
    RArray<CEikMenuPaneItem::SData>& aItems, //The items that will be added to the menu
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   485
    CMIDCommandList* aCommandList, //The list of commands to be examined
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   486
    TBool aSeparator
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   487
)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   488
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   489
    if (!aCommandList)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   490
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   491
        return;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   492
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   493
    const TBool isItemCommands = (aCommandList == iItemCommandList);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   494
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   495
    CMIDCommandList* list = aCommandList;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   496
    CEikMenuPaneItem::SData item;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   497
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   498
#ifdef RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   499
    // implicitList is used when creating options menu content.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   500
    TBool implicitList = EFalse;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   501
    if (iContent && iContent->Type() == EList && iContentControl)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   502
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   503
        CMIDList* list = static_cast<CMIDList*>(iContentControl);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   504
        implicitList = list->ListChoiceType() == MMIDChoiceGroup::EImplicit;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   505
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   506
#endif // RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   507
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   508
    const TInt count = list->Count();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   509
    for (TInt ii=0; ii<count; ii++)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   510
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   511
        const CMIDCommand* command = (list->At(ii).iCommand);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   512
#ifdef RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   513
        // If command is mapped to any sk, do not add it to menu (pop-up menu is an exception).
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   514
        if (!iIsFullScreenMode && CommandIsMappedToSk(command) && aMenuType != CMIDMenuHandler::EPopUpMenu)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   515
#else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   516
        // If command is mapped to any sk, do not add it to menu.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   517
        if (!iIsFullScreenMode && CommandIsMappedToSk(command))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   518
#endif // RD_JAVA_S60_RELEASE_9_2               
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   519
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   520
            continue;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   521
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   522
        // Only commands of type OK and ITEM are visible in context menu.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   523
        // TextBox/TextField device-provided commands:
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   524
        // - "Fetch number"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   525
        // - "Call"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   526
        // - "Fetch e-mail address"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   527
        // are exception. Those are visible ONLY in Options menu so here
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   528
        // they are not added to context menu.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   529
#ifdef RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   530
        if (aMenuType == CMIDMenuHandler::EOkMenu || aMenuType == CMIDMenuHandler::EPopUpMenu)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   531
#else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   532
        if (aMenuType == CMIDMenuHandler::EOkMenu)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   533
#endif // RD_JAVA_S60_RELEASE_9_2            
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   534
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   535
            if ((!isItemCommands &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   536
            (command->CommandType() != MMIDCommand::EOk) &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   537
            (command->CommandType() != MMIDCommand::EItem)) ||
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   538
            (command->Id() == CMIDEdwinUtils::EMenuCommandFetchPhoneNumber) ||
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   539
            (command->Id() == CMIDEdwinUtils::EMenuCommandFetchEmailAddress) ||
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   540
            (command->Id() == CMIDEdwinUtils::EMenuCommandCreatePhoneCall))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   541
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   542
                continue;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   543
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   544
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   545
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   546
        if (aMenuType == CMIDMenuHandler::EHelpMenu)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   547
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   548
            if (command->CommandType() != MMIDCommand::EHelp)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   549
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   550
                continue;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   551
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   552
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   553
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   554
        TPtrC shortLabel = const_cast<CMIDCommand*>(command)->ShortLabel();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   555
        TPtrC longLabel  = const_cast<CMIDCommand*>(command)->Label();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   556
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   557
        item.iCommandId = ii + list->CommandOffset();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   558
        item.iCascadeId = 0;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   559
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   560
        if (ii == (count-1) && aSeparator)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   561
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   562
            item.iFlags = EEikMenuItemSeparatorAfter;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   563
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   564
        else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   565
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   566
            item.iFlags = 0;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   567
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   568
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   569
        // Find out whether the long label fits into the menu without clipping,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   570
        // and use the long label if it fits; otherwise use short label.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   571
        //
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   572
        // In some scripts the visual presentation may differ from the logical text,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   573
        // so we need to convert the text to visual presentation first.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   574
        // The clipped clipped string is not used, only the return value is.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   575
        //
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   576
        const CFont& font =
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   577
            *AknLayoutUtils::FontFromId(AKN_LAYOUT_TEXT_List_pane_texts__menu_single__Line_1(0).iFont);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   578
        TInt maxMenuItemLength = CEikMenuPaneItem::SData::ENominalTextLength;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   579
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   580
        TRect parentRect = Rect();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   581
        TAknLayoutText prompt1;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   582
        prompt1.LayoutText(parentRect, AKN_LAYOUT_TEXT_Data_query_pop_up_window_texts_Line_1(0));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   583
        TInt layoutWidth = prompt1.TextRect().Width();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   584
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   585
        HBufC* visual = HBufC::NewMaxLC(maxMenuItemLength + KAknBidiExtraSpacePerLine);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   586
        TPtr visualPtr = visual->Des();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   587
        TBool clip = AknBidiTextUtils::ConvertToVisualAndClip(
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   588
                         longLabel,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   589
                         visualPtr,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   590
                         font,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   591
                         layoutWidth,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   592
                         layoutWidth,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   593
                         AknBidiTextUtils::EImplicit,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   594
                         0xFFFF);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   595
        CleanupStack::PopAndDestroy(visual);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   596
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   597
        if (clip)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   598
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   599
            BaflUtils::CopyWithTruncation(item.iText, shortLabel);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   600
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   601
        else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   602
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   603
            BaflUtils::CopyWithTruncation(item.iText, longLabel);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   604
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   605
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   606
        if ((iMSKCommand) && (iMSKCommand == list->At(ii).iCommand))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   607
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   608
            User::LeaveIfError(aItems.Insert(item, 0));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   609
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   610
        else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   611
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   612
#ifdef RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   613
            if (aMenuType == CMIDMenuHandler::EOptionsMenu)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   614
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   615
                TBool implicitCmd = (implicitList && (command->CommandType() == MMIDCommand::EOk ||
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   616
                                                      command->CommandType() == MMIDCommand::EItem));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   617
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   618
                if (!implicitCmd)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   619
                {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   620
                    User::LeaveIfError(aItems.Append(item));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   621
                }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   622
                else if (implicitCmd && iContentControl &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   623
                         static_cast<CMIDList*>(iContentControl)->IsHighlighted())
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   624
                {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   625
                    // If highlight in implicit list is False then there is no focus
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   626
                    // Item/Ok should be visible in options menu only when there is focus on item
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   627
                    User::LeaveIfError(aItems.Append(item));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   628
                }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   629
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   630
            else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   631
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   632
                User::LeaveIfError(aItems.Append(item));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   633
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   634
#else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   635
            User::LeaveIfError(aItems.Append(item));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   636
#endif // RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   637
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   638
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   639
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   640
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   641
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   642
/**
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   643
 * Create a list of menu items based on the type of menu and the
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   644
 * existing command lists.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   645
 *
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   646
 * This method is executed each time the menu is displayed to the user.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   647
 * There are two types of menus that can be displayed: context sensitive
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   648
 * - activated by the select key also known as ok-options menu -
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   649
 * or standard options menu - activated by the LSK. In the standard options
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   650
 * menu we display item and standard commands.In the context menu we display
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   651
 * item commands (if there are any) and standard commands if they are
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   652
 * of type OK or ITEM, this is taken care of by PopulateMenuItemsWithListL().
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   653
 *
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   654
 * @see PopulateMenuItemsWithListL(), CMIDMenuHandler::ShowMenuL()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   655
 **/
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   656
void CMIDDisplayable::CreateMenuItemsL
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   657
(
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   658
    const CMIDMenuHandler::TMenuType& aMenuType, // the type of menu
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   659
    RArray<CEikMenuPaneItem::SData>& aMenuItems // the list of menu items
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   660
)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   661
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   662
    aMenuItems.Reset();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   663
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   664
    if (aMenuType == CMIDMenuHandler::EOkMenu)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   665
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   666
        if (iItemCommandList && iItemCommandList->Count() > 0)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   667
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   668
            PopulateMenuItemsWithListL(aMenuType, aMenuItems, iItemCommandList, EFalse);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   669
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   670
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   671
        // Add form commands always
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   672
        PopulateMenuItemsWithListL(aMenuType, aMenuItems, iCommandList, EFalse);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   673
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   674
    else if (aMenuType == CMIDMenuHandler::EHelpMenu)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   675
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   676
        // Add the Help commands only
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   677
        PopulateMenuItemsWithListL(aMenuType, aMenuItems, iCommandList, EFalse);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   678
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   679
    else if (aMenuType == CMIDMenuHandler::EOptionsMenu)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   680
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   681
        PopulateMenuItemsWithListL(aMenuType, aMenuItems, iItemCommandList, EFalse);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   682
        PopulateMenuItemsWithListL(aMenuType, aMenuItems, iCommandList, ETrue);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   683
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   684
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   685
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   686
/**
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   687
 * iMenuHandler gets the commands first and handles the default ones (exit, options...).
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   688
 * The rest of the commands are passed here.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   689
 **/
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   690
void CMIDDisplayable::ProcessCommandL(TInt aCommandId)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   691
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   692
    if (!iActive)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   693
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   694
        return;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   695
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   696
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   697
    if (aCommandId == EAknSoftkeyContextOptions)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   698
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   699
        // MSK command to show context sensitive menu -> open it
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   700
        ShowOkOptionsMenuL();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   701
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   702
    else if (aCommandId == KBuiltInMSKCommandId)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   703
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   704
        // Handle built-in command that is not accessible from menus, only in MSK.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   705
        // Send a notification to the observer; there always should be one in built-in
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   706
        // commands, if not it is considered to be an error.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   707
        ASSERT(iMSKCommand->Observer());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   708
        iMSKCommand->Observer()->ProcessCommandL(iMSKCommand);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   709
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   710
    else if (aCommandId >= KItemCommandIdBase
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   711
             && iItemCommandList->IsValidIndex(aCommandId-KItemCommandIdBase))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   712
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   713
        HandleItemCommandL(iItemCommandList->At(aCommandId-KItemCommandIdBase));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   714
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   715
    else if (aCommandId >= KCommandIdBase
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   716
             && iCommandList->IsValidIndex(aCommandId-KCommandIdBase))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   717
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   718
        HandleStandardCommandL(iCommandList->At(aCommandId-KCommandIdBase));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   719
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   720
#ifdef RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   721
    // If command has come from pop-up menu, ensure that
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   722
    // possible pending up event is forwarded to the UI component.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   723
    if (iContent && iContentControl)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   724
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   725
        if (iContent->Type() == EList)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   726
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   727
            CMIDList* list = static_cast<CMIDList*>(iContentControl);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   728
            list->PostPendingUpEventL();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   729
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   730
        else if (iContent->Type() == EForm)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   731
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   732
            CMIDForm* form = static_cast<CMIDForm*>(iContentControl);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   733
            form->PostPendingUpEventL();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   734
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   735
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   736
#endif // RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   737
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   738
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   739
#ifdef RD_SCALABLE_UI_V2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   740
/** */
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   741
// This function can be moved out from RD_SCALABLE_UI_V2 flag if needed.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   742
// It is behind this flag because currently it is used only by Touch.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   743
void CMIDDisplayable::ProcessCommandL(CMIDCommand* aCommand)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   744
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   745
    TInt internalID = GetInternalCommandIdFor(aCommand);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   746
    if (internalID != KCommandIdNotFound)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   747
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   748
        ProcessCommandL(internalID);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   749
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   750
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   751
#endif //RD_SCALABLE_UI_V2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   752
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   753
/** */
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   754
void CMIDDisplayable::HandleStandardCommandL(const TCommandEntry& aCmdEntry)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   755
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   756
    TBool postJavaEvent = ETrue;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   757
    if (aCmdEntry.iCommand->Id() < 0)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   758
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   759
        //non-midlet command, see if there is an observer
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   760
        if (aCmdEntry.iCommand->Observer())
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   761
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   762
            postJavaEvent = !(aCmdEntry.iCommand->Observer()->ProcessCommandL(aCmdEntry.iCommand));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   763
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   764
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   765
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   766
    if (postJavaEvent)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   767
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   768
        iEnv.PostJavaEvent(*this, EDisplayable, ECommand, aCmdEntry.iKey);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   769
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   770
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   771
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   772
/** */
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   773
void CMIDDisplayable::HandleItemCommandL(const TCommandEntry& aCmdEntry)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   774
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   775
    TBool postJavaEvent = ETrue;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   776
    if (aCmdEntry.iCommand->Id() < 0)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   777
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   778
        //non-midlet command, see if there is an observer
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   779
        if (aCmdEntry.iCommand->Observer())
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   780
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   781
            postJavaEvent = !(aCmdEntry.iCommand->Observer()->ProcessCommandL(aCmdEntry.iCommand));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   782
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   783
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   784
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   785
    if (postJavaEvent && iContent->Type() == EForm)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   786
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   787
        CMIDForm* form = static_cast<CMIDForm*>(iContentControl);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   788
        ASSERT(form);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   789
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   790
        MMIDItem* item = form->CurrentItem();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   791
        if (item)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   792
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   793
            iEnv.PostJavaEvent(*item, EItem, ECommand, aCmdEntry.iKey);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   794
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   795
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   796
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   797
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   798
void CMIDDisplayable::HandleHelpCommandL()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   799
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   800
    // Get how many java help commands is registered
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   801
    TInt numCommands = NumCommandsForHelpOptionsMenu();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   802
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   803
    // If there is only one help command, invoke the Java help event directly
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   804
    if (numCommands == 1)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   805
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   806
        TCommandEntry cmdEntry;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   807
        cmdEntry.iCommand = NULL;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   808
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   809
        if (iCommandList)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   810
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   811
            TInt index = iCommandList->HighestPriorityCommand(MMIDCommand::EHelp);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   812
            if (index != KErrNotFound)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   813
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   814
                cmdEntry = iCommandList->At(index);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   815
                iEnv.PostJavaEvent(*this, EDisplayable, ECommand, cmdEntry.iKey);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   816
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   817
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   818
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   819
    // If there is two or more help commands, let display the menu with these commands
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   820
    else if (numCommands > 0)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   821
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   822
        iMenuHandler->ShowMenuL(CMIDMenuHandler::EHelpMenu);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   823
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   824
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   825
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   826
TInt CMIDDisplayable::NumCommandsForHelpOptionsMenu() const
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   827
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   828
    TInt ret = 0;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   829
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   830
    // Add always HELP commands from form
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   831
    TInt numCommands = iCommandList->Count();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   832
    for (TInt i = 0; i < numCommands; i++)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   833
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   834
        const CMIDCommand& command = *(iCommandList->At(i).iCommand);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   835
        if (command.CommandType() == MMIDCommand::EHelp)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   836
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   837
            ret++;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   838
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   839
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   840
    return ret;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   841
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   842
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   843
/**
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   844
 * Find the screen or help command with highest priority
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   845
 * and if exists invokes it
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   846
 **/
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   847
void CMIDDisplayable::HandleHighestPriorityScreenOrHelpCommandL()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   848
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   849
    // Find the highest priority screen or help command
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   850
    TInt screenOrHelpCmdIndex = GetHighestPriorityScreenOrHelpCommand();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   851
    if (screenOrHelpCmdIndex != KErrNotFound)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   852
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   853
        HandleStandardCommandL(iCommandList->At(screenOrHelpCmdIndex));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   854
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   855
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   856
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   857
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   858
// From MMIDDisplayable
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   859
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   860
void CMIDDisplayable::SetTitleL(const TDesC* aTitle)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   861
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   862
    delete iTitle;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   863
    iTitle = NULL;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   864
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   865
    if (aTitle)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   866
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   867
        iTitle = aTitle->AllocL();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   868
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   869
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   870
    if (iTitle)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   871
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   872
        iHasTitle = ETrue;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   873
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   874
    else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   875
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   876
        iHasTitle = EFalse;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   877
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   878
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   879
    if (iActive)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   880
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   881
        ShowTitleL();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   882
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   883
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   884
    if (iContent && iContent->Type() == EAlert)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   885
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   886
        CMIDAlert* alert = (CMIDAlert*) iContent;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   887
        alert->SetTitleL(iTitle);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   888
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   889
    // Title must be forwarded to Pop-up TextBox
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   890
    else if (iContent && iContent->Type() == ETextBox && iIsPopupTextBox)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   891
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   892
        CMIDTextBoxDialogControl* textbox = (CMIDTextBoxDialogControl*) iContent;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   893
        textbox->SetTitleL(iTitle);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   894
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   895
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   896
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   897
/**
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   898
 * Sets the Ticker
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   899
 *
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   900
 * StartL is called on the current displayable's ticker in these circumstances:
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   901
 * - When the MIDlet is brought to the foreground (in HandleForegroundL(ETrue))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   902
 * - When the device is switched on (in HandleSwitchOnL(ETrue))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   903
 * - If the MIDlet has been paused due to a CSaveNotifier event, StartL is
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   904
 *   called when the MIDlet is next brought to the foreground.(in HandleSwitchOnL(ETrue))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   905
 * - When the displayable is made current (StartL called by framework)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   906
 *
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   907
 * Stop is called on the current displayable's ticker in these circumstances:
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   908
 * - When the MIDlet is placed in the background.(in HandleForegroundL(EFalse) )
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   909
 * - The implementation uses the CSaveNotifier framework to provide MIDLet state changes.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   910
 *   When the following events are received ESaveAll,ESaveQuick,ESaveData,EReleaseRAM
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   911
 *   the MIDlet is paused and the ticker is stopped.(in HandleSwitchOnL(EFalse))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   912
 * - When the Displayable is no longer current. (Stop is called by framework)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   913
 **/
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   914
void CMIDDisplayable::SetTickerL(MMIDTicker* aTicker)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   915
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   916
    CMIDTicker* newTicker = static_cast< CMIDTicker* >(aTicker);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   917
    // if it is the same do nothing
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   918
    if (iTicker == aTicker)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   919
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   920
        return;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   921
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   922
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   923
    if (iTicker)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   924
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   925
        // Tell the current Ticker that it has no displayable
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   926
        iTicker->SetDisplayableL(this, KRemoveDisplayable);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   927
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   928
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   929
    iTicker = newTicker;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   930
    if (iTicker)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   931
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   932
        iTicker->SetDisplayableL(this, KAddDisplayable);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   933
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   934
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   935
    // Request ticker timer if a valid ticker has been set and
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   936
    // this is the current displayable.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   937
    UpdateTickerL();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   938
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   939
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   940
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   941
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   942
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   943
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   944
MMIDTicker* CMIDDisplayable::Ticker() const
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   945
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   946
    return iTicker;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   947
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   948
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   949
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   950
// Ensures that ticker update events are generated when appropriate
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   951
// (e.g. when active) and that this displayables ticker control is notified
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   952
// whenever it needs to redraw.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   953
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   954
// ResumeTicker() and SuspendTicker() deal with the ticker timer whereas
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   955
// PauseTicker() is actually sending the ticker to the background makeing it
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   956
// disappear.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   957
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   958
void CMIDDisplayable::UpdateTickerL()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   959
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   960
    if (iActive)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   961
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   962
        iUIManager->OpenNaviPaneControllerL()->SetTickerL(iTicker);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   963
        if (iIsFullScreenMode || iIsPopupTextBox)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   964
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   965
            iUIManager->OpenNaviPaneControllerL()->ShowTickerL(EFalse);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   966
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   967
        else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   968
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   969
            iUIManager->OpenNaviPaneControllerL()->ShowTickerL(ETrue);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   970
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   971
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   972
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   973
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   974
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   975
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   976
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   977
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   978
void CMIDDisplayable::HandleSwitchOnL(TBool /*aSwitchOn*/)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   979
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   980
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   981
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   982
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   983
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   984
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   985
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   986
void CMIDDisplayable::HandleForegroundL(TBool aForeground)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   987
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   988
    DEBUG("+ CMIDDisplayable::HandleForegroundL");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   989
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   990
    // send HandleForegroundL notification to Form
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   991
    if (iContent && (iContent->Type() == MMIDComponent::EForm) && iContentControl)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   992
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   993
        CMIDForm* form = static_cast<CMIDForm*>(iContentControl);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   994
        ASSERT(form);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   995
        form->HandleForegroundL(aForeground);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   996
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   997
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   998
    // Notify canvas about gained foreground only if it is the current displayable
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   999
    if (!aForeground || iActive)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1000
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1001
        HandleCanvasForeground(aForeground);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1002
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1003
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1004
    if (aForeground)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1005
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1006
        // If MIDlet is sent to foreground and JAD-attribute BackgroundEvent=Pause,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1007
        // then call startApp() method for the MIDlet.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1008
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1009
        if (iEnv.MidletAttributeIsSetToVal(LcduiMidletAttributes::KAttribBackgroundEvent,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1010
                                           LcduiMidletAttributeValues::KPauseValue))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1011
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1012
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1013
            iEnv.PostMidletEvent(EStart);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1014
            iAppUi->SetPauseAppState(EFalse);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1015
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1016
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1017
    else //to background
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1018
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1019
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1020
        // If MIDlet is sent to background and JAD-attribute BackgroundEvent=Pause,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1021
        // and window is not faded yet or window is already faded but pauseApp was not called yet,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1022
        // then call pauseApp() method for the MIDlet.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1023
        TBool isfaded = this->DrawableWindow()->IsFaded();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1024
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1025
        if (iEnv.MidletAttributeIsSetToVal(LcduiMidletAttributes::KAttribBackgroundEvent,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1026
                                           LcduiMidletAttributeValues::KPauseValue) && (!isfaded ||
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1027
                                                   (isfaded && !iAppUi->GetPauseAppState())))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1028
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1029
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1030
            iEnv.PostMidletEvent(EPause);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1031
            iAppUi->SetPauseAppState(ETrue);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1032
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1033
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1034
    DEBUG("- CMIDDisplayable::HandleForegroundL");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1035
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1036
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1037
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1038
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1039
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1040
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1041
void CMIDDisplayable::HandleResourceChangeL(TInt aType)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1042
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1043
    DEBUG("+ CMIDDisplayable::HandleResourceChangeL");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1044
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1045
    if (aType == KEikDynamicLayoutVariantSwitch)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1046
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1047
        // dynamic orientation change
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1048
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1049
        // Correct rect is set for displayable
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1050
        if (iActive && iCanvasKeypad)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1051
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1052
            //Update correct On-Screen Keypad type
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1053
            UpdateOnScreenKeypadSettings();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1054
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1055
        UpdateDisplayableRect();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1056
        SetRect(iDisplayableRect);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1057
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1058
        // MIDlet icon is resized in cpane SizeChanged()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1059
        if (!iActive && iContentControl)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1060
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1061
            //The active displayable already gets this call by the CONE framework but
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1062
            //background displayables don't, so for example a background form won't be
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1063
            //re-laid-out if we don't call this here
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1064
            iContentControl->HandleResourceChange(aType);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1065
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1066
#ifdef RD_SCALABLE_UI_V2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1067
        // When current Displayble is Canvas or popup Displayable and the last
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1068
        // Displayble was Canvas, then OSK visual appearance is needed
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1069
        //  to be change.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1070
        if (iUseOnScreenKeypad && iCanvasKeypad && (iActive || this->DrawableWindow()->IsFaded()))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1071
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1072
            if (iActive)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1073
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1074
                // Current is Canvas.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1075
                iCanvasKeypad->UpdateVisualAppearanceL(*iCanvas, iOnScreenKeyboardType, *this);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1076
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1077
            else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1078
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1079
                // Get current Displayable and the last fullscreen Displayble.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1080
                MMIDDisplayable* current = iEnv.Current();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1081
                const MMIDDisplayable* last = iEnv.LastFullscreenDisplayable();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1082
                if (current && last && current->Component()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1083
                        && last->Component())
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1084
                {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1085
                    // Get types of Displayables.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1086
                    MMIDComponent::TType lastType = last->Component()->Type();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1087
                    MMIDComponent::TType currentType = current->Component()->Type();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1088
                    if (lastType == ECanvas)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1089
                    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1090
                        if (currentType == EAlert)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1091
                        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1092
                            // Current is Alert and the last fullscreen
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1093
                            // Displayable was Canvas.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1094
                            iCanvasKeypad->UpdateVisualAppearanceL(
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1095
                                *iCanvas, iOnScreenKeyboardType, *this);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1096
                        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1097
                        else if (currentType == ETextBox && current->IsPopupTextBox())
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1098
                        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1099
                            // Current is popup TextBox and the last fullscreen
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1100
                            // Displayable was Canvas.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1101
                            iCanvasKeypad->UpdateVisualAppearanceL(
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1102
                                *iCanvas, iOnScreenKeyboardType, *this);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1103
                        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1104
                    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1105
                }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1106
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1107
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1108
#endif // RD_SCALABLE_UI_V2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1109
        iFullscreenCanvasLabelCacheIsValid = EFalse;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1110
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1111
    else if (aType == KEikColorResourceChange ||
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1112
             aType == KAknsMessageSkinChange  ||
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1113
             aType == KUidValueCoeColorSchemeChangeEvent)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1114
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1115
        //skin or color change, may need to recreate ctx icon
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1116
        // send skin change event to non-active controls so they can also
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1117
        // reload graphics
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1118
        if (!iActive && iContentControl)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1119
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1120
            iContentControl->HandleResourceChange(aType);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1121
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1122
#ifdef RD_SCALABLE_UI_V2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1123
        if (iUseOnScreenKeypad && iCanvasKeypad && iActive)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1124
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1125
            iCanvasKeypad->UpdateVisualAppearanceL(*iCanvas, iOnScreenKeyboardType, *this);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1126
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1127
#endif // RD_SCALABLE_UI_V2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1128
        iFullscreenCanvasLabelCacheIsValid = EFalse;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1129
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1130
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1131
    DEBUG("- CMIDDisplayable::HandleResourceChangeL");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1132
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1133
    // Language input change, needed by TextEditor.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1134
    if ((aType == KEikInputLanguageChange) && iContentControl)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1135
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1136
        iContentControl->HandleResourceChange(aType);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1137
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1138
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1139
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1140
#ifdef RD_JAVA_NGA_ENABLED
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1141
void CMIDDisplayable::HandleFullOrPartialForegroundL(TBool aFullOrPartialFg)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1142
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1143
    CMIDCanvas* canvas = GetContentCanvas();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1144
    if (canvas)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1145
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1146
        canvas->HandleFullOrPartialForegroundL(aFullOrPartialFg, iActive);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1147
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1148
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1149
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1150
void CMIDDisplayable::HandleFreeGraphicsMemory()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1151
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1152
    CMIDCanvas* canvas = GetContentCanvas();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1153
    if (canvas)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1154
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1155
        canvas->FreeGraphicsMemory(ETrue);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1156
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1157
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1158
#endif // RD_JAVA_NGA_ENABLED
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1159
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1160
/**
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1161
 * The container has changed it available drawing space, so resize
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1162
 * the displayable to fit and post a size changed event.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1163
 **/
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1164
void CMIDDisplayable::Layout()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1165
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1166
    TBool changed(EFalse);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1167
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1168
    //
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1169
    // Get client area of window (within border).
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1170
    //
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1171
    TRect rect(iBorder.InnerRect(Rect()));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1172
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1173
    if (iContentControl)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1174
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1175
        if (iContentControl->Rect() != rect)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1176
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1177
            // Anything left in rect is space for the content.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1178
            // It is arguable that the content should post the resize event as
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1179
            // it knows its true size. Certainly that is required for Canvas.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1180
            iContentControl->SetRect(rect);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1181
            changed = ETrue;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1182
            TRAP_IGNORE(iUIManager->OpenNaviPaneControllerL()->LayoutTickerL());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1183
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1184
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1185
        MMIDComponent::TType type = iContent->Type();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1186
        //
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1187
        // We assume that the content width/height == control width height
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1188
        // arguably not a valid assumption for any content - but especially
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1189
        // invalid for Canvas when the JAD specifies an assumed size.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1190
        //
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1191
        // Let Canvas's post their own size, but
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1192
        // use the content rect size for all other displayables.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1193
        //
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1194
        if (type != ECanvas && type != EGameCanvas)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1195
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1196
            //
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1197
            // Only post this event for non-canvas components.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1198
            //
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1199
            TSize size(rect.Size());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1200
            iEnv.PostJavaEvent(*this, EDisplayable, ESizeChanged, size.iWidth, size.iHeight, 0);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1201
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1202
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1203
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1204
    if (changed)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1205
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1206
        DrawDeferred();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1207
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1208
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1209
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1210
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1211
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1212
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1213
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1214
TInt CMIDDisplayable::GetSKPositionForOSK()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1215
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1216
    return iSKPositionWithQwerty;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1217
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1218
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1219
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1220
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1221
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1222
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1223
TRect CMIDDisplayable::GetCanvasRectFromLaf()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1224
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1225
    DEBUG("+ CMIDDisplayable::GetCanvasRectFromLaf");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1226
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1227
    TRect resultRect = TRect(0,0,0,0);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1228
    AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen, resultRect);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1229
    TAknLayoutRect canvasRect;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1230
    TAknLayoutRect mainPane;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1231
    TAknLayoutRect mainMidpPane;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1232
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1233
#ifdef RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1234
    // If split screen is open, then it is needed return current size of Canvas.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1235
    if (iSplitScreenKeyboard)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1236
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1237
        CMIDCanvas* canvas = GetContentCanvas();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1238
        if (canvas)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1239
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1240
            resultRect = canvas->ViewRect();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1241
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1242
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1243
    else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1244
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1245
#endif // RD_JAVA_S60_RELEASE_9_2    
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1246
        //Read canvasRect from LAF depending on keyboard type
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1247
        switch (iOnScreenKeyboardType)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1248
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1249
        case EOnScreenKeypadValueNo:
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1250
            break;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1251
        case EOnScreenKeypadValueNavigationKeys:
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1252
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1253
            if (iIsFullScreenMode)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1254
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1255
                if (!Layout_Meta_Data::IsLandscapeOrientation())  //portrait
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1256
                {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1257
                    canvasRect.LayoutRect(resultRect, AknLayoutScalable_Avkon::midp_canvas_pane(1).LayoutLine());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1258
                }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1259
                else //landscape
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1260
                {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1261
                    canvasRect.LayoutRect(resultRect, AknLayoutScalable_Avkon::midp_canvas_pane(8).LayoutLine());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1262
                }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1263
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1264
            else //normal mode
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1265
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1266
                if (!Layout_Meta_Data::IsLandscapeOrientation())  //portrait
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1267
                {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1268
                    mainPane.LayoutRect(resultRect, AknLayoutScalable_Avkon::main_pane(3).LayoutLine());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1269
                    mainMidpPane.LayoutRect(mainPane.Rect(), AknLayoutScalable_Avkon::main_midp_pane(0).LayoutLine());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1270
                    canvasRect.LayoutRect(mainMidpPane.Rect(), AknLayoutScalable_Avkon::midp_canvas_pane(4).LayoutLine());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1271
                }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1272
                else //landscape
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1273
                {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1274
                    mainPane.LayoutRect(resultRect, AknLayoutScalable_Avkon::main_pane(4).LayoutLine());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1275
                    mainMidpPane.LayoutRect(mainPane.Rect(), AknLayoutScalable_Avkon::main_midp_pane(1).LayoutLine());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1276
                    canvasRect.LayoutRect(mainMidpPane.Rect(), AknLayoutScalable_Avkon::midp_canvas_pane(7).LayoutLine());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1277
                }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1278
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1279
            resultRect = canvasRect.Rect();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1280
            break;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1281
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1282
        case EOnScreenKeypadValueGameActions:
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1283
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1284
            if (iIsFullScreenMode)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1285
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1286
                if (!Layout_Meta_Data::IsLandscapeOrientation())  //portrait
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1287
                {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1288
                    canvasRect.LayoutRect(resultRect, AknLayoutScalable_Avkon::midp_canvas_pane(2).LayoutLine());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1289
                }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1290
                else //landscape
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1291
                {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1292
                    canvasRect.LayoutRect(resultRect, AknLayoutScalable_Avkon::midp_canvas_pane(3).LayoutLine());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1293
                }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1294
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1295
            else //normal mode
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1296
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1297
                if (!Layout_Meta_Data::IsLandscapeOrientation())  //portrait
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1298
                {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1299
                    mainPane.LayoutRect(resultRect, AknLayoutScalable_Avkon::main_pane(3).LayoutLine());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1300
                    mainMidpPane.LayoutRect(mainPane.Rect(), AknLayoutScalable_Avkon::main_midp_pane(0).LayoutLine());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1301
                    canvasRect.LayoutRect(mainMidpPane.Rect(), AknLayoutScalable_Avkon::midp_canvas_pane(5).LayoutLine());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1302
                }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1303
                else//landscape
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1304
                {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1305
                    mainPane.LayoutRect(resultRect, AknLayoutScalable_Avkon::main_pane(4).LayoutLine());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1306
                    mainMidpPane.LayoutRect(mainPane.Rect(), AknLayoutScalable_Avkon::main_midp_pane(1).LayoutLine());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1307
                    canvasRect.LayoutRect(mainMidpPane.Rect(), AknLayoutScalable_Avkon::midp_canvas_pane(6).LayoutLine());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1308
                }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1309
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1310
            resultRect = canvasRect.Rect();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1311
            break;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1312
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1313
        case EOnScreenKeypadValueLskRsk:
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1314
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1315
            if (iIsFullScreenMode)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1316
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1317
                if (!Layout_Meta_Data::IsLandscapeOrientation())  //portrait
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1318
                {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1319
                    canvasRect.LayoutRect(resultRect, AknLayoutScalable_Avkon::midp_canvas_pane(11).LayoutLine());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1320
                }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1321
                else //landscape
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1322
                {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1323
                    if (iSKPositionWithQwerty == ESoftkeysRight)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1324
                    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1325
                        canvasRect.LayoutRect(resultRect, AknLayoutScalable_Avkon::midp_canvas_pane(10).LayoutLine());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1326
                    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1327
                    else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1328
                    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1329
#ifdef RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1330
                        canvasRect.LayoutRect(resultRect, AknLayoutScalable_Avkon::midp_canvas_pane(9).LayoutLine());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1331
#else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1332
                        resultRect = TRect(80,0,560,360); // Layout data not defined in older releases.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1333
                        DEBUG("- CMIDDisplayable::GetCanvasRectFromLaf");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1334
                        return resultRect;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1335
#endif // RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1336
                    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1337
                }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1338
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1339
            else//normal mode
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1340
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1341
                //no need to present LSK&RSK in OSK when in normal mode Canvas
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1342
                resultRect = TRect(0,0,0,0);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1343
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1344
                DEBUG("- CMIDDisplayable::GetCanvasRectFromLaf");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1345
                return resultRect;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1346
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1347
            resultRect = canvasRect.Rect();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1348
            break;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1349
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1350
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1351
#ifdef RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1352
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1353
#endif // RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1354
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1355
    DEBUG("- CMIDDisplayable::GetCanvasRectFromLaf");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1356
    return resultRect;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1357
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1358
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1359
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1360
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1361
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1362
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1363
void CMIDDisplayable::AddCommandL(MMIDCommand* aCommand)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1364
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1365
    iCommandList->AddL(aCommand);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1366
    InitializeCbasL();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1367
    iMenuHandler->UpdateMenuIfVisibleL();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1368
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1369
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1370
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1371
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1372
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1373
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1374
void CMIDDisplayable::RemoveCommand(MMIDCommand* aCommand)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1375
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1376
    iCommandList->Remove(aCommand);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1377
    TRAP_IGNORE(InitializeCbasL());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1378
    TRAP_IGNORE(iMenuHandler->UpdateMenuIfVisibleL());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1379
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1380
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1381
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1382
// This method reports the total space available to the
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1383
// content class. Displayable subclasses may report a
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1384
// different value as the width/height in which case they
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1385
// will use a differnt mechanism.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1386
// @see MMIDCanvas::ContentSize
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1387
// @see MMIDForm::Width
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1388
// @see MMIDForm::Height
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1389
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1390
TSize CMIDDisplayable::ContentSize() const
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1391
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1392
    if (iContent->Type() == MMIDComponent::EAlert)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1393
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1394
        return static_cast<CMIDAlert*>(iContent)->Dialog()->Size();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1395
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1396
    else if (iContent->Type() == MMIDComponent::ETextBox && iIsPopupTextBox)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1397
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1398
        return static_cast<CMIDTextBoxDialogControl*>(iContent)->Dialog()->ContentSize();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1399
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1400
    else if (iContent->Type() == MMIDComponent::EForm)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1401
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1402
        // return the size that is available for the form items
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1403
        // as stated in MIDP specification. This is smaller size than would be
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1404
        // returned by the iContentControl->Size().
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1405
        CMIDForm* form = static_cast<CMIDForm*>(iContent);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1406
        return TSize(form->Width(), form->Height());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1407
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1408
    /**
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1409
    Size really depends on the content class, however
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1410
    javax.microedition.lcdui.Form and javax.microedition.lcdui.Canvas
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1411
    contain overrides to return the correct size - so polymorphism is
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1412
    only required here for List,TextBox and Alert.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1413
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1414
    We return the size of the content control, so as long as the content
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1415
    control keeps its size up to date (eg alerts must have the same size as the dialog)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1416
    the correct size will be returned even if there is no polymorphism
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1417
    provided by the framework. Now, for alerts UpdateSizeL() must have
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1418
    been called, in fact when the dialog is not yet displaying they need
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1419
    to create one, set the size and then delete the dialog immediately.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1420
    */
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1421
    if (iContentControl)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1422
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1423
        return iContentControl->Size();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1424
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1425
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1426
    //If there is no content then we shouldn't really exist
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1427
    //because java side Displayable is abstract
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1428
    return TSize(0,0);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1429
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1430
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1431
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1432
// Called by the framework when current displayable was changed
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1433
// in case that old and new displayable type is canvas to change osk state
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1434
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1435
void CMIDDisplayable::ChangeOSKBackgroundState(TBool aOSKBackgroundState)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1436
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1437
    if (iContent && iContent->Type() == ECanvas)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1438
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1439
        if (iCanvasKeypad)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1440
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1441
            iCanvasKeypad->OSKInBackground(aOSKBackgroundState);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1442
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1443
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1444
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1445
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1446
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1447
// Called by the framework when we become or stop being the active displayable.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1448
// See HandleActivated(), HandleDeactivated().
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1449
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1450
void CMIDDisplayable::HandleCurrentL(TBool aCurrent)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1451
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1452
    DEBUG("+ CMIDDisplayable::HandleCurrentL");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1453
    ASSERT(iContentControl);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1454
    ASSERT(iContent);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1455
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1456
    iActive = aCurrent;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1457
    const TType type = iContent->Type();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1458
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1459
    if (aCurrent)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1460
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1461
        HandleCanvasForeground(aCurrent);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1462
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1463
        // when setting displayable as current remember to deactivate
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1464
        // the default displayable if it has not been done yet
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1465
        CMIDDisplayable* defaultDisplayable =
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1466
            iUIManager->GetDefaultDisplayable();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1467
        if (defaultDisplayable &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1468
                (this != defaultDisplayable) &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1469
                defaultDisplayable->IsActive())
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1470
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1471
            defaultDisplayable->HandleCurrentL(EFalse);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1472
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1473
        // "Whole screen size"-displayable behind popup type displayable is stored.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1474
        if (type == EAlert || (type == ETextBox && iIsPopupTextBox))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1475
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1476
            if (!(iMenuHandler->GetDisplayable() && (iMenuHandler->GetDisplayable()->IsPopupTextBox() ||
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1477
                    iMenuHandler->GetDisplayable()->Component()->Type() == EAlert)))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1478
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1479
                iDisplayableBehindPopup    = iMenuHandler->GetDisplayable();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1480
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1481
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1482
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1483
        iMenuHandler->SetDisplayable(this);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1484
        // Tell the iAppUi about setting this as active
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1485
        iAppUi->SetCurrentDisplayable(this);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1486
        HandleActivatedL();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1487
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1488
    else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1489
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1490
        HandleDeactivated();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1491
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1492
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1493
    if (type == EAlert)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1494
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1495
        // alerts do their on thing, they rely on sleeping dialogs in fact
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1496
        CMIDAlert* alert = static_cast<CMIDAlert*>(iContentControl);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1497
        TRAP_IGNORE(alert->HandleCurrentL(aCurrent));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1498
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1499
        UpdateTickerL();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1500
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1501
    else if (type == ETextBox && iIsPopupTextBox)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1502
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1503
        // Pop-up TextBox do their on thing, they rely on sleeping dialogs in fact
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1504
        CMIDTextBoxDialogControl* textBoxDialogControl =
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1505
            static_cast<CMIDTextBoxDialogControl*>(iContentControl);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1506
        TRAP_IGNORE(textBoxDialogControl->HandleCurrentL(aCurrent));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1507
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1508
    else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1509
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1510
        if (aCurrent)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1511
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1512
            UpdateVisualAppearanceL();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1513
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1514
        else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1515
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1516
            // Hide the displayable except the current displayable is Alert
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1517
            // or pop-up TextBox.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1518
            if ((this != iUIManager->GetDefaultDisplayable()) &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1519
                    (iMenuHandler->GetDisplayable()) &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1520
                    (iMenuHandler->GetDisplayable()->Component()->Type() != EAlert)  &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1521
                    !(iMenuHandler->GetDisplayable()->Component()->Type() == ETextBox &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1522
                      iMenuHandler->GetDisplayable()->IsPopupTextBox()))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1523
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1524
                MakeVisible(EFalse);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1525
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1526
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1527
            // Notify canvas after changing the visibility
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1528
            HandleCanvasForeground(aCurrent);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1529
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1530
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1531
        iContentControl->SetFocus(aCurrent);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1532
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1533
        switch (type)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1534
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1535
        case EForm:
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1536
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1537
            CMIDForm* form = static_cast<CMIDForm*>(iContentControl);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1538
            TRAP_IGNORE(form->HandleCurrentL(aCurrent));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1539
            break;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1540
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1541
        case ETextBox:
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1542
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1543
            CMIDTextBoxControl* textBoxControl =
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1544
                static_cast<CMIDTextBoxControl*>(iContentControl);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1545
            TRAP_IGNORE(textBoxControl->HandleCurrentL(aCurrent));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1546
            break;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1547
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1548
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1549
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1550
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1551
    DEBUG("- CMIDDisplayable::HandleCurrentL");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1552
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1553
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1554
/**
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1555
 * Called when we become the active displayable, see HandleCurrent().
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1556
 * Put icontentControl on the app UI stack and update the title.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1557
 **/
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1558
void CMIDDisplayable::HandleActivatedL()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1559
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1560
    DEBUG("+ CMIDDisplayable::HandleActivatedL");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1561
    ASSERT(iContentControl);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1562
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1563
    if (iContentControl->IsNonFocusing()) // i.e it's a Form
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1564
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1565
        iAppUi->AddToStackL(
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1566
            iContentControl,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1567
            (ECoeStackPriorityDefault - 1),
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1568
            ECoeStackFlagRefusesFocus);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1569
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1570
    else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1571
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1572
        iAppUi->AddToStackL(iContentControl);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1573
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1574
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1575
    ShowTitleL();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1576
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1577
    /* In case Canvas is in fullcsreen mode iDisplaybleRect needs to be updated.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1578
     * The Canvas rect has been reduced if Casvas has been displayed before (See HandleDeactivated).
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1579
     */
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1580
    if (iContent && iContent->Type() == ECanvas)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1581
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1582
        if (iCanvasKeypad)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1583
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1584
            UpdateOnScreenKeypadSettings();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1585
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1586
        UpdateDisplayableRect();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1587
        SetRect(iDisplayableRect);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1588
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1589
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1590
#ifdef RD_SCALABLE_UI_V2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1591
    // Hide CanvasKeypad if the current displayable is not Alert nor pop-up TextBox.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1592
    if (iUIManager->GetCanvasKeypad() && !iCanvasKeypad &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1593
            (iContent->Type() != EAlert &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1594
             !(iContent->Type() == ETextBox && iIsPopupTextBox)))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1595
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1596
        iUIManager->GetCanvasKeypad()->MakeVisible(EFalse);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1597
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1598
#endif //RD_SCALABLE_UI_V2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1599
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1600
    DEBUG("- CMIDDisplayable::HandleActivatedL");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1601
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1602
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1603
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1604
// Called when we stop being the active displayable, see HandleCurrent().
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1605
// Remove iContentControl from the app UI stack. If a menu was showing then
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1606
// hide it.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1607
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1608
void CMIDDisplayable::HandleDeactivated()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1609
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1610
    DEBUG("+ CMIDDisplayable::HandleDeactivated");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1611
    ASSERT(iContentControl);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1612
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1613
    // Make displayable behind popup/Alert non-visible if displayable behind
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1614
    // popup/Alert is changed to Canvas when dismissing the popup/Alert.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1615
    // Use case: Canvas on-screen keypad visibility after displayable changes.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1616
    if (iDisplayableBehindPopup && iContent && (iContent->Type() == EAlert || (iContent->Type() == ETextBox && iIsPopupTextBox))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1617
            && iDisplayableBehindPopup != iMenuHandler->GetDisplayable())
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1618
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1619
        if (iMenuHandler->GetDisplayable()->Component()->Type() == ECanvas ||
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1620
                iMenuHandler->GetDisplayable()->Component()->Type() == EGameCanvas)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1621
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1622
            iDisplayableBehindPopup->MakeVisible(EFalse);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1623
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1624
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1625
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1626
    // Stop displaying commands of old displayable
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1627
    iMenuHandler->HideMenuIfVisible();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1628
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1629
    // Stop repeat timer if OSK set to background
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1630
    if (iContent && iContent->Type() == ECanvas && iCanvasKeypad)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1631
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1632
        iCanvasKeypad->OSKInBackground(ETrue);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1633
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1634
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1635
    iAppUi->RemoveFromStack(iContentControl);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1636
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1637
    /* Enable status pane when Canvas in fullscreen mode is deactivated.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1638
     * In case there is Canvas in fullscreen mode and then setCurrent(Alert,normal mode displayable)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1639
     * is called, status pane stays behind the Canvas window.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1640
     * First we make status pane and cbas visible according to whether we
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1641
     * are full screen or not. This determines the rect returned by iAppUi->ClientRect()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1642
     */
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1643
    if (iContent && iContent->Type() == ECanvas && iIsFullScreenMode)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1644
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1645
        CEikStatusPane* pane = iAppUi->StatusPane();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1646
        pane->MakeVisible(ETrue);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1647
        // set right Width from APPUI client rect
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1648
        TRect displayableRectT = iDisplayableRect;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1649
        TRect iDisplayableRect = iAppUi->ClientRect();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1650
        iDisplayableRect.iBr.iY = displayableRectT.iBr.iY;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1651
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1652
        TRAPD(err, SetFullScreenModeL(ETrue));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1653
        if (err != KErrNone)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1654
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1655
            DEBUG_INT("CMIDDisplayable::HandleDeactivated - SetFullScreenModeL error %d", err);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1656
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1657
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1658
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1659
    DEBUG("- CMIDDisplayable::HandleDeactivated");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1660
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1661
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1662
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1663
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1664
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1665
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1666
void CMIDDisplayable::UpdateVisualAppearanceL()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1667
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1668
    DEBUG("+ CMIDDisplayable::UpdateVisualAppearanceL");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1669
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1670
    Window().SetOrdinalPosition(0);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1671
    MakeVisible(ETrue);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1672
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1673
    // First we make status pane and cbas visible according to whether we
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1674
    // are full screen or not. This determines the rect returned by
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1675
    // iAppUi->ClientRect()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1676
    CEikStatusPane* pane = iAppUi->StatusPane();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1677
    pane->MakeVisible(!iIsFullScreenMode);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1678
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1679
    java::ui::CoreUiAvkonAppUi* appUi =
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1680
        java::ui::CoreUiAvkonLcdui::getInstance().getJavaUiAppUi();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1681
    if (!iIsFullScreenMode && appUi && appUi->hidesIndicators())
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1682
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1683
        HideIndicators();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1684
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1685
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1686
    if (iCba)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1687
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1688
        iCba->MakeVisible(!iIsFullScreenMode);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1689
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1690
#ifdef RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1691
        // To enable clock pane in landscape after MIDlet was started
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1692
        iCba->SetBoundingRect(TRect(0, 0, 0, 0));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1693
#endif // RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1694
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1695
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1696
    // Close fixed toolbar for full screen Canvas.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1697
    CAknToolbar* toolbar = iAppUi->CurrentFixedToolbar();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1698
    if (toolbar)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1699
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1700
        toolbar->SetToolbarVisibility(!iIsFullScreenMode);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1701
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1702
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1703
#ifdef RD_SCALABLE_UI_V2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1704
    if ((iActive && iCanvasKeypad)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1705
            || (!iActive && this->DrawableWindow()->IsFaded()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1706
                && iCanvasKeypad))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1707
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1708
        if (iUseOnScreenKeypad)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1709
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1710
            iCanvasKeypad->UpdateVisualAppearanceL(
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1711
                *iCanvas, iOnScreenKeyboardType, *this);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1712
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1713
            // Because keypad changed its appearance we have to assure that
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1714
            // values for soft key label locations are updated.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1715
            iFullscreenCanvasLabelCacheIsValid = EFalse;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1716
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1717
        else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1718
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1719
            // Canvas keypad has to be set invisible if On-Screen keypad is
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1720
            // not to be used. Otherwise, if the visibility not handled here,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1721
            // status pane and CBA area's visual appearance can be corrupted.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1722
            if (!iIsFullScreenMode)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1723
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1724
                iCanvasKeypad->MakeVisible(EFalse);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1725
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1726
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1727
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1728
#endif //RD_SCALABLE_UI_V2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1729
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1730
    // At this point we can set the rect.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1731
    if (!iIsFullScreenMode && iCba)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1732
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1733
        InitializeCbasL();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1734
        iCba->DrawableWindow()->SetOrdinalPosition(0);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1735
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1736
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1737
    UpdateTickerL();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1738
    DrawDeferred();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1739
    DEBUG("- CMIDDisplayable::UpdateVisualAppearanceL");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1740
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1741
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1742
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1743
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1744
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1745
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1746
void CMIDDisplayable::SetComponentL(MMIDComponent& aComponent)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1747
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1748
    ASSERT(!iContentControl);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1749
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1750
    iContent = &aComponent;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1751
    iContentControl = NULL;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1752
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1753
    MMIDComponent::TType type = aComponent.Type();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1754
    switch (type)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1755
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1756
    case MMIDComponent::EForm:
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1757
        iContentControl = static_cast<CMIDForm*>(iContent);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1758
        break;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1759
    case MMIDComponent::EAlert:
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1760
        iContentControl = static_cast<CMIDAlert*>(iContent);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1761
        break;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1762
    case MMIDComponent::ECanvas:
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1763
    case MMIDComponent::EGameCanvas:
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1764
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1765
        iContentControl = &(static_cast<MMIDCanvas*>(iContent)->Control());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1766
#ifdef RD_SCALABLE_UI_V2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1767
        iCanvas = static_cast<CMIDCanvas*>(iContentControl);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1768
        if (AknLayoutUtils::PenEnabled())
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1769
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1770
            iUseOnScreenKeypad = ETrue;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1771
            iCanvasKeypad = iUIManager->OpenCanvasKeypadL(this);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1772
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1773
            // initialize iPropertyWatch as CPropertyWatch
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1774
            iPropertyWatch = CPropertyWatch::NewL(this);//Property observer
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1775
            UpdateOnScreenKeypadSettings();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1776
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1777
        UpdateDisplayableRect();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1778
        SetRect(iDisplayableRect);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1779
#endif //RD_SCALABLE_UI_V2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1780
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1781
    break;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1782
    case MMIDComponent::ETextBox:
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1783
        if (iIsPopupTextBox) // pop-up TextBox
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1784
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1785
            iContentControl = static_cast<CMIDTextBoxDialogControl*>(iContent);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1786
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1787
        else                // normal TextBox
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1788
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1789
            iContentControl = static_cast<CMIDTextBoxControl*>(iContent);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1790
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1791
        break;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1792
    case MMIDComponent::EList:
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1793
        iContentControl = static_cast<CMIDList*>(iContent);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1794
        // Lengthen long tap delay to get better usability.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1795
        iLongTapDetector->SetTimeDelayBeforeAnimation(KListLongTapAnimationDelay);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1796
        iLongTapDetector->SetLongTapDelay(KListLongTapAnimationDelay + KListLongTapDelay);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1797
        break;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1798
    case MMIDComponent::EDefaultBackground:
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1799
        iContentControl = static_cast<CMIDDefaultBackground*>(iContent);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1800
        break;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1801
    default:
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1802
        ASSERT(iContentControl);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1803
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1804
    Layout();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1805
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1806
    ASSERT(iContentControl);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1807
    iContentControl->ActivateL();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1808
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1809
    DEBUG("- CMIDDisplayable::SetComponentL");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1810
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1811
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1812
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1813
void CMIDDisplayable::UpdateOnScreenKeypadSettings()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1814
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1815
    DEBUG("+ CMIDDisplayable::UpdateOnScreenKeypadSettings");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1816
    if (iCanvasKeypad)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1817
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1818
        TInt hwKeyboardLayout = 0;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1819
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1820
        if (AknLayoutUtils::PenEnabled())
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1821
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1822
            // touch screen
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1823
            ReadOnScreenKeypadTypeFromSuiteSettings();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1824
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1825
            if (iOnScreenKeyboardType == EOnScreenKeypadValueNo)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1826
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1827
                iUseOnScreenKeypad = EFalse;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1828
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1829
                DEBUG("- CMIDDisplayable::UpdateOnScreenKeypadSettings");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1830
                return;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1831
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1832
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1833
            RProperty::Get(
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1834
                KCRUidAvkon, KAknKeyBoardLayout, hwKeyboardLayout);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1835
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1836
            // Avoid display of on-screen keypad on screen
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1837
            // in landscape mode for QWERTY layout 3x11 (4) and 4x10 (3)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1838
            if (hwKeyboardLayout == EPtiKeyboardQwerty4x10 ||
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1839
                    hwKeyboardLayout == EPtiKeyboardQwerty3x11)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1840
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1841
                // HW keyboard is opened
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1842
                if (iIsFullScreenMode)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1843
                {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1844
                    iOnScreenKeyboardType = EOnScreenKeypadValueLskRsk;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1845
                    iUseOnScreenKeypad = ETrue;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1846
                }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1847
                else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1848
                {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1849
                    // normal mode
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1850
                    iOnScreenKeyboardType = EOnScreenKeypadValueNo;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1851
                    iUseOnScreenKeypad = EFalse;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1852
                }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1853
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1854
            else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1855
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1856
                // Keypadless device or HW keyboard is closed
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1857
                iUseOnScreenKeypad = ETrue;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1858
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1859
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1860
        else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1861
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1862
            // no touch screen
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1863
            iUseOnScreenKeypad = EFalse;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1864
            iOnScreenKeyboardType = EOnScreenKeypadValueNo;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1865
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1866
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1867
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1868
    DEBUG("- CMIDDisplayable::UpdateOnScreenKeypadSettings");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1869
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1870
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1871
void CMIDDisplayable::ReadOnScreenKeypadTypeFromSuiteSettings()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1872
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1873
    DEBUG("+ CMIDDisplayable::ReadOnScreenKeypadTypeFromSuiteSettings");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1874
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1875
    // Read required keyboard type
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1876
    // 0=not defined,  1=no, 2=navigationkeys, 3=gameactions(default)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1877
    TRAP_IGNORE(iOnScreenKeyboardType = OnScreenKeypadL());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1878
    if (iOnScreenKeyboardType == EOnScreenKeypadValueUndefined)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1879
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1880
        // if keypad value cannot be read correctly
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1881
        // set gameactions keypad active (ignore error silently)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1882
        iOnScreenKeyboardType = EOnScreenKeypadValueGameActions;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1883
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1884
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1885
    DEBUG("- CMIDDisplayable::ReadOnScreenKeypadTypeFromSuiteSettings");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1886
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1887
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1888
void CMIDDisplayable::HandleOnScreenKeypadVisual()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1889
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1890
    DEBUG("+ CMIDDisplayable::HandleOnScreenKeypadVisual");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1891
#ifdef RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1892
    if (iActive && !iSplitScreenKeyboard)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1893
#else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1894
    if (iActive)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1895
#endif // RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1896
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1897
        UpdateOnScreenKeypadSettings();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1898
        UpdateDisplayableRect();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1899
        SetRect(iDisplayableRect);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1900
        TRAP_IGNORE(UpdateVisualAppearanceL());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1901
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1902
    DEBUG("- CMIDDisplayable::HandleOnScreenKeypadVisual");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1903
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1904
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1905
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1906
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1907
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1908
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1909
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1910
CCoeControl& CMIDDisplayable::ContentWindow()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1911
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1912
    return *this;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1913
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1914
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1915
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1916
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1917
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1918
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1919
void CMIDDisplayable::SetCommandListenerExistence(TBool aExistence)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1920
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1921
    iCommandListenerExistence = aExistence;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1922
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1923
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1924
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1925
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1926
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1927
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1928
TBool CMIDDisplayable::IsCommandListenerSet() const
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1929
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1930
    return iCommandListenerExistence;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1931
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1932
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1933
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1934
// Gets a softkey label location
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1935
// This can be got fot fullscreen canvas only
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1936
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1937
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1938
TBool CMIDDisplayable::SoftKeyLabelLocation(TInt aSoftKeyId, TPoint& aPosition, TSize& aSize)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1939
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1940
    if ((iContent->Type() == ECanvas && iIsFullScreenMode) &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1941
            (aSoftKeyId > 0) &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1942
            (aSoftKeyId <= KSoftKeyLabelPropertyNumberOfSoftKeys))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1943
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1944
        // Refresh the properties cache
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1945
        // (can be trapped - checked by iFullscreenCanvasLabelCacheIsValid)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1946
        TRAPD(result, RenewFullscreenCanvasLabelCacheL());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1947
        if (result != KErrNone)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1948
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1949
            DEBUG_INT("CMIDDisplayable::SoftKeyLabelLocation - Exception from CMIDDisplayable::RenewFullscreenCanvasLabelCacheL. Error = %d", result);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1950
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1951
        else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1952
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1953
            TInt skIndex = aSoftKeyId - 1;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1954
            if (iFullscreenCanvasLabelCacheIsValid &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1955
                    iFullscreenCanvasLabelCache[ skIndex ].iIsOn)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1956
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1957
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1958
                aPosition = iFullscreenCanvasLabelCache[ skIndex ].iPosition;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1959
                aSize = iFullscreenCanvasLabelCache[ skIndex ].iSize;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1960
                return ETrue;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1961
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1962
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1963
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1964
    return EFalse;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1965
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1966
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1967
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1968
// Force sync draw.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1969
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1970
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1971
void CMIDDisplayable::DrawNow()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1972
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1973
    CEikBorderedControl::DrawNow();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1974
    if (iCba)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1975
        iCba->DrawNow();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1976
    iAppUi->StatusPane()->DrawNow();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1977
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1978
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1979
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1980
// Gets a softkey label anchor
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1981
// This can be got fot fullscreen canvas only
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1982
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1983
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1984
TInt CMIDDisplayable::SoftKeyLabelAnchor(TInt aSoftKeyId)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1985
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1986
    if ((iContent->Type() == ECanvas && iIsFullScreenMode) &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1987
            (aSoftKeyId > 0) &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1988
            (aSoftKeyId <= KSoftKeyLabelPropertyNumberOfSoftKeys))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1989
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1990
        // Refresh the properties cache
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1991
        // (can be trapped - checked by iFullscreenCanvasLabelCacheIsValid)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1992
        TRAPD(result, RenewFullscreenCanvasLabelCacheL());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1993
        if (result != KErrNone)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1994
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1995
            DEBUG_INT("CMIDDisplayable::SoftKeyLabelAnchor - Exception from CMIDDisplayable::RenewFullscreenCanvasLabelCacheL. Error = %d", result);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1996
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1997
        else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1998
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1999
            TInt skIndex = aSoftKeyId - 1;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2000
            if (iFullscreenCanvasLabelCacheIsValid &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2001
                    iFullscreenCanvasLabelCache[ skIndex ].iIsOn)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2002
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2003
                return iFullscreenCanvasLabelCache[ skIndex ].iAnchor;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2004
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2005
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2006
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2007
    return 0;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2008
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2009
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2010
void CMIDDisplayable::SetS60SelectionKeyCompatibility(TBool aS60SelectionKeyCompatibility)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2011
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2012
    iS60SelectionKeyCompatibility = aS60SelectionKeyCompatibility;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2013
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2014
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2015
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2016
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2017
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2018
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2019
CMIDUIManager* CMIDDisplayable::GetUIManager() const
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2020
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2021
    return iUIManager;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2022
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2023
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2024
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2025
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2026
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2027
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2028
void CMIDDisplayable::UpdateDisplayableRect()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2029
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2030
    DEBUG("+ CMIDDisplayable::UpdateDisplayableRect");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2031
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2032
#ifdef RD_SCALABLE_UI_V2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2033
    TRect canvasRect;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2034
    if (iContent)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2035
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2036
        if (iUseOnScreenKeypad)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2037
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2038
            MMIDComponent::TType type = iContent->Type();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2039
            if (type == ECanvas || type == EGameCanvas)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2040
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2041
                canvasRect = GetCanvasRectFromLaf();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2042
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2043
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2044
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2045
#endif //RD_SCALABLE_UI_V2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2046
    if (iIsFullScreenMode)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2047
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2048
        iDisplayableRect = iAppUi->ApplicationRect();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2049
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2050
        // Update Cba because of softkey location properties
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2051
        // (see RenewFullscreenCanvasLabelCacheL())
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2052
        if (iCba && iActive)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2053
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2054
            // enable cba so that the layout is performed correctly
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2055
            iCba->MakeVisible(ETrue);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2056
            iCba->SetBoundingRect(iDisplayableRect);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2057
            // iCba is always invisible in fullscreen
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2058
            iCba->MakeVisible(EFalse);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2059
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2060
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2061
#ifdef RD_SCALABLE_UI_V2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2062
        if (iUseOnScreenKeypad && (canvasRect != TRect(0,0,0,0)))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2063
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2064
            iDisplayableRect = canvasRect;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2065
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2066
#endif //RD_SCALABLE_UI_V2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2067
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2068
    else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2069
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2070
        // In case we are changing from FullScreen mode to Normal mode
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2071
        // the status pane has to be enabled before quering client area rect.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2072
        CEikStatusPane* pane = iAppUi->StatusPane();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2073
        // Store pane visibility
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2074
        TBool paneVisible = pane->IsVisible();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2075
        pane->MakeVisible(ETrue);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2076
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2077
        iDisplayableRect = iAppUi->ClientRect();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2078
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2079
#ifdef RD_SCALABLE_UI_V2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2080
        if (iUseOnScreenKeypad && (canvasRect != TRect(0,0,0,0)))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2081
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2082
            iDisplayableRect = canvasRect;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2083
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2084
#endif //RD_SCALABLE_UI_V2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2085
        if (!iActive)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2086
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2087
            // Restore pane visibility. There is one pane for all displayables.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2088
            // Only active displayable can decide about the pane visibility.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2089
            // Others should not change it.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2090
            pane->MakeVisible(paneVisible);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2091
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2092
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2093
        if (iCba)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2094
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2095
            // Store cba visibility
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2096
            TBool cbaVisible = iCba->IsVisible();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2097
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2098
            // enable cba so that the layout is performed correctly
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2099
            iCba->MakeVisible(ETrue);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2100
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2101
            iCba->SetBoundingRect(iDisplayableRect);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2102
            // Control pane area has to be reduced
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2103
            iCba->ReduceRect(iDisplayableRect);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2104
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2105
            if (!iActive)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2106
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2107
                // Restore cba visibility. There is one cba for all displayables.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2108
                // Only active displayable can decide about the cba visibility.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2109
                // Others should not change it.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2110
                iCba->MakeVisible(cbaVisible);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2111
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2112
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2113
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2114
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2115
    DEBUG("- CMIDDisplayable::UpdateDisplayableRect");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2116
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2117
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2118
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2119
// When we are full screen (currently only Canvas supports this) we need to
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2120
// get rid of status pane and CBAs. We do this by calling SetRect() to the full
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2121
// screen rect. We also set a flag in canvas, which determines its behaviour.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2122
// See CMIDCanvas::FullScreen(). We store the full screen status in iIsFullScreenMode.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2123
// Note that this method is called by java side.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2124
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2125
void CMIDDisplayable::SetFullScreenModeL(TBool aFullScreen)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2126
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2127
    DEBUG("+ CMIDDisplayable::SetFullScreenModeL");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2128
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2129
    iIsFullScreenMode = aFullScreen;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2130
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2131
    if (iContent->Type() == MMIDComponent::ECanvas)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2132
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2133
        static_cast<CMIDCanvas*>(iContent)->FullScreen(iIsFullScreenMode);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2134
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2135
    if (iCanvasKeypad)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2136
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2137
        UpdateOnScreenKeypadSettings();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2138
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2139
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2140
    // Displayable rect is updated and set
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2141
    UpdateDisplayableRect();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2142
    SetRect(iDisplayableRect);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2143
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2144
    if (iActive)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2145
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2146
        //this means we are the active displayable
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2147
        UpdateVisualAppearanceL();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2148
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2149
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2150
    if (aFullScreen)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2151
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2152
        iFullscreenCanvasLabelCacheIsValid = EFalse;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2153
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2154
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2155
    DEBUG("- CMIDDisplayable::SetFullScreenModeL");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2156
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2157
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2158
#ifdef RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2159
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2160
// When partial screen keyboard is opened we need to
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2161
// get rid of status pane and resize Displayable.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2162
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2163
void CMIDDisplayable::HandleSplitScreenKeyboard(TBool aOpened)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2164
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2165
    iSplitScreenKeyboard = aOpened;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2166
    if (aOpened)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2167
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2168
        iAppUi->StatusPane()->MakeVisible(EFalse);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2169
        TRect clientRect = iAppUi->ClientRect();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2170
        SetRect(clientRect);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2171
        if (iActive)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2172
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2173
            DrawDeferred();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2174
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2175
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2176
    else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2177
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2178
        if (iActive)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2179
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2180
            UpdateOnScreenKeypadSettings();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2181
            UpdateDisplayableRect();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2182
            SetRect(iDisplayableRect);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2183
            // Ignoring leave
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2184
            // The method was already called at least once
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2185
            // and must be called here.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2186
            TRAP_IGNORE(UpdateVisualAppearanceL());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2187
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2188
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2189
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2190
#endif // RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2191
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2192
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2193
// Return true if we are in full screen mode (cavas), false otherwise.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2194
// @see iIsFullScreenMode
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2195
// @see SetFullScreenModeL().
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2196
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2197
TBool CMIDDisplayable::IsFullScreenMode() const
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2198
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2199
    return iIsFullScreenMode;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2200
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2201
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2202
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2203
// Sets a new command to the middle soft key (MSK). This can be used e.g. by
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2204
// ListBox to set the selection command to the MSK. Context sensitive menu
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2205
// opening command is handled automatically by displayable, there is no need
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2206
// to set a command for that. Setting MSK via this method, overrides
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2207
// automatic behavior of displayable e.g. to open context menu. To unset the
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2208
// MSK command, set it to NULL, then the automatic behavior is effective again.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2209
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2210
void CMIDDisplayable::SetMSKCommand(CMIDCommand* aMSKCommand)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2211
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2212
    CMIDCommand* oldMSKCommand = iMSKCommand;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2213
    iMSKCommand = aMSKCommand;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2214
    if (oldMSKCommand != iMSKCommand)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2215
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2216
        // avoid unnecessary updating to avoid flickering
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2217
        TRAP_IGNORE(InitializeCbasL());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2218
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2219
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2220
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2221
void CMIDDisplayable::SetSelectCommand(CMIDCommand* aSelectCommand)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2222
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2223
    if (aSelectCommand != iSelectCommand)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2224
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2225
        // avoid unnecessary updating to avoid flickering
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2226
        iSelectCommand = aSelectCommand;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2227
        TRAP_IGNORE(InitializeCbasL());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2228
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2229
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2230
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2231
void CMIDDisplayable::SetSelectCommandState(TBool aEnableSelectCommand)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2232
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2233
    iSelectCommandEnabled = aEnableSelectCommand;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2234
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2235
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2236
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2237
// Sets the list of form item commands associated with this Displayable on a
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2238
// given moment. Calling this will cause the CBA to be updated accordingly and
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2239
// usually it is called when focus has moved to a new Item.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2240
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2241
// If the MSK command is not NULL, it will be presented in the middle soft key
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2242
// (MSK). Setting the MSK command here is basically equivalent to setting it with
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2243
// SetMSKCommand. The parameter is added here to remind the programmer and to
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2244
// gain a small performance benefit of not updating the CBA twice.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2245
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2246
void CMIDDisplayable::SetItemCommandList(CMIDCommandList* aList, CMIDCommand* aMSKCommand)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2247
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2248
    iItemCommandList = aList;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2249
    if (iItemCommandList)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2250
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2251
        iItemCommandList->SetCommandOffset(KItemCommandIdBase);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2252
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2253
    CMIDCommand* oldMSKCommand = iMSKCommand;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2254
    iMSKCommand = aMSKCommand;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2255
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2256
    TInt newCount = iItemCommandList ? iItemCommandList->Count() : 0;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2257
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2258
    // To avoid flicker don't update the CBA if the old and the new command list
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2259
    // both have 0 items (very likely).
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2260
    if (!(iItemCommandsCount==0 && newCount==0) ||
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2261
            oldMSKCommand != iMSKCommand
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2262
            || iS60SelectionKeyCompatibility
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2263
       )
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2264
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2265
        TRAP_IGNORE(InitializeCbasL());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2266
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2267
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2268
    // set current items commands count
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2269
    iItemCommandsCount = newCount;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2270
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2271
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2272
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2273
// Called to show the MIDlet title in the Status Pane.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2274
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2275
void CMIDDisplayable::ShowTitleL()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2276
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2277
    CEikStatusPane* pane = iAppUi->StatusPane();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2278
    CAknTitlePane* titlePane = (CAknTitlePane*)pane->ControlL(TUid::Uid(EEikStatusPaneUidTitle));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2279
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2280
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2281
    if ((iContent && iContent->Type() == ETextBox) && iIsPopupTextBox)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2282
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2283
        // No need to update status pane for pop-up TextBox, because it is not using it.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2284
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2285
    else if ((iContent && iContent->Type() == EAlert) || !(this->iTitle) ||
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2286
             (this->iTitle->Length() < 1))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2287
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2288
        const TDesC& titleText = iEnv.MidletName();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2289
        titlePane->SetTextL(titleText);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2290
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2291
    else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2292
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2293
        titlePane->SetTextL(*iTitle);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2294
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2295
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2296
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2297
// Get Tilte to
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2298
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2299
HBufC* CMIDDisplayable::Title()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2300
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2301
    return iTitle;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2302
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2303
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2304
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2305
// First map the first eligible command to every sk. Then for the
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2306
// sk that accepts the options menu, change the mapped command to
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2307
// the options menu if there are still commands that have not been
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2308
// mapped. ASSUMPTION 1: Only one sk accepts a menu and this menu is
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2309
// always the options menu. ASSUMPTION 2: sks are ordered so that
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2310
// sks that are more restrictive in the type of commands they accept
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2311
// come before less restrictive sks, eg the right sk comes before the
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2312
// left sk.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2313
// Some components, for example, List, do not want MSK set if list is empty,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2314
// decision is done based on enableDefaultMSK parameter value
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2315
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2316
// Finally draw the CBA.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2317
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2318
void CMIDDisplayable::InitializeCbasL()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2319
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2320
    if (!iActive)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2321
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2322
        return;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2323
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2324
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2325
    iCba->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2326
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2327
    // Initialize command lists
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2328
    RArray<CMIDCommandList*> lists;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2329
    CleanupClosePushL(lists);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2330
    User::LeaveIfError(lists.Append(iCommandList));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2331
    User::LeaveIfError(lists.Append(iItemCommandList));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2332
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2333
#ifdef RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2334
    if (iSelectCommand)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2335
#else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2336
    if (!iSelectCommandEnabled && iSelectCommand)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2337
#endif // RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2338
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2339
        // remove the select command
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2340
        for (TInt j = 0; j < lists.Count(); j++)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2341
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2342
            if (lists[j])
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2343
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2344
                CMIDCommandList* itemCommandList = lists[j];
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2345
                if (itemCommandList)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2346
                {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2347
                    TInt index = itemCommandList->FindCommandIndex(iSelectCommand);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2348
                    if (index != KErrNotFound)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2349
                    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2350
                        itemCommandList->Remove(iSelectCommand);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2351
                    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2352
                }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2353
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2354
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2355
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2356
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2357
    TInt numLists = lists.Count();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2358
    TInt numSoftKeys = iSoftKeys.Count();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2359
    ResetSoftKeysAndCommands(lists);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2360
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2361
    // Variable implicitList is used when mapping commands to soft keys
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2362
    // In case of IMPLICIT List with only OK or ITEM commands,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2363
    // no command is mapped to soft key and these commands are not
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2364
    // populated to Options menu
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2365
    TBool implicitList = EFalse;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2366
#ifdef RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2367
    if (iContent && iContent->Type() == EList && iContentControl)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2368
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2369
        CMIDList* list = static_cast<CMIDList*>(iContentControl);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2370
        // Important: Set to ETrue only if List is IMPLICIT and there is no highlight
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2371
        implicitList = (list->ListChoiceType() == MMIDChoiceGroup::EImplicit) &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2372
                       !list->IsHighlighted();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2373
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2374
#endif // RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2375
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2376
    // First map one command to every softkey if possible,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2377
    // sks must have been ordered correctly, ie right key before
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2378
    // left key or else left key might get BACK cmd if not other
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2379
    // cmds are available.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2380
    for (TInt i = 0; i < numSoftKeys; i++)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2381
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2382
        for (TInt j = 0; j < numLists && !iSoftKeys[i]->HasAMappedCommand(); j++)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2383
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2384
            if (lists[j])
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2385
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2386
                TInt index = lists[j]->FindCommandForSoftKey(*iSoftKeys[i], implicitList);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2387
                if (index != KErrNotFound)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2388
                {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2389
                    TInt commandId = lists[j]->CommandOffset() + index;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2390
                    CMIDCommand* cmd = lists[j]->At(index).iCommand;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2391
                    iSoftKeys[i]->Map(cmd);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2392
                    iCba->SetCommandL(iSoftKeys[i]->PositionInCBA(),
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2393
                                      commandId,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2394
                                      lists[j]->ShortLabel(index));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2395
                }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2396
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2397
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2398
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2399
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2400
    // Then for the sk that can potentially accept an options menu,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2401
    // see if the mapped command must be replaced by the options menu
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2402
    // when there is at least one command that has not been mapped to any sk.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2403
    // Important: Do not set Options menu in case of IMPLICIT List
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2404
    // with only OK or ITEM commands
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2405
    TBool needToDisplayMenu = EFalse;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2406
    for (TInt j = 0; j < numLists && !needToDisplayMenu; j++)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2407
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2408
        if (lists[j])
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2409
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2410
            // Looping trough all commands
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2411
            for (TInt i = 0; i < lists[j]->Count() && !needToDisplayMenu; i++)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2412
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2413
                CMIDCommand* cmd = lists[j]->At(i).iCommand;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2414
                // In case that displayable is IMPLICIT List, we need to know,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2415
                // if it has only OK or ITEM commands
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2416
                if (!(implicitList && (cmd->CommandType() == MMIDCommand::EOk ||
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2417
                                       cmd->CommandType() == MMIDCommand::EItem)))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2418
                {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2419
                    // There is at least one command, which is not mapped yet,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2420
                    // so it will be populated to Options menu.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2421
                    needToDisplayMenu = !CommandIsMappedToSk(cmd);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2422
                }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2423
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2424
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2425
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2426
    if (needToDisplayMenu)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2427
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2428
        iSoftKeys[KOptionsMenuCBAIndex]->MappedCommand()->SetMappedToSoftKey(EFalse);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2429
        iSoftKeys[KOptionsMenuCBAIndex]->Map(NULL);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2430
        iCba->SetCommandL(iSoftKeys[KOptionsMenuCBAIndex]->PositionInCBA(),R_MIDP_SOFTKEY_OPTIONS);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2431
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2432
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2433
    // Setup the MSK command
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2434
    TInt contextMenuSize = NumCommandsForOkOptionsMenu();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2435
    // first reset stored id of command mapped to MSK
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2436
    iIdOfMSKCommand = KErrNotFound;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2437
    if (!iS60SelectionKeyCompatibility)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2438
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2439
        if (iMSKCommand)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2440
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2441
            // There is a explicitly set MSK command -> it takes the precedence and gets MSK
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2442
            TInt commandId = GetInternalCommandIdFor(iMSKCommand);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2443
            if (commandId == KCommandIdNotFound)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2444
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2445
                // it must be a built-in command, it is the only command not contained in the command lists
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2446
                commandId = KBuiltInMSKCommandId;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2447
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2448
            iCba->SetCommandL(KMSKPositionInCBA, commandId, iMSKCommand->ShortLabel());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2449
            iIdOfMSKCommand = commandId;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2450
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2451
        else if (!iMSKCommand && (contextMenuSize == 1))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2452
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2453
            // There is no explicitly set MSK command and just one for the context menu.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2454
            // Instead of a menu, put the command to MSK directly.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2455
            RPointerArray<CMIDCommand> commands;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2456
            GetOkOptionsMenuCommandsL(commands);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2457
            ASSERT(commands.Count() == 1);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2458
            CMIDCommand* command = commands[0];
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2459
            commands.Close();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2460
            iCba->SetCommandL(KMSKPositionInCBA,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2461
                              GetInternalCommandIdFor(command),
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2462
                              command->ShortLabel());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2463
            iIdOfMSKCommand = GetInternalCommandIdFor(command);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2464
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2465
        else if (!iMSKCommand && (contextMenuSize > 1))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2466
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2467
            // There is no explicitly set MSK command, but there is a
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2468
            // context sensitive menu -> display MSK command & icon for opening the menu
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2469
            _LIT(KEmptyLabel, ""); // the label is never shown in MSK, but an icon is
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2470
            iCba->SetCommandL(KMSKPositionInCBA, EAknSoftkeyContextOptions, KEmptyLabel);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2471
            iIdOfMSKCommand = EAknSoftkeyContextOptions;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2472
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2473
        else if (!iMSKCommand && (contextMenuSize == 0))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2474
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2475
            // There is no explicitly set MSK command and no OK or ITEM command defined
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2476
            // Try to map SCREEN or HELP command with the highest priority
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2477
            TInt screenOrHelpCmdIndex = GetHighestPriorityScreenOrHelpCommand();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2478
            if (screenOrHelpCmdIndex != KErrNotFound)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2479
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2480
                CMIDCommand *command = iCommandList->At(screenOrHelpCmdIndex).iCommand;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2481
                if (command)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2482
                {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2483
                    // At least one SCREEN or HELP command is set, map to MSK
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2484
                    iCba->SetCommandL(KMSKPositionInCBA,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2485
                                      GetInternalCommandIdFor(command),
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2486
                                      command->ShortLabel());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2487
                    iIdOfMSKCommand = GetInternalCommandIdFor(command);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2488
                }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2489
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2490
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2491
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2492
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2493
    CleanupStack::PopAndDestroy(&lists);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2494
    iCba->DrawDeferred();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2495
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2496
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2497
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2498
// Returns an internal command id for a command. Assumes that
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2499
// command is not NULL.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2500
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2501
TInt CMIDDisplayable::GetInternalCommandIdFor(CMIDCommand* aCommand) const
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2502
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2503
    ASSERT(aCommand);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2504
    // See if command is part on command list, if the list exists
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2505
    if (iCommandList)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2506
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2507
        // To identify the command, first find it from the list, this is based on
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2508
        // command ids. However, commands in iCommandList and iItemCommandList may
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2509
        // have same ids (because of Java side implementation) and thus we compare
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2510
        // the pointer of the command in the second phase.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2511
        TInt index = iCommandList->FindCommandIndex(aCommand);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2512
        if (index != KErrNotFound && iCommandList->At(index).iCommand == aCommand)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2513
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2514
            return iCommandList->CommandOffset() + index;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2515
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2516
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2517
    // See if command is part of item command list, if the list exists
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2518
    if (iItemCommandList)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2519
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2520
        // To identify the command, first find it from the list, this is based on
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2521
        // command ids. However, commands in iCommandList and iItemCommandList may
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2522
        // have same ids (because of Java side implementation) and thus we compare
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2523
        // the pointer of the command in the second phase.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2524
        TInt index = iItemCommandList->FindCommandIndex(aCommand);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2525
        if (index != KErrNotFound && iItemCommandList->At(index).iCommand == aCommand)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2526
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2527
            return iItemCommandList->CommandOffset() + index;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2528
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2529
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2530
    // Did not find the requested command
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2531
    return KCommandIdNotFound;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2532
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2533
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2534
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2535
// Return true if the command is mapped to any softkey. The same java side command seem
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2536
// to exist on more than one list so we use the command Id to make sure the command is not
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2537
// a repeatition of an existing command.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2538
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2539
TBool CMIDDisplayable::CommandIsMappedToSk(const CMIDCommand* aCommand) const
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2540
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2541
    DEBUG("+ CMIDDisplayable::CommandIsMappedToSk");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2542
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2543
    TBool commandIsMapped = aCommand->IsMappedToSoftKey();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2544
    for (TInt k = 0; k < iSoftKeys.Count() && !commandIsMapped; k++)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2545
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2546
        const CMIDCommand* skCmd = iSoftKeys[k]->MappedCommand();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2547
        if (skCmd && skCmd == aCommand && skCmd->Id() == aCommand->Id())
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2548
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2549
            commandIsMapped = ETrue;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2550
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2551
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2552
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2553
    DEBUG("- CMIDDisplayable::CommandIsMappedToSk");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2554
    return commandIsMapped;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2555
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2556
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2557
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2558
// See how many commands eligible for the ok-optins menu we have. If we
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2559
// have only one command then post java event directly. Otherwise show
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2560
// ok-options menu. In these two cases return ETrue. If zero or negative
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2561
// commands do nothing and return EFalse. See also NumCommandsForOkOptionsMenu()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2562
// and CMIDMenuHandler::ShowMenuL().
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2563
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2564
TBool CMIDDisplayable::ShowOkOptionsMenuL()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2565
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2566
    TInt numCommands = NumCommandsForOkOptionsMenu();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2567
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2568
    if (numCommands == 1)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2569
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2570
        TCommandEntry cmd;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2571
        cmd.iCommand = NULL;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2572
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2573
        if (iItemCommandList && iItemCommandList->Count() > 0)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2574
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2575
            // there can only be one so pick the first one
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2576
            cmd = iItemCommandList->At(0);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2577
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2578
            if (cmd.iCommand->IsMappedToSoftKey())
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2579
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2580
                HandleItemCommandL(cmd);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2581
                return ETrue;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2582
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2583
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2584
        else if (iCommandList && iCommandList->Count() > 0)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2585
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2586
            TInt index = iCommandList->HighestPriorityCommand(MMIDCommand::EOk);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2587
            if (index == KErrNotFound)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2588
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2589
                // there can only be one so if the other one was KErrNotFound, this must be it
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2590
                index = iCommandList->HighestPriorityCommand(MMIDCommand::EItem);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2591
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2592
            cmd = iCommandList->At(index);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2593
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2594
            if (cmd.iCommand->IsMappedToSoftKey())
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2595
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2596
                HandleStandardCommandL(cmd);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2597
                return ETrue;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2598
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2599
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2600
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2601
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2602
    if (numCommands > 0)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2603
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2604
        iMenuHandler->ShowMenuL(CMIDMenuHandler::EOkMenu);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2605
        return ETrue;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2606
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2607
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2608
    return EFalse;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2609
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2610
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2611
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2612
// See how many commands eligible for the screen or help - optins menu we have.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2613
// If we have only one command call ProcessCommandL. Otherwise show
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2614
// options menu. In these two cases return ETrue. If zero or negative
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2615
// commands do nothing and return EFalse.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2616
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2617
TBool CMIDDisplayable::ShowScreenOrHelpOptionsMenuL()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2618
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2619
    TBool ret = EFalse;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2620
    TInt numOkCommands = NumCommandsForOkOptionsMenu();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2621
    TInt numScreenOrHelpCommands = NumCommandsForScreenOrHelpOptionsMenu();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2622
    TInt screenOrHelpCmdIndex = GetHighestPriorityScreenOrHelpCommand();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2623
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2624
    // There is no OK or ITEM command defined on form
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2625
    // There are SCREEN or HELP commands
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2626
    if (iCommandList && screenOrHelpCmdIndex != KErrNotFound && numOkCommands == 0)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2627
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2628
        CMIDCommand *command = NULL;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2629
        if (iCommandList->IsValidIndex(screenOrHelpCmdIndex))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2630
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2631
            command = iCommandList->At(screenOrHelpCmdIndex).iCommand;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2632
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2633
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2634
        if (command && (command->CommandType() == MMIDCommand::EScreen ||
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2635
                        command->CommandType() == MMIDCommand::EHelp) && iMenuHandler)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2636
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2637
            if (numScreenOrHelpCommands > 1)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2638
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2639
                iMenuHandler->ShowMenuL(CMIDMenuHandler::EOptionsMenu);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2640
                ret = ETrue;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2641
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2642
            else if (numScreenOrHelpCommands == 1)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2643
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2644
                ProcessCommandL(iCommandList->CommandOffset());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2645
                ret = ETrue;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2646
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2647
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2648
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2649
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2650
    return ret;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2651
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2652
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2653
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2654
// Return the number of commands that can be displayed in the ok-options menu.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2655
// If form has set any item commands in iItemCommandList this means that there is
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2656
// a form item focused and the commands for this item should be displayed in
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2657
// the ok-options menu along with form OK and ITEM commands.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2658
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2659
// If we have no item cmds we analyse the standard command list and
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2660
// select only the commands of type OK or ITEM.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2661
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2662
// TextBox/TextField device-provided commands:
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2663
// - "Fetch number"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2664
// - "Call"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2665
// - "Fetch e-mail address"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2666
// are exception. Those are visible ONLY in Options menu so here they are
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2667
// removed from context menu commands count.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2668
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2669
TInt CMIDDisplayable::NumCommandsForOkOptionsMenu() const
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2670
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2671
    TInt ret = 0;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2672
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2673
    if (iItemCommandList && iItemCommandList->Count() > 0)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2674
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2675
        TInt numItemCommands = iItemCommandList->Count();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2676
        for (TInt i = 0; i < numItemCommands; i++)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2677
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2678
            const CMIDCommand& command = *(iItemCommandList->At(i).iCommand);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2679
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2680
            if ((command.Id() != CMIDEdwinUtils::EMenuCommandFetchPhoneNumber) &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2681
                    (command.Id() != CMIDEdwinUtils::EMenuCommandFetchEmailAddress) &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2682
                    (command.Id() != CMIDEdwinUtils::EMenuCommandCreatePhoneCall))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2683
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2684
                ret++;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2685
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2686
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2687
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2688
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2689
    // Add always OK and ITEM commands from form
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2690
    TInt numCommands = iCommandList->Count();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2691
    for (TInt i = 0; i < numCommands; i++)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2692
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2693
        const CMIDCommand& command = *(iCommandList->At(i).iCommand);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2694
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2695
        if (((command.CommandType() == MMIDCommand::EOk) ||
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2696
                (command.CommandType() == MMIDCommand::EItem)) &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2697
                (command.Id() != CMIDEdwinUtils::EMenuCommandFetchPhoneNumber) &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2698
                (command.Id() != CMIDEdwinUtils::EMenuCommandFetchEmailAddress) &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2699
                (command.Id() != CMIDEdwinUtils::EMenuCommandCreatePhoneCall))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2700
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2701
            TBool selectCommand = (&command == iSelectCommand);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2702
            if (selectCommand && !iSelectCommandEnabled)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2703
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2704
                continue;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2705
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2706
            ret++;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2707
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2708
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2709
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2710
    return ret;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2711
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2712
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2713
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2714
// Return the number of commands that can be displayed in the screen or help - options menu.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2715
// Form item screen or help commands are ignored
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2716
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2717
// TextBox/TextField device-provided commands:
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2718
// - "Fetch number"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2719
// - "Call"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2720
// - "Fetch e-mail address"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2721
// are exception. Those are visible ONLY in Options menu so here they are
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2722
// removed from context menu commands count.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2723
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2724
TInt CMIDDisplayable::NumCommandsForScreenOrHelpOptionsMenu() const
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2725
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2726
    TInt ret = 0;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2727
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2728
    // Add SCREEN and HELP commands from form
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2729
    if (iCommandList)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2730
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2731
        TInt numCommands = iCommandList->Count();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2732
        for (TInt i = 0; i < numCommands; i++)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2733
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2734
            const CMIDCommand& command = *(iCommandList->At(i).iCommand);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2735
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2736
            if (((command.CommandType() == MMIDCommand::EScreen) ||
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2737
                    (command.CommandType() == MMIDCommand::EHelp)) &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2738
                    (command.Id() != CMIDEdwinUtils::EMenuCommandFetchPhoneNumber) &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2739
                    (command.Id() != CMIDEdwinUtils::EMenuCommandFetchEmailAddress) &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2740
                    (command.Id() != CMIDEdwinUtils::EMenuCommandCreatePhoneCall))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2741
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2742
                TBool selectCommand = (&command == iSelectCommand);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2743
                if (selectCommand && !iSelectCommandEnabled)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2744
                {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2745
                    continue;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2746
                }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2747
                ret++;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2748
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2749
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2750
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2751
    return ret;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2752
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2753
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2754
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2755
// Returns a pointer to the command in the iCommandList with the specified
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2756
// ID number. If such command is not found, returns NULL.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2757
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2758
CMIDCommand* CMIDDisplayable::FindCommandWithId(TInt aCommandId) const
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2759
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2760
    TInt numCommands = iCommandList->Count();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2761
    for (TInt i = 0; i < numCommands; i++)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2762
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2763
        CMIDCommand* command = iCommandList->At(i).iCommand;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2764
        if (command->Id() == aCommandId)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2765
            return command;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2766
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2767
    return NULL;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2768
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2769
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2770
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2771
// Retrieves the commands to be placed in the context (ok-options) menu.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2772
// The commands are returned in the array, provided by the calling code.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2773
// This function will empty the commands array before filling it.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2774
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2775
// Only commands of type OK and ITEM are visible in context menu.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2776
// TextBox/TextField device-provided commands:
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2777
// - "Fetch number"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2778
// - "Call"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2779
// - "Fetch e-mail address"
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2780
// are exception. Those are visible ONLY in Options menu so here
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2781
// they are not added to context menu commands array.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2782
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2783
// If there are item commands, there are placed first. Form commands of ITEM
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2784
// and OK type are then included always.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2785
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2786
void CMIDDisplayable::GetOkOptionsMenuCommandsL(RPointerArray<CMIDCommand>& aCommands) const
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2787
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2788
    aCommands.Reset();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2789
    if (iItemCommandList && iItemCommandList->Count() > 0)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2790
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2791
        for (TInt i = 0; i < iItemCommandList->Count(); i++)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2792
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2793
            const CMIDCommand* command = iItemCommandList->At(i).iCommand;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2794
            if ((command->Id() != CMIDEdwinUtils::EMenuCommandFetchPhoneNumber) &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2795
                    (command->Id() != CMIDEdwinUtils::EMenuCommandFetchEmailAddress) &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2796
                    (command->Id() != CMIDEdwinUtils::EMenuCommandCreatePhoneCall))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2797
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2798
                aCommands.AppendL(command);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2799
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2800
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2801
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2802
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2803
    // add Form commands always
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2804
    TInt numCommands = iCommandList->Count();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2805
    for (TInt i = 0; i < numCommands; i++)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2806
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2807
        const CMIDCommand* command = iCommandList->At(i).iCommand;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2808
        if (((command->CommandType() == MMIDCommand::EOk) ||
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2809
                (command->CommandType() == MMIDCommand::EItem)) &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2810
                (command->Id() != CMIDEdwinUtils::EMenuCommandFetchPhoneNumber) &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2811
                (command->Id() != CMIDEdwinUtils::EMenuCommandFetchEmailAddress) &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2812
                (command->Id() != CMIDEdwinUtils::EMenuCommandCreatePhoneCall))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2813
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2814
            if (!iSelectCommandEnabled && command == iSelectCommand)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2815
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2816
                continue;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2817
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2818
            aCommands.AppendL(command);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2819
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2820
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2821
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2822
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2823
/**
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2824
 * Retrieves index of the highest priority SCREEN command
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2825
 * where there is no SCREEN command it retreives index
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2826
 * of the highest priority HELP command number.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2827
 *
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2828
 * When there is no such command type, it returns KErrNotFound
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2829
 **/
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2830
TInt CMIDDisplayable::GetHighestPriorityScreenOrHelpCommand() const
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2831
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2832
    TInt cmdNum = iCommandList->HighestPriorityCommand(MMIDCommand::EScreen);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2833
    if (cmdNum == KErrNotFound)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2834
        cmdNum = iCommandList->HighestPriorityCommand(MMIDCommand::EHelp);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2835
    return cmdNum;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2836
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2837
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2838
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2839
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2840
// Removes the title, effectively showing the midlet name as the title.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2841
// Used by popup-style TextBox which maintains its own title.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2842
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2843
void CMIDDisplayable::ClearTitleL()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2844
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2845
    delete iTitle;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2846
    iTitle = NULL;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2847
    if (this->iActive)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2848
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2849
        this->ShowTitleL();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2850
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2851
    iHasTitle = EFalse;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2852
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2853
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2854
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2855
// Replaces the CEikButtonGroupContainer.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2856
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2857
void CMIDDisplayable::SetCba(CEikButtonGroupContainer* aCba)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2858
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2859
    DEBUG("+ CMIDDisplayable::SetCba");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2860
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2861
    ASSERT(aCba);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2862
    iCba = aCba;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2863
    iCba->DrawDeferred();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2864
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2865
    DEBUG("- CMIDDisplayable::SetCba");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2866
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2867
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2868
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2869
// Reset the status of all sks and commands so that no command is mapped to any sk
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2870
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2871
void CMIDDisplayable::ResetSoftKeysAndCommands(const RArray<CMIDCommandList*>& aLists)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2872
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2873
    TInt numSoftKeys = iSoftKeys.Count();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2874
    for (TInt i = 0; i < numSoftKeys; i++)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2875
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2876
        iSoftKeys[i]->Map(NULL);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2877
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2878
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2879
    TInt numLists = aLists.Count();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2880
    for (TInt j = 0; j < numLists; j++)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2881
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2882
        if (aLists[j])
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2883
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2884
            aLists[j]->UnMapCommands();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2885
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2886
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2887
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2888
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2889
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2890
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2891
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2892
TBool CMIDDisplayable::TryDetectLongTapL(const TPointerEvent& aPointerEvent)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2893
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2894
    //Following code disables the cancelling of long tap to be determined as a normal tap.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2895
    //Cancelling of long tap (up event during long tap animation) shouldn't do anything
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2896
    //else than cancel the animation.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2897
    if (iLongTapDetector->IsAnimationRunning() &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2898
            aPointerEvent.iType == TPointerEvent::EButton1Up)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2899
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2900
        iLongTapDetector->PointerEventL(aPointerEvent);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2901
        return ETrue;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2902
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2903
    // If there is a context menu available, forward events to long tap detector
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2904
#ifdef RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2905
    if (NumCommandsForOkOptionsMenu() > 0)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2906
#else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2907
    if (NumCommandsForOkOptionsMenu() > 1)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2908
#endif // RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2909
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2910
        iLongTapDetector->PointerEventL(aPointerEvent);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2911
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2912
    if (aPointerEvent.iType == TPointerEvent::EButton1Up && iLongTapDetected)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2913
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2914
        iLongTapDetected = EFalse;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2915
        return ETrue;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2916
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2917
    else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2918
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2919
        return EFalse;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2920
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2921
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2922
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2923
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2924
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2925
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2926
void CMIDDisplayable::HandleLongTapEventL(const TPoint& /*aPenEventLocation*/,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2927
        const TPoint& aPenEventScreenLocation)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2928
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2929
    // Long tap was detected -> show context menu. However, make sure that the
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2930
    // context sensitive menu is still there; it could be that the menu items
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2931
    // have been changed while waiting for the long tap event
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2932
    RArray<CEikMenuPaneItem::SData> menuItems; // the list of menu items
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2933
    menuItems.Reset();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2934
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2935
    if (iItemCommandList && iItemCommandList->Count() > 0)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2936
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2937
#ifdef RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2938
        PopulateMenuItemsWithListL(CMIDMenuHandler::EPopUpMenu, menuItems, iItemCommandList, EFalse);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2939
#else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2940
        PopulateMenuItemsWithListL(CMIDMenuHandler::EOkMenu, menuItems, iItemCommandList, EFalse);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2941
#endif // RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2942
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2943
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2944
    // Add form commands always
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2945
#ifdef RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2946
    PopulateMenuItemsWithListL(CMIDMenuHandler::EPopUpMenu, menuItems, iCommandList, EFalse);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2947
#else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2948
    PopulateMenuItemsWithListL(CMIDMenuHandler::EOkMenu, menuItems, iCommandList, EFalse);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2949
#endif // RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2950
#ifdef RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2951
    if (menuItems.Count() > 0)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2952
#else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2953
    if (menuItems.Count() > 1)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2954
#endif // RD_JAVA_S60_RELEASE_9_2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2955
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2956
        // recreate stylus popup menu because it does not have method
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2957
        // for clearing the menu items
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2958
        delete iStylusPopupMenu;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2959
        iStylusPopupMenu = NULL;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2960
        iStylusPopupMenu = CAknStylusPopUpMenu::NewL(this, aPenEventScreenLocation);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2961
        for (TInt i = 0; i < menuItems.Count(); i++)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2962
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2963
            iStylusPopupMenu->AddMenuItemL(menuItems[i].iText, menuItems[i].iCommandId);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2964
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2965
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2966
        iStylusPopupMenu->SetPosition(aPenEventScreenLocation);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2967
        iStylusPopupMenu->ShowMenu();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2968
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2969
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2970
    iLongTapDetected = ETrue;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2971
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2972
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2973
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2974
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2975
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2976
MAknsControlContext* CMIDDisplayable::BackGroundControlContext()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2977
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2978
    return iBackGroundControlContext;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2979
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2980
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2981
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2982
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2983
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2984
CMIDCommandList* CMIDDisplayable::MainCommandList() const
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2985
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2986
    return iCommandList;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2987
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2988
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2989
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2990
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2991
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2992
MMIDComponent* CMIDDisplayable::Component() const
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2993
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2994
    return iContent;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2995
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2996
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2997
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2998
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2999
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3000
TInt CMIDDisplayable::CommandCount()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3001
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3002
    return iCommandList->Count();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3003
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3004
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3005
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3006
// Returns a boolean indicating whether a non-null title has been set by
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3007
// calling the Displayable's SetTitle method.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3008
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3009
TBool CMIDDisplayable::HasTitle() const
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3010
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3011
    return iHasTitle;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3012
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3013
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3014
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3015
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3016
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3017
CMIDMenuHandler* CMIDDisplayable::MenuHandler() const
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3018
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3019
    return iMenuHandler;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3020
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3021
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3022
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3023
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3024
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3025
TBool CMIDDisplayable::IsActive() const
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3026
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3027
    return iActive;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3028
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3029
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3030
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3031
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3032
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3033
TTypeUid::Ptr CMIDDisplayable::MopSupplyObject(TTypeUid aId)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3034
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3035
    if (aId.iUid == MAknsControlContext::ETypeId && iBackGroundControlContext)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3036
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3037
        return MAknsControlContext::SupplyMopObject(aId, iBackGroundControlContext);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3038
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3039
    ASSERT(iMenuHandler);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3040
    return SupplyMopObject(aId, iMenuHandler->Cba(), iMenuHandler->MenuBar());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3041
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3042
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3043
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3044
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3045
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3046
void CMIDDisplayable::NotifyContentDestroyed()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3047
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3048
    iContent = NULL;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3049
    iContentControl = NULL;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3050
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3051
    iEnv.RemoveObserver(*this);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3052
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3053
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3054
/** Check virtual keyboard status. Only for touchscreen.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3055
  *  Returns a boolean variable:
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3056
  *  ETrue  - VKB is opened,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3057
  *  EFalse - VKB is hidden.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3058
 **/
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3059
#ifdef RD_TACTILE_FEEDBACK
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3060
TBool CMIDDisplayable::IsVKBOnScreen()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3061
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3062
    TBool vkbOpen = EFalse;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3063
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3064
    if (!iPenInputServerConnected && AknLayoutUtils::PenEnabled())
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3065
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3066
        TInt err = iPenInputServer.Connect();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3067
        iPenInputServerConnected = (err == KErrNone);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3068
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3069
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3070
    if (iPenInputServerConnected)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3071
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3072
        if (iPenInputServer.IsVisible())
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3073
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3074
            vkbOpen = ETrue;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3075
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3076
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3077
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3078
    return vkbOpen;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3079
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3080
#endif //RD_TACTILE_FEEDBACK
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3081
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3082
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3083
#ifdef RD_SCALABLE_UI_V2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3084
TUint CMIDDisplayable::OnScreenKeypadL()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3085
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3086
    DEBUG("+ CMIDDisplayable::OnScreenKeypadL");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3087
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3088
    if (RProcess().SecureId().iId != 0x102033E6)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3089
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3090
        // For standalone type apps we don't show keypad.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3091
        return EOnScreenKeypadValueNo;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3092
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3093
    TUint onScreenKeypadValue = EOnScreenKeypadValueUndefined;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3094
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3095
    std::auto_ptr<java::storage::JavaStorage> js(java::storage::JavaStorage::createInstance());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3096
    java::storage::JavaStorageApplicationEntry_t entries;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3097
    try
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3098
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3099
        js->open();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3100
        java::util::Uid uid;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3101
        TUidToUid(iEnv.MidletSuiteUid(), uid);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3102
        js->read(java::storage::MIDP_PACKAGE_TABLE, uid, entries);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3103
        js->close();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3104
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3105
    catch (java::storage::JavaStorageException& ex)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3106
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3107
        DEBUG_INT("CMIDCanvas::IsNetworkIndicatorEnabledL: JavaStorage error: \
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3108
            reading MIDP_PACKAGE_TABLE failed, error code = %D", ex.mStatus);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3109
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3110
    java::storage::JavaStorageEntry attribute;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3111
    attribute.setEntry(java::storage::ON_SCREEN_KEYPAD, L"");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3112
    java::storage::JavaStorageApplicationEntry_t::const_iterator findIterator = entries.find(attribute);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3113
    std::wstring res = L"";
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3114
    if (findIterator != entries.end())
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3115
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3116
        res = (*findIterator).entryValue();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3117
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3118
    entries.clear();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3119
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3120
    if (res == L"0")
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3121
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3122
        onScreenKeypadValue = EOnScreenKeypadValueNo;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3123
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3124
    else if (res == L"1")
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3125
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3126
        onScreenKeypadValue = EOnScreenKeypadValueGameActions;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3127
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3128
    else if (res == L"2")
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3129
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3130
        onScreenKeypadValue = EOnScreenKeypadValueNavigationKeys;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3131
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3132
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3133
    DEBUG("- CMIDDisplayable::OnScreenKeypadL");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3134
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3135
    return onScreenKeypadValue;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3136
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3137
#endif // RD_SCALABLE_UI_V2
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3138
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3139
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3140
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3141
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3142
void CMIDDisplayable::SetEmphasis(CCoeControl* /*aMenuControl*/,TBool /*aEmphasis*/)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3143
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3144
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3145
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3146
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3147
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3148
// Adds a rectangle to be excluded from redrawing (for DSA)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3149
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3150
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3151
void CMIDDisplayable::AddDirectContentArea(const TRect& aRect)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3152
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3153
    TDirectContentsRect rect(aRect);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3154
    TInt index = iDirectContentsRects.Find(
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3155
                     rect, TIdentityRelation< TDirectContentsRect >(CMIDDisplayable::MatchDirectContentsRects));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3156
    if (index == KErrNotFound)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3157
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3158
        TInt err = iDirectContentsRects.Append(rect);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3159
        if (KErrNone == err)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3160
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3161
            UpdateDirectContentsRegion();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3162
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3163
        else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3164
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3165
            DEBUG_INT("CMIDDisplayable::AddDirectContentArea - RArray append error %d", err);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3166
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3167
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3168
    else
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3169
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3170
        iDirectContentsRects[ index ].iRefCount++;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3171
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3172
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3173
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3174
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3175
// Removes a rectangle to be excluded from redrawing (for DSA)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3176
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3177
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3178
void CMIDDisplayable::RemoveDirectContentArea(const TRect& aRect)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3179
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3180
    TDirectContentsRect rect(aRect);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3181
    TInt index = iDirectContentsRects.Find(
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3182
                     rect, TIdentityRelation< TDirectContentsRect >(CMIDDisplayable::MatchDirectContentsRects));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3183
    if (index != KErrNotFound)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3184
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3185
        iDirectContentsRects[ index ].iRefCount--;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3186
        if (iDirectContentsRects[ index ].iRefCount <= 0)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3187
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3188
            iDirectContentsRects.Remove(index);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3189
            UpdateDirectContentsRegion();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3190
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3191
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3192
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3193
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3194
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3195
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3196
// Matches two direct content rectangles and returns the result
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3197
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3198
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3199
TBool CMIDDisplayable::MatchDirectContentsRects
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3200
(
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3201
    const TDirectContentsRect& aLhs,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3202
    const TDirectContentsRect& aRhs
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3203
)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3204
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3205
    return (aLhs.iRect == aRhs.iRect);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3206
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3207
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3208
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3209
// Update the direct content regions
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3210
// This should be called just after addition or removal of dc rectangle
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3211
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3212
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3213
void CMIDDisplayable::UpdateDirectContentsRegion()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3214
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3215
    iDirectContentsRegion.Clear();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3216
    TInt count = iDirectContentsRects.Count();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3217
    for (int index = 0; index < count; index++)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3218
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3219
        iDirectContentsRegion.AddRect(iDirectContentsRects[ index ].iRect);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3220
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3221
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3222
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3223
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3224
TBool CMIDDisplayable::NoDirectContentAreaDefined()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3225
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3226
    return iDirectContentsRegion.IsEmpty();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3227
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3228
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3229
void CMIDDisplayable::SetPopupTextBox(TBool aPopup)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3230
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3231
    iIsPopupTextBox = aPopup;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3232
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3233
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3234
TBool CMIDDisplayable::IsPopupTextBox()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3235
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3236
    return iIsPopupTextBox;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3237
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3238
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3239
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3240
// Gets the location and anchor for all the softkey buttons
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3241
// for fullscreen canvas and stores it for later usage.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3242
// The data have to marked as invalid in iFullscreenCanvasLabelCacheIsValid
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3243
// if any resolution / skin change is proceeding.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3244
// ---------------------------------------------------------------------------
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3245
//
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3246
void CMIDDisplayable::RenewFullscreenCanvasLabelCacheL()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3247
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3248
    DEBUG("+ CMIDDisplayable::RenewFullscreenCanvasLabelCacheL");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3249
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3250
    if ((iCba)   &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3251
            (!iFullscreenCanvasLabelCacheIsValid) &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3252
            (iCommandList))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3253
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3254
        TPoint move(0, 0);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3255
        if (iUseOnScreenKeypad)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3256
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3257
            // SK location have to be moved when OnScreenKeypad is active
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3258
            TSize diff(iDisplayableRect.Size() -
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3259
                       iAppUi->ApplicationRect().Size());
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3260
            move = diff.AsPoint();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3261
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3262
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3263
        for (TInt softKeyId = 0; softKeyId < KSoftKeyLabelPropertyNumberOfSoftKeys; softKeyId++)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3264
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3265
            iFullscreenCanvasLabelCache[softKeyId].iIsOn = EFalse;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3266
            TBool SKVisibility = true;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3267
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3268
            // Check if the MSK is used in Avkon
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3269
            if (softKeyId == KSoftKeyLabelPropertyPositionsMSKIndex)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3270
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3271
                TBool MSKEnabledInPlatform;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3272
                CRepository* cenRep = NULL;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3273
                TRAPD(err, cenRep = CRepository::NewL(KCRUidAvkon));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3274
                if (!err)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3275
                {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3276
                    err = cenRep->Get(KAknMiddleSoftkeyEnabled, MSKEnabledInPlatform);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3277
                    delete cenRep;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3278
                }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3279
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3280
                // Check the cases, in which the MSK is off
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3281
                if (!AknLayoutUtils::MSKEnabled() || !MSKEnabledInPlatform ||
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3282
                        !Layout_Meta_Data::IsMSKEnabled() ||
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3283
                        Layout_Meta_Data::IsLandscapeOrientation())
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3284
                {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3285
                    SKVisibility = false;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3286
                }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3287
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3288
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3289
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3290
            if (SKVisibility)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3291
            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3292
                iCba->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3293
                TInt softKeyCbaPosition = KSoftKeyLabelPropertyPositionsInCBA[ softKeyId ];
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3294
                iCba->SetCommandL(softKeyCbaPosition, R_MIDP_SOFTKEY_OPTIONS);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3295
                TInt cmdId = EAknSoftkeyOptions;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3296
                TInt position = iCba->PositionById(cmdId);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3297
                if ((position == softKeyCbaPosition) && iCba->IsCommandVisible(cmdId))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3298
                {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3299
                    CEikCommandButton *cmdButton = (CEikCommandButton*)iCba->ControlOrNull(cmdId);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3300
                    if (cmdButton && cmdButton->IsVisible()  && !iCba->IsCommandDimmed(cmdId))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3301
                    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3302
                        CEikLabel *label = (CEikLabel*)cmdButton->ComponentControl(0);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3303
                        if (label && label->IsVisible())
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3304
                        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3305
                            iFullscreenCanvasLabelCache[softKeyId].iPosition
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3306
                            = label->PositionRelativeToScreen() + move;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3307
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3308
                            iFullscreenCanvasLabelCache[softKeyId].iSize = label->Size();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3309
                            TGulAlignment align = label->iAlignment;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3310
                            TGulHAlignment hAlign = align.HAlignment();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3311
                            switch (hAlign)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3312
                            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3313
                            case EHLeft:
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3314
                                iFullscreenCanvasLabelCache[softKeyId].iAnchor = TSoftkeyLabel::EJavaLeft;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3315
                                break;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3316
                            case EHCenter:
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3317
                                iFullscreenCanvasLabelCache[softKeyId].iAnchor = TSoftkeyLabel::EJavaHCenter;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3318
                                break;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3319
                            case EHRight:
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3320
                                iFullscreenCanvasLabelCache[softKeyId].iAnchor = TSoftkeyLabel::EJavaRight;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3321
                                break;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3322
                            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3323
                            TGulVAlignment vAlign = align.VAlignment();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3324
                            switch (vAlign)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3325
                            {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3326
                            case EVTop:
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3327
                                iFullscreenCanvasLabelCache[softKeyId].iAnchor |= TSoftkeyLabel::EJavaTop;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3328
                                break;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3329
                            case EVCenter:
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3330
                                iFullscreenCanvasLabelCache[softKeyId].iAnchor |= TSoftkeyLabel::EJavaVCenter;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3331
                                break;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3332
                            case EVBottom:
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3333
                                iFullscreenCanvasLabelCache[softKeyId].iAnchor |= TSoftkeyLabel::EJavaBottom;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3334
                                break;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3335
                            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3336
                            iFullscreenCanvasLabelCache[softKeyId].iIsOn = ETrue;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3337
                        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3338
                    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3339
                }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3340
            }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3341
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3342
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3343
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3344
    iFullscreenCanvasLabelCacheIsValid = ETrue;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3345
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3346
    DEBUG("- CMIDDisplayable::RenewFullscreenCanvasLabelCacheL");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3347
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3348
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3349
void CMIDDisplayable::HandleCanvasForeground(TBool aForeground)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3350
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3351
    CMIDCanvas* canvas = GetContentCanvas();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3352
    if (canvas)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3353
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3354
        canvas->HandleForeground(aForeground);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3355
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3356
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3357
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3358
void CMIDDisplayable::HandleApplicationBackground()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3359
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3360
    // If iCanvasKeypad exists, it notifies On-Screen Keypad
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3361
    // about current application focus lost.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3362
    if (iCanvasKeypad)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3363
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3364
        iCanvasKeypad->HandleApplicationBackground();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3365
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3366
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3367
    HandleCanvasForeground(EFalse);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3368
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3369
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3370
void CMIDDisplayable::ProcessMSKCommandL()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3371
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3372
    if (iIdOfMSKCommand != KErrNotFound)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3373
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3374
        ProcessCommandL(iIdOfMSKCommand);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3375
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3376
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3377
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3378
void CMIDDisplayable::DisplayableBehindPopupIsDestroyed()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3379
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3380
    // Old fullscreen Displayable is destroyed.
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3381
    iDisplayableBehindPopup = NULL;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3382
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3383
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3384
void CMIDDisplayable::HideIndicator(CEikStatusPane* aSp, TInt aId)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3385
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3386
    TUid uid = TUid::Uid(aId);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3387
    CEikStatusPaneBase::TPaneCapabilities subPane = aSp->PaneCapabilities(uid);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3388
    if (subPane.IsPresent() && subPane.IsAppOwned())
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3389
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3390
        CCoeControl* ctrl = NULL;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3391
        TRAP_IGNORE(ctrl = aSp->ControlL(uid));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3392
        if (ctrl)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3393
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3394
            ctrl->MakeVisible(EFalse);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3395
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3396
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3397
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3398
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3399
void CMIDDisplayable::HideIndicators()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3400
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3401
    CEikStatusPane* pane = iAppUi->StatusPane();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3402
    if (!pane)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3403
        return;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3404
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3405
    HideIndicator(pane, EEikStatusPaneUidSignal);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3406
    HideIndicator(pane, EEikStatusPaneUidBattery);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3407
    HideIndicator(pane, EEikStatusPaneUidIndic);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3408
    HideIndicator(pane, EEikStatusPaneUidMessage);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3409
    HideIndicator(pane, EEikStatusPaneUidClock);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3410
    HideIndicator(pane, EEikStatusPaneUidDigitalClock);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3411
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3412
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3413
CMIDCanvas* CMIDDisplayable::GetContentCanvas()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3414
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3415
    CMIDCanvas* ret = NULL;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3416
    if (iContent && iContentControl &&
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3417
            (iContent->Type() == MMIDComponent::ECanvas ||
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3418
             iContent->Type() == MMIDComponent::EGameCanvas))
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3419
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3420
        ret = static_cast<CMIDCanvas*>(iContentControl);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3421
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3422
    return ret;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3423
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3424
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3425
CPropertyWatch* CPropertyWatch::NewL(MMIDDisplayable* aDisplayable)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3426
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3427
    DEBUG("+ CPropertyWatch::NewL");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3428
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3429
    CPropertyWatch* self = new(ELeave) CPropertyWatch;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3430
    CleanupStack::PushL(self);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3431
    self->ConstructL(aDisplayable);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3432
    CleanupStack::Pop(self);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3433
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3434
    DEBUG("- CPropertyWatch::NewL");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3435
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3436
    return self;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3437
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3438
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3439
void CMIDDisplayable::FixOrientation()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3440
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3441
    TBool tmpRestoreOrientation;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3442
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3443
    if (!iAvkonAppUi)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3444
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3445
        return;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3446
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3447
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3448
    iOldUiOrientation = iAvkonAppUi->Orientation();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3449
    tmpRestoreOrientation = (iOldUiOrientation == CAknAppUiBase::EAppUiOrientationUnspecified) ? ETrue : EFalse;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3450
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3451
    // Fix the orientation when was set to unspecified only
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3452
    if (tmpRestoreOrientation)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3453
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3454
        TRAP_IGNORE(iAvkonAppUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationLandscape));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3455
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3456
        iRestoreOrientation = ETrue;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3457
        ++iReleaseCnt;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3458
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3459
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3460
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3461
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3462
void CMIDDisplayable::ReleaseOrientation()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3463
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3464
    if (!iAvkonAppUi)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3465
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3466
        return;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3467
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3468
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3469
    if (iReleaseCnt > 0)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3470
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3471
        --iReleaseCnt;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3472
        if (iReleaseCnt == 0 && iRestoreOrientation)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3473
        {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3474
            TRAP_IGNORE(iAvkonAppUi->SetOrientationL(iOldUiOrientation));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3475
            iRestoreOrientation = EFalse;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3476
        }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3477
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3478
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3479
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3480
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3481
CPropertyWatch::CPropertyWatch()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3482
        : CActive(0)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3483
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3484
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3485
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3486
void CPropertyWatch::ConstructL(MMIDDisplayable* aDisplayable)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3487
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3488
    DEBUG("+ CPropertyWatch::ConstructL");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3489
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3490
    iDisplayable = static_cast< CMIDDisplayable* >(aDisplayable);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3491
    User::LeaveIfError(iProperty.Attach(KCRUidAvkon, KAknKeyBoardLayout));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3492
    CActiveScheduler::Add(this);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3493
    iDelayTimer = CPeriodic::NewL(CActive::EPriorityStandard);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3494
    RunL();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3495
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3496
    DEBUG("- CPropertyWatch::ConstructL");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3497
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3498
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3499
CPropertyWatch::~CPropertyWatch()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3500
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3501
    DEBUG("+ CPropertyWatch::~CPropertyWatch");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3502
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3503
    Cancel();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3504
    iProperty.Close();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3505
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3506
    if (iDelayTimer)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3507
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3508
        iDelayTimer->Cancel();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3509
        delete iDelayTimer;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3510
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3511
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3512
    DEBUG("- CPropertyWatch::~CPropertyWatch");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3513
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3514
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3515
void CPropertyWatch::DoCancel()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3516
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3517
    iProperty.Cancel();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3518
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3519
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3520
void CPropertyWatch::HandleDelayTimerEventL()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3521
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3522
    iDelayTimer->Cancel();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3523
    if (Layout_Meta_Data::IsLandscapeOrientation())
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3524
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3525
        iDisplayable->HandleOnScreenKeypadVisual();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3526
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3527
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3528
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3529
TInt CPropertyWatch::DelayTimerCallbackL(TAny* aThis)
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3530
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3531
    CPropertyWatch* observer = static_cast<CPropertyWatch*>(aThis);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3532
    observer->HandleDelayTimerEventL();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3533
    return 0;
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3534
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3535
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3536
void CPropertyWatch::RunL()
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3537
{
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3538
    DEBUG("+ CPropertyWatch::RunL");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3539
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3540
    //Resubscribe before processing new value to prevent missing updates
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3541
    iProperty.Subscribe(iStatus);
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3542
    SetActive();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3543
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3544
    if (Layout_Meta_Data::IsLandscapeOrientation())
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3545
    {
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3546
        iDelayTimer->Cancel();
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3547
        iDelayTimer->Start(KTimerDelayValue, KTimerDelayValue,
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3548
                           TCallBack(DelayTimerCallbackL, this));
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3549
    }
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3550
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3551
    DEBUG("- CPropertyWatch::RunL");
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3552
}
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3553
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3554
2455ef1f5bbc Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  3555
// End of File