2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * Layouts from pop-up windows. Mostly used for implementing list queries,
16 * options menus, grouped soft notifications and other popup windows.
21 #ifndef __AKNPOPUPLAYOUT__
22 #define __AKNPOPUPLAYOUT__
27 struct TAknPopupWindowLayoutDef;
29 class CAknPopupHeadingPane;
33 class TAknWindowComponentLayout;
35 const TInt EAknPopupLayoutsDynamic = 0x80;
36 const TInt EAknPopupLayoutsFind = 0x100;
38 /** The purpose of AknPopupLayouts class is to provide layouts
39 * for popup windows described in European Avkon LAF
42 * Applications should not use this class except for building custom
43 * layouts. The default layouts looks usually much nicer.
45 * Applications cannot extend this class to add new layouts, but they
46 * can override virtual methods from the class that call methods from
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
56 struct TAknPopupLayoutsNode;
57 struct TAknPopupLayoutsNode
59 TAknPopupLayoutsNode *iNext;
61 CCoeControl *iControl;
63 enum TAknPopupLayoutsNodeList
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
80 * There's example at aknGMSstylegrid.cpp how to make new popup window without avkon
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
95 // these are versions of the popup windows which does not resize
96 // themselves if you insert items. (they're full size from the
98 EDynMenuWindow = EMenuWindow + 0x80,
99 EDynMenuGraphicWindow,
100 EDynMenuGraphicHeadingWindow,
101 EDynMenuDoubleWindow,
102 EDynMenuDoubleLargeGraphicWindow
105 public: // interface for controls
109 * Implementation of SizeChanged() for a popup window control with a list inside
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...
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);
124 * Implementation of Draw() for a popup window control with a list inside
126 IMPORT_C static void HandleDraw(CEikonEnv* aEikEnv,
128 const TAknPopupWindowLayoutDef &aDef,
129 CEikListBox *aListBox,
130 CAknPopupHeadingPane *aHeadingOrNull);
133 public: // interface for adding heading
135 * Adds a heading to popup window
137 IMPORT_C static void ModifyWindowGraphicForHeading(TAknPopupWindowLayoutDef &aDef);
138 IMPORT_C static void ModifyWindowGraphicForMessageBox(TAknPopupWindowLayoutDef &aDef, TInt aNumOfLines);
140 public: // The implementation of different popup window styles.
142 * Calculates layout of popup_menu_window from LAF specification
144 IMPORT_C static void CalcPopupMenuWindow(TAknPopupWindowLayoutDef &aDef,
146 TInt aNumberOfLinesInListBox);
148 * Calculates layout of popup_menu_graphic_window from LAF specification
150 IMPORT_C static void CalcPopupMenuGraphicWindow(TAknPopupWindowLayoutDef &aDef,
152 TInt aNumberOfLinesInListBox);
154 * Calculates layout of popup_menu_graphic_heading_window from LAF specification
156 IMPORT_C static void CalcPopupMenuGraphicHeadingWindow(TAknPopupWindowLayoutDef &aDef,
158 TInt aNumberOfLinesInListBox);
160 * Calculates layout of popup_menu_double_window from LAF specification
162 IMPORT_C static void CalcPopupMenuDoubleWindow(TAknPopupWindowLayoutDef &aDef,
164 TInt aNumberOfLinesInListBox);
166 * Calculates layout of popup_menu_double_large_graphic_window from LAF specification
168 IMPORT_C static void CalcPopupMenuDoubleLargeGraphicWindow(TAknPopupWindowLayoutDef &aDef,
170 TInt aNumberOfLinesInListBox);
172 * Calculates layout of popup_snote_window from LAF specification
174 IMPORT_C static void CalcPopupSNoteGroupWindow(TAknPopupWindowLayoutDef &aDef,
176 TInt aNumberOfLinesInListBox);
179 * Setup a border for the window
181 IMPORT_C static void SetupMenuPopupWindow(TAknPopupWindowLayoutDef &aDef,
182 TInt aNumberOfLinesInListBox,
185 * Setup a border for the window
187 IMPORT_C static void SetupPopupMenuGraphicWindow(TAknPopupWindowLayoutDef &aDef,
188 TInt aNumberOfLinesInListBox,
191 * Setup a border for the window
193 IMPORT_C static void SetupPopupMenuGraphicHeadingWindow(TAknPopupWindowLayoutDef &aDef,
194 TInt aNumberOfLinesInListBox,
197 * Setup a border for the window
199 IMPORT_C static void SetupPopupMenuDoubleWindow(TAknPopupWindowLayoutDef &aDef,
200 TInt aNumberOfLinesInListBox,
203 * Setup a border for the window
205 IMPORT_C static void SetupImageSelectionMenuPopupWindow(TAknPopupWindowLayoutDef &aDef,
209 * Setup a border for the window
211 IMPORT_C static void SetupPopupSNoteGroupWindow(TAknPopupWindowLayoutDef &aDef,
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);
223 * Access to different coordinate transformations needed to setup popup windows
225 IMPORT_C static TRect WindowRect(TAknPopupWindowLayoutDef &aDef);
227 * Access to different coordinate transformations needed to setup popup windows
229 IMPORT_C static TRect MenuRect(TAknPopupWindowLayoutDef &aDef);
231 * Check integer range
233 IMPORT_C static void CheckRange(TInt &aValue, TInt aMin, TInt aMax);
235 * Helper for building popup window layout
237 IMPORT_C static void MenuPopupWindowGraphics(TAknPopupWindowLayoutDef &aDef);
239 static TRect RectFromLayout(TRect aParent, const TAknWindowComponentLayout &aComponentLayout);
242 /** TAknPopupWindowLayoutDef
243 * collects all LAF specification lines that are needed for popup windows
247 struct TAknPopupWindowLayoutDef
249 IMPORT_C TAknPopupWindowLayoutDef();
250 TAknLayoutRect iListRect;
251 TAknLayoutRect iHeadingRect;
253 TAknLayoutRect iCover;
254 TAknLayoutRect iSecond;
255 TAknLayoutRect iFirst;
256 TAknLayoutRect iOutline;
257 TAknLayoutRect iInside;
259 TAknLayoutRect iVertLineExt1;
260 TAknLayoutRect iVertLineExt2;
262 // the window position relative to clientrect
265 // popup_menu_window position relative to iWindowPos
266 TPoint iPopupMenuWindowOffset;