Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
2 * Copyright (c) 1997-2009 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.
19 #if !defined(__EIKCAPC_H__)
22 #if !defined(__COECNTRL_H__)
26 #if !defined(__FEPBASE_H__)
30 #if !defined(__EIKLABEL_H__)
37 #include <AknControl.h>
41 // Forward declaration of types used in layout routines.
46 class CEikSecretEditor;
48 class CEikCapCExtension;
49 class MPointerEventObserver;
50 class MAknsControlContext;
54 * CaptionedControl is part of the dialogs. All dialogs and forms use captionedcontrol
55 * as a control for one DLG_LINE. Each DLG_LINE has one captionedcontrol in it.
57 * Rectangle of the captionedcontrol is single form field / form line or DLG_LINE's
58 * rectangle dependent on the dialog type.
60 class CEikCaptionedControl : public CAknControl, public MCoeCaptionRetrieverForFep, public MCoeControlObserver
62 friend class CEikCapCExtension;
64 enum TSpaceSharingFlags
66 EIfTooSmallCtlGetsWidthLast =0x0,
67 EIfTooSmallCtlGetsWidthFirst =0x1,
68 EIfTooSmallCtlGetsEqualShareOfWidth =0x2,
69 EIfTooBigCtlStaysMinHeight =0x4,
70 EIfTooBigCtlStaysMinWidth =0x8,
71 EIfTooBigCtlStaysMinSize =0xc,
72 EIfTooSmallDontStrech =0x10
74 enum TCaptionExpandingState
84 IMPORT_C CEikCaptionedControl();
87 IMPORT_C ~CEikCaptionedControl();
88 public: // new functions
89 /** SetUsesEars() sets a flag Uses Ears.
91 IMPORT_C void SetUsesEars();
92 /** SetSpaceSharingFlags() sets flags for space sharing
94 IMPORT_C void SetSpaceSharingFlags(TInt aFlags);
95 /** SetExtraAscent() modifies layout to include extra ascent for fonts
97 IMPORT_C void SetExtraAscent();
98 /** SetCaptionL() Sets label of the DLG_LINE
99 * @param aText Descriptor
101 IMPORT_C void SetCaptionL(const TDesC& aText);
102 /** SetTrailerL() Sets trailer
104 * @param aText Descriptor
106 IMPORT_C void SetTrailerL(const TDesC& aText);
107 /** Sets the captionedcontrol to be currently focused or not
108 * @param aSelected whether captionedcontrol is focused
110 IMPORT_C void SetCurrent(TBool aSelected);
111 /** Updates captionedcontrol's dimmed state
113 IMPORT_C void CheckDimmedDisplayState();
114 /** Sets minimumsizes to zero
116 IMPORT_C void ResetMinimumSizes();
117 /** Whether captionedcontrol is latent
119 * @return true if is latent
121 IMPORT_C TBool IsLatent() const;
122 /** Sets captionedcontrol latent status
124 IMPORT_C void SetLatent(TBool aLatent);
125 /** Whether captionedcontrol has latent group following it
126 * @returns true if has latent group following
128 IMPORT_C TBool LatentGroupLineFollows() const;
129 /** Sets latent group following flag
130 * @param aLglf true if latent group following
132 IMPORT_C void SetLatentGroupLineFollows(TBool aLglf);
133 /** Whether there is a divider after the captionedcontrol
135 IMPORT_C TBool DividerAfter() const;
136 /** Sets divider after the captionedcontrol
138 IMPORT_C void SetDividerAfter(TBool aDividerAfter);
139 /** Whether captionedcontrol consumes enter key
141 IMPORT_C TBool TakesEnterKey() const;
142 /** Sets captionedcontrol to take enter key
143 * @param aTakesEnter true if takes enter key, false if not
145 IMPORT_C void SetTakesEnterKey(TBool aTakesEnter);
146 /** Whether offers hot keys
147 * @return boolean true if offers hotkeys
149 IMPORT_C TBool OfferHotKeys() const;
150 /** Sets captionedcontrol to offer hotkeys
152 IMPORT_C void SetOfferHotKeys(TBool aOffer);
156 * From MCoeControlObserver:
157 * Acts upon changes in the hosted control's state.
159 * This class's implementation handles events from MFNE editor editing
160 * buttons in touch enabled builds
162 * @param aControl The control changing its state (not used)
163 * @param aEventType The type of control event
165 IMPORT_C virtual void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
168 TInt MaximumNumberOfControlLinesOnVisiblePage() const;
169 TInt NumberOfLines() const;
170 TInt NumberOfLinesForScrollBar() const;
172 TBool ControlIsAnEdwin(TInt aControlType) const;
173 TBool ControlIsAMfne(TInt aControlType) const;
174 TBool ControlIsAPopfield(TInt aControlType) const;
175 TBool ControlIsASecretEditor(TInt aControlType) const;
176 TBool ControlIsASlider(TInt aControlType) const;
177 TBool ControlIsAColourSelGrid(TInt aControlType) const;
178 TInt ControlType() const;
180 public: // from CCoeControl
181 /** MinimumSize() returns minimum size of the control
183 IMPORT_C TSize MinimumSize();
184 /** ConstructFromResourceL() constructs the captionedcontrol from DLG_LINE resource
186 * usually called with the following code:
187 * TResourceReader reader;
188 * iCoeEnv->CreateResourceReaderLC(reader, resId);
189 * control->ConstructFromResourceL(reader);
190 * CleanupStack::PopAndDestroy();
192 IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
193 /** OfferKeyEventL() handles key events
195 IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
196 /** GetColorUseListL() gets color use list
198 IMPORT_C virtual void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const; // not available before Release 005u
199 /** HandleResourceChange handles several kinds of resource change event
201 IMPORT_C virtual void HandleResourceChange(TInt aType); // not available before Release 005u
202 /** Provides ability to get input capabilities needed for fep
204 IMPORT_C TCoeInputCapabilities InputCapabilities() const;
205 /** SetDimmed sets captionedcontrol to dimmed state
207 IMPORT_C void SetDimmed(TBool aDimmed);
208 /** HandlePointerEventL handles touch pointer events
210 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
212 void RegisterPageWithCaptionControl(CEikDialogPage* aPage);
214 public: // internal layout properties
215 //void SetProperties(const TRegion &aRegion, const RArray<TCapCProperty> &aProperties);
216 //TRect Line(TInt aLineIndex); // text line rectangles
217 //TInt LineIndex(TPoint aPoint);
218 //TPoint LineControlPoint(TInt aLineIndex);
219 //RArray<TInt> LineIndexesIntersecting(TRect aRect);
220 //void SetProperty(TInt aLine, TCapCProperty &aProperty);
221 //void ClearProperty(TInt aLine, TCapCProperty &aProperty);
222 //TCapCProperty Properties(TInt aLine);
223 //void LineRegions(TRegion &aRegion);
224 //void SetVisibleArea(TRect aRect);
225 //void RemoveVisibleArea();
226 private: // from CCoeControl
227 IMPORT_C TInt CountComponentControls() const;
228 IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const;
229 IMPORT_C void SizeChanged();
230 IMPORT_C void FocusChanged(TDrawNow aDrawNow);
231 protected: // from CCoeControl
232 IMPORT_C void Draw(const TRect& aRect) const;
233 IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
234 private: // from CCoeControl
235 IMPORT_C void Reserved_2();
236 // from MCoeCaptionRetrieverForFep
237 IMPORT_C virtual void GetCaptionForFep(TDes& aCaption) const;
238 IMPORT_C virtual void MCoeCaptionRetrieverForFep_Reserved_1();
239 IMPORT_C virtual void MCoeCaptionRetrieverForFep_Reserved_2();
244 IMPORT_C void* ExtensionInterface( TUid aInterface );
246 protected: // from MObjectProvider
247 IMPORT_C TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
250 /** SetToolTipTextL() sets tooltip text
251 * @param aText descriptor for tooltip text
254 IMPORT_C void SetToolTipTextL( const TDesC& aText ) ;
255 /** Ability to query tooltip text string
257 IMPORT_C const TDesC* ToolTipText() const ;
258 /** SetBitmapFromFileL() sets icon contents for the captionedcontrol
260 IMPORT_C void SetBitmapFromFileL( const TDesC& aFilename,TInt aMainId,TInt aMaskId =-1 ) ;
261 /** SetEditable sets captionedcontrol to editable state
263 IMPORT_C void SetEditableL( TBool aEditable, TBool aShowEmptyFields = ETrue ) ;
265 IMPORT_C void SetFormFlags( TInt aFlags ) ;
266 void GetAknLayoutValuesL() ; // Visible within DLL only.
267 TBool HasSeparator() const;
268 /** GetFullCaptionText() gets caption descriptor
271 IMPORT_C const TPtrC GetFullCaptionText() const;
272 TBool IsDisplayable() const;
274 * Allows clients of CEikCaptionedControl to turn off drawing
275 * of white background of captionedcontrol.
279 IMPORT_C void SetDrawNoWhiteBackground(TBool aEnabled); // for list queries with find.
282 * In case of an editor control residing in a form,
283 * sets up a pictograph animation callback to redraw the form highlight
284 * control when pictograph animations are updated.
286 void SetPictographCallBack();
289 * Sets icon and sets its size.
290 * @param aBitmap a bitmap which has already been loaded. Must not be NULL.
291 * @param aMask a mask bitmap which has already been loaded. Can be NULL.
292 * Takes ownership of the bitmap objects.
295 IMPORT_C void SetIconL( CFbsBitmap* aBitmap, CFbsBitmap* aMask );
298 * Sets one of the two small indicator icons
299 * @param aIcon a index 0 or 1 depending on which icon to set
300 * @param aBitmap a bitmap pointer or NULL
301 * @param aMask a mask pointer or NULL
303 IMPORT_C void SetIndicatorIconL( TInt aIcon, CFbsBitmap *aBitmap, CFbsBitmap *aMask );
305 /** SetPointerEventObserver
306 * Low level observer for touch related pointer events.
307 * This can be used to receive low level pointer events.
309 IMPORT_C void SetPointerEventObserver(MPointerEventObserver *aObserver);
310 MPointerEventObserver *PointerEventObserver() const;
312 TRect ViewRect() const;
313 TRect EditRect() const;
323 private: // new functions
324 TInt WidthForEars(TInt aWidthRemaining) const;
325 void DrawEarsNow(TWhichEars aEar) const;
326 void DrawEars(TWhichEars aEar) const;
327 void DrawSingleEar(TWhichEars aEar,TBool aPressed) const;
328 TRect EarRect(TWhichEars aEar) const;
329 void FireEarL(TWhichEars aEar,TInt aEarRepeat);
330 TInt SquashComponentWidth(TInt& aTotalWidth,const TInt aComponentWidthHint);
331 void StretchComponents();
332 void SetVertEdgeSpacing( TInt aVertEdgeSpacing );
333 void SetHorzEdgeSpacing( TInt aHorzEdgeSpacing );
334 void SquashComponents();
335 void CalculateNumberOfLinesForControl( TInt aLines ) ;
336 void SizeDialogComponents() ;
337 void PositionDialogComponents() ;
338 static TInt PictographAnimationCallBack( TAny* aPtr );
340 * Sets a size for a bitmap that has already been loaded.
343 void SetIconSizeL(CFbsBitmap* aBitmap);
345 * Gets control context for the given control
346 * @param aDialog a dialog to get context for
347 * If aDialog provided does not exist, TODO
349 MAknsControlContext* GetDialogControlContext(const CCoeControl* aDialog) const;
352 * Searches recursively for control's parents until it finds a window owning control
354 const CCoeControl* WindowOwningParent() const;
358 * Positions form components in accordance with dialog page flags.
359 * If the dialog instance is not registered, them flags set with SetFormFlags() are used.
361 void PositionFormComponents();
362 void ScrollBackEditor();
365 void DrawClosingLine() const;
366 const CEikDialogPage* DialogPage() const { return iDialogPage; }
367 void SetPartiallyVisible( TBool aPVisible );
368 TBool PressedDownState() const;
369 void SetPressedDownState( TBool aPressed );
371 TSize EditorControlSize() const ;
372 void SetElementBrushColorsL( TRgb aColor ) ;
373 void SetElementTextColorsL( TRgb aColor ) ;
375 TBool ShowBitmap() const;
376 void LayoutBitmap(const TRect& aRect);
377 void LayoutCaption(const TRect& aRect);
378 void DoFormCaptionSettingsL(const TDesC& aText);
380 static void FormLayoutControlBitmap(CEikImage* aBitmap, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines);
381 static void FormLayoutControlEdwin(CEikEdwin* aEdwin, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines, TBool aBitmapPresent, TBool aIsFocused);
382 static void FormLayoutControlLabel(CEikLabel* aSlider, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines, TBool aLayoutWithBitmap, TBool aIsFocused, TInt aIconCount);
383 static void FormLayoutControlMfne(CEikMfne* aMfne, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines, TBool aBitmapPresent, TBool aIsFocused );
384 static void FormLayoutControlPopfield(CAknPopupField* aPopfield, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines, TBool aBitmapPresent, TBool aIsFocused);
385 static void FormLayoutControlSecretEditor(CEikSecretEditor* aSecretEd, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines, TBool aBitmapPresent, TBool aIsFocused );
386 static void FormLayoutControlSlider(CAknSlider* aSlider, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines, TBool aBitmapPresent);
387 static void ConvertViewRectToEditRect(TRect& aRect);
388 static void ConvertEditRectToViewRect(TRect& aRect);
392 * Access method for use in a CAknForm context.
394 * @return Enumeration for layout for the CAknForm
395 * Layout value is received from owning CEikDialogPage, if it is not defined then EEikFormUseDoubleSpacedFormat flag is checked.
396 * Default value is CEikDialogPage::ESingle
398 CEikDialogPage::TFormLayoutSelection FormLayout() const;
401 * Draws the separator between (at the top of current ) caption control(s)
403 * @param gc Current graphics contect
405 void DrawFormSeparator( CWindowGc& gc ) const;
408 * Constructs the extension object.
409 * There is no base constructL, so it is necessary to call this in several places
411 void ConstructExtensionL() ;
413 void DrawAsSkinnedForm( CWindowGc& aGc, const TRect& aRect ) const;
414 void LayoutSkinControlContexts();
415 TBool DrawingSkins() const;
416 void DrawAsForm( const TRect& aRect ) const;
417 void DrawAsEikonDialog( const TRect& aRect ) const;
418 void DrawAsFormInEditMode( const TRect& aRect ) const;
419 void DrawAsFormInViewMode( const TRect& aRect ) const;
420 void DrawAsFormUnFocusedLine( const TRect& aRect ) const;
423 CCoeControl* iControl;
424 CEikCapCLabel* iCaption;
431 TBool iIsFormControl ;
436 TBool iHasAppendedEditIndicator;
443 TBool iDoNotDisplay ;
445 TInt iVertEdgeSpacing ;
446 TInt iHorzEdgeSpacing ;
447 TInt iOriginalHeight ;
449 TSize iEditorControlSize ;
450 TInt iNumberOfLines ;
452 friend class CEikCapCArray;
454 enum { ENotSupplied = -1 } ;
459 TInt iCaptionFontId ;
461 TInt iVerticalLineXPosition; //iAknTopSpacing ;
462 CCoeControl* iHighlightControl;
463 CEikCapCExtension* iExtension ; // BC extension for additional Data members.
464 TInt iAknFormControlHeight ;
465 TInt iAknFormControlWidth ;
468 TBool iIsCurrentLine;
469 CEikDialogPage* iDialogPage;
476 * Special Label Class which appends colon to label text
479 NONSHARABLE_CLASS(CEikCapCLabel) : public CEikLabel
485 TBool ColonEnabled() const ;
486 void EnableColon( TBool aEnable ) ;
489 void Draw(const TRect& aRect) const ;
490 void DrawL(const TRect& aRect) ;
493 TBool iIsColonEnabled ;
496 class MPointerEventObserver
499 virtual bool PointerEvent(CEikCaptionedControl *aControl, const TPointerEvent& aPointerEvent)=0;