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 * Contains the View and the Component of the photoalbum picture grid
22 #ifndef __CAknGMSStyleGrid_h
23 #define __CAknGMSStyleGrid_h
31 // ============================================================================
32 // CAknGMSStyleGridView
33 // ============================================================================
36 the view for the grid component.
38 class CAknGMSStyleGridView : public CAknGridView
40 public: // from CAknGridView
41 IMPORT_C CAknGMSStyleGridView();
42 public: // from CAknGridView
44 draws the hor. and vert. lines.
46 IMPORT_C void Draw(const TRect* aClipRect = NULL) const;
47 public: // new methods
49 sets the rectangle for the drawing operations.
50 This method is called when the grid is constructed.
52 IMPORT_C void SetupLayout(const TRect& aRect, TBool aIsPopup = EFalse, TInt aNum = -1);
53 private: // overridden from CListBoxView
54 IMPORT_C virtual TAny* Reserved_1();
56 private: // new methods
58 Calculate maximum number of horizontal lines
60 TInt MaxNumOfHorLines() const;
63 Calculate maximum number of vertical lines
65 TInt MaxNumOfVerLines() const;
68 TAknLayoutRect iHorLine[5];
69 TAknLayoutRect iVerLine[3];
74 // ============================================================================
76 // ============================================================================
78 implements the grid for the PhotoAlbum
79 A markable grid_large_graphic_pane, with 2 columns. The cell displays
83 class CAknGMSStyleGrid : public CAknSelectionGridTypedef
88 * @param aParent A parent used to find a window for the grid.
89 * @param aIsPopup Whether a popup layout or main pane layout is used
91 IMPORT_C static CAknGMSStyleGrid* NewL(const CCoeControl* aParent, TBool aIsPopup = EFalse);
93 do not use this, use NewL
94 aIsPopup = EFalse is default.
96 IMPORT_C CAknGMSStyleGrid();
98 * @param aIsPopup Whether a popup layout is used or not
100 IMPORT_C CAknGMSStyleGrid(TBool aIsPopup);
102 * 2nd phase of construction.
103 * @param aParent the parent compound control
104 * @param aRows desired rows of grid
105 * @param aCols desired cols of grid
107 IMPORT_C void ConstructL(const CCoeControl* aParent, TInt aRows=4, TInt aCols=2);
112 IMPORT_C ~CAknGMSStyleGrid();
115 * Sets the layout of the grid view
117 IMPORT_C void SetupLayout();
121 * Handles pointer events
123 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
125 public: // from CAknGrid
127 * layouts and repaints the grid
129 IMPORT_C void SizeChanged();
132 * Decides size of the grid for dialogs.
134 IMPORT_C TSize MinimumSize();
137 * Offers key events to parent class.
138 * @param aKeyEvent kind of key event
139 * @param aType key typed
141 IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
144 * Defines a grid cell size
145 * @return size of a grid cell
147 static TSize KCELL_SIZE();
151 * @param aRect the rectangle to draw.
153 IMPORT_C void Draw(const TRect& aRect) const;
156 * Overriden from CAknGrid. Create the grid view for thus grid class.
157 * @ return the grid view
159 IMPORT_C CListBoxView* MakeViewClassInstanceL();
163 * Are we a popup window or main pane window, ETrue = popup window.
171 IMPORT_C void* ExtensionInterface( TUid aInterface );
175 * a helper method for logging calls
177 static void _LOG(const TDesC& aText);
184 * The window part of a gms grid.
186 class CAknGMSPopupGrid : public CAknPopupList
190 * Creates a window for the grid.
191 * @param aListBox The grid used.
192 * @param aCbaResource The softkeys used.
193 * @param aType The layout used
195 IMPORT_C static CAknGMSPopupGrid* NewL(CEikListBox* aListBox, TInt aCbaResource, AknPopupLayouts::TAknPopupLayouts aType=AknPopupLayouts::EMenuWindow);
198 * Setup the whole window layout; window position, grid and heading position, shadow for the window.
199 * @param aLayoutId A choice of layout -- not used by the implementation.
201 IMPORT_C void SetupWindowLayout(AknPopupLayouts::TAknPopupLayouts);
203 * Calculate grid window position
205 IMPORT_C static void CalcPopupGridLargeGraphicWindow(TAknPopupWindowLayoutDef &aDef, TRect aClientRect, TInt aNumberOfLinesInListBox);
207 * Calculate grid and heading position
209 IMPORT_C static void SetupPopupGridLargeGraphicWindow(TAknPopupWindowLayoutDef &aDef,
210 TInt aNumberOfLinesInListBox,
213 * Setup shadow for the window.
215 IMPORT_C static void PopupGridLargeGraphicGraphics(TAknPopupWindowLayoutDef &aDef);
219 * Handles pointer events
221 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
227 IMPORT_C void* ExtensionInterface( TUid aInterface );
230 #endif // __CAknGMSStyleGrid_h