epoc32/include/mw/akncolourselectiongrid.h
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
     1.1 --- a/epoc32/include/mw/akncolourselectiongrid.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/mw/akncolourselectiongrid.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,232 @@
     1.4 -akncolourselectiongrid.h
     1.5 +/*
     1.6 +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
     1.7 +* All rights reserved.
     1.8 +* This component and the accompanying materials are made available
     1.9 +* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
    1.10 +* which accompanies this distribution, and is available
    1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.12 +*
    1.13 +* Initial Contributors:
    1.14 +* Nokia Corporation - initial contribution.
    1.15 +*
    1.16 +* Contributors:
    1.17 +*
    1.18 +* Description: 
    1.19 +*      This file defines the CAknColourSelectionGrid class
    1.20 +*
    1.21 +*/
    1.22 +
    1.23 +
    1.24 +
    1.25 +#ifndef __AKNCOLOURSELECTIONGRID_H
    1.26 +#define __AKNCOLOURSELECTIONGRID_H
    1.27 +
    1.28 +//  INCLUDES
    1.29 +#include <e32base.h>
    1.30 +#include <AknDialog.h>
    1.31 +#include <eiklbo.h>
    1.32 +#include <coecobs.h>
    1.33 +
    1.34 +// FORWARD DECLARATIONS
    1.35 +class CColorGrid;
    1.36 +class CNoneField;
    1.37 +class CAknGrid;
    1.38 +class CAknColourSelectionGridExtension;
    1.39 +
    1.40 +// CLASS DECLARATION
    1.41 +
    1.42 +/**
    1.43 +* Colour selection grid
    1.44 +*
    1.45 +* This class can be used when application offers to user
    1.46 +* possibility to choose colour. There is also possibility to select
    1.47 +* nothing.
    1.48 +*
    1.49 +* use example:
    1.50 +*
    1.51 +* TBool noneExist = ETrue;
    1.52 +* TBool noneChosen = EFalse;
    1.53 +* TRgb  colour = KRgbDarkGray;
    1.54 +* CArrayFixFlat<TRgb>* colours = new(ELeave) CArrayFixFlat<TRgb>(6);
    1.55 +*
    1.56 +* colours->AppendL(KRgbBlack);
    1.57 +* colours->AppendL(KRgbDarkGray);
    1.58 +*
    1.59 +*   CAknColourSelectionGrid *d = CAknColourSelectionGrid::NewL(
    1.60 +*                                                 colours,
    1.61 +*                                                 noneExist,
    1.62 +*                                                 noneChosen,
    1.63 +*                                                 colour);
    1.64 +*
    1.65 +*   d->ExecuteLD();
    1.66 +*
    1.67 +*
    1.68 +*  @lib avkon
    1.69 +*  @since 2.0
    1.70 +*/
    1.71 +
    1.72 +NONSHARABLE_CLASS(CAknColourSelectionGrid) : public CAknDialog, public MEikListBoxObserver
    1.73 +    {
    1.74 +    public:  // Constructors and destructor
    1.75 +
    1.76 +        /**
    1.77 +        * Two-phased constructor.
    1.78 +        *
    1.79 +        * NewL() Creates dialog
    1.80 +        *
    1.81 +        * @since 2.0
    1.82 +        *
    1.83 +        * @param aColours array of colors for grid
    1.84 +        *
    1.85 +        * @param aNoneExist boolean flag does none exist in dialog
    1.86 +        *
    1.87 +        * @param aNoneChosen Dialog sets boolean value is none chosen
    1.88 +        * If value is EFalse in start, some colour will be active in start
    1.89 +        *
    1.90 +        * @param aColourChosen Dialog sets the value of color chosen
    1.91 +        * If starting value aNoneChosen is EFalse, starting value of
    1.92 +        * aColours tells witch colour is active when grid starts
    1.93 +        *
    1.94 +        */
    1.95 +        IMPORT_C static CAknColourSelectionGrid* NewL(
    1.96 +                            CArrayFixFlat<TRgb> *aColours,
    1.97 +                            TBool aNoneExist,
    1.98 +                            TBool& aNoneChosen,
    1.99 +                            TRgb& aColourChosen);
   1.100 +
   1.101 +        /**
   1.102 +        * ExecuteLD() runs dialog, waits user to make his choise
   1.103 +        * and destroys dialog
   1.104 +        *
   1.105 +        * @since 2.0
   1.106 +        */
   1.107 +        IMPORT_C TBool ExecuteLD();
   1.108 +
   1.109 +
   1.110 +    private: // Constructor
   1.111 +        /**
   1.112 +        * C++ default constructor.
   1.113 +        */
   1.114 +        CAknColourSelectionGrid();
   1.115 +
   1.116 +
   1.117 +    public: // Destructor
   1.118 +        /**
   1.119 +        * Destructor
   1.120 +        */
   1.121 +        IMPORT_C ~CAknColourSelectionGrid();
   1.122 +
   1.123 +
   1.124 +
   1.125 +    private: // New functions
   1.126 +
   1.127 +        /**
   1.128 +        * Grid() returns control to grid
   1.129 +        *
   1.130 +        * @since 2.0
   1.131 +        * @return Control to grid
   1.132 +        */
   1.133 +        CAknGrid *Grid() const;
   1.134 +
   1.135 +
   1.136 +    private: // Functions from base classes
   1.137 +        /**
   1.138 +        * From CAknDialog.
   1.139 +        *
   1.140 +        * Handles key events
   1.141 +        *
   1.142 +        * @since 2.0
   1.143 +        * @param aKeyEvent
   1.144 +        * @param aType
   1.145 +        * @return was the key event handled
   1.146 +        */
   1.147 +        TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) ;
   1.148 +
   1.149 +        /**
   1.150 +        * From CAknDialog.
   1.151 +        *
   1.152 +        * If ok is pressed, writes values for iColorChosen and iNoneChosen
   1.153 +        *
   1.154 +        * @since 2.0
   1.155 +        * @param aKeycode
   1.156 +        * @return allways ETrue
   1.157 +        */
   1.158 +        TBool OkToExitL(TInt aKeycode);
   1.159 +
   1.160 +        /**
   1.161 +        * From CEikDialog
   1.162 +        * @since 2.0
   1.163 +        */
   1.164 +        void  PreLayoutDynInitL();
   1.165 +        /**
   1.166 +        * From CEikDialog
   1.167 +        * @since 2.0
   1.168 +        */
   1.169 +        void  PostLayoutDynInitL();
   1.170 +        /**
   1.171 +        * From CEikDialog
   1.172 +        * @since 2.0
   1.173 +        * @param aControlType
   1.174 +        * @return created control
   1.175 +        */
   1.176 +        SEikControlInfo CreateCustomControlL(TInt aControlType);
   1.177 +
   1.178 +        /**
   1.179 +        * From CEikDialog
   1.180 +        * @since 2.0
   1.181 +        * @param aSize not in use
   1.182 +        */
   1.183 +        virtual void SetSizeAndPosition(const TSize& aSize);
   1.184 +
   1.185 +        /**
   1.186 +        * From CCoeControl
   1.187 +        * @since 2.0
   1.188 +        */
   1.189 +        virtual void ActivateL();
   1.190 +
   1.191 +
   1.192 +        /**
   1.193 +        * From MEikListBoxObserver
   1.194 +        * Handles list box events
   1.195 +        * @param aListBox pointer to observed listbox
   1.196 +        * @param aEventType Event to be handled
   1.197 +        */
   1.198 +        void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
   1.199 +
   1.200 +    public:
   1.201 +        /**
   1.202 +        * From MCoeControlObserver
   1.203 +        * Handles control events from nonebutton.
   1.204 +        * @param aControl Pointer to observed control
   1.205 +        * @param aEventType type of event to be handled
   1.206 +        */
   1.207 +        void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
   1.208 +
   1.209 +        /**
   1.210 +        * From MDialogPageObserver
   1.211 +        * Handles dialogpage events
   1.212 +        * @param aEventID event to be handled
   1.213 +        */
   1.214 +        void HandleDialogPageEventL(TInt aEventID);
   1.215 +
   1.216 +        /**
   1.217 +        * From CoeControl
   1.218 +        * @since 3.2
   1.219 +        * Handles pointer events
   1.220 +        */
   1.221 +        IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
   1.222 +
   1.223 +    private: // Data
   1.224 +        CColorGrid* iGrid;
   1.225 +        CNoneField* iNoneBox;
   1.226 +        TInt iIndex;
   1.227 +        CFbsBitmap* iBitmap;
   1.228 +        TBool iNoneExist;
   1.229 +        TBool* iNoneChosen;
   1.230 +        TRgb* iColourChosen;
   1.231 +        CArrayFixFlat<TRgb>* iColours;
   1.232 +        TInt iWsBufferRequestID;
   1.233 +        CAknColourSelectionGridExtension *iExtension;
   1.234 +    };
   1.235 +
   1.236 +#endif  // __AKNCOLOURSELECTIONGRID_H