00001 /* 00002 * ============================================================================ 00003 * Name : AknPopupLayout.h 00004 * Part of : Avkon 00005 * 00006 * Description: 00007 * Layouts from pop-up windows. Mostly used for implementing list queries, 00008 * options menus, grouped soft notifications and other popup windows. 00009 * Version: 00010 * 00011 * Copyright © 2002 Nokia Corporation. 00012 * This material, including documentation and any related 00013 * computer programs, is protected by copyright controlled by 00014 * Nokia Corporation. All rights are reserved. Copying, 00015 * including reproducing, storing, adapting or translating, any 00016 * or all of this material requires the prior written consent of 00017 * Nokia Corporation. This material also contains confidential 00018 * information which may not be disclosed to others without the 00019 * prior written consent of Nokia Corporation. 00020 * ============================================================================ 00021 */ 00022 00023 #ifndef __AKNPOPUPLAYOUT__ 00024 #define __AKNPOPUPLAYOUT__ 00025 00026 #include <aknutils.h> 00027 #include <e32std.h> 00028 00029 struct TAknPopupWindowLayoutDef; 00030 class CEikListBox; 00031 class CAknPopupHeadingPane; 00032 class CWindowGc; 00033 class CCoeControl; 00034 class CEikonEnv; 00035 class TAknWindowComponentLayout; 00036 00037 const TInt EAknPopupLayoutsDynamic = 0x80; 00038 const TInt EAknPopupLayoutsFind = 0x100; 00039 00058 struct TAknPopupLayoutsNode; 00059 struct TAknPopupLayoutsNode 00060 { 00061 TAknPopupLayoutsNode *iNext; 00062 TInt iId; 00063 CCoeControl *iControl; 00064 }; 00065 enum TAknPopupLayoutsNodeList 00066 { 00067 EListNode = 0x5555, 00068 EHeadingNode, 00069 EWindowOwningNode, 00070 EMessageBoxNode, 00071 EFindBoxNode 00072 }; 00073 00074 class AknPopupLayouts 00075 { 00076 public: 00085 enum TAknPopupLayouts 00086 { 00087 // these are the standard popup windows 00088 EMenuWindow, // CAknSinglePopupMenuStyleListBox 00089 EMenuGraphicWindow, // CAknSingleGraphicPopupMenuStyleListBox 00090 EMenuGraphicHeadingWindow, // CAknSingleGraphicHeadingPopupMenuStyleListBox, CAknSingleHeadingPopupMenuStyleListBox 00091 EMenuDoubleWindow, // CAknDoublePopupMenuStyleListBox 00092 EMenuDoubleLargeGraphicWindow, // CAknDoubleLargeGraphicPopupMenuStyleListBox 00093 EPopupSNotePopupWindow, 00094 EMenuUnknownColumnWindow, // for apps that use Column listboxes inside popup list 00095 EMenuUnknownFormattedCellWindow,// for apps that use Formatted cell listboxes inside popup list 00096 00097 // these are versions of the popup windows which does not resize 00098 // themselves if you insert items. (they're full size from the 00099 // beginning) 00100 EDynMenuWindow = EMenuWindow + 0x80, 00101 EDynMenuGraphicWindow, 00102 EDynMenuGraphicHeadingWindow, 00103 EDynMenuDoubleWindow, 00104 EDynMenuDoubleLargeGraphicWindow 00105 }; 00106 00107 public: // interface for controls 00108 00109 00117 IMPORT_C static void HandleSizeChanged(TAknPopupWindowLayoutDef &aDef, 00118 TAknPopupLayouts aLayout, 00119 TAknPopupLayoutsNode *aListOfControls); 00120 IMPORT_C static void HandleSizeChanged(TAknPopupWindowLayoutDef &aDef, 00121 TAknPopupLayouts aLayout, 00122 CAknPopupHeadingPane *aHeadingOrNull, 00123 CEikListBox *aListBox, 00124 CCoeControl *aWindowOwningControl); 00128 IMPORT_C static void HandleDraw(CEikonEnv* aEikEnv, 00129 CWindowGc &aGc, 00130 const TAknPopupWindowLayoutDef &aDef, 00131 CEikListBox *aListBox, 00132 CAknPopupHeadingPane *aHeadingOrNull); 00133 00134 00135 public: // interface for adding heading 00139 IMPORT_C static void ModifyWindowGraphicForHeading(TAknPopupWindowLayoutDef &aDef); 00140 IMPORT_C static void ModifyWindowGraphicForMessageBox(TAknPopupWindowLayoutDef &aDef, TInt aNumOfLines); 00141 00142 public: // The implementation of different popup window styles. 00146 IMPORT_C static void CalcPopupMenuWindow(TAknPopupWindowLayoutDef &aDef, 00147 TRect aClientRect, 00148 TInt aNumberOfLinesInListBox); 00152 IMPORT_C static void CalcPopupMenuGraphicWindow(TAknPopupWindowLayoutDef &aDef, 00153 TRect aClientRect, 00154 TInt aNumberOfLinesInListBox); 00158 IMPORT_C static void CalcPopupMenuGraphicHeadingWindow(TAknPopupWindowLayoutDef &aDef, 00159 TRect aClientRect, 00160 TInt aNumberOfLinesInListBox); 00164 IMPORT_C static void CalcPopupMenuDoubleWindow(TAknPopupWindowLayoutDef &aDef, 00165 TRect aClientRect, 00166 TInt aNumberOfLinesInListBox); 00170 IMPORT_C static void CalcPopupMenuDoubleLargeGraphicWindow(TAknPopupWindowLayoutDef &aDef, 00171 TRect aClientRect, 00172 TInt aNumberOfLinesInListBox); 00176 IMPORT_C static void CalcPopupSNoteGroupWindow(TAknPopupWindowLayoutDef &aDef, 00177 TRect aClientRect, 00178 TInt aNumberOfLinesInListBox); 00179 00183 IMPORT_C static void SetupMenuPopupWindow(TAknPopupWindowLayoutDef &aDef, 00184 TInt aNumberOfLinesInListBox, 00185 TBool aHeading); 00189 IMPORT_C static void SetupPopupMenuGraphicWindow(TAknPopupWindowLayoutDef &aDef, 00190 TInt aNumberOfLinesInListBox, 00191 TBool aHeading); 00195 IMPORT_C static void SetupPopupMenuGraphicHeadingWindow(TAknPopupWindowLayoutDef &aDef, 00196 TInt aNumberOfLinesInListBox, 00197 TBool aHeading); 00201 IMPORT_C static void SetupPopupMenuDoubleWindow(TAknPopupWindowLayoutDef &aDef, 00202 TInt aNumberOfLinesInListBox, 00203 TBool aHeading); 00207 IMPORT_C static void SetupImageSelectionMenuPopupWindow(TAknPopupWindowLayoutDef &aDef, 00208 TInt num, 00209 TBool heading); 00213 IMPORT_C static void SetupPopupSNoteGroupWindow(TAknPopupWindowLayoutDef &aDef, 00214 TInt num, 00215 TBool heading); 00216 00217 00218 public: // interface to setup listbox and popup heading pane. (used by HandleSizeChanged) 00219 IMPORT_C static void HandleSizeAndPositionOfComponents(const TAknPopupWindowLayoutDef &aDef, 00220 CCoeControl *aContentInsidePopup, 00221 CAknPopupHeadingPane *aHeadingOrNull); 00222 IMPORT_C static void SetupDefaults(TAknPopupWindowLayoutDef &aDef); 00223 public: // Utilities 00227 IMPORT_C static TRect WindowRect(TAknPopupWindowLayoutDef &aDef); 00231 IMPORT_C static TRect MenuRect(TAknPopupWindowLayoutDef &aDef); 00235 IMPORT_C static void CheckRange(TInt &aValue, TInt aMin, TInt aMax); 00239 IMPORT_C static void MenuPopupWindowGraphics(TAknPopupWindowLayoutDef &aDef); 00240 00241 static TRect RectFromLayout(TRect aParent, const TAknWindowComponentLayout &aComponentLayout); 00242 }; 00243 00249 struct TAknPopupWindowLayoutDef 00250 { 00251 EXPORT_C TAknPopupWindowLayoutDef(); 00252 TAknLayoutRect iListRect; 00253 TAknLayoutRect iHeadingRect; 00254 00255 TAknLayoutRect iCover; 00256 TAknLayoutRect iSecond; 00257 TAknLayoutRect iFirst; 00258 TAknLayoutRect iOutline; 00259 TAknLayoutRect iInside; 00260 00261 TAknLayoutRect iVertLineExt1; 00262 TAknLayoutRect iVertLineExt2; 00263 00264 // the window position relative to clientrect 00265 TRect iWindowRect; 00266 00267 // popup_menu_window position relative to iWindowPos 00268 TPoint iPopupMenuWindowOffset; 00269 TInt iMaximumHeight; 00270 }; 00271 00272 #endif 00273 00274 00275