classicui_pub/grids_api/inc/AknGMSStyleGrid.h
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     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 *       Contains the View and the Component of the photoalbum picture grid
       
    16 *       component.
       
    17 *
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 #ifndef __CAknGMSStyleGrid_h
       
    23 #define __CAknGMSStyleGrid_h
       
    24 
       
    25 #include <AknGrid.h>
       
    26 #include <aknPopup.h>
       
    27 #include <aknlists.h>
       
    28 
       
    29 class CGulIcon;
       
    30 
       
    31 // ============================================================================
       
    32 // CAknGMSStyleGridView
       
    33 // ============================================================================
       
    34 
       
    35 /**
       
    36 	 the view for the grid component.
       
    37 */
       
    38 class CAknGMSStyleGridView : public CAknGridView
       
    39 	{
       
    40 public: // from CAknGridView
       
    41 	IMPORT_C CAknGMSStyleGridView();
       
    42 public: // from	CAknGridView
       
    43 	/**
       
    44 		draws the hor. and vert. lines.
       
    45 	*/
       
    46 	IMPORT_C void Draw(const TRect* aClipRect = NULL) const;
       
    47 public: // new methods
       
    48 	/**
       
    49 	 sets the rectangle for the drawing operations.
       
    50 	 This method is called when the grid is constructed.
       
    51 	 */
       
    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();
       
    55 
       
    56 private: // new methods
       
    57     /**
       
    58      Calculate maximum number of horizontal lines
       
    59      */
       
    60     TInt MaxNumOfHorLines() const;
       
    61 
       
    62     /**
       
    63      Calculate maximum number of vertical lines
       
    64      */
       
    65     TInt MaxNumOfVerLines() const;
       
    66 
       
    67 private: // data
       
    68 	TAknLayoutRect iHorLine[5];
       
    69 	TAknLayoutRect iVerLine[3];
       
    70 	const TRect* iRect;
       
    71 	};
       
    72 
       
    73 
       
    74 // ============================================================================
       
    75 // CAknGMSStyleGrid
       
    76 // ============================================================================
       
    77 /**
       
    78 	implements the grid for the PhotoAlbum
       
    79 	A markable grid_large_graphic_pane, with 2 columns. The cell displays
       
    80 	80x32 bitmaps.
       
    81 */
       
    82 
       
    83 class CAknGMSStyleGrid : public CAknSelectionGridTypedef
       
    84     {
       
    85 public:
       
    86     /**
       
    87      * Creates a gms grid
       
    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
       
    90      */
       
    91     IMPORT_C static CAknGMSStyleGrid* NewL(const CCoeControl* aParent, TBool aIsPopup = EFalse);
       
    92     /**
       
    93        do not use this, use NewL
       
    94        aIsPopup = EFalse is default.
       
    95     */
       
    96     IMPORT_C CAknGMSStyleGrid(); 
       
    97     /**
       
    98      * @param aIsPopup Whether a popup layout is used or not
       
    99      */
       
   100     IMPORT_C CAknGMSStyleGrid(TBool aIsPopup);
       
   101     /**
       
   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
       
   106 	*/
       
   107 	IMPORT_C void ConstructL(const CCoeControl* aParent, TInt aRows=4, TInt aCols=2);
       
   108 
       
   109 	/**
       
   110 		the destructor
       
   111 	*/
       
   112 	IMPORT_C ~CAknGMSStyleGrid();
       
   113 
       
   114     /**
       
   115      * Sets the layout of the grid view
       
   116      */
       
   117     IMPORT_C void SetupLayout();
       
   118 
       
   119     /**
       
   120      * From CCoeControl.     
       
   121      * Handles pointer events
       
   122      */
       
   123     IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); 
       
   124 
       
   125 public: // from CAknGrid
       
   126 	/**
       
   127 	 *	layouts and repaints the grid
       
   128 	 */
       
   129 	IMPORT_C void SizeChanged();
       
   130          
       
   131         /**
       
   132          * Decides size of the grid for dialogs.
       
   133          */
       
   134         IMPORT_C TSize MinimumSize();
       
   135 
       
   136 	/**
       
   137 	 * Offers key events to parent class.
       
   138 	 * @param aKeyEvent kind of key event
       
   139 	 * @param aType key typed
       
   140 	 */
       
   141 	IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
       
   142 
       
   143 	/**
       
   144 	 * Defines a grid cell size
       
   145 	 * @return size of a grid cell
       
   146 	 */
       
   147     static TSize KCELL_SIZE();
       
   148 
       
   149 	/**
       
   150 	 * Redraw the grid.
       
   151 	 * @param aRect the rectangle to draw.
       
   152 	 */
       
   153 	IMPORT_C void Draw(const TRect& aRect) const;
       
   154 	
       
   155 	/**
       
   156 	 * Overriden from CAknGrid. Create the grid view for thus grid class.
       
   157 	 * @ return the grid view
       
   158 	 */ 
       
   159         IMPORT_C CListBoxView* MakeViewClassInstanceL();
       
   160 
       
   161 protected:
       
   162     /**
       
   163      * Are we a popup window or main pane window, ETrue = popup window.
       
   164      */
       
   165     TBool iIsPopup;
       
   166     
       
   167 private:
       
   168     /**
       
   169     * From CAknControl
       
   170     */
       
   171     IMPORT_C void* ExtensionInterface( TUid aInterface );
       
   172 
       
   173 private:
       
   174 	/**
       
   175 	 *	a helper method for logging calls
       
   176 	 */	
       
   177 	static void _LOG(const TDesC& aText);
       
   178 
       
   179 private: // data
       
   180 
       
   181 };
       
   182 
       
   183 /** 
       
   184  * The window part of a gms grid.
       
   185  */
       
   186 class CAknGMSPopupGrid : public CAknPopupList
       
   187     {
       
   188 public:
       
   189     /**
       
   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
       
   194      */
       
   195     IMPORT_C static CAknGMSPopupGrid* NewL(CEikListBox* aListBox, TInt aCbaResource, AknPopupLayouts::TAknPopupLayouts aType=AknPopupLayouts::EMenuWindow);
       
   196 public:
       
   197     /**
       
   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.
       
   200      */
       
   201     IMPORT_C void SetupWindowLayout(AknPopupLayouts::TAknPopupLayouts);
       
   202     /**
       
   203      * Calculate grid window position
       
   204      */
       
   205     IMPORT_C static void CalcPopupGridLargeGraphicWindow(TAknPopupWindowLayoutDef &aDef, TRect aClientRect, TInt aNumberOfLinesInListBox);
       
   206     /**
       
   207      * Calculate grid and heading position
       
   208      */
       
   209     IMPORT_C static void SetupPopupGridLargeGraphicWindow(TAknPopupWindowLayoutDef &aDef, 
       
   210 				     TInt aNumberOfLinesInListBox, 
       
   211 				     TBool aHeading);
       
   212     /**
       
   213      * Setup shadow for the window.
       
   214      */
       
   215     IMPORT_C static void PopupGridLargeGraphicGraphics(TAknPopupWindowLayoutDef &aDef);
       
   216 
       
   217     /**
       
   218      * From CCoeControl.     
       
   219      * Handles pointer events
       
   220      */
       
   221     IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);    
       
   222 
       
   223 private:
       
   224     /**
       
   225     * From CAknControl
       
   226     */
       
   227     IMPORT_C void* ExtensionInterface( TUid aInterface );
       
   228     };
       
   229 
       
   230 #endif // __CAknGMSStyleGrid_h