S60 3rd Edition API Reference: eikcapc.h Source File

eikcapc.h

Go to the documentation of this file.
00001 // EIKCAPC.H
00002 //
00003 // Copyright (c) 1997-1999 Symbian Ltd.  All rights reserved.
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 // Forward declaration of types used in layout routines.
00029 class CAknPopupField;
00030 class CAknSlider;
00031 class CEikEdwin;
00032 class CEikMfne; 
00033 class CEikSecretEditor;
00034 class CEikCapCLabel ;
00035 class CEikCapCExtension;
00036 
00045 class CEikCaptionedControl : public CAknControl, public MCoeCaptionRetrieverForFep, public MCoeControlObserver
00046     {
00047     friend class CEikCapCExtension;
00048 public:
00049     enum TSpaceSharingFlags
00050         {
00051         EIfTooSmallCtlGetsWidthLast         =0x0,
00052         EIfTooSmallCtlGetsWidthFirst        =0x1,
00053         EIfTooSmallCtlGetsEqualShareOfWidth =0x2,
00054         EIfTooBigCtlStaysMinHeight          =0x4,
00055         EIfTooBigCtlStaysMinWidth           =0x8,
00056         EIfTooBigCtlStaysMinSize            =0xc,
00057         EIfTooSmallDontStrech               =0x10
00058         };
00059     enum TCaptionExpandingState
00060         {
00061         EInitial = 0,
00062         EExtended =1,
00063         ERetracted =2
00064         };
00065 
00066 public:
00069     IMPORT_C CEikCaptionedControl();
00072     IMPORT_C ~CEikCaptionedControl();
00073 public: // new functions
00076     IMPORT_C void SetUsesEars();
00079     IMPORT_C void SetSpaceSharingFlags(TInt aFlags);
00082     IMPORT_C void SetExtraAscent();
00086     IMPORT_C void SetCaptionL(const TDesC& aText);
00091     IMPORT_C void SetTrailerL(const TDesC& aText);
00095     IMPORT_C void SetCurrent(TBool aSelected);
00098     IMPORT_C void CheckDimmedDisplayState();
00101     IMPORT_C void ResetMinimumSizes();
00106     IMPORT_C TBool IsLatent() const;
00109     IMPORT_C void SetLatent(TBool aLatent);
00113     IMPORT_C TBool LatentGroupLineFollows() const;
00117     IMPORT_C void SetLatentGroupLineFollows(TBool aLglf);
00120     IMPORT_C TBool DividerAfter() const;
00123     IMPORT_C void SetDividerAfter(TBool aDividerAfter);
00126     IMPORT_C TBool TakesEnterKey() const;
00130     IMPORT_C void SetTakesEnterKey(TBool aTakesEnter);
00134     IMPORT_C TBool OfferHotKeys() const;
00137     IMPORT_C void SetOfferHotKeys(TBool aOffer);
00138     
00139 
00150         IMPORT_C virtual void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
00151         
00152 public:
00153     TInt MaximumNumberOfControlLinesOnVisiblePage() const;
00154         TInt NumberOfLines() const;
00155 public:
00156     TBool ControlIsAnEdwin(TInt aControlType) const;
00157     TBool ControlIsAMfne(TInt aControlType) const;
00158     TBool ControlIsAPopfield(TInt aControlType) const;
00159     TBool ControlIsASecretEditor(TInt aControlType) const;
00160     TBool ControlIsASlider(TInt aControlType) const;
00161     TBool ControlIsAColourSelGrid(TInt aControlType) const;
00162         TInt ControlType() const;
00163 
00164 public: // from CCoeControl
00167     IMPORT_C TSize MinimumSize();
00176     IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
00179     IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
00182     IMPORT_C virtual void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const; // not available before Release 005u
00185     IMPORT_C virtual void HandleResourceChange(TInt aType);         // not available before Release 005u
00188     IMPORT_C TCoeInputCapabilities InputCapabilities() const;
00191     IMPORT_C void SetDimmed(TBool aDimmed);
00194     IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00195 public:
00196     void RegisterPageWithCaptionControl(const CEikDialogPage* aPage);
00197 
00198 public: // internal layout properties
00199         //void SetProperties(const TRegion &aRegion, const RArray<TCapCProperty> &aProperties);
00200         //TRect Line(TInt aLineIndex); // text line rectangles
00201         //TInt LineIndex(TPoint aPoint);
00202         //TPoint LineControlPoint(TInt aLineIndex);
00203         //RArray<TInt> LineIndexesIntersecting(TRect aRect);
00204         //void SetProperty(TInt aLine, TCapCProperty &aProperty);
00205         //void ClearProperty(TInt aLine, TCapCProperty &aProperty);
00206         //TCapCProperty Properties(TInt aLine);
00207         //void LineRegions(TRegion &aRegion);
00208         //void SetVisibleArea(TRect aRect);
00209         //void RemoveVisibleArea();
00210 private: // from CCoeControl
00211     IMPORT_C TInt CountComponentControls() const;
00212     IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const;
00213     IMPORT_C void SizeChanged();
00214     IMPORT_C void FocusChanged(TDrawNow aDrawNow);
00215 protected: // from CCoeControl
00216     IMPORT_C void Draw(const TRect& aRect) const;
00217     IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
00218 private: // from CCoeControl
00219     IMPORT_C void Reserved_2();
00220     // from MCoeCaptionRetrieverForFep
00221     IMPORT_C virtual void GetCaptionForFep(TDes& aCaption) const;
00222     IMPORT_C virtual void MCoeCaptionRetrieverForFep_Reserved_1();
00223     IMPORT_C virtual void MCoeCaptionRetrieverForFep_Reserved_2();
00224 private:
00228     IMPORT_C void* ExtensionInterface( TUid aInterface );
00229 
00230 protected: // from MObjectProvider
00231     IMPORT_C TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
00232 
00233 public:
00238     IMPORT_C void SetToolTipTextL( const TDesC& aText ) ;
00241     IMPORT_C const TDesC* ToolTipText() const ;
00244     IMPORT_C void SetBitmapFromFileL( const TDesC& aFilename,TInt aMainId,TInt aMaskId =-1 ) ;
00247     IMPORT_C void SetEditableL( TBool aEditable, TBool aShowEmptyFields = ETrue ) ;
00248     
00249     void SetFormFlags( TInt aFlags ) ;
00250     void GetAknLayoutValuesL() ;  // Visible within DLL only.
00251     TBool HasSeparator() const;
00255     IMPORT_C const TPtrC GetFullCaptionText() const;
00256     TBool   IsDisplayable() const;
00257     void ClearCaptionControlNow() const; // used to clear graphics area before deletion.
00264     IMPORT_C void SetDrawNoWhiteBackground(TBool aEnabled); // for list queries with find.
00265 
00271     void SetPictographCallBack();
00272     
00280     IMPORT_C void SetIconL( CFbsBitmap* aBitmap, CFbsBitmap* aMask ); 
00281 
00282 
00283 protected:
00284     TRect ViewRect() const;
00285     TRect EditRect() const;
00286 
00287 private:
00288     enum TWhichEars
00289         {
00290         ENoEar=0x00,
00291         ELeftEar=0x01,
00292         ERightEar=0x02,
00293         EBothEars=0x03
00294         };
00295 private: // new functions
00296     TInt WidthForEars(TInt aWidthRemaining) const;
00297     void DrawEarsNow(TWhichEars aEar) const;
00298     void DrawEars(TWhichEars aEar) const;
00299     void DrawSingleEar(TWhichEars aEar,TBool aPressed) const;
00300     TRect EarRect(TWhichEars aEar) const;
00301     void FireEarL(TWhichEars aEar,TInt aEarRepeat);
00302     TInt SquashComponentWidth(TInt& aTotalWidth,const TInt aComponentWidthHint);
00303     void StretchComponents();
00304     void SetVertEdgeSpacing( TInt aVertEdgeSpacing );
00305     void SetHorzEdgeSpacing( TInt aHorzEdgeSpacing );
00306     void SquashComponents();
00307     void CalculateNumberOfLinesForControl( TInt aLines ) ;
00308     void SizeDialogComponents() ;
00309     void PositionDialogComponents() ;
00310     static TInt PictographAnimationCallBack( TAny* aPtr );
00315     void SetIconSizeL(CFbsBitmap* aBitmap);
00316 
00317 public:
00318     void PositionFormComponents() ;
00319 public:
00320     void DrawClosingLine() const;
00321         const CEikDialogPage* DialogPage() const { return iDialogPage; }
00322 private:
00323     TSize EditorControlSize() const ;
00324     void SetElementBrushColorsL( TRgb aColor ) ;
00325     void SetElementTextColorsL( TRgb aColor ) ;
00326 
00327     TBool ShowBitmap() const;
00328     void  LayoutBitmap(const TRect& aRect);
00329     void  LayoutCaption(const TRect& aRect);
00330     void DoFormCaptionSettingsL(const TDesC& aText);
00331 private:
00332     static void FormLayoutControlBitmap(CEikImage* aBitmap, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines);
00333     static void FormLayoutControlEdwin(CEikEdwin* aEdwin, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines, TBool aBitmapPresent, TBool aIsFocused);
00334     static void FormLayoutControlLabel(CEikLabel* aSlider, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines, TBool aLayoutWithBitmap, TBool aIsFocused, TInt aIconCount);
00335     static void FormLayoutControlMfne(CEikMfne* aMfne,  const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines, TBool aBitmapPresent, TBool aIsFocused );
00336     static void FormLayoutControlPopfield(CAknPopupField* aPopfield, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines, TBool aBitmapPresent, TBool aIsFocused);
00337     static void FormLayoutControlSecretEditor(CEikSecretEditor* aSecretEd, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines, TBool aBitmapPresent, TBool aIsFocused );
00338     static void FormLayoutControlSlider(CAknSlider* aSlider, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines, TBool aBitmapPresent);
00339     static void ConvertViewRectToEditRect(TRect& aRect);
00340     static void ConvertEditRectToViewRect(TRect& aRect);
00341 
00348     CEikDialogPage::TFormLayoutSelection FormLayout() const;
00349 
00355     void DrawFormSeparator( CWindowGc& gc ) const;
00356 
00361     void ConstructExtensionL() ;
00362 
00363     void DrawAsSkinnedForm( CWindowGc& aGc, const TRect& aRect ) const;
00364     void LayoutSkinControlContexts();
00365     TBool DrawingSkins() const;
00366     void DrawAsForm( const TRect& aRect ) const;
00367     void DrawAsEikonDialog( const TRect& aRect ) const;
00368     void DrawAsFormInEditMode( const TRect& aRect ) const;
00369     void DrawAsFormInViewMode( const TRect& aRect ) const;
00370     void DrawAsFormUnFocusedLine( const TRect& aRect ) const;
00371 
00372 public:
00373     CCoeControl* iControl;
00374     CEikCapCLabel* iCaption;
00375     HBufC* iCaptionText;
00376 
00377     CEikLabel* iTrailer;
00378     TInt iId;
00379     TInt iControlType;
00380     TAny* iReturnValue;
00381     TBool iIsFormControl ;
00382     CEikImage* iBitmap ;
00383     TBool iIsEditable ;
00384 
00385 private:
00386     TBool iHasAppendedEditIndicator;
00387     TSize iMinSize;
00388     TInt  iCapCFlags;
00389     TInt  iCaptionWidth;
00390     TInt  iFullWidth;
00391     TSize iNormalSize ;
00392     HBufC*iToolTipText ;
00393     TBool iDoNotDisplay ;
00394 
00395     TInt iVertEdgeSpacing ;
00396     TInt iHorzEdgeSpacing ;
00397     TInt iOriginalHeight ;
00398 
00399     TSize iEditorControlSize ;
00400     TInt iNumberOfLines ;
00401 
00402     friend class CEikCapCArray;
00403 
00404     enum { ENotSupplied = -1 } ;
00405     TInt iFlags ;
00406 
00407     TBool iRefresh ;
00408 
00409     TInt iCaptionFontId ;
00410     TInt iEditorFontId ;
00411     TInt iVerticalLineXPosition; //iAknTopSpacing ;         
00412     CCoeControl* iHighlightControl;
00413     CEikCapCExtension* iExtension ;  // BC extension for additional Data members.
00414     TInt iAknFormControlHeight ;
00415     TInt iAknFormControlWidth ;
00416     TInt iPenColor ;
00417     TInt iShadowColor ;
00418     TBool iIsCurrentLine;
00419     const CEikDialogPage* iDialogPage;
00420 
00421 
00422     };
00423 
00424 
00425 /*
00426  * Special Label Class which appends colon to label text
00427  */
00428 
00429 NONSHARABLE_CLASS(CEikCapCLabel) : public CEikLabel
00430     {
00431 public :
00432     CEikCapCLabel() ;
00433     ~CEikCapCLabel() ;
00434 
00435     TBool ColonEnabled() const ;
00436     void EnableColon( TBool aEnable ) ;
00437 
00438 protected :
00439     void Draw(const TRect& aRect) const ;
00440     void DrawL(const TRect& aRect) ;
00441 
00442 private:
00443     TBool iIsColonEnabled ;
00444     } ;
00445 
00446 
00447 #endif

Copyright © Nokia Corporation 2001-2007
Back to top