1.1 --- a/epoc32/include/mw/aknpopuplayout.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/mw/aknpopuplayout.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,273 @@
1.4 -aknpopuplayout.h
1.5 +/*
1.6 +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
1.7 +* All rights reserved.
1.8 +* This component and the accompanying materials are made available
1.9 +* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.10 +* which accompanies this distribution, and is available
1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.12 +*
1.13 +* Initial Contributors:
1.14 +* Nokia Corporation - initial contribution.
1.15 +*
1.16 +* Contributors:
1.17 +*
1.18 +* Description:
1.19 +* Layouts from pop-up windows. Mostly used for implementing list queries,
1.20 +* options menus, grouped soft notifications and other popup windows.
1.21 +*
1.22 +*/
1.23 +
1.24 +
1.25 +#ifndef __AKNPOPUPLAYOUT__
1.26 +#define __AKNPOPUPLAYOUT__
1.27 +
1.28 +#include <aknutils.h>
1.29 +#include <e32std.h>
1.30 +
1.31 +struct TAknPopupWindowLayoutDef;
1.32 +class CEikListBox;
1.33 +class CAknPopupHeadingPane;
1.34 +class CWindowGc;
1.35 +class CCoeControl;
1.36 +class CEikonEnv;
1.37 +class TAknWindowComponentLayout;
1.38 +
1.39 +const TInt EAknPopupLayoutsDynamic = 0x80;
1.40 +const TInt EAknPopupLayoutsFind = 0x100;
1.41 +
1.42 +/** The purpose of AknPopupLayouts class is to provide layouts
1.43 + * for popup windows described in European Avkon LAF
1.44 + * document.
1.45 + *
1.46 + * Applications should not use this class except for building custom
1.47 + * layouts. The default layouts looks usually much nicer.
1.48 + *
1.49 + * Applications cannot extend this class to add new layouts, but they
1.50 + * can override virtual methods from the class that call methods from
1.51 + * these classes.
1.52 + *
1.53 + * These classes are used by
1.54 + * 1) List queries CAknListQueryDialog (aknquerydialog.cpp)
1.55 + * 2) options menus CEikMenuPane and CEikMenuBar (uikon/coctlsrc/eikmenup.cpp)
1.56 + * 3) popup windows CAknPopupList (aknpopup.cpp)
1.57 + * 4) grouped soft notifications
1.58 + *
1.59 + */
1.60 +struct TAknPopupLayoutsNode;
1.61 +struct TAknPopupLayoutsNode
1.62 +{
1.63 + TAknPopupLayoutsNode *iNext;
1.64 + TInt iId;
1.65 + CCoeControl *iControl;
1.66 +};
1.67 +enum TAknPopupLayoutsNodeList
1.68 +{
1.69 + EListNode = 0x5555,
1.70 + EHeadingNode,
1.71 + EWindowOwningNode,
1.72 + EMessageBoxNode,
1.73 + EFindBoxNode
1.74 +};
1.75 +
1.76 +class AknPopupLayouts
1.77 + {
1.78 +public:
1.79 + /**
1.80 + * If you ever want to add new items here, do not -- instead derive from
1.81 + * popuplist or list query and override SetupWindowLayout().
1.82 + * (or if you can modify avkon, then add them here to make it easier for apps to use
1.83 + * the new layout..)
1.84 + * There's example at aknGMSstylegrid.cpp how to make new popup window without avkon
1.85 + * modifications.
1.86 + */
1.87 + enum TAknPopupLayouts
1.88 + {
1.89 + // these are the standard popup windows
1.90 + EMenuWindow, // CAknSinglePopupMenuStyleListBox
1.91 + EMenuGraphicWindow, // CAknSingleGraphicPopupMenuStyleListBox
1.92 + EMenuGraphicHeadingWindow, // CAknSingleGraphicHeadingPopupMenuStyleListBox, CAknSingleHeadingPopupMenuStyleListBox
1.93 + EMenuDoubleWindow, // CAknDoublePopupMenuStyleListBox
1.94 + EMenuDoubleLargeGraphicWindow, // CAknDoubleLargeGraphicPopupMenuStyleListBox
1.95 + EPopupSNotePopupWindow,
1.96 + EMenuUnknownColumnWindow, // for apps that use Column listboxes inside popup list
1.97 + EMenuUnknownFormattedCellWindow,// for apps that use Formatted cell listboxes inside popup list
1.98 +
1.99 + // these are versions of the popup windows which does not resize
1.100 + // themselves if you insert items. (they're full size from the
1.101 + // beginning)
1.102 + EDynMenuWindow = EMenuWindow + 0x80,
1.103 + EDynMenuGraphicWindow,
1.104 + EDynMenuGraphicHeadingWindow,
1.105 + EDynMenuDoubleWindow,
1.106 + EDynMenuDoubleLargeGraphicWindow
1.107 + };
1.108 +
1.109 +public: // interface for controls
1.110 +
1.111 +
1.112 + /**
1.113 + * Implementation of SizeChanged() for a popup window control with a list inside
1.114 + *
1.115 + * This method calls setrect() on heading, listbox and window owning control
1.116 + * and expects the window owning control has listbox and heading in
1.117 + * its componentcontrols...
1.118 + */
1.119 + IMPORT_C static void HandleSizeChanged(TAknPopupWindowLayoutDef &aDef,
1.120 + TAknPopupLayouts aLayout,
1.121 + TAknPopupLayoutsNode *aListOfControls);
1.122 + IMPORT_C static void HandleSizeChanged(TAknPopupWindowLayoutDef &aDef,
1.123 + TAknPopupLayouts aLayout,
1.124 + CAknPopupHeadingPane *aHeadingOrNull,
1.125 + CEikListBox *aListBox,
1.126 + CCoeControl *aWindowOwningControl);
1.127 + /**
1.128 + * Implementation of Draw() for a popup window control with a list inside
1.129 + */
1.130 + IMPORT_C static void HandleDraw(CEikonEnv* aEikEnv,
1.131 + CWindowGc &aGc,
1.132 + const TAknPopupWindowLayoutDef &aDef,
1.133 + CEikListBox *aListBox,
1.134 + CAknPopupHeadingPane *aHeadingOrNull);
1.135 +
1.136 +
1.137 +public: // interface for adding heading
1.138 + /**
1.139 + * Adds a heading to popup window
1.140 + */
1.141 + IMPORT_C static void ModifyWindowGraphicForHeading(TAknPopupWindowLayoutDef &aDef);
1.142 + IMPORT_C static void ModifyWindowGraphicForMessageBox(TAknPopupWindowLayoutDef &aDef, TInt aNumOfLines);
1.143 +
1.144 +public: // The implementation of different popup window styles.
1.145 + /**
1.146 + * Calculates layout of popup_menu_window from LAF specification
1.147 + */
1.148 + IMPORT_C static void CalcPopupMenuWindow(TAknPopupWindowLayoutDef &aDef,
1.149 + TRect aClientRect,
1.150 + TInt aNumberOfLinesInListBox);
1.151 + /**
1.152 + * Calculates layout of popup_menu_graphic_window from LAF specification
1.153 + */
1.154 + IMPORT_C static void CalcPopupMenuGraphicWindow(TAknPopupWindowLayoutDef &aDef,
1.155 + TRect aClientRect,
1.156 + TInt aNumberOfLinesInListBox);
1.157 + /**
1.158 + * Calculates layout of popup_menu_graphic_heading_window from LAF specification
1.159 + */
1.160 + IMPORT_C static void CalcPopupMenuGraphicHeadingWindow(TAknPopupWindowLayoutDef &aDef,
1.161 + TRect aClientRect,
1.162 + TInt aNumberOfLinesInListBox);
1.163 + /**
1.164 + * Calculates layout of popup_menu_double_window from LAF specification
1.165 + */
1.166 + IMPORT_C static void CalcPopupMenuDoubleWindow(TAknPopupWindowLayoutDef &aDef,
1.167 + TRect aClientRect,
1.168 + TInt aNumberOfLinesInListBox);
1.169 + /**
1.170 + * Calculates layout of popup_menu_double_large_graphic_window from LAF specification
1.171 + */
1.172 + IMPORT_C static void CalcPopupMenuDoubleLargeGraphicWindow(TAknPopupWindowLayoutDef &aDef,
1.173 + TRect aClientRect,
1.174 + TInt aNumberOfLinesInListBox);
1.175 + /**
1.176 + * Calculates layout of popup_snote_window from LAF specification
1.177 + */
1.178 + IMPORT_C static void CalcPopupSNoteGroupWindow(TAknPopupWindowLayoutDef &aDef,
1.179 + TRect aClientRect,
1.180 + TInt aNumberOfLinesInListBox);
1.181 +
1.182 + /**
1.183 + * Setup a border for the window
1.184 + */
1.185 + IMPORT_C static void SetupMenuPopupWindow(TAknPopupWindowLayoutDef &aDef,
1.186 + TInt aNumberOfLinesInListBox,
1.187 + TBool aHeading);
1.188 + /**
1.189 + * Setup a border for the window
1.190 + */
1.191 + IMPORT_C static void SetupPopupMenuGraphicWindow(TAknPopupWindowLayoutDef &aDef,
1.192 + TInt aNumberOfLinesInListBox,
1.193 + TBool aHeading);
1.194 + /**
1.195 + * Setup a border for the window
1.196 + */
1.197 + IMPORT_C static void SetupPopupMenuGraphicHeadingWindow(TAknPopupWindowLayoutDef &aDef,
1.198 + TInt aNumberOfLinesInListBox,
1.199 + TBool aHeading);
1.200 + /**
1.201 + * Setup a border for the window
1.202 + */
1.203 + IMPORT_C static void SetupPopupMenuDoubleWindow(TAknPopupWindowLayoutDef &aDef,
1.204 + TInt aNumberOfLinesInListBox,
1.205 + TBool aHeading);
1.206 + /**
1.207 + * Setup a border for the window
1.208 + */
1.209 + IMPORT_C static void SetupImageSelectionMenuPopupWindow(TAknPopupWindowLayoutDef &aDef,
1.210 + TInt num,
1.211 + TBool heading);
1.212 + /**
1.213 + * Setup a border for the window
1.214 + */
1.215 + IMPORT_C static void SetupPopupSNoteGroupWindow(TAknPopupWindowLayoutDef &aDef,
1.216 + TInt num,
1.217 + TBool heading);
1.218 +
1.219 +
1.220 +public: // interface to setup listbox and popup heading pane. (used by HandleSizeChanged)
1.221 + IMPORT_C static void HandleSizeAndPositionOfComponents(const TAknPopupWindowLayoutDef &aDef,
1.222 + CCoeControl *aContentInsidePopup,
1.223 + CAknPopupHeadingPane *aHeadingOrNull);
1.224 + IMPORT_C static void SetupDefaults(TAknPopupWindowLayoutDef &aDef);
1.225 +public: // Utilities
1.226 + /**
1.227 + * Access to different coordinate transformations needed to setup popup windows
1.228 + */
1.229 + IMPORT_C static TRect WindowRect(TAknPopupWindowLayoutDef &aDef);
1.230 + /**
1.231 + * Access to different coordinate transformations needed to setup popup windows
1.232 + */
1.233 + IMPORT_C static TRect MenuRect(TAknPopupWindowLayoutDef &aDef);
1.234 + /**
1.235 + * Check integer range
1.236 + */
1.237 + IMPORT_C static void CheckRange(TInt &aValue, TInt aMin, TInt aMax);
1.238 + /**
1.239 + * Helper for building popup window layout
1.240 + */
1.241 + IMPORT_C static void MenuPopupWindowGraphics(TAknPopupWindowLayoutDef &aDef);
1.242 +
1.243 + static TRect RectFromLayout(TRect aParent, const TAknWindowComponentLayout &aComponentLayout);
1.244 + };
1.245 +
1.246 +/** TAknPopupWindowLayoutDef
1.247 + * collects all LAF specification lines that are needed for popup windows
1.248 + *
1.249 + */
1.250 +
1.251 +struct TAknPopupWindowLayoutDef
1.252 + {
1.253 + IMPORT_C TAknPopupWindowLayoutDef();
1.254 + TAknLayoutRect iListRect;
1.255 + TAknLayoutRect iHeadingRect;
1.256 +
1.257 + TAknLayoutRect iCover;
1.258 + TAknLayoutRect iSecond;
1.259 + TAknLayoutRect iFirst;
1.260 + TAknLayoutRect iOutline;
1.261 + TAknLayoutRect iInside;
1.262 +
1.263 + TAknLayoutRect iVertLineExt1;
1.264 + TAknLayoutRect iVertLineExt2;
1.265 +
1.266 + // the window position relative to clientrect
1.267 + TRect iWindowRect;
1.268 +
1.269 + // popup_menu_window position relative to iWindowPos
1.270 + TPoint iPopupMenuWindowOffset;
1.271 + TInt iMaximumHeight;
1.272 + };
1.273 +
1.274 +#endif
1.275 +
1.276 +
1.277 +