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

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 #start_since SINCE_3_1_SDK
00210 
00213     enum TMenuType {
00219         EMenuOptions = 0,
00220         
00226         EMenuContext = 1,
00227         
00232         EMenuEdit = 2,
00233         
00239         EMenuOptionsNoTaskSwapper = 3
00240         };
00241 #end_since SINCE_3_1_SDK
00242 
00243         friend class CEikMenuPaneTitle;
00244         
00245 private:
00246         
00247         enum {ENothingSelected=-1};
00248         
00249 public:
00250 
00254         IMPORT_C ~CEikMenuBar();
00255         
00259         IMPORT_C CEikMenuBar();
00260         
00261 public: // framework
00262 
00276         IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,
00277                                              TEventCode aType);
00278 
00296     IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00297 
00305     IMPORT_C void Draw(const TRect& aRect) const;
00306         
00307 private:
00308 
00312     IMPORT_C void* ExtensionInterface( TUid aInterface );
00313 
00314 private: // from MCoeInputObserver
00315 
00316         IMPORT_C TCoeInputCapabilities InputCapabilities() const;
00317         
00318 public:
00319 
00324         class CTitleArray : public CArrayPtrFlat<CEikMenuBarTitle>
00325                 {
00326                 
00327         public:
00328         
00332                 IMPORT_C ~CTitleArray();
00333                 
00337                 IMPORT_C CTitleArray();
00338                 
00345                 IMPORT_C void AddTitleL(CEikMenuBarTitle* aMenuTitle);
00346 
00352                 void DeleteResource(TInt aResource);
00353                 };
00354 
00355 public: // new functions
00356 
00369         IMPORT_C void ConstructL(MEikMenuObserver* aMenuObserver,
00370                                  TInt aHotKeyResourceId=0,
00371                                  TInt aMenuTitleResourceId=0);
00372 
00379     IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
00380 
00388     IMPORT_C void ChangeMenuBarL(TInt aHotKeyResourceId=0,
00389                                  TInt aMenuTitleResourceId=0,
00390                                  TInt aDisplayNow=ETrue);
00391 
00398     IMPORT_C CEikHotKeyTable* SetHotKeyTable(CEikHotKeyTable* aHotKeyTable);
00399 
00405     IMPORT_C void SetMenuTitleResourceId(TInt aMenuTitleResourceId);
00406     
00407 #start_since SINCE_3_1_SDK
00408 
00412         IMPORT_C void SetContextMenuTitleResourceId(TInt aMenuTitleResourceId);
00413 #end_since SINCE_3_1_SDK
00414                 
00420     IMPORT_C void SetMenuTitleArray(CTitleArray* aTitleArray);
00421 
00427     IMPORT_C void SetTitleArrayOwnedExternally(TBool aOwnedExternally);
00428 
00436     IMPORT_C SCursor SetMenuCursor(const SCursor& aCursor);
00437 
00446     IMPORT_C void StopDisplayingMenuBar();
00447 
00456     IMPORT_C void TryDisplayMenuBarL();
00457 #start_since SINCE_3_1_SDK
00458 
00461         IMPORT_C void TryDisplayContextMenuBarL();
00462 #end_since SINCE_3_1_SDK
00463 
00469     IMPORT_C void TryDisplayMenuBarWithoutFepMenusL();
00470 
00477     IMPORT_C void MoveHighlightToL(TInt aNewSelectedTitle,
00478                                    TInt aNewSelectedItem=0);
00479 
00485     IMPORT_C void DrawItem(TInt aItem) const;
00486 
00490     CEikHotKeyTable* HotKeyTable() const { return(iHotKeyTable); }
00491 
00497     IMPORT_C TInt SelectedTitle();
00498 
00504     IMPORT_C TInt SelectedItem();
00505 
00513     IMPORT_C virtual void FindCommandIdInResourceL(TInt aCommandId,
00514                                                    TInt& aPaneindex,
00515                                                    TInt& aItemindex);
00516 
00523     IMPORT_C CEikMenuPane* MenuPane();
00524 
00532     IMPORT_C void ReduceRect(TRect& aRect) const;
00533 
00540     IMPORT_C CTitleArray* TitleArray();
00541 
00547     IMPORT_C void SetEditMenuObserver(MEikMenuObserver* aEditMenuObserver);
00548 
00555     IMPORT_C void RemoveEditMenuObserver(MEikMenuObserver* aEditMenuObserver);
00556  
00562     IMPORT_C TBool IsDisplayed();
00563 
00564 #start_since SINCE_3_1_SDK
00565 
00573     IMPORT_C void SetMenuType(TMenuType aMenuType);
00574 #end_since SINCE_3_1_SDK
00575 
00576 private: // from MAknIntermediateState
00577 
00578         void CloseState();
00579         
00580 public: // from CCoeControl
00581 
00593     IMPORT_C virtual void GetColorUseListL(
00594             CArrayFix<TCoeColorUse>& aColorUseList) const; 
00595         
00612         IMPORT_C virtual void HandleResourceChange(TInt aType);                 
00613 
00614 private: // from CCoeControl
00615         IMPORT_C void Reserved_1();
00616         IMPORT_C void Reserved_2();
00617         // from MEikCommandObserver
00618         void ProcessCommandL(TInt aCommandId);
00619 private: // from MObjectProvider
00620         TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
00621 private:
00622         void StartDisplayingMenuBarL();
00623         void HideMenuPane();
00624         void SaveCurrentMenuPositionL();
00625         void SetCursorPositionFromArray();
00626         TBool MenuHasItems() const;
00627         void SetMenuHasItems();
00628         TBool MenuHasPane() const;
00629         void SetMenuHasPane();
00630         TBool TitleArrayOwnedExternally() const;
00631         void ResetTitleArray();
00632         void CreateTitleArrayL();
00633         void SetMenuPaneFlag(TInt aFlag);
00634         void AddFEPMenuL();
00635         void AddMenuIfNotPresentL(TInt aResourceId);
00636         void UpdateTitleTextBaseline();
00637 private:
00638         enum TEikMenuFlags {ETitleArrayOwnedExternally=0x01,EMenuHasItems=0x02,EMenuHasPane=0x04,EBackgroundFaded=0x08, ESoundsInstalled=0x10};
00639         CEikButtonGroupContainer* iMenuCba;
00640         MEikMenuObserver* iMenuObserver;
00641         MEikMenuObserver* iEditMenuObserver;
00642         MEikMenuObserver* iActiveEditMenuObserver;
00643         CEikMenuPane* iMenuPane;
00644         CEikHotKeyTable* iHotKeyTable;
00645         SCursor iCursor;
00646         TInt iMenuTitleResourceId;
00647         TInt iMenuPaneResourceId;
00648         TInt iMenuHotKeyResourceId;
00649         TInt iSelectedTitle;
00650         TInt iBaseLine;
00651         TInt iMenuTitleLeftSpace;
00652         TInt iMenuFlags;
00653         CTitleArray* iTitleArray;
00654         CArrayFixFlat<SPosition>* iPastMenuPosArray;
00655         TBool iPreventFepMenu;
00656         friend class CEikMenuBarExtension;
00657         CEikMenuBarExtension* iExt;
00658         };
00659 
00663 class CEikMenuPaneTitle : public CEikBorderedControl
00664         {
00665         
00666 public:
00667 
00671         IMPORT_C CEikMenuPaneTitle(CEikMenuBar* aMenuBar);
00672         
00677         IMPORT_C void ConstructL();
00678         
00684         IMPORT_C void SetSelectedTitle(TInt aSelectedTitle);
00685         
00691         IMPORT_C void Draw(const TRect& aRect) const;
00692     
00698     IMPORT_C TMargins Margins() const;
00699         
00703         IMPORT_C void Close();
00704         
00705 public:// framework
00706 
00712         IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00713 
00726         IMPORT_C virtual void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const; // not available before Release 005u
00727 
00733         IMPORT_C virtual void HandleResourceChange(TInt aType);                 // not available before Release 005u
00734 
00735 private:
00739     IMPORT_C void* ExtensionInterface( TUid aInterface );
00740 private:
00741         CEikMenuBar* const iMenuBar;
00742         TInt iSelectedTitle;
00743         };
00744 
00745 #endif

Copyright © Nokia Corporation 2001-2007
Back to top