uifw/EikStd/coctlsrc/eiktxlbx.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 			  
       
    19 #include <e32base.h>
       
    20 #include <e32keys.h>
       
    21 
       
    22 #include <bamatch.h>
       
    23 #include <badesca.h>
       
    24 #include <barsread.h>
       
    25 
       
    26 #include <eiktxlbx.h>
       
    27 #include <eiklbv.h>
       
    28 #include <eiklbi.h>
       
    29 #include <eiktxlbm.h>
       
    30 #include <eikenv.h>
       
    31 #include <eikpanic.h>
       
    32 #include <w32std.h> 
       
    33 #include "laflbx.h"
       
    34 #include "laftxlbx.h"
       
    35 #include "akntrace.h"
       
    36 
       
    37 EXPORT_C CEikTextListBox::CEikTextListBox()
       
    38     {
       
    39     }
       
    40 
       
    41 EXPORT_C CEikTextListBox::~CEikTextListBox()
       
    42     {
       
    43     }
       
    44 
       
    45 EXPORT_C void CEikTextListBox::CreateItemDrawerL()
       
    46 	{
       
    47 	_AKNTRACE_FUNC_ENTER;
       
    48 	const CFont* font=LafTextListBox::Font(iEikonEnv->LafEnv());
       
    49 	iItemDrawer = new(ELeave) CTextListItemDrawer((CTextListBoxModel*)iModel,font);
       
    50 	_AKNTRACE_FUNC_EXIT;
       
    51 	}
       
    52 
       
    53 EXPORT_C void CEikTextListBox::ConstructFromResourceL(TResourceReader& aReader)
       
    54     {
       
    55     _AKNTRACE_FUNC_ENTER;
       
    56 	RestoreCommonListBoxPropertiesL(aReader);
       
    57 	iRequiredCellCharWidth = aReader.ReadInt16();
       
    58 
       
    59     TInt array_id = aReader.ReadInt32();
       
    60     if (array_id)
       
    61 		{
       
    62 		CDesCArray* desArray = iCoeEnv->ReadDesCArrayResourceL(array_id);
       
    63 		CleanupStack::PushL(desArray);
       
    64 		iModel = new(ELeave) CTextListBoxModel;
       
    65 		((CTextListBoxModel*)iModel)->ConstructL(desArray);
       
    66 		CleanupStack::Pop();
       
    67 		}
       
    68 	else
       
    69 		{
       
    70 		iModel = new(ELeave) CTextListBoxModel;
       
    71 		((CTextListBoxModel*)iModel)->ConstructL();
       
    72 		}
       
    73 	CreateItemDrawerL();
       
    74 	((CTextListItemDrawer*)iItemDrawer)->SetCellWidthInChars(iRequiredCellCharWidth);
       
    75 	CreateViewL();
       
    76 	UpdateViewColors();
       
    77 	UpdateItemDrawerColors();
       
    78 	_AKNTRACE_FUNC_EXIT;
       
    79     }
       
    80 
       
    81 EXPORT_C void CEikTextListBox::ConstructL(const CCoeControl* aParent, TInt aFlags)
       
    82 	{
       
    83 	_AKNTRACE_FUNC_ENTER;
       
    84 	iModel = new(ELeave) CTextListBoxModel;
       
    85 	((CTextListBoxModel*)iModel)->ConstructL();
       
    86 	CreateItemDrawerL();
       
    87 	CEikListBox::ConstructL(aParent,aFlags);
       
    88 	_AKNTRACE_FUNC_EXIT;
       
    89 	}
       
    90 
       
    91 /**
       
    92  * Writes the internal state of the control and its components to aStream.
       
    93  * Does nothing in release mode.
       
    94  * Designed to be overidden and base called by subclasses.
       
    95  *
       
    96  * @internal
       
    97  * @since App-Framework_6.1
       
    98  */
       
    99 #ifndef _DEBUG
       
   100 EXPORT_C void CEikTextListBox::WriteInternalStateL(RWriteStream&) const
       
   101 	{}
       
   102 #else
       
   103 EXPORT_C void CEikTextListBox::WriteInternalStateL(RWriteStream& aWriteStream) const
       
   104 	{
       
   105 	_LIT(KLitEikTxLbxCtlStart, "<CEikTextListBox>");
       
   106 	_LIT(KLitEikTxLbxCtlEnd, "<\\CEikTextListBox>");
       
   107 	_LIT(KLitEikTxLbxReqWdth,"<iRequiredCellCharWidth>");
       
   108 	_LIT(KLitEikTxLbxReqWdthEnd,"<\\iRequiredCellCharWidth>");
       
   109 
       
   110 	aWriteStream << KLitEikTxLbxCtlStart;
       
   111 	aWriteStream << KLitEikTxLbxReqWdth;
       
   112 	aWriteStream.WriteInt32L(iRequiredCellCharWidth);
       
   113 	aWriteStream << KLitEikTxLbxReqWdthEnd;
       
   114 	CEikListBox::WriteInternalStateL(aWriteStream);
       
   115 	aWriteStream << KLitEikTxLbxCtlEnd;
       
   116 	}
       
   117 #endif
       
   118 
       
   119 EXPORT_C CTextListBoxModel* CEikTextListBox::Model() const
       
   120 	{
       
   121 	return (CTextListBoxModel*) iModel;
       
   122 	}
       
   123 
       
   124 /**
       
   125  * Gets the list of logical colors employed in the drawing of the control,
       
   126  * paired with an explanation of how they are used. Appends the list to aColorUseList.
       
   127  *
       
   128  * @since ER5U 
       
   129  */
       
   130 EXPORT_C void CEikTextListBox::GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const
       
   131 	{
       
   132 	CEikListBox::GetColorUseListL(aColorUseList);
       
   133 	}
       
   134 
       
   135 /**
       
   136  * Handles a change to the control's resources of type aType
       
   137  * which are shared across the environment, e.g. colors or fonts.
       
   138  *
       
   139  * @since ER5U 
       
   140  */
       
   141 EXPORT_C void CEikTextListBox::HandleResourceChange(TInt aType)
       
   142 	{
       
   143 	CEikListBox::HandleResourceChange(aType);
       
   144 	}
       
   145 
       
   146 EXPORT_C void CEikTextListBox::HandlePointerEventL(const TPointerEvent& aPointerEvent) 
       
   147     { 
       
   148     CEikListBox::HandlePointerEventL(aPointerEvent); 
       
   149     }
       
   150 
       
   151 EXPORT_C void* CEikTextListBox::ExtensionInterface( TUid /*aInterface*/ )
       
   152     {
       
   153     return NULL;
       
   154     }
       
   155 
       
   156 EXPORT_C void CEikTextListBox::CEikListBox_Reserved()
       
   157 	{}
       
   158 
       
   159 //
       
   160 // class CEikSnakingTextListBox
       
   161 //
       
   162 
       
   163 EXPORT_C CEikSnakingTextListBox::CEikSnakingTextListBox()
       
   164     {
       
   165     }
       
   166 
       
   167 EXPORT_C CEikSnakingTextListBox::~CEikSnakingTextListBox()
       
   168     {
       
   169     }
       
   170 
       
   171 EXPORT_C void CEikSnakingTextListBox::ConstructL(const CCoeControl* aParent, TInt aFlags)
       
   172 	{
       
   173 	_AKNTRACE_FUNC_ENTER;
       
   174 	iModel = new(ELeave) CTextListBoxModel;
       
   175 	((CTextListBoxModel*)iModel)->ConstructL();
       
   176 	const CFont* font=LafSnakingTextListBox::Font(iEikonEnv->LafEnv());
       
   177 	iItemDrawer = new(ELeave) CTextListItemDrawer((CTextListBoxModel*)iModel, font);
       
   178 	CEikListBox::ConstructL(aParent, aFlags);
       
   179 	_AKNTRACE_FUNC_EXIT;
       
   180 	}
       
   181 
       
   182 EXPORT_C CTextListBoxModel* CEikSnakingTextListBox::Model() const
       
   183 	{
       
   184 	return (CTextListBoxModel*) iModel;
       
   185 	}
       
   186 
       
   187 /**
       
   188  * Gets the list of logical colors employed in the drawing of the control,
       
   189  * paired with an explanation of how they are used. Appends the list to aColorUseList.
       
   190  *
       
   191  * @since ER5U 
       
   192  */
       
   193 EXPORT_C void CEikSnakingTextListBox::GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const
       
   194 	{
       
   195 	CEikSnakingListBox::GetColorUseListL(aColorUseList);
       
   196 	}
       
   197 
       
   198 /**
       
   199  * Handles a change to the control's resources of type aType
       
   200  * which are shared across the environment, e.g. colors or fonts.
       
   201  *
       
   202  * @since ER5U 
       
   203  */
       
   204 EXPORT_C void CEikSnakingTextListBox::HandleResourceChange(TInt aType)
       
   205 	{
       
   206 	CEikSnakingListBox::HandleResourceChange(aType);
       
   207 	}
       
   208 
       
   209 EXPORT_C void CEikSnakingTextListBox::HandlePointerEventL(const TPointerEvent& aPointerEvent) 
       
   210     { 
       
   211     CEikSnakingListBox::HandlePointerEventL(aPointerEvent); 
       
   212     }
       
   213 
       
   214 EXPORT_C void* CEikSnakingTextListBox::ExtensionInterface( TUid /*aInterface*/ )
       
   215     {
       
   216     return NULL;
       
   217     }