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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * This file defines the CAknColourSelectionGrid class
21 #ifndef __AKNCOLOURSELECTIONGRID_H
22 #define __AKNCOLOURSELECTIONGRID_H
26 #include <AknDialog.h>
30 // FORWARD DECLARATIONS
34 class CAknColourSelectionGridExtension;
39 * Colour selection grid
41 * This class can be used when application offers to user
42 * possibility to choose colour. There is also possibility to select
47 * TBool noneExist = ETrue;
48 * TBool noneChosen = EFalse;
49 * TRgb colour = KRgbDarkGray;
50 * CArrayFixFlat<TRgb>* colours = new(ELeave) CArrayFixFlat<TRgb>(6);
52 * colours->AppendL(KRgbBlack);
53 * colours->AppendL(KRgbDarkGray);
55 * CAknColourSelectionGrid *d = CAknColourSelectionGrid::NewL(
68 NONSHARABLE_CLASS(CAknColourSelectionGrid) : public CAknDialog, public MEikListBoxObserver
70 public: // Constructors and destructor
73 * Two-phased constructor.
75 * NewL() Creates dialog
79 * @param aColours array of colors for grid
81 * @param aNoneExist boolean flag does none exist in dialog
83 * @param aNoneChosen Dialog sets boolean value is none chosen
84 * If value is EFalse in start, some colour will be active in start
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
91 IMPORT_C static CAknColourSelectionGrid* NewL(
92 CArrayFixFlat<TRgb> *aColours,
98 * ExecuteLD() runs dialog, waits user to make his choise
103 IMPORT_C TBool ExecuteLD();
106 private: // Constructor
108 * C++ default constructor.
110 CAknColourSelectionGrid();
113 public: // Destructor
117 IMPORT_C ~CAknColourSelectionGrid();
121 private: // New functions
124 * Grid() returns control to grid
127 * @return Control to grid
129 CAknGrid *Grid() const;
132 private: // Functions from base classes
141 * @return was the key event handled
143 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) ;
148 * If ok is pressed, writes values for iColorChosen and iNoneChosen
152 * @return allways ETrue
154 TBool OkToExitL(TInt aKeycode);
160 void PreLayoutDynInitL();
165 void PostLayoutDynInitL();
169 * @param aControlType
170 * @return created control
172 SEikControlInfo CreateCustomControlL(TInt aControlType);
177 * @param aSize not in use
179 virtual void SetSizeAndPosition(const TSize& aSize);
185 virtual void ActivateL();
189 * From MEikListBoxObserver
190 * Handles list box events
191 * @param aListBox pointer to observed listbox
192 * @param aEventType Event to be handled
194 void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
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
203 void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
206 * From MDialogPageObserver
207 * Handles dialogpage events
208 * @param aEventID event to be handled
210 void HandleDialogPageEventL(TInt aEventID);
215 * Handles pointer events
217 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
221 CNoneField* iNoneBox;
227 CArrayFixFlat<TRgb>* iColours;
228 TInt iWsBufferRequestID;
229 CAknColourSelectionGridExtension *iExtension;
232 #endif // __AKNCOLOURSELECTIONGRID_H