epoc32/include/mw/aknpopuplayout.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 /*
     2 * Copyright (c) 2002 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 *     Layouts from pop-up windows. Mostly used for implementing list queries,
    16 *     options menus, grouped soft notifications and other popup windows.
    17 *
    18 */
    19 
    20 
    21 #ifndef __AKNPOPUPLAYOUT__
    22 #define __AKNPOPUPLAYOUT__
    23 
    24 #include <AknUtils.h>
    25 #include <e32std.h>
    26 
    27 struct TAknPopupWindowLayoutDef;
    28 class CEikListBox;
    29 class CAknPopupHeadingPane;
    30 class CWindowGc;
    31 class CCoeControl;
    32 class CEikonEnv;
    33 class TAknWindowComponentLayout;
    34 
    35 const TInt EAknPopupLayoutsDynamic = 0x80;
    36 const TInt EAknPopupLayoutsFind = 0x100;
    37 
    38 /** The purpose of AknPopupLayouts class is to provide layouts
    39  *  for popup windows described in European Avkon LAF
    40  *  document.
    41  *  
    42  *  Applications should not use this class except for building custom
    43  *  layouts. The default layouts looks usually much nicer.
    44  *
    45  *  Applications cannot extend this class to add new layouts, but they
    46  *  can override virtual methods from the class that call methods from
    47  *  these classes.
    48  *
    49  *  These classes are used by
    50  *    1) List queries CAknListQueryDialog (aknquerydialog.cpp)
    51  *    2) options menus CEikMenuPane and CEikMenuBar (uikon/coctlsrc/eikmenup.cpp)
    52  *    3) popup windows CAknPopupList (aknpopup.cpp)
    53  *    4) grouped soft notifications
    54  *
    55  */
    56 struct TAknPopupLayoutsNode;
    57 struct TAknPopupLayoutsNode
    58 {
    59 	TAknPopupLayoutsNode *iNext;
    60 	TInt iId;
    61 	CCoeControl *iControl;
    62 };
    63 enum TAknPopupLayoutsNodeList
    64 {
    65 	EListNode = 0x5555,
    66 	EHeadingNode,
    67 	EWindowOwningNode,
    68 	EMessageBoxNode,
    69     EFindBoxNode
    70 };
    71 
    72 class AknPopupLayouts
    73     {
    74 public: 
    75     /** 
    76      *	If you ever want to add new items here, do not -- instead derive from
    77      * popuplist or list query and override SetupWindowLayout().
    78      * (or if you can modify avkon, then add them here to make it easier for apps to use
    79      * the new layout..)
    80      * There's example at aknGMSstylegrid.cpp how to make new popup window without avkon
    81      * modifications.
    82      */
    83     enum TAknPopupLayouts
    84 	{
    85 	// these are the standard popup windows
    86 	EMenuWindow, // CAknSinglePopupMenuStyleListBox
    87 	EMenuGraphicWindow, // CAknSingleGraphicPopupMenuStyleListBox
    88 	EMenuGraphicHeadingWindow, // CAknSingleGraphicHeadingPopupMenuStyleListBox, CAknSingleHeadingPopupMenuStyleListBox
    89 	EMenuDoubleWindow, // CAknDoublePopupMenuStyleListBox
    90 	EMenuDoubleLargeGraphicWindow, // CAknDoubleLargeGraphicPopupMenuStyleListBox
    91 	EPopupSNotePopupWindow,
    92     EMenuUnknownColumnWindow,       // for apps that use Column listboxes inside popup list
    93     EMenuUnknownFormattedCellWindow,// for apps that use Formatted cell listboxes inside popup list
    94 	
    95 	// these are versions of the popup windows which does not resize
    96 	// themselves if you insert items. (they're full size from the
    97 	// beginning)
    98 	EDynMenuWindow = EMenuWindow + 0x80,
    99 	EDynMenuGraphicWindow,
   100 	EDynMenuGraphicHeadingWindow,
   101 	EDynMenuDoubleWindow,
   102 	EDynMenuDoubleLargeGraphicWindow	
   103 	};
   104 
   105 public: // interface for controls
   106     
   107 
   108    /** 
   109     * Implementation of SizeChanged() for a popup window control with a list inside
   110     *
   111     * This method calls setrect() on heading, listbox and window owning control
   112     * and expects the window owning control has listbox and heading in
   113     * its componentcontrols...
   114     */
   115     IMPORT_C static void HandleSizeChanged(TAknPopupWindowLayoutDef &aDef,
   116 					   TAknPopupLayouts aLayout,
   117 					   TAknPopupLayoutsNode *aListOfControls);
   118     IMPORT_C static void HandleSizeChanged(TAknPopupWindowLayoutDef &aDef, 
   119 				  TAknPopupLayouts aLayout,
   120 				  CAknPopupHeadingPane *aHeadingOrNull,
   121 				  CEikListBox *aListBox,
   122 				  CCoeControl *aWindowOwningControl);
   123    /** 
   124     * Implementation of Draw() for a popup window control with a list inside
   125     */    
   126     IMPORT_C static void HandleDraw(CEikonEnv* aEikEnv,
   127 			   CWindowGc &aGc,
   128 			   const TAknPopupWindowLayoutDef &aDef, 
   129 			   CEikListBox *aListBox,
   130 			   CAknPopupHeadingPane *aHeadingOrNull);
   131 
   132 
   133 public: // interface for adding heading
   134    /** 
   135     * Adds a heading to popup window
   136     */
   137     IMPORT_C static void ModifyWindowGraphicForHeading(TAknPopupWindowLayoutDef &aDef);
   138     IMPORT_C static void ModifyWindowGraphicForMessageBox(TAknPopupWindowLayoutDef &aDef, TInt aNumOfLines);
   139 
   140 public: // The implementation of different popup window styles.
   141    /** 
   142     * Calculates layout of popup_menu_window from LAF specification
   143     */
   144     IMPORT_C static void CalcPopupMenuWindow(TAknPopupWindowLayoutDef &aDef, 
   145 					     TRect aClientRect, 
   146 					     TInt aNumberOfLinesInListBox);
   147    /** 
   148     * Calculates layout of popup_menu_graphic_window from LAF specification
   149     */
   150     IMPORT_C static void CalcPopupMenuGraphicWindow(TAknPopupWindowLayoutDef &aDef,
   151 						    TRect aClientRect, 
   152 						    TInt aNumberOfLinesInListBox);
   153    /** 
   154     * Calculates layout of popup_menu_graphic_heading_window from LAF specification
   155     */
   156     IMPORT_C static void CalcPopupMenuGraphicHeadingWindow(TAknPopupWindowLayoutDef &aDef,
   157 							   TRect aClientRect, 
   158 							   TInt aNumberOfLinesInListBox);
   159    /** 
   160     * Calculates layout of popup_menu_double_window from LAF specification
   161     */
   162     IMPORT_C static void CalcPopupMenuDoubleWindow(TAknPopupWindowLayoutDef &aDef,
   163 						   TRect aClientRect, 
   164 						   TInt aNumberOfLinesInListBox);
   165    /** 
   166     * Calculates layout of popup_menu_double_large_graphic_window from LAF specification
   167     */
   168     IMPORT_C static void CalcPopupMenuDoubleLargeGraphicWindow(TAknPopupWindowLayoutDef &aDef,
   169 							       TRect aClientRect, 
   170 							       TInt aNumberOfLinesInListBox);
   171    /** 
   172     * Calculates layout of popup_snote_window from LAF specification
   173     */
   174     IMPORT_C static void CalcPopupSNoteGroupWindow(TAknPopupWindowLayoutDef &aDef, 
   175 						   TRect aClientRect, 
   176 						   TInt aNumberOfLinesInListBox);
   177 
   178     /**
   179      * Setup a border for the window
   180      */
   181     IMPORT_C static void SetupMenuPopupWindow(TAknPopupWindowLayoutDef &aDef, 
   182 					      TInt aNumberOfLinesInListBox, 
   183 					      TBool aHeading);
   184     /**
   185      * Setup a border for the window
   186      */
   187     IMPORT_C static void SetupPopupMenuGraphicWindow(TAknPopupWindowLayoutDef &aDef, 
   188 						     TInt aNumberOfLinesInListBox,
   189 						     TBool aHeading);
   190     /**
   191      * Setup a border for the window
   192      */
   193     IMPORT_C static void SetupPopupMenuGraphicHeadingWindow(TAknPopupWindowLayoutDef &aDef, 
   194 							    TInt aNumberOfLinesInListBox, 
   195 							    TBool aHeading);
   196     /**
   197      * Setup a border for the window
   198      */
   199     IMPORT_C static void SetupPopupMenuDoubleWindow(TAknPopupWindowLayoutDef &aDef, 
   200 						    TInt aNumberOfLinesInListBox, 
   201 						    TBool aHeading);    
   202     /**
   203      * Setup a border for the window
   204      */
   205     IMPORT_C static void SetupImageSelectionMenuPopupWindow(TAknPopupWindowLayoutDef &aDef,
   206 							    TInt num, 
   207 							    TBool heading);
   208     /**
   209      * Setup a border for the window
   210      */
   211     IMPORT_C static void SetupPopupSNoteGroupWindow(TAknPopupWindowLayoutDef &aDef,
   212 						    TInt num,
   213 						    TBool heading);
   214 
   215     
   216 public: // interface to setup listbox and popup heading pane. (used by HandleSizeChanged)
   217     IMPORT_C static void HandleSizeAndPositionOfComponents(const TAknPopupWindowLayoutDef &aDef, 
   218 						  CCoeControl *aContentInsidePopup,
   219 						  CAknPopupHeadingPane *aHeadingOrNull);
   220     IMPORT_C static void SetupDefaults(TAknPopupWindowLayoutDef &aDef);
   221 public: // Utilities
   222     /**
   223      * Access to different coordinate transformations needed to setup popup windows
   224      */
   225     IMPORT_C static TRect WindowRect(TAknPopupWindowLayoutDef &aDef);
   226     /**
   227      * Access to different coordinate transformations needed to setup popup windows
   228      */
   229     IMPORT_C static TRect MenuRect(TAknPopupWindowLayoutDef &aDef);
   230     /**
   231      * Check integer range
   232      */
   233     IMPORT_C static void CheckRange(TInt &aValue, TInt aMin, TInt aMax);
   234     /**
   235      * Helper for building popup window layout
   236      */
   237     IMPORT_C static void MenuPopupWindowGraphics(TAknPopupWindowLayoutDef &aDef);
   238 
   239     static TRect RectFromLayout(TRect aParent, const TAknWindowComponentLayout &aComponentLayout);
   240     };
   241 
   242 /** TAknPopupWindowLayoutDef
   243  * collects all LAF specification lines that are needed for popup windows
   244  *
   245  */
   246 
   247 struct TAknPopupWindowLayoutDef
   248     {
   249     IMPORT_C TAknPopupWindowLayoutDef();
   250     TAknLayoutRect iListRect;
   251     TAknLayoutRect iHeadingRect;
   252     
   253     TAknLayoutRect iCover;
   254     TAknLayoutRect iSecond;
   255     TAknLayoutRect iFirst;
   256     TAknLayoutRect iOutline;
   257     TAknLayoutRect iInside;
   258     
   259     TAknLayoutRect iVertLineExt1;
   260     TAknLayoutRect iVertLineExt2;
   261 
   262     // the window position relative to clientrect
   263     TRect iWindowRect;
   264 
   265     // popup_menu_window position relative to iWindowPos
   266     TPoint iPopupMenuWindowOffset;
   267     TInt iMaximumHeight;
   268     };
   269 
   270 #endif
   271 
   272 
   273