meetingrequest/mrgui/inc/cesmrlayoutmgr.h
branchRCL_3
changeset 12 4ce476e64c59
parent 11 0396474f30f5
child 13 8592a65ad3fb
equal deleted inserted replaced
11:0396474f30f5 12:4ce476e64c59
     1 /*
       
     2 * Copyright (c) 2007-2009 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:  ESMR checkbox component for es mr gui (editor)
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CESMRLAYOUTMGR_H
       
    20 #define CESMRLAYOUTMGR_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <fbs.h>
       
    24 //<cmail>
       
    25 #include "esmrdef.h"
       
    26 //</cmail>
       
    27 #include <layoutmetadata.cdl.h>
       
    28 #include <cenrepnotifyhandler.h>
       
    29 
       
    30 class CFont;
       
    31 class CCoeEnv;
       
    32 class TMargins;
       
    33 class TLogicalFont;
       
    34 class CAknLayoutFont;
       
    35 class CRepository;
       
    36 class TAknsItemID;
       
    37 class MESMRFontSizeObserver;
       
    38 
       
    39 /**
       
    40  * MRUI mif file that includes all icon fallbacks for sis installations
       
    41  */
       
    42 _LIT( KESMRMifFile, "esmrgui.mif");
       
    43 
       
    44 /**
       
    45  * Namespace for layout constants
       
    46  */
       
    47 namespace ESMRLayout // codescanner::namespace
       
    48     {
       
    49     /**
       
    50      * common icon value all around the application
       
    51      */
       
    52     #define KIconSize ::TSize(20,20) // codescanner::baddefines
       
    53     
       
    54     /**
       
    55      * Icon border margin
       
    56      */
       
    57     const TInt KIconBorderMargin = 3;
       
    58 
       
    59     /**
       
    60      * Field end margin
       
    61      */
       
    62     const TInt KFieldEndMargin = 6;
       
    63     
       
    64     /**
       
    65      * Mirrored icon margin
       
    66      */
       
    67     const TInt KMirroredIconMargin = 9;
       
    68     }
       
    69 
       
    70 /**
       
    71  * CESMRLayoutManager
       
    72  *
       
    73  * @lib esmrgui.lib
       
    74  */
       
    75 NONSHARABLE_CLASS( CESMRLayoutManager ) :
       
    76     public CBase,
       
    77     public MCenRepNotifyHandlerCallback
       
    78     {
       
    79 public:
       
    80     // Enumeration for margin ids
       
    81     enum TMarginsId
       
    82         {
       
    83         EFieldMargins = 0x000000
       
    84         };
       
    85 
       
    86     // Struct for field sizes
       
    87     struct SFieldSize
       
    88         {
       
    89         TESMREntryFieldId iId;
       
    90         TInt iFontSmallHeight;
       
    91         TInt iFontNormalHeight;
       
    92         TInt iFontLargeHeight;
       
    93         TInt iWidthLandscape;
       
    94         TInt iWidthPortrait;
       
    95         };
       
    96 
       
    97 public: // Construction and destruction
       
    98 
       
    99     /**
       
   100      * Creates and initialzes new CESMRLayoutManager object.
       
   101      * @return Pointer to CESMRLayoutManager object.
       
   102      */
       
   103     static CESMRLayoutManager* NewL();
       
   104 
       
   105     /**
       
   106      * C++ destructor
       
   107      */
       
   108     virtual ~CESMRLayoutManager();
       
   109 
       
   110 public: // Interface
       
   111 
       
   112     /**
       
   113      * Fetches field size information.
       
   114      * @param aId Field id.
       
   115      * @return Field size information.
       
   116      */
       
   117     virtual TSize FieldSize( TESMREntryFieldId aId );
       
   118 
       
   119     /**
       
   120      * Returns margin values used in the fields
       
   121      *
       
   122      * @param TMarginsId - Not currently in use
       
   123      * @return TMargins margin values (pixels)
       
   124      */
       
   125     virtual TMargins Margins( TMarginsId aId );
       
   126 
       
   127     /**
       
   128      * Fetches font for field.
       
   129      *
       
   130      * @param aEnv Pointer to coe environment
       
   131      * @param aId Field id.
       
   132      * @return Pointer to font object. Ownership is not transferred.
       
   133      *         Can return NULL pointer.
       
   134      */
       
   135     virtual const CFont* Font(
       
   136             CCoeEnv* aEnv,
       
   137             TESMREntryFieldId aId);
       
   138 
       
   139     /**
       
   140      * Fetces icon margin from the top of the field.
       
   141      * This depends on the font size
       
   142      *
       
   143      * @return Margin value (pixels)
       
   144      */
       
   145     virtual TInt IconTopMargin();
       
   146 
       
   147     /**
       
   148      * Fetces text margin from the top of the field.
       
   149      * This depends on the font size
       
   150      *
       
   151      * @return Margin value (pixels)
       
   152      */
       
   153     virtual TInt TextTopMargin();
       
   154 
       
   155     /**
       
   156      * Fetces text margin from the side of the field.
       
   157      * This depends on the font size.
       
   158      *
       
   159      * @return Margin value (pixels)
       
   160      */
       
   161     virtual TInt TextSideMargin();
       
   162 
       
   163     /**
       
   164      * Returns the size of the control where response
       
   165      * area answer text is written.
       
   166      *
       
   167      * @return TSize Size of the control
       
   168      */
       
   169     virtual TSize ResponseAreaAnswerTextSize();
       
   170 
       
   171     /**
       
   172      * Returns the size of the control where response
       
   173      * area topic text is written.
       
   174      *
       
   175      * @return TSize Size of the control
       
   176      */
       
   177     virtual TSize ResponseAreaTopicTextSize();
       
   178 
       
   179     /**
       
   180      * Returns the position of the control where response
       
   181      * area answer text is written.
       
   182      *
       
   183      * @return TPoint position of the control
       
   184      */
       
   185     virtual TPoint ResponseAreaAnswerTextPosition();
       
   186 
       
   187     /**
       
   188      * Returns the position of the icon in the response area item
       
   189      *
       
   190      * @return TPoint position of the control
       
   191      */
       
   192     virtual TPoint ResponseAreaAnswerIconPosition();
       
   193 
       
   194     /**
       
   195      * Returns the height of the response area item
       
   196      *
       
   197      * @return TInt height of the control
       
   198      */
       
   199     virtual TInt ResponseAreaAnswerItemheight();
       
   200 
       
   201     /**
       
   202      * Returns the height of standard list field
       
   203      *
       
   204      * @return TInt height of the control
       
   205      */
       
   206     virtual TInt RegularFieldHeight();
       
   207 
       
   208     /**
       
   209      * Returns the position of the text control used in organizer field
       
   210      *
       
   211      * @return TInt height of the control
       
   212      */
       
   213     virtual TPoint OrganizerTextPosition();
       
   214 
       
   215     /**
       
   216      * Returns the width of the text control used in organizer field
       
   217      *
       
   218      * @return TInt width of the control
       
   219      */
       
   220     virtual TInt OrganizerTextWidth();
       
   221 
       
   222     /**
       
   223      * Returns the height of the title pane
       
   224      *
       
   225      * @return TInt height of the control
       
   226      */
       
   227     virtual TInt TitlePaneHeight();
       
   228 
       
   229     /**
       
   230      * Returns the skin/theme based color used as a background
       
   231      * color in the list.
       
   232      *
       
   233      * @return TRgb background color
       
   234      */
       
   235     virtual TRgb ListAreaBgColor();
       
   236 
       
   237     /**
       
   238      * Returns the skin/theme based color used as a text
       
   239      * color.
       
   240      *
       
   241      * @return TRgb text color
       
   242      */
       
   243     virtual TRgb GeneralListAreaTextColor();
       
   244 
       
   245     /**
       
   246      * Returns the skin/theme based color used as a text
       
   247      * color.
       
   248      *
       
   249      * @return TRgb text color
       
   250      */
       
   251     virtual TRgb ViewerListAreaTextColor();
       
   252 
       
   253     /**
       
   254      * Returns the skin/theme based color used as a text
       
   255      * color when text is "highlighted".
       
   256      *
       
   257      * @return TRgb text color
       
   258      */
       
   259     virtual TRgb ViewerListAreaHighlightedTextColor();
       
   260 
       
   261     /**
       
   262      * Returns the skin/theme based text color used as a text
       
   263      * color in theme documentation specified places.
       
   264      *
       
   265      * @return TRgb text color
       
   266      */
       
   267     virtual TRgb NormalTextColor();
       
   268 
       
   269     /**
       
   270      * Returns the skin/theme based text color used as a text
       
   271      * color in theme documentation specified places.
       
   272      *
       
   273      * @return TRgb text color
       
   274      */
       
   275     virtual TRgb HighlightedTextColor();
       
   276     
       
   277     /**
       
   278      * Returns the skin/theme based text color used as a text
       
   279      * color in title pane.
       
   280      *
       
   281      * @return TRgb text color
       
   282      */
       
   283     virtual TRgb TitleAreaTextColor();
       
   284 
       
   285     /**
       
   286      * Returns the skin/theme based text background color to be used
       
   287      * as a color in theme documentation specified places.
       
   288      *
       
   289      * @return TRgb text color
       
   290      */
       
   291     virtual TRgb NormalTextBgColor();
       
   292 
       
   293     /**
       
   294      * Returns the skin/theme based field border color to be used
       
   295      * as a color in theme documentation specified places.
       
   296      *
       
   297      * @return TRgb text color
       
   298      */
       
   299     virtual TRgb FieldBorderColor();
       
   300 
       
   301     /**
       
   302      * Returns the text color ID for normal text.
       
   303      *
       
   304      * @return TInt text color ID
       
   305      */
       
   306     virtual TInt NormalTextColorID();
       
   307 
       
   308     /**
       
   309      * Returns the text color ID for viewer area text.
       
   310      *
       
   311      * @return TInt text color ID
       
   312      */
       
   313     virtual TInt ViewerListAreaTextColorID();
       
   314 
       
   315     /**
       
   316      * Creates bitmap and bitmap mask. Bitmap is skin/theme based
       
   317      * and it's retrived by the given ID.Bitmap is also resized to
       
   318      * the given size.
       
   319      * Ownership of these created bitmaps is transferred to the caller.
       
   320      *
       
   321      * @param aIconID - id of the wanted bitmap
       
   322      * @param aBitmap - reference to the pointer where new bitmap is stored
       
   323      * @param aMask - reference to the pointer where new bitmap mask is stored
       
   324      * @param aSize - Desired size for the bitmap
       
   325      * @return TInt - KErrNone if bitmap was constructed succesfully
       
   326      *                KErrNotFound if any problems occured
       
   327      */
       
   328     virtual TInt GetSkinBasedBitmap( TAknsItemID aIconID,
       
   329                                      CFbsBitmap*& aBitmap,
       
   330                                      CFbsBitmap*& aMask,
       
   331                                      TSize aSize );
       
   332     /**
       
   333      * Checks if Font settings were changed since last font update query
       
   334      * Note: This function does not make a query/poll from the cenrep
       
   335      * @see CESMRLayoutManager::Font
       
   336      *
       
   337      * @return TBool - True, if font was changed
       
   338      */
       
   339     virtual TBool IsFontChanged();
       
   340 
       
   341    /**
       
   342      * Checks current font zoom/size of this layoutmanager
       
   343      *
       
   344      * @return TAknUiZoom - font zoom state
       
   345      */
       
   346     virtual TInt CurrentFontZoom();
       
   347 
       
   348     /**
       
   349      * Sets the Font size settings observer.
       
   350      * @param MESMRFontSizeObserver Observer instance to be informed.
       
   351      */
       
   352     void SetObserver( MESMRFontSizeObserver* aObserver );
       
   353 
       
   354     /**
       
   355      * Returns the position of the conflict popup control
       
   356      *
       
   357      * @return TPoint control position
       
   358      */
       
   359     IMPORT_C static TPoint ConflictPopupPosition();
       
   360 
       
   361     /**
       
   362      * Returns information about mirrored layout.
       
   363      *
       
   364      * @return TBool - ETrue if mirrored layout is set, otherwise EFalse.
       
   365      */
       
   366     IMPORT_C static TBool IsMirrored();
       
   367 
       
   368     /**
       
   369      * Sets fallback icon from esmrgui.mif file if no matching icon from skin
       
   370      * also used by several other fields as a utility
       
   371      *
       
   372      * @param aIconID - ID for the icon that this field should show
       
   373      * @param aFileIndex - id of the icon (from esmrgui.mif)
       
   374      * @param aFileMaskIndex - id of the icon mask (from esmrgui.mif)
       
   375      */
       
   376     IMPORT_C static void SetBitmapFallback( const TAknsItemID& aIconID,
       
   377                                             TInt& aFileIndex,
       
   378                                             TInt& aFileMaskIndex);
       
   379     
       
   380 private:
       
   381     // Default c++ constructor
       
   382     CESMRLayoutManager();
       
   383     // Second phase constructor
       
   384     void ConstructL();
       
   385     // From MCenRepNotifyHandlerCallback
       
   386     // Notifies the observer that font size has changed
       
   387     virtual void HandleNotifyInt( TUint32 aId, TInt aNewValue );
       
   388 
       
   389     /**
       
   390      * Method is used to add sizes of the fields for different font sizes and
       
   391      * orientations. This is called only once at the construct phase.
       
   392      *
       
   393      * @param aId - ID of the field
       
   394      * @param aFontSmallHeight - height of the field when small fonts are set.
       
   395      * @param aFontNormalHeight - height of the field when normal fonts are set.
       
   396      * @param aFontLargeHeight - height of the field when large fonts are set.
       
   397      * @param aWidthLandscape - width of the field when orientation is landscape.
       
   398      * @param aWidthPortrait - width of the field when orientation is portrait.
       
   399      *
       
   400      */
       
   401     void AddSize(
       
   402             TESMREntryFieldId aId,
       
   403             TInt aFontSmallHeight,
       
   404             TInt aFontNormalHeight,
       
   405             TInt aFontLargeHeight,
       
   406             TInt aWidthLandscape,
       
   407             TInt aWidthPortrait );
       
   408 
       
   409 private: // Data
       
   410     /// Own: Field size array
       
   411     RArray<SFieldSize> iSize;
       
   412     /// Own: Pointer to text field fonts
       
   413     CAknLayoutFont* iFont;
       
   414     /// Own: Pointer to mfne field fonts
       
   415     CAknLayoutFont* iMfneFont;
       
   416     /// Own: Pointer to cenrep object fetching font settings information
       
   417     CRepository* iFontSettings;
       
   418     /// Own: Font settings value
       
   419     TInt iFontSettingsValue;
       
   420     /// Own: Font settings change status
       
   421     TBool iFontSettingsChanged;
       
   422     /// Own: Active object which listens Font Size Key from a CenRep
       
   423     CCenRepNotifyHandler* iNotifyHandler;
       
   424     /// Ref: Observer for Font Size
       
   425     MESMRFontSizeObserver* iFontSizeObserver;
       
   426     };
       
   427 
       
   428 #endif //CESMRLAYOUTMGR_H
       
   429 
       
   430 // EOF