classicui_plat/grids_api/inc/akncolourselectiongrid.h
changeset 45 667edd0b8678
equal deleted inserted replaced
37:89c890c70182 45:667edd0b8678
       
     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 *      This file defines the CAknColourSelectionGrid class
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __AKNCOLOURSELECTIONGRID_H
       
    22 #define __AKNCOLOURSELECTIONGRID_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include <e32base.h>
       
    26 #include <AknDialog.h>
       
    27 #include <eiklbo.h>
       
    28 #include <coecobs.h>
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CColorGrid;
       
    32 class CNoneField;
       
    33 class CAknGrid;
       
    34 class CAknColourSelectionGridExtension;
       
    35 
       
    36 // CLASS DECLARATION
       
    37 
       
    38 /**
       
    39 * Colour selection grid
       
    40 *
       
    41 * This class can be used when application offers to user
       
    42 * possibility to choose colour. There is also possibility to select
       
    43 * nothing.
       
    44 *
       
    45 * use example:
       
    46 *
       
    47 * TBool noneExist = ETrue;
       
    48 * TBool noneChosen = EFalse;
       
    49 * TRgb  colour = KRgbDarkGray;
       
    50 * CArrayFixFlat<TRgb>* colours = new(ELeave) CArrayFixFlat<TRgb>(6);
       
    51 *
       
    52 * colours->AppendL(KRgbBlack);
       
    53 * colours->AppendL(KRgbDarkGray);
       
    54 *
       
    55 *   CAknColourSelectionGrid *d = CAknColourSelectionGrid::NewL(
       
    56 *                                                 colours,
       
    57 *                                                 noneExist,
       
    58 *                                                 noneChosen,
       
    59 *                                                 colour);
       
    60 *
       
    61 *   d->ExecuteLD();
       
    62 *
       
    63 *
       
    64 *  @lib avkon
       
    65 *  @since 2.0
       
    66 */
       
    67 
       
    68 NONSHARABLE_CLASS(CAknColourSelectionGrid) : public CAknDialog, public MEikListBoxObserver
       
    69     {
       
    70     public:  // Constructors and destructor
       
    71 
       
    72         /**
       
    73         * Two-phased constructor.
       
    74         *
       
    75         * NewL() Creates dialog
       
    76         *
       
    77         * @since 2.0
       
    78         *
       
    79         * @param aColours array of colors for grid
       
    80         *
       
    81         * @param aNoneExist boolean flag does none exist in dialog
       
    82         *
       
    83         * @param aNoneChosen Dialog sets boolean value is none chosen
       
    84         * If value is EFalse in start, some colour will be active in start
       
    85         *
       
    86         * @param aColourChosen Dialog sets the value of color chosen
       
    87         * If starting value aNoneChosen is EFalse, starting value of
       
    88         * aColours tells witch colour is active when grid starts
       
    89         *
       
    90         */
       
    91         IMPORT_C static CAknColourSelectionGrid* NewL(
       
    92                             CArrayFixFlat<TRgb> *aColours,
       
    93                             TBool aNoneExist,
       
    94                             TBool& aNoneChosen,
       
    95                             TRgb& aColourChosen);
       
    96 
       
    97         /**
       
    98         * ExecuteLD() runs dialog, waits user to make his choise
       
    99         * and destroys dialog
       
   100         *
       
   101         * @since 2.0
       
   102         */
       
   103         IMPORT_C TBool ExecuteLD();
       
   104 
       
   105 
       
   106     private: // Constructor
       
   107         /**
       
   108         * C++ default constructor.
       
   109         */
       
   110         CAknColourSelectionGrid();
       
   111 
       
   112 
       
   113     public: // Destructor
       
   114         /**
       
   115         * Destructor
       
   116         */
       
   117         IMPORT_C ~CAknColourSelectionGrid();
       
   118 
       
   119 
       
   120 
       
   121     private: // New functions
       
   122 
       
   123         /**
       
   124         * Grid() returns control to grid
       
   125         *
       
   126         * @since 2.0
       
   127         * @return Control to grid
       
   128         */
       
   129         CAknGrid *Grid() const;
       
   130 
       
   131 
       
   132     private: // Functions from base classes
       
   133         /**
       
   134         * From CAknDialog.
       
   135         *
       
   136         * Handles key events
       
   137         *
       
   138         * @since 2.0
       
   139         * @param aKeyEvent
       
   140         * @param aType
       
   141         * @return was the key event handled
       
   142         */
       
   143         TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) ;
       
   144 
       
   145         /**
       
   146         * From CAknDialog.
       
   147         *
       
   148         * If ok is pressed, writes values for iColorChosen and iNoneChosen
       
   149         *
       
   150         * @since 2.0
       
   151         * @param aKeycode
       
   152         * @return allways ETrue
       
   153         */
       
   154         TBool OkToExitL(TInt aKeycode);
       
   155 
       
   156         /**
       
   157         * From CEikDialog
       
   158         * @since 2.0
       
   159         */
       
   160         void  PreLayoutDynInitL();
       
   161         /**
       
   162         * From CEikDialog
       
   163         * @since 2.0
       
   164         */
       
   165         void  PostLayoutDynInitL();
       
   166         /**
       
   167         * From CEikDialog
       
   168         * @since 2.0
       
   169         * @param aControlType
       
   170         * @return created control
       
   171         */
       
   172         SEikControlInfo CreateCustomControlL(TInt aControlType);
       
   173 
       
   174         /**
       
   175         * From CEikDialog
       
   176         * @since 2.0
       
   177         * @param aSize not in use
       
   178         */
       
   179         virtual void SetSizeAndPosition(const TSize& aSize);
       
   180 
       
   181         /**
       
   182         * From CCoeControl
       
   183         * @since 2.0
       
   184         */
       
   185         virtual void ActivateL();
       
   186 
       
   187 
       
   188         /**
       
   189         * From MEikListBoxObserver
       
   190         * Handles list box events
       
   191         * @param aListBox pointer to observed listbox
       
   192         * @param aEventType Event to be handled
       
   193         */
       
   194         void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
       
   195 
       
   196     public:
       
   197         /**
       
   198         * From MCoeControlObserver
       
   199         * Handles control events from nonebutton.
       
   200         * @param aControl Pointer to observed control
       
   201         * @param aEventType type of event to be handled
       
   202         */
       
   203         void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
       
   204 
       
   205         /**
       
   206         * From MDialogPageObserver
       
   207         * Handles dialogpage events
       
   208         * @param aEventID event to be handled
       
   209         */
       
   210         void HandleDialogPageEventL(TInt aEventID);
       
   211 
       
   212         /**
       
   213         * From CoeControl
       
   214         * @since 3.2
       
   215         * Handles pointer events
       
   216         */
       
   217         IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
       
   218 
       
   219     private: // Data
       
   220         CColorGrid* iGrid;
       
   221         CNoneField* iNoneBox;
       
   222         TInt iIndex;
       
   223         CFbsBitmap* iBitmap;
       
   224         TBool iNoneExist;
       
   225         TBool* iNoneChosen;
       
   226         TRgb* iColourChosen;
       
   227         CArrayFixFlat<TRgb>* iColours;
       
   228         TInt iWsBufferRequestID;
       
   229         CAknColourSelectionGridExtension *iExtension;
       
   230     };
       
   231 
       
   232 #endif  // __AKNCOLOURSELECTIONGRID_H