eikcba.h

Go to the documentation of this file.
00001 /*
00002 * ============================================================================
00003 *  Name        : eikcba.h
00004 *  Part of     : UI Framework Core / EIKON Concrete Controls
00005 *  Description : EIKON control button array and cba button class definitions.
00006 *  Version     : %version: 29.1.2 %
00007 *
00008 *  Copyright © 2002-2008 Nokia.  All rights reserved.
00009 *  This material, including documentation and any related computer
00010 *  programs, is protected by copyright controlled by Nokia.  All
00011 *  rights are reserved.  Copying, including reproducing, storing,
00012 *  adapting or translating, any or all of this material requires the
00013 *  prior written consent of Nokia.  This material also contains
00014 *  confidential information which may not be disclosed to others
00015 *  without the prior written consent of Nokia.
00016 * ============================================================================
00017 * Template version: 4.1
00018 */
00019 
00020 #ifndef __EIKCBA_H__
00021 #define __EIKCBA_H__
00022 
00023 #include <eikctgrp.h>
00024 #include <badesca.h>
00025 #include <eikbtgrp.h>
00026 #include <eiksbobs.h>
00027 #include <eiksbfrm.h>
00028 
00029 #include <eikimage.h>
00030 #include <akncontrol.h>
00031 #include <aknsitemdata.h> // TAknsItemID
00032 #include <babitflags.h>   // TBitFlags
00033 
00034 class CEikLabel;
00035 class CEikCbaButton;
00036 class CCoeBrushAndPenContext;
00037 class MEikCommandObserver;
00038 class TCoeColorUse;
00039 
00040 class CAknScrollBar;
00041 class TEikScrollBarModel;
00042 
00043 class CEikEnhancedCbaButton;
00044 class CEikCommandTable;
00045 
00046 class CAknsBasicBackgroundControlContext;
00047 class CAknsLayeredBackgroundControlContext;
00048 class CAknsMaskedLayerBackgroundControlContext;
00049 class CEikCbaExtension;
00050 
00051 const TInt KMaxCbaLabelLength = 32;
00052 const TInt KMaxButtonsInCommandTable = 4;
00053 
00061 NONSHARABLE_CLASS(CEikCba) :
00062     public CEikControlGroup, 
00063     public MEikEnhancedButtonGroup, 
00064     public MEikScrollBarObserver,
00065     public MCoeControlObserver
00066     {
00067 public: 
00072     DECLARE_TYPE_ID(0x101F4105)
00073 
00074     
00083     static CEikCba* NewL(
00084         const CEikCba* aPrevious, 
00085         MEikCommandObserver* aCommandObserver, 
00086         RWindowGroup* aParentWg);
00087         
00098     static CEikCba* NewL(
00099         TInt aResourceId,
00100         const CEikCba* aPrevious,
00101         MEikCommandObserver* aCommandObserver,
00102         RWindowGroup* aParentWg);
00103         
00113     static CEikCba* NewLC(
00114         const CEikCba* aPrevious,
00115         MEikCommandObserver* aCommandObserver,
00116         RWindowGroup* aParentWg);
00117         
00128     static CEikCba* NewLC(
00129         TInt aResourceId,
00130         const CEikCba* aPrevious,
00131         MEikCommandObserver* aCommandObserver,
00132         RWindowGroup* aParentWg);
00133         
00137     ~CEikCba();
00138 
00139 public: // new methods
00146     TInt MaxCommands() const;
00147     
00156     void UpdateCbaLabels(TBool aScrollerOn);
00157     
00164     TInt MSKEnabledInPlatform() const;
00165 
00172     void SetSBFrameObserver(MEikScrollBarObserver* aObserver);
00173 
00180     void SetScrollBarModelL(TEikScrollBarModel* aModel);
00181     
00188     const CEikCbaScrollBarFrame* ScrollBarFrame() const;
00189     
00195     CAknScrollBar* VScrollBarAsControl();
00196 
00203     void CreateArrowHeadScrollBarL(); 
00204 
00205 public:
00214     void InsertControlL(TEikGroupControl& aGroupControl, TInt aIndex);
00215 
00227     void SetCommandL(
00228         TInt aPosition,
00229         TInt aCommandId,
00230         const TDesC* aText,
00231         const CFbsBitmap* aBitmap,
00232         const CFbsBitmap* aMask);
00233         
00245     void SetCommandL(TInt aPosition, TInt aResourceId);
00246     
00256     void SetCommandSetL(TInt aResourceId);
00257 
00271     void AddCommandL(
00272         TInt aPosition,
00273         TInt aCommandId,
00274         const TDesC* aText,
00275         const CFbsBitmap* aBitmap,
00276         const CFbsBitmap* aMask);
00277        
00291     void AddCommandToStackL(
00292         TInt aPosition,
00293         TInt aCommandId,
00294         const TDesC* aText,
00295         const CFbsBitmap* aBitmap,
00296         const CFbsBitmap* aMask);
00297        
00308     void AddCommandToStackL(TInt aPosition, TInt aResourceId);
00309     
00320     void AddCommandSetToStackL(TInt aResourceId);
00321     
00330     void SetDefaultCommand(TInt aCommandId);
00331     
00343     TSize CalcMinimumSizeL(TInt aResourceId);
00344     
00357     void RemoveCommandFromStack(TInt aPosition, TInt aCommandId);
00358     
00368     TInt CommandPos(TInt aCommandId) const;
00369 
00379     void DimCommand(TInt aCommandId, TBool aDimmed);
00380     
00391     TBool IsCommandDimmed(TInt aCommandId) const;
00392     
00404     void MakeCommandVisible(TInt aCommandId, TBool aVisible);
00405 
00416     TBool IsCommandVisible(TInt aCommandId) const;
00417     
00426     void AnimateCommand(TInt aCommandId);
00427 
00436     CCoeControl* AsControl();
00437     
00446     const CCoeControl* AsControl() const;
00447     
00457     void SetBoundingRect(const TRect& aBoundingRect);
00458     
00469     void ReduceRect(TRect& aBoundingRect) const;
00470     
00479     CCoeControl* GroupControlById(TInt aCommandId);
00480 
00490     CCoeControl* GroupControlById(TInt aCommandId) const;
00491     
00501     TInt CommandId(TInt aCommandPos) const;
00502     
00511     TInt ButtonCount() const;
00512     
00520     void RemovePreviousCommand(TInt aPosition);
00521 
00532     CEikCommandButton* GroupControlAsButton(TInt aCommandId) const;
00533     
00542     TUint ButtonGroupFlags() const;
00543     
00551     IMPORT_C void SetButtonGroupFlags(TInt aFlags);
00552 
00564     IMPORT_C void SetSkinBackgroundId(const TAknsItemID& aIID);
00565 
00573     void SetMSKIconL();
00574     
00584     void SetMSKCommandObserver(MEikCommandObserver* aCommandObserver);
00585     
00595     void DimCommandByPosition(TInt aPosition, TBool aDimmed);
00596     
00606     TBool IsCommandDimmedByPosition(TInt aPosition) const;
00607     
00617     void MakeCommandVisibleByPosition(TInt aPosition, TBool aVisible);
00618 
00628     TBool IsCommandVisibleByPosition(TInt aPosition) const;
00629     
00638     void AnimateCommandByPosition(TInt aPosition);
00639     
00648 //    CCoeControl* GroupControlByPosition(TInt aPosition) const;
00649 
00667     TRect ButtonRectByPosition( TInt aPosition,
00668                                 TBool aRelativeToScreen );
00669     
00678     void EnablePostingTransparency( TBool aEnable );
00679 
00680 public:
00684     virtual void Reserved_MtsmPosition();
00685     
00689     virtual void Reserved_MtsmObject();
00690 
00691 public: // from CCoeControl
00700     TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
00701     
00708     TSize MinimumSize();
00709     
00717     void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const;
00718     
00725     void HandleResourceChange(TInt aType);
00726     
00733     void MakeVisible(TBool aVisible);
00734  
00741     void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00742     
00749     void SetContainerWindowL( const CCoeControl& aContainer );
00750     
00751     void ActivateL();
00752 
00753 public: // from MEikEnhancedButtonGroup
00760     IMPORT_C void OfferCommandListL(const RArray<TInt>& aCommandList);
00761     
00768     IMPORT_C void OfferCommandListL(const TInt aResourceId);
00769     
00777     IMPORT_C TBool IsCommandInGroup(const TInt aCommandId) const;
00778     
00786     IMPORT_C void ReplaceCommand(const TInt aCommandId, const TInt aResourceId);
00787     
00788 public: // From MCoeControlObserver
00789     void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
00790 
00791 private:
00795     IMPORT_C void* ExtensionInterface( TUid aInterface );
00796 
00797 protected:
00807     virtual void HandleScrollEventL(CEikScrollBar* aScrollBar, TEikScrollEvent aEventType);
00808 
00819     TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
00820 
00827     void Draw(const TRect& aRect) const;
00828 
00829 public:
00830 
00842     IMPORT_C TBool IsEmpty() const;
00843 
00844 private: // new methods
00845     CEikCba(
00846         const CEikCba* aPrevious, 
00847         MEikCommandObserver* aCommandObserver, 
00848         RWindowGroup* aParentWg);
00849         
00850     void BaseConstructL();
00851     void ConstructL(TInt aResourceId);
00852     void ConstructFromResourceL(TResourceReader& aReader);
00853     CCoeControl* ButtonById( TInt aCommandId ) const;
00854     void CreateScrollBarFrameL();
00855     void InsertScrollBarL();
00856     TEikGroupControl VScrollBarAsGroupControl();
00857     void CheckSkinAndUpdateContext();
00858     
00859     TInt AknLayoutFlags() const;
00860     void SizeChangedInControlPane();
00861     void SizeChangedInStaconPane();
00862     void SizeChangedInRightPane();
00863     void UpdateFonts();
00864     
00865     void DoSkinChange();
00866     void DoColorChange();
00867     void DoLayoutChange();
00868     
00869     void SizeChangedInsideDialog();
00870 
00878     void LayoutControl(CCoeControl* aControl, const TRect& aRect);        
00879     
00880     void DoSetLayers( const TAknsItemID& aIID );
00881     
00886     void BroadcastPostingTransparency( TBool aEnable );
00887 
00891     void SetFadeState();
00892 
00893 private: // from CCoeControl
00894     void SizeChanged();
00895 
00896 private: // data
00897     TUint                   iCbaFlags;
00898     
00900     const CEikCba*          iLink; 
00901     
00902     CCoeBrushAndPenContext* iBrushAndPenContext;
00903     MEikCommandObserver*    iCommandObserver;
00904     CEikCbaScrollBarFrame*  iSBFrame;
00905     RWindowGroup*           iParentWg;
00906     
00908     CEikCommandTable*   iCommandTable;
00909     
00911     TBool iMSKset;
00912     
00914     TBool iMSKEnabledInPlatform;
00915     
00917     MEikCommandObserver* iMSKCommandObserver;
00918     
00919     // From extension.
00920     const CFont* iLabelFont;
00921     const CFont* iStaconLabelFont;
00922     const CFont* iRightPaneLabelFont;
00923     TBool iPopupVisible;
00924     TBitFlags iFlags;
00925 
00927     CAknsBasicBackgroundControlContext* iBgContext;
00928     
00930     CAknsLayeredBackgroundControlContext* iStaconBgContext;
00931 
00933     CAknsMaskedLayerBackgroundControlContext* iMLBgContext;
00934     CAknsMaskedLayerBackgroundControlContext* iStaconBgContextTop;
00935     CAknsMaskedLayerBackgroundControlContext* iStaconBgContextBottom;
00936     
00937     TAknsItemID iBgIID;
00938     
00940     CPeriodic* iTimer;
00941     
00946     TAknsItemID iClockIndicBgIID;
00947     TBool       iIsClockIndicBgIIDSet;
00948     
00949     CEikCbaExtension* iExtension;
00950     };
00951 
00959 class CEikCbaButton : public CAknControl
00960     {
00961 public:
00965     struct SButtonOptions
00966         {
00967         TInt iCommandId;
00968         TBool iDimmed;
00969         };
00970 public:
00974     ~CEikCbaButton();
00975     
00981     void ConstructL(TGulAlignmentValue aAlignment);
00982 public:
00988     void AddCommandL(const TDesC& aText);
00989     
00996     void PushCommandL(TInt aCommandId, const TDesC& aText);
00997     
01003     TInt PopCommand();
01004     
01010     void RemoveCommand(TInt aCommandId);
01011     
01015     void RemovePreviousCommand();
01016     
01022     void SwitchToShortTextL(TBool aShortText);
01023     
01029     void SetLabelFont(const CFont* aLabelFont);
01030     
01034     void TruncateLabelText();
01035 
01039     TBool IsEmptyText() const;
01040     
01041 public:
01048     void SetContainerWindowL(const CCoeControl& aContainer);
01049     
01056     void ConstructFromResourceL(TResourceReader& aReader, TGulAlignmentValue anAlignment);
01057     
01064     TSize MinimumSize();
01065     
01072     void SetDimmed(TBool aDimmed);
01073     
01080     IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
01081     
01082 public:
01088     void SetImage(CEikImage &aImage);
01089     
01093     void ReplaceImageByLabel();
01094     
01100     inline TBool IsImageOn() const {return iDoImage;};
01101     
01105     void ConstructEmptyButtonL();
01106 
01107 protected:
01114     TInt IndexFromCommandId(TInt aCommandId);
01115     
01121     void UpdateLabelText(TPtrC aLabelText);
01122 
01123 private: 
01130     TInt CountComponentControls() const;
01131     
01139     CCoeControl* ComponentControl(TInt aIndex) const;
01140     
01145     void SizeChanged();
01146     
01150     IMPORT_C void* ExtensionInterface( TUid aInterface );
01151 
01152 public: // new functions
01159     TBool PressedDown() const;
01160     
01169     void SetPressedDown( const TBool aPressedDown );
01170 
01179     void SetTextBitmapMode( TBool aEnableBitmap );
01180 
01191     void DrawToContext(
01192         CBitmapContext& aContext,
01193         CBitmapContext& aMaskContext,
01194         const TPoint& aOffset ) const;
01195     
01201     inline TPtrC GetFullLabelText() { return iFullLabelText;}
01202     
01203 private:    
01204     void PrepareImageL();
01205     
01206 protected:
01207     TBuf<KMaxCbaLabelLength> iFullLabelText;
01208     TPtrC iLongLabelText;
01209     TPtrC iShortLabelText;
01210     CEikLabel* iLabel;
01211     CDesCArray* iText;
01212     CArrayFix<SButtonOptions>* iButtonOptions;
01213     CEikImage* iImage;
01215     const CFbsBitmap* iMask;
01217     CFbsBitmap* iSfeMask;
01218     TBool iDoImage;
01220     TBool iUseTextBitmap;
01222     TBool iPressedDown;
01223     };
01224 
01231 class CEikEnhancedCbaButton : public CEikCbaButton
01232     {
01233 public:
01237     CEikEnhancedCbaButton();
01238 
01242     ~CEikEnhancedCbaButton();
01243     
01249     TInt CommandType() const;
01250     
01256     void SetCommandType(const TInt aCommandType);
01257     
01263     TInt CommandId() const; 
01264     
01270     void ConstructFromResourceL(TResourceReader& aReader);
01271     
01275     void ConstructEmptyButtonL();
01276     
01282     TPtrC* LabelText();
01283 
01284 private: // data
01285     TInt iCommandType; 
01286     TInt iCommandId;
01287     };
01288 
01297 NONSHARABLE_CLASS(CEikCommandTable) : public CBase
01298     {
01299 public:
01305     static CEikCommandTable* NewL();
01306     
01312     static CEikCommandTable* NewLC();
01313     
01317     ~CEikCommandTable();    
01318         
01325     TInt AddCommandL(CEikEnhancedCbaButton* aButton);
01326     
01333     TBool IsCommandPlaced(const TInt aCommandId) const;
01334     
01342     void ReplaceCommandL(const TInt aCommandId, const TInt aResourceId);
01343     
01350     CEikEnhancedCbaButton* Command(const TInt aCommandIndex);
01351     
01355     void Reset();
01356     
01357 private: // member functions
01361     CEikCommandTable();
01362     
01366     void ConstructL();
01367     
01368 private: // data
01370     TFixedArray<CEikEnhancedCbaButton*, KMaxButtonsInCommandTable> iCommandButtons;
01371     
01373     RArray< RArray<TInt> > iPriorities; 
01374     };
01375 
01376 #endif // __EIKCBA_H__

Copyright © Nokia Corporation 2001-2007
Back to top