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 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: // new functions
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: // from CCoeControl
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; // not available before Release 005u
00188     IMPORT_C virtual void HandleResourceChange(TInt aType);         // not available before Release 005u
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(const CEikDialogPage* aPage);
00200 
00201 public: // internal layout properties
00202         //void SetProperties(const TRegion &aRegion, const RArray<TCapCProperty> &aProperties);
00203         //TRect Line(TInt aLineIndex); // text line rectangles
00204         //TInt LineIndex(TPoint aPoint);
00205         //TPoint LineControlPoint(TInt aLineIndex);
00206         //RArray<TInt> LineIndexesIntersecting(TRect aRect);
00207         //void SetProperty(TInt aLine, TCapCProperty &aProperty);
00208         //void ClearProperty(TInt aLine, TCapCProperty &aProperty);
00209         //TCapCProperty Properties(TInt aLine);
00210         //void LineRegions(TRegion &aRegion);
00211         //void SetVisibleArea(TRect aRect);
00212         //void RemoveVisibleArea();
00213 private: // from CCoeControl
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: // from CCoeControl
00219     IMPORT_C void Draw(const TRect& aRect) const;
00220     IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
00221 private: // from CCoeControl
00222     IMPORT_C void Reserved_2();
00223     // from MCoeCaptionRetrieverForFep
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: // from MObjectProvider
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() ;  // Visible within DLL only.
00254     TBool HasSeparator() const;
00258     IMPORT_C const TPtrC GetFullCaptionText() const;
00259     TBool   IsDisplayable() const;
00260     void ClearCaptionControlNow() const; // used to clear graphics area before deletion.
00267     IMPORT_C void SetDrawNoWhiteBackground(TBool aEnabled); // for list queries with find.
00268 
00274     void SetPictographCallBack();
00275     
00283     IMPORT_C void SetIconL( CFbsBitmap* aBitmap, CFbsBitmap* aMask ); 
00284 
00291         IMPORT_C void SetIndicatorIconL( TInt aIcon, CFbsBitmap *aBitmap, CFbsBitmap *aMask );
00292 
00297         IMPORT_C void SetPointerEventObserver(MPointerEventObserver *aObserver);
00298         MPointerEventObserver *PointerEventObserver() const;
00299 protected:
00300     TRect ViewRect() const;
00301     TRect EditRect() const;
00302 
00303 private:
00304     enum TWhichEars
00305         {
00306         ENoEar=0x00,
00307         ELeftEar=0x01,
00308         ERightEar=0x02,
00309         EBothEars=0x03
00310         };
00311 private: // new functions
00312     TInt WidthForEars(TInt aWidthRemaining) const;
00313     void DrawEarsNow(TWhichEars aEar) const;
00314     void DrawEars(TWhichEars aEar) const;
00315     void DrawSingleEar(TWhichEars aEar,TBool aPressed) const;
00316     TRect EarRect(TWhichEars aEar) const;
00317     void FireEarL(TWhichEars aEar,TInt aEarRepeat);
00318     TInt SquashComponentWidth(TInt& aTotalWidth,const TInt aComponentWidthHint);
00319     void StretchComponents();
00320     void SetVertEdgeSpacing( TInt aVertEdgeSpacing );
00321     void SetHorzEdgeSpacing( TInt aHorzEdgeSpacing );
00322     void SquashComponents();
00323     void CalculateNumberOfLinesForControl( TInt aLines ) ;
00324     void SizeDialogComponents() ;
00325     void PositionDialogComponents() ;
00326     static TInt PictographAnimationCallBack( TAny* aPtr );
00331     void SetIconSizeL(CFbsBitmap* aBitmap);
00337     MAknsControlContext* GetDialogControlContext(const CCoeControl* aDialog) const;
00338 
00342     const CCoeControl* WindowOwningParent() const;
00343 
00344 public:
00349     void PositionFormComponents();
00350     
00351 public:
00352     void DrawClosingLine() const;
00353         const CEikDialogPage* DialogPage() const { return iDialogPage; }
00354 private:
00355     TSize EditorControlSize() const ;
00356     void SetElementBrushColorsL( TRgb aColor ) ;
00357     void SetElementTextColorsL( TRgb aColor ) ;
00358 
00359     TBool ShowBitmap() const;
00360     void  LayoutBitmap(const TRect& aRect);
00361     void  LayoutCaption(const TRect& aRect);
00362     void DoFormCaptionSettingsL(const TDesC& aText);
00363 private:
00364     static void FormLayoutControlBitmap(CEikImage* aBitmap, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines);
00365     static void FormLayoutControlEdwin(CEikEdwin* aEdwin, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines, TBool aBitmapPresent, TBool aIsFocused);
00366     static void FormLayoutControlLabel(CEikLabel* aSlider, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines, TBool aLayoutWithBitmap, TBool aIsFocused, TInt aIconCount);
00367     static void FormLayoutControlMfne(CEikMfne* aMfne,  const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines, TBool aBitmapPresent, TBool aIsFocused );
00368     static void FormLayoutControlPopfield(CAknPopupField* aPopfield, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines, TBool aBitmapPresent, TBool aIsFocused);
00369     static void FormLayoutControlSecretEditor(CEikSecretEditor* aSecretEd, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines, TBool aBitmapPresent, TBool aIsFocused );
00370     static void FormLayoutControlSlider(CAknSlider* aSlider, const TRect& aParent, TBool aIsEditable, TBool aSingleLayout, TInt aNumberOfLines, TBool aBitmapPresent);
00371     static void ConvertViewRectToEditRect(TRect& aRect);
00372     static void ConvertEditRectToViewRect(TRect& aRect);
00373 
00374     /*  
00375     *
00376     * Access method for use in a CAknForm context. 
00377     *
00378     * @return   Enumeration for layout for the CAknForm
00379     *           Layout value is received from owning CEikDialogPage, if it is not defined then EEikFormUseDoubleSpacedFormat flag is checked.
00380     *           Default value is CEikDialogPage::ESingle
00381     */
00382     CEikDialogPage::TFormLayoutSelection FormLayout() const;
00383 
00389     void DrawFormSeparator( CWindowGc& gc ) const;
00390 
00395     void ConstructExtensionL() ;
00396 
00397     void DrawAsSkinnedForm( CWindowGc& aGc, const TRect& aRect ) const;
00398     void LayoutSkinControlContexts();
00399     TBool DrawingSkins() const;
00400     void DrawAsForm( const TRect& aRect ) const;
00401     void DrawAsEikonDialog( const TRect& aRect ) const;
00402     void DrawAsFormInEditMode( const TRect& aRect ) const;
00403     void DrawAsFormInViewMode( const TRect& aRect ) const;
00404     void DrawAsFormUnFocusedLine( const TRect& aRect ) const;
00405 
00406 public:
00407     CCoeControl* iControl;
00408     CEikCapCLabel* iCaption;
00409     HBufC* iCaptionText;
00410 
00411     CEikLabel* iTrailer;
00412     TInt iId;
00413     TInt iControlType;
00414     TAny* iReturnValue;
00415     TBool iIsFormControl ;
00416     CEikImage* iBitmap ;
00417     TBool iIsEditable ;
00418 
00419 private:
00420     TBool iHasAppendedEditIndicator;
00421     TSize iMinSize;
00422     TInt  iCapCFlags;
00423     TInt  iCaptionWidth;
00424     TInt  iFullWidth;
00425     TSize iNormalSize ;
00426     HBufC*iToolTipText ;
00427     TBool iDoNotDisplay ;
00428 
00429     TInt iVertEdgeSpacing ;
00430     TInt iHorzEdgeSpacing ;
00431     TInt iOriginalHeight ;
00432 
00433     TSize iEditorControlSize ;
00434     TInt iNumberOfLines ;
00435 
00436     friend class CEikCapCArray;
00437 
00438     enum { ENotSupplied = -1 } ;
00439     TInt iFlags ;
00440 
00441     TBool iRefresh ;
00442 
00443     TInt iCaptionFontId ;
00444     TInt iEditorFontId ;
00445     TInt iVerticalLineXPosition; //iAknTopSpacing ;         
00446     CCoeControl* iHighlightControl;
00447     CEikCapCExtension* iExtension ;  // BC extension for additional Data members.
00448     TInt iAknFormControlHeight ;
00449     TInt iAknFormControlWidth ;
00450     TInt iPenColor ;
00451     TInt iShadowColor ;
00452     TBool iIsCurrentLine;
00453     const CEikDialogPage* iDialogPage;
00454 
00455 
00456     };
00457 
00458 
00459 /*
00460  * Special Label Class which appends colon to label text
00461  */
00462 
00463 NONSHARABLE_CLASS(CEikCapCLabel) : public CEikLabel
00464     {
00465 public :
00466     CEikCapCLabel() ;
00467     ~CEikCapCLabel() ;
00468 
00469     TBool ColonEnabled() const ;
00470     void EnableColon( TBool aEnable ) ;
00471 
00472 protected :
00473     void Draw(const TRect& aRect) const ;
00474     void DrawL(const TRect& aRect) ;
00475 
00476 private:
00477     TBool iIsColonEnabled ;
00478     } ;
00479 
00480 class MPointerEventObserver
00481         {
00482 public:
00483         virtual bool PointerEvent(CEikCaptionedControl *aControl, const TPointerEvent& aPointerEvent)=0;
00484         };
00485 
00486 #endif

Copyright © Nokia Corporation 2001-2008
Back to top