eikmenub.h

Go to the documentation of this file.
00001 // EIKMENUB.H
00002 //
00003 // Copyright (c) 1997-1999 Symbian Ltd.  All rights reserved.
00004 //
00005 
00006 #if !defined(__EIKMENUB_H__)
00007 #define __EIKMENUB_H__
00008 
00009 #if !defined(__EIKDEF_H__)
00010 #include <eikdef.h>
00011 #endif
00012 
00013 #if !defined(__EIKBCTRL_H__)
00014 #include <eikbctrl.h>
00015 #endif
00016 
00017 #if !defined(__EIKMENUP_H__)
00018 #include <eikmenup.h>
00019 #endif
00020 
00021 #include <eikbtgpc.h>
00022 #include <eikcmobs.h>
00023 #include <aknintermediate.h>
00024 
00025 class CEikHotKeyTable;
00026 class CEikMenuBarExtension;
00027 
00028 
00035 class CEikMenuBarTitle : public CBase
00036         {
00037 public:
00043         struct SData
00044                 {
00045         enum { 
00047             ENominalTextLength=40 
00048             };
00052                 TInt iMenuPaneResourceId;
00056                 TBuf<ENominalTextLength> iText; // less than this actually stored
00057                 };
00058 public:
00062         IMPORT_C CEikMenuBarTitle();
00066         IMPORT_C ~CEikMenuBarTitle();
00072         IMPORT_C void SetIcon(CGulIcon* aIcon);
00073 
00080         IMPORT_C void SetBitmapsOwnedExternally(TBool aOwnedExternally);
00081 
00091         IMPORT_C void DrawIcon(CWindowGc& aGc, TRect aRect, TInt aLeftMargin) const;
00092 
00100         IMPORT_C void CreateIconL(CFbsBitmap* aBitmap, CFbsBitmap* aMask);
00101 
00108         IMPORT_C void SetIconBitmapL(CFbsBitmap* aBitmap);
00109 
00116         IMPORT_C void SetIconMaskL(CFbsBitmap* aMask);
00117 
00124         IMPORT_C CFbsBitmap* IconBitmap() const;
00125 
00132         IMPORT_C CFbsBitmap* IconMask() const;
00133 
00134 public: // other functions
00135 
00142         TInt ExtraLeftMargin() const;
00143 
00151         void CalculateBaseLine(TInt& aBaseLine, TInt& aTitleHeight);
00152         
00153 public:
00154 
00156         TInt iPos;
00157 
00159         TInt iWidth;
00160 
00162         SData iData;
00163 
00165         TInt iTitleFlags;
00166         
00167 private:
00168         CGulIcon* iIcon;
00169         };
00170 
00176 class CEikMenuBar : public CEikBorderedControl, 
00177                     public MEikCommandObserver, 
00178                     public MAknIntermediateState
00179         {
00180         
00181 public:
00182 
00187         DECLARE_TYPE_ID(0x101F4106)
00188 
00189         
00190         struct SCursor
00191                 {
00193                 TInt iMenuPaneIndex;
00194                 
00196                 TInt iMenuItemIndex;
00197                 };
00198 
00200         struct SPosition
00201                 {
00203                 TInt iMenuId;
00204                 
00206                 SCursor iMenuCursorPos;
00207                 };
00208 
00209     enum TMenuType {
00214         EMenuOptions = 0,
00215         
00220         EMenuContext = 1,
00221         
00225         EMenuEdit = 2,
00226         
00231         EMenuOptionsNoTaskSwapper = 3
00232         };
00233 
00234         friend class CEikMenuPaneTitle;
00235         
00236 private:
00237         
00238         enum {ENothingSelected=-1};
00239         
00240 public:
00241 
00245         IMPORT_C ~CEikMenuBar();
00246         
00250         IMPORT_C CEikMenuBar();
00251         
00252 public: // framework
00253 
00267         IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,
00268                                              TEventCode aType);
00269 
00287     IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00288 
00296     IMPORT_C void Draw(const TRect& aRect) const;
00297         
00298 private:
00299 
00303     IMPORT_C void* ExtensionInterface( TUid aInterface );
00304 
00305 private: // from MCoeInputObserver
00306 
00307         IMPORT_C TCoeInputCapabilities InputCapabilities() const;
00308         
00309 public:
00310 
00315         class CTitleArray : public CArrayPtrFlat<CEikMenuBarTitle>
00316                 {
00317                 
00318         public:
00319         
00323                 IMPORT_C ~CTitleArray();
00324                 
00328                 IMPORT_C CTitleArray();
00329                 
00336                 IMPORT_C void AddTitleL(CEikMenuBarTitle* aMenuTitle);
00337 
00343                 void DeleteResource(TInt aResource);
00344                 };
00345 
00346 public: // new functions
00347 
00360         IMPORT_C void ConstructL(MEikMenuObserver* aMenuObserver,
00361                                  TInt aHotKeyResourceId=0,
00362                                  TInt aMenuTitleResourceId=0);
00363 
00370     IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
00371 
00379     IMPORT_C void ChangeMenuBarL(TInt aHotKeyResourceId=0,
00380                                  TInt aMenuTitleResourceId=0,
00381                                  TInt aDisplayNow=ETrue);
00382 
00389     IMPORT_C CEikHotKeyTable* SetHotKeyTable(CEikHotKeyTable* aHotKeyTable);
00390 
00396     IMPORT_C void SetMenuTitleResourceId(TInt aMenuTitleResourceId);
00397     
00403         IMPORT_C void SetContextMenuTitleResourceId(TInt aMenuTitleResourceId);
00404                 
00410     IMPORT_C void SetMenuTitleArray(CTitleArray* aTitleArray);
00411 
00417     IMPORT_C void SetTitleArrayOwnedExternally(TBool aOwnedExternally);
00418 
00426     IMPORT_C SCursor SetMenuCursor(const SCursor& aCursor);
00427 
00436     IMPORT_C void StopDisplayingMenuBar();
00437 
00446     IMPORT_C void TryDisplayMenuBarL();
00447         IMPORT_C void TryDisplayContextMenuBarL();
00454     IMPORT_C void TryDisplayMenuBarWithoutFepMenusL();
00455 
00462     IMPORT_C void MoveHighlightToL(TInt aNewSelectedTitle,
00463                                    TInt aNewSelectedItem=0);
00464 
00470     IMPORT_C void DrawItem(TInt aItem) const;
00471 
00475     CEikHotKeyTable* HotKeyTable() const { return(iHotKeyTable); }
00476 
00482     IMPORT_C TInt SelectedTitle();
00483 
00489     IMPORT_C TInt SelectedItem();
00490 
00498     IMPORT_C virtual void FindCommandIdInResourceL(TInt aCommandId,
00499                                                    TInt& aPaneindex,
00500                                                    TInt& aItemindex);
00501 
00508     IMPORT_C CEikMenuPane* MenuPane();
00509 
00517     IMPORT_C void ReduceRect(TRect& aRect) const;
00518 
00525     IMPORT_C CTitleArray* TitleArray();
00526 
00532     IMPORT_C void SetEditMenuObserver(MEikMenuObserver* aEditMenuObserver);
00533 
00540     IMPORT_C void RemoveEditMenuObserver(MEikMenuObserver* aEditMenuObserver);
00541  
00547     IMPORT_C TBool IsDisplayed();
00548 
00556     IMPORT_C void SetMenuType(TMenuType aMenuType);
00557 
00558 private: // from MAknIntermediateState
00559 
00560         void CloseState();
00561         
00562 public: // from CCoeControl
00563 
00575     IMPORT_C virtual void GetColorUseListL(
00576             CArrayFix<TCoeColorUse>& aColorUseList) const; 
00577         
00594         IMPORT_C virtual void HandleResourceChange(TInt aType);                 
00595 
00596 private: // from CCoeControl
00597         IMPORT_C void Reserved_1();
00598         IMPORT_C void Reserved_2();
00599         // from MEikCommandObserver
00600         void ProcessCommandL(TInt aCommandId);
00601 private: // from MObjectProvider
00602         TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
00603 private:
00604         void StartDisplayingMenuBarL();
00605         void HideMenuPane();
00606         void SaveCurrentMenuPositionL();
00607         void SetCursorPositionFromArray();
00608         TBool MenuHasItems() const;
00609         void SetMenuHasItems();
00610         TBool MenuHasPane() const;
00611         void SetMenuHasPane();
00612         TBool TitleArrayOwnedExternally() const;
00613         void ResetTitleArray();
00614         void CreateTitleArrayL();
00615         void SetMenuPaneFlag(TInt aFlag);
00616         void AddFEPMenuL();
00617         void AddMenuIfNotPresentL(TInt aResourceId);
00618         void UpdateTitleTextBaseline();
00619 private:
00620         enum TEikMenuFlags {ETitleArrayOwnedExternally=0x01,EMenuHasItems=0x02,EMenuHasPane=0x04,EBackgroundFaded=0x08, ESoundsInstalled=0x10};
00621         CEikButtonGroupContainer* iMenuCba;
00622         MEikMenuObserver* iMenuObserver;
00623         MEikMenuObserver* iEditMenuObserver;
00624         MEikMenuObserver* iActiveEditMenuObserver;
00625         CEikMenuPane* iMenuPane;
00626         CEikHotKeyTable* iHotKeyTable;
00627         SCursor iCursor;
00628         TInt iMenuTitleResourceId;
00629         TInt iMenuPaneResourceId;
00630         TInt iMenuHotKeyResourceId;
00631         TInt iSelectedTitle;
00632         TInt iBaseLine;
00633         TInt iMenuTitleLeftSpace;
00634         TInt iMenuFlags;
00635         CTitleArray* iTitleArray;
00636         CArrayFixFlat<SPosition>* iPastMenuPosArray;
00637         TBool iPreventFepMenu;
00638         friend class CEikMenuBarExtension;
00639         CEikMenuBarExtension* iExt;
00640         };
00641 
00645 class CEikMenuPaneTitle : public CEikBorderedControl
00646         {
00647         
00648 public:
00649 
00653         IMPORT_C CEikMenuPaneTitle(CEikMenuBar* aMenuBar);
00654         
00659         IMPORT_C void ConstructL();
00660         
00666         IMPORT_C void SetSelectedTitle(TInt aSelectedTitle);
00667         
00673         IMPORT_C void Draw(const TRect& aRect) const;
00674     
00680     IMPORT_C TMargins Margins() const;
00681         
00685         IMPORT_C void Close();
00686         
00687 public:// framework
00688 
00694         IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00695 
00708         IMPORT_C virtual void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const; // not available before Release 005u
00709 
00715         IMPORT_C virtual void HandleResourceChange(TInt aType);                 // not available before Release 005u
00716 
00717 private:
00721     IMPORT_C void* ExtensionInterface( TUid aInterface );
00722 private:
00723         CEikMenuBar* const iMenuBar;
00724         TInt iSelectedTitle;
00725         };
00726 
00727 #endif

Copyright © Nokia Corporation 2001-2008
Back to top