uifw/AvKon/src/aknnotecontrol.cpp
branchRCL_3
changeset 4 8ca85d2f0db7
parent 0 2f259fa3e83a
child 51 fcdfafb36fe7
equal deleted inserted replaced
0:2f259fa3e83a 4:8ca85d2f0db7
    47 #include <eikdialg.h>
    47 #include <eikdialg.h>
    48 #include <eikdialogext.h>
    48 #include <eikdialogext.h>
    49 #include <touchfeedback.h>
    49 #include <touchfeedback.h>
    50 
    50 
    51 #include <AknTasHook.h> // for testability hooks
    51 #include <AknTasHook.h> // for testability hooks
       
    52 
       
    53 #include "akntrace.h"
    52 const TInt KRate = 95;    // 95% similar rate
    54 const TInt KRate = 95;    // 95% similar rate
    53 const TInt KFullColor = 255;
    55 const TInt KFullColor = 255;
    54 
    56 
    55 // ---------------------------------------------
    57 // ---------------------------------------------
    56 // CONSTRUCTION - DESTRUCTION
    58 // CONSTRUCTION - DESTRUCTION
    71  *
    73  *
    72  * 
    74  * 
    73  */
    75  */
    74 EXPORT_C CAknNoteControl::~CAknNoteControl()
    76 EXPORT_C CAknNoteControl::~CAknNoteControl()
    75     {
    77     {
       
    78     _AKNTRACE_FUNC_ENTER;
    76     AKNTASHOOK_REMOVE();
    79     AKNTASHOOK_REMOVE();
    77     MTouchFeedback* feedback = MTouchFeedback::Instance();
    80     MTouchFeedback* feedback = MTouchFeedback::Instance();
    78     if ( feedback )
    81     if ( feedback )
    79         {
    82         {
    80         feedback->RemoveFeedbackForControl( this );
    83         feedback->RemoveFeedbackForControl( this );
    81         }
    84         }
    82 
    85 
    83     delete iAttributes;
    86     delete iAttributes;
    84     delete iLineWidths;
    87     delete iLineWidths;
       
    88     _AKNTRACE_FUNC_EXIT;
    85     }
    89     }
    86 
    90 
    87 void CAknNoteControl::ConstructFromResourceL(TResourceReader &aRes)
    91 void CAknNoteControl::ConstructFromResourceL(TResourceReader &aRes)
    88     {
    92     {
    89     
    93     
   126 
   130 
   127 // -----------------------------------------
   131 // -----------------------------------------
   128 //  CCOECONTROL METHODS
   132 //  CCOECONTROL METHODS
   129 // -----------------------------------------
   133 // -----------------------------------------
   130 void CAknNoteControl::Draw(const TRect& /*aRect*/) const
   134 void CAknNoteControl::Draw(const TRect& /*aRect*/) const
   131     {   
   135     {
       
   136     _AKNTRACE_FUNC_ENTER;
   132     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
   137     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
   133 
   138 
   134     MAknsControlContext* cc = iAttributes->iBgContext;
   139     MAknsControlContext* cc = iAttributes->iBgContext;
   135     
   140     
   136 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS
   141 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS
   185     }
   190     }
   186     if (iImageHasShadow)
   191     if (iImageHasShadow)
   187         {
   192         {
   188         iShadowRect.DrawRect( gc );
   193         iShadowRect.DrawRect( gc );
   189         }   
   194         }   
       
   195     _AKNTRACE_FUNC_EXIT;
   190     }
   196     }
   191     
   197     
   192 EXPORT_C void CAknNoteControl::HandlePointerEventL(const TPointerEvent& aPointerEvent) 
   198 EXPORT_C void CAknNoteControl::HandlePointerEventL(const TPointerEvent& aPointerEvent) 
   193     { 
   199     { 
   194     CAknControl::HandlePointerEventL(aPointerEvent); 
   200     CAknControl::HandlePointerEventL(aPointerEvent); 
   275  * Do not call this method when you need to do layout for reasons
   281  * Do not call this method when you need to do layout for reasons
   276  * different than the size or position of the control changing.
   282  * different than the size or position of the control changing.
   277  * Call Layout instead.
   283  * Call Layout instead.
   278  */
   284  */
   279 void CAknNoteControl::SizeChanged()
   285 void CAknNoteControl::SizeChanged()
   280     {  
   286     {
       
   287     _AKNTRACE_FUNC_ENTER;
   281     DoLayout();
   288     DoLayout();
       
   289     _AKNTRACE_FUNC_EXIT;
   282     }
   290     }
   283 
   291 
   284 /** 
   292 /** 
   285  * Code shared between SizeChanged() and Layout().
   293  * Code shared between SizeChanged() and Layout().
   286  *
   294  *
   287  */
   295  */
   288 void CAknNoteControl::DoLayout()
   296 void CAknNoteControl::DoLayout()
   289     {
   297     {
       
   298     _AKNTRACE_FUNC_ENTER;
       
   299     _AKNTRACE("iNoteLayout = %d", iNoteLayout);
   290     TextControl()->SetRect(LayoutRect());
   300     TextControl()->SetRect(LayoutRect());
   291     switch(iNoteLayout)
   301     switch(iNoteLayout)
   292         {
   302         {
   293     case EGeneralLayout:
   303     case EGeneralLayout:
   294         GeneralNoteLayout();
   304         GeneralNoteLayout();
   331                                ETouchFeedbackVibra );
   341                                ETouchFeedbackVibra );
   332             feedback->SetFeedbackArea( this, 0, Rect(), spec );
   342             feedback->SetFeedbackArea( this, 0, Rect(), spec );
   333             delete spec;
   343             delete spec;
   334             }
   344             }
   335         }
   345         }
       
   346     _AKNTRACE_FUNC_EXIT;
   336     }
   347     }
   337 
   348 
   338 /**
   349 /**
   339  *
   350  *
   340  * This is used by a dialog to layout the control correctly.
   351  * This is used by a dialog to layout the control correctly.
   341  *
   352  *
   342  */
   353  */
   343 void CAknNoteControl::WindowLayout( TAknWindowLineLayout& aLayout ) const
   354 void CAknNoteControl::WindowLayout( TAknWindowLineLayout& aLayout ) const
   344     {
   355     {
       
   356     _AKNTRACE_FUNC_ENTER;
       
   357     _AKNTRACE("iNoteLayout = %d", iNoteLayout);
   345     TIndex laf(NumberOfLines());
   358     TIndex laf(NumberOfLines());
   346     AknLayoutUtils::TAknCbaLocation cbaLocation( AknLayoutUtils::CbaLocation() );
   359     AknLayoutUtils::TAknCbaLocation cbaLocation( AknLayoutUtils::CbaLocation() );
   347     TInt variety( 0 );
   360     TInt variety( 0 );
   348     
   361     
   349     switch(iNoteLayout)
   362     switch(iNoteLayout)
   434             
   447             
   435             aLayout = AknLayoutScalable_Avkon::popup_note_window( variety +
   448             aLayout = AknLayoutScalable_Avkon::popup_note_window( variety +
   436                 laf.PopupNoteWindow() );
   449                 laf.PopupNoteWindow() );
   437             break;
   450             break;
   438         }
   451         }
       
   452     _AKNTRACE_FUNC_EXIT;
   439     }
   453     }
   440 
   454 
   441 /**
   455 /**
   442  * Return the note height 
   456  * Return the note height 
   443  *
   457  *
  1180  * The dialog will not be resized. 
  1194  * The dialog will not be resized. 
  1181  *
  1195  *
  1182  */
  1196  */
  1183 EXPORT_C void CAknNoteControl::SetTextL(const TDesC& aText, TInt aLineNum)
  1197 EXPORT_C void CAknNoteControl::SetTextL(const TDesC& aText, TInt aLineNum)
  1184     {
  1198     {
       
  1199     _AKNTRACE_FUNC_ENTER;
  1185     TAknLayoutText textRect;
  1200     TAknLayoutText textRect;
  1186     
  1201     _AKNTRACE(_L("SetTextL = %S"), &aText);
  1187     if ( iNoteLayout == ENotificationWithGraphicsLayout || iNoteLayout == ETextualNotificationLayout )
  1202     if ( iNoteLayout == ENotificationWithGraphicsLayout || iNoteLayout == ETextualNotificationLayout )
  1188         {
  1203         {
  1189         textRect.LayoutText(LayoutRect(), AKN_LAYOUT_TEXT_Notification_pop_up_window_texts__text__Line_1(1));
  1204         textRect.LayoutText(LayoutRect(), AKN_LAYOUT_TEXT_Notification_pop_up_window_texts__text__Line_1(1));
  1190         }
  1205         }
  1191     else 
  1206     else 
  1195     
  1210     
  1196     const CFont *font = textRect.Font();    
  1211     const CFont *font = textRect.Font();    
  1197 
  1212 
  1198     Attributes()->SetTextL(aText, aLineNum, font, iLineWidths);
  1213     Attributes()->SetTextL(aText, aLineNum, font, iLineWidths);
  1199     Layout();
  1214     Layout();
       
  1215     _AKNTRACE_FUNC_EXIT;
  1200     }
  1216     }
  1201 
  1217 
  1202 /**
  1218 /**
  1203  * Set the number inside the note text. The text must have been 
  1219  * Set the number inside the note text. The text must have been 
  1204  * previously set via resource or via SetTextL and must have a
  1220  * previously set via resource or via SetTextL and must have a