00001
00002
00003
00004
00005
00006 #if !defined(__EIKCAPC_H__)
00007 #define __EIKCAPC_H__
00008
00009 #if !defined(__COECNTRL_H__)
00010 #include <coecntrl.h>
00011 #endif
00012
00013 #if !defined(__FEPBASE_H__)
00014 #include <fepbase.h>
00015 #endif
00016
00017 #if !defined(__EIKLABEL_H__)
00018 #include <eiklabel.h>
00019 #endif
00020
00021 #include <eikdialg.h>
00022 #include <eikdpage.h>
00023
00024 #include <AknControl.h>
00025
00026 class CEikImage ;
00027 class CEikDialogPage;
00028
00029 class CAknPopupField;
00030 class CAknSlider;
00031 class CEikEdwin;
00032 class CEikMfne;
00033 class CEikSecretEditor;
00034 class CEikCapCLabel ;
00035 class CEikCapCExtension;
00036 class MPointerEventObserver;
00037 class MAknsControlContext;
00038
00047 class CEikCaptionedControl : public CAknControl, public MCoeCaptionRetrieverForFep, public MCoeControlObserver
00048 {
00049 friend class CEikCapCExtension;
00050 public:
00051 enum TSpaceSharingFlags
00052 {
00053 EIfTooSmallCtlGetsWidthLast =0x0,
00054 EIfTooSmallCtlGetsWidthFirst =0x1,
00055 EIfTooSmallCtlGetsEqualShareOfWidth =0x2,
00056 EIfTooBigCtlStaysMinHeight =0x4,
00057 EIfTooBigCtlStaysMinWidth =0x8,
00058 EIfTooBigCtlStaysMinSize =0xc,
00059 EIfTooSmallDontStrech =0x10
00060 };
00061 enum TCaptionExpandingState
00062 {
00063 EInitial = 0,
00064 EExtended =1,
00065 ERetracted =2
00066 };
00067
00068 public:
00071 IMPORT_C CEikCaptionedControl();
00074 IMPORT_C ~CEikCaptionedControl();
00075 public:
00078 IMPORT_C void SetUsesEars();
00081 IMPORT_C void SetSpaceSharingFlags(TInt aFlags);
00084 IMPORT_C void SetExtraAscent();
00088 IMPORT_C void SetCaptionL(const TDesC& aText);
00093 IMPORT_C void SetTrailerL(const TDesC& aText);
00097 IMPORT_C void SetCurrent(TBool aSelected);
00100 IMPORT_C void CheckDimmedDisplayState();
00103 IMPORT_C void ResetMinimumSizes();
00108 IMPORT_C TBool IsLatent() const;
00111 IMPORT_C void SetLatent(TBool aLatent);
00115 IMPORT_C TBool LatentGroupLineFollows() const;
00119 IMPORT_C void SetLatentGroupLineFollows(TBool aLglf);
00122 IMPORT_C TBool DividerAfter() const;
00125 IMPORT_C void SetDividerAfter(TBool aDividerAfter);
00128 IMPORT_C TBool TakesEnterKey() const;
00132 IMPORT_C void SetTakesEnterKey(TBool aTakesEnter);
00136 IMPORT_C TBool OfferHotKeys() const;
00139 IMPORT_C void SetOfferHotKeys(TBool aOffer);
00140
00141
00152 IMPORT_C virtual void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
00153
00154 public:
00155 TInt MaximumNumberOfControlLinesOnVisiblePage() const;
00156 TInt NumberOfLines() const;
00157 TInt NumberOfLinesForScrollBar() const;
00158 public:
00159 TBool ControlIsAnEdwin(TInt aControlType) const;
00160 TBool ControlIsAMfne(TInt aControlType) const;
00161 TBool ControlIsAPopfield(TInt aControlType) const;
00162 TBool ControlIsASecretEditor(TInt aControlType) const;
00163 TBool ControlIsASlider(TInt aControlType) const;
00164 TBool ControlIsAColourSelGrid(TInt aControlType) const;
00165 TInt ControlType() const;
00166
00167 public:
00170 IMPORT_C TSize MinimumSize();
00179 IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
00182 IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
00185 IMPORT_C virtual void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const;
00188 IMPORT_C virtual void HandleResourceChange(TInt aType);
00191 IMPORT_C TCoeInputCapabilities InputCapabilities() const;
00194 IMPORT_C void SetDimmed(TBool aDimmed);
00197 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00198 public:
00199 void RegisterPageWithCaptionControl(CEikDialogPage* aPage);
00200
00201 public:
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213 private:
00214 IMPORT_C TInt CountComponentControls() const;
00215 IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const;
00216 IMPORT_C void SizeChanged();
00217 IMPORT_C void FocusChanged(TDrawNow aDrawNow);
00218 protected:
00219 IMPORT_C void Draw(const TRect& aRect) const;
00220 IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
00221 private:
00222 IMPORT_C void Reserved_2();
00223
00224 IMPORT_C virtual void GetCaptionForFep(TDes& aCaption) const;
00225 IMPORT_C virtual void MCoeCaptionRetrieverForFep_Reserved_1();
00226 IMPORT_C virtual void MCoeCaptionRetrieverForFep_Reserved_2();
00227 private:
00231 IMPORT_C void* ExtensionInterface( TUid aInterface );
00232
00233 protected:
00234 IMPORT_C TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
00235
00236 public:
00241 IMPORT_C void SetToolTipTextL( const TDesC& aText ) ;
00244 IMPORT_C const TDesC* ToolTipText() const ;
00247 IMPORT_C void SetBitmapFromFileL( const TDesC& aFilename,TInt aMainId,TInt aMaskId =-1 ) ;
00250 IMPORT_C void SetEditableL( TBool aEditable, TBool aShowEmptyFields = ETrue ) ;
00251
00252 IMPORT_C void SetFormFlags( TInt aFlags ) ;
00253 void GetAknLayoutValuesL() ;
00254 TBool HasSeparator() const;
00258 IMPORT_C const TPtrC GetFullCaptionText() const;
00259 TBool IsDisplayable() const;
00266 IMPORT_C void SetDrawNoWhiteBackground(TBool aEnabled);
00267
00273 void SetPictographCallBack();
00274
00282 IMPORT_C void SetIconL( CFbsBitmap* aBitmap, CFbsBitmap* aMask );
00283
00290 IMPORT_C void SetIndicatorIconL( TInt aIcon, CFbsBitmap *aBitmap, CFbsBitmap *aMask );
00291
00296 IMPORT_C void SetPointerEventObserver(MPointerEventObserver *aObserver);
00297 MPointerEventObserver *PointerEventObserver() const;
00298 protected:
00299 TRect ViewRect() const;
00300 TRect EditRect() const;
00301
00302 private:
00303 enum TWhichEars
00304 {
00305 ENoEar=0x00,
00306 ELeftEar=0x01,
00307 ERightEar=0x02,
00308 EBothEars=0x03
00309 };
00310 private:
00311 TInt WidthForEars(TInt aWidthRemaining) const;
00312 void DrawEarsNow(TWhichEars aEar) const;
00313 void DrawEars(TWhichEars aEar) const;
00314 void DrawSingleEar(TWhichEars aEar,TBool aPressed) const;
00315 TRect EarRect(TWhichEars aEar) const;
00316 void FireEarL(TWhichEars aEar,TInt aEarRepeat);
00317 TInt SquashComponentWidth(TInt& aTotalWidth,const TInt aComponentWidthHint);
00318 void StretchComponents();
00319 void SetVertEdgeSpacing( TInt aVertEdgeSpacing );
00320 void SetHorzEdgeSpacing( TInt aHorzEdgeSpacing );
00321 void SquashComponents();
00322 void CalculateNumberOfLinesForControl( TInt aLines ) ;
00323 void SizeDialogComponents() ;
00324 void PositionDialogComponents() ;
00325 static TInt PictographAnimationCallBack( TAny* aPtr );
00330 void SetIconSizeL(CFbsBitmap* aBitmap);
00336 MAknsControlContext* GetDialogControlContext(const CCoeControl* aDialog) const;
00337
00341 const CCoeControl* WindowOwningParent() const;
00342
00343 public:
00348 void PositionFormComponents();
00349 void ScrollBackEditor();
00350
00351 public:
00352 void DrawClosingLine() const;
00353 const CEikDialogPage* DialogPage() const { return iDialogPage; }
00354 void SetPartiallyVisible( TBool aPVisible );
00355 TBool PressedDownState() const;
00356 void SetPressedDownState( TBool aPressed );
00357 private:
00358 TSize EditorControlSize() const ;
00359 void SetElementBrushColorsL( TRgb aColor ) ;
00360 void SetElementTextColorsL( TRgb aColor ) ;
00361
00362 TBool ShowBitmap() const;
00363 void LayoutBitmap(const TRect& aRect);
00364 void LayoutCaption(const TRect& aRect);
00365 void DoFormCaptionSettingsL(const TDesC& aText);
00366 private:
00367 static void FormLayoutControlBitmap(CEikImage* aBitmap, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines);
00368 static void FormLayoutControlEdwin(CEikEdwin* aEdwin, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines, TBool aBitmapPresent, TBool aIsFocused);
00369 static void FormLayoutControlLabel(CEikLabel* aSlider, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines, TBool aLayoutWithBitmap, TBool aIsFocused, TInt aIconCount);
00370 static void FormLayoutControlMfne(CEikMfne* aMfne, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines, TBool aBitmapPresent, TBool aIsFocused );
00371 static void FormLayoutControlPopfield(CAknPopupField* aPopfield, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines, TBool aBitmapPresent, TBool aIsFocused);
00372 static void FormLayoutControlSecretEditor(CEikSecretEditor* aSecretEd, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines, TBool aBitmapPresent, TBool aIsFocused );
00373 static void FormLayoutControlSlider(CAknSlider* aSlider, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines, TBool aBitmapPresent);
00374 static void ConvertViewRectToEditRect(TRect& aRect);
00375 static void ConvertEditRectToViewRect(TRect& aRect);
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385 CEikDialogPage::TFormLayoutSelection FormLayout() const;
00386
00392 void DrawFormSeparator( CWindowGc& gc ) const;
00393
00398 void ConstructExtensionL() ;
00399
00400 void DrawAsSkinnedForm( CWindowGc& aGc, const TRect& aRect ) const;
00401 void LayoutSkinControlContexts();
00402 TBool DrawingSkins() const;
00403 void DrawAsForm( const TRect& aRect ) const;
00404 void DrawAsEikonDialog( const TRect& aRect ) const;
00405 void DrawAsFormInEditMode( const TRect& aRect ) const;
00406 void DrawAsFormInViewMode( const TRect& aRect ) const;
00407 void DrawAsFormUnFocusedLine( const TRect& aRect ) const;
00408
00409 public:
00410 CCoeControl* iControl;
00411 CEikCapCLabel* iCaption;
00412 HBufC* iCaptionText;
00413
00414 CEikLabel* iTrailer;
00415 TInt iId;
00416 TInt iControlType;
00417 TAny* iReturnValue;
00418 TBool iIsFormControl ;
00419 CEikImage* iBitmap ;
00420 TBool iIsEditable ;
00421
00422 private:
00423 TBool iHasAppendedEditIndicator;
00424 TSize iMinSize;
00425 TInt iCapCFlags;
00426 TInt iCaptionWidth;
00427 TInt iFullWidth;
00428 TSize iNormalSize ;
00429 HBufC*iToolTipText ;
00430 TBool iDoNotDisplay ;
00431
00432 TInt iVertEdgeSpacing ;
00433 TInt iHorzEdgeSpacing ;
00434 TInt iOriginalHeight ;
00435
00436 TSize iEditorControlSize ;
00437 TInt iNumberOfLines ;
00438
00439 friend class CEikCapCArray;
00440
00441 enum { ENotSupplied = -1 } ;
00442 TInt iFlags ;
00443
00444 TBool iRefresh ;
00445
00446 TInt iCaptionFontId ;
00447 TInt iEditorFontId ;
00448 TInt iVerticalLineXPosition;
00449 CCoeControl* iHighlightControl;
00450 CEikCapCExtension* iExtension ;
00451 TInt iAknFormControlHeight ;
00452 TInt iAknFormControlWidth ;
00453 TInt iPenColor ;
00454 TInt iShadowColor ;
00455 TBool iIsCurrentLine;
00456 CEikDialogPage* iDialogPage;
00457
00458
00459 };
00460
00461
00462
00463
00464
00465
00466 NONSHARABLE_CLASS(CEikCapCLabel) : public CEikLabel
00467 {
00468 public :
00469 CEikCapCLabel() ;
00470 ~CEikCapCLabel() ;
00471
00472 TBool ColonEnabled() const ;
00473 void EnableColon( TBool aEnable ) ;
00474
00475 protected :
00476 void Draw(const TRect& aRect) const ;
00477 void DrawL(const TRect& aRect) ;
00478
00479 private:
00480 TBool iIsColonEnabled ;
00481 } ;
00482
00483 class MPointerEventObserver
00484 {
00485 public:
00486 virtual bool PointerEvent(CEikCaptionedControl *aControl, const TPointerEvent& aPointerEvent)=0;
00487 };
00488
00489 #endif