| 183 |  | * @param Name of options menu item |
| 184 |  | * @return command id |
| 185 | Â | */Â |
| 186 | Â | TInt AddOptionsMenuItem(const TDesC& aName);Â |
| 187 | Â | Â |
| 188 | Â | /**Â |
| 189 |  | * Method ClearOptionsMenu |
| 190 | Â | * @since 3.2Â |
| 191 |  | * @return void |
| 192 | Â | */Â |
| 193 | Â | void ClearOptionsMenu();Â |
|  | 189 | * @param text buffer displayed in the main area of the menu item |
|  | 190 | * @param ID of the command to issue when the menu item is selected |
|  | 191 | * @param command ID of the parent menu item |
|  | 192 | * @return none |
| Â | 193 | */Â |
| Â | 194 | void AddOptionsMenuItem( const TDesC& aText, TInt aCmdId, TInt aParentCmdId, void* obj );Â |
| Â | 195 | Â |
| Â | 196 | /**Â |
|  | 197 | * Method SetRightSoftKeyLabel |
| Â | 198 | * @since 3.2Â |
|  | 199 | * @param text buffer to be set as right soft key label  |
|  | 200 | * @return none |
| Â | 201 | */Â |
| Â | 202 | void SetRightSoftKeyLabel( const TDesC& aText );Â |
| Â | 203 | Â |
| Â | 204 | /**Â |
|  | 205 | * Method DeleteMenuItem |
| Â | 206 | * @since 3.2Â |
|  | 207 | * @param command ID of the menu item |
|  | 208 | * @param command ID of the parent menu item |
|  | 209 | * @return none |
| Â | 210 | */Â |
| Â | 211 | void DeleteMenuItem( TInt aCmdId, TInt aParentCmdId );Â |
| Â | 212 | Â |
| Â | 213 | /**Â |
|  | 214 | * Method ClearMenuItems |
| Â | 215 | * @since 3.2Â |
|  | 216 | * @param none |
|  | 217 | * @return none |
| Â | 218 | */Â |
| Â | 219 | void ClearMenuItems();Â |
| Â | 220 | Â |
| Â | 221 | /**Â |
|  | 222 | * Method ReplaceMenuItem |
| Â | 223 | * @since 3.2Â |
|  | 224 | * @param command ID of the menu item to be replaced |
|  | 225 | * @param text/label for the new menu item |
|  | 226 | * @param command ID of the new menu item |
|  | 227 | * @param dimmed status |
|  | 228 | * @return none |
| Â | 229 | */Â |
| Â | 230 | void ReplaceMenuItem( TInt oldCmdId, const TDesC& newText, Â |
| Â | 231 | TInt newCmdId, TInt newDimmed );Â |
| Â | 232 | Â |
| Â | 233 | /**Â |
|  | 234 | * Method GetMenuItem |
| Â | 235 | * @since 3.2Â |
|  | 236 | * @param text/label for the menu item |
|  | 237 | * @param command ID of the menu item |
|  | 238 | * @param boolean flag to dim or undim the menu item |
|  | 239 | * @return none |
| Â | 240 | */Â |
| Â | 241 | void GetMenuItem( TDes& textVal, TInt& cmdId, TBool& dimStat );Â |
| Â | 242 | Â |
| Â | 243 | /**Â |
|  | 244 | * Method SetDimmed |
| Â | 245 | * @since 3.2Â |
|  | 246 | * @param command ID of the menu item |
|  | 247 | * @param boolean flag to dim or undim the menu item |
|  | 248 | * @return none |
| Â | 249 | */Â |
| Â | 250 | void SetDimmed( TInt aCmdId, TBool aValue );Â |
| Â | 251 | Â |
| Â | 252 | /**Â |
|  | 253 | * Method SetMenuItemObserver |
| Â | 254 | * @since 3.2Â |
|  | 255 | * @param command ID of the menu item |
|  | 256 | * @param callback function |
|  | 257 | * @return none |
| Â | 258 | */Â |
| Â | 259 | void SetMenuItemObserver( Â |
| Â | 260 | TInt aCmdId, WidgetEventHandler* aOnSelectCallback );Â |
| Â | 261 | Â |
| Â | 262 | /**Â |
|  | 263 | * Method GetMenuItemObserver |
| Â | 264 | * @since 3.2Â |
|  | 265 | * @param command ID of the menu item |
|  | 266 | * @return callback function |
| Â | 267 | */Â |
| Â | 268 | WidgetEventHandler* GetMenuItemObserver( TInt aCmdId );Â |
| Â | 269 | Â |
| Â | 270 | /**Â |
|  | 271 | * Method SetMenuObserver |
| Â | 272 | * @since 3.2Â |
|  | 273 | * @param callback function |
|  | 274 | * @return none |
| Â | 275 | */Â |
| Â | 276 | void SetMenuObserver( WidgetEventHandler* aMenuCallback );Â |
| Â | 277 | Â |
| Â | 278 | /**Â |
|  | 279 | * Method GetMenuObserver |
| Â | 280 | * @since 3.2Â |
|  | 281 | * @param  |
|  | 282 | * @return callback function |
| Â | 283 | */Â |
| Â | 284 | WidgetEventHandler*& GetMenuObserver();Â |
| Â | 285 | Â |
| Â | 286 | /**Â |
|  | 287 | * Method SetRightKeyObserver |
| Â | 288 | * @since 3.2Â |
|  | 289 | * @param callback function |
|  | 290 | * @return none |
| Â | 291 | */Â |
| Â | 292 | void SetRightKeyObserver( WidgetEventHandler* aMenuCallback );Â |
| Â | 293 | Â |
| Â | 294 | Â |
| Â | 295 | /**Â |
|  | 296 | * Method GetMenuObserver |
| Â | 297 | * @since 3.2Â |
|  | 298 | * @param  |
|  | 299 | * @return callback function |
| Â | 300 | */Â |
| Â | 301 | WidgetEventHandler*& GetRightKeyObserver();Â |
| 232 | Â | void SetOnHideListener(CWidgetEventHandler* aCallback);Â |
| 233 | Â | Â |
| 234 | Â | /**Â |
| 235 |  | * Method SetOnRemoveListener |
| 236 | Â | * @since 3.2Â |
| 237 |  | * @param CWidgetEventHandler |
| 238 |  | * @return void |
| 239 | Â | */Â |
| 240 | Â | void SetOnRemoveListener(CWidgetEventHandler* aCallback);Â |
| 241 | Â | Â |
| 242 | Â | /**Â |
| 243 |  | * Method SetOnShowListener |
| 244 | Â | * @since 3.2Â |
| 245 |  | * @param CWidgetEventHandler |
| 246 |  | * @return void |
| 247 | Â | */Â |
| 248 | Â | void SetOnShowListener(CWidgetEventHandler* aCallback);Â |
| Â | 356 | void SetOnShowListener( WidgetEventHandler* aCallback );Â |
| Â | 357 | Â |
| Â | 358 | /**Â |
|  | 359 | * Method GetFromMenuItemCollection |
| Â | 360 | * @since 3.2Â |
|  | 361 | * @param text of menu item |
| Â | 362 | * @return void*Â |
| Â | 363 | */Â |
| Â | 364 | void* GetFromMenuItemCollection( const TDesC& textVal );Â |
| Â | 365 | Â |
| Â | 366 | /**Â |
|  | 367 | * Method GetFromMenuItemCollection |
| Â | 368 | * @since 3.2Â |
|  | 369 | * @param commmand id of menu item |
| Â | 370 | * @return void*Â |
| Â | 371 | */Â |
| Â | 372 | void* GetFromMenuItemCollection( TInt cmdId );Â |
| Â | 373 | Â |
| 357 |  | CWebKitView* iWebKitView; //not owned |
| 358 | Â | Â |
| 359 | Â | CWidgetPreferences* iPreferences;Â |
| 360 | Â | TWidgetRenderer* iWidgetRenderer;Â |
| 361 | Â | Â |
| 362 |  | struct TMenuItem |
|  | 515 | CWebKitView* iWebKitView;//not owned |
| Â | 516 | CWidgetPreferences* iPreferences;Â |
| Â | 517 | TWidgetRenderer* iWidgetRenderer; Â |
| Â | 518 | TInt iWidgetId;Â |
| Â | 519 | TBool iNavigationEnabled;Â |
| Â | 520 | TBool iPageScalerWasEnabled;Â |
| Â | 521 | HBufC* iWidgetBasePath;Â |
| Â | 522 | HBufC* iWidgetBundleId;Â |
| Â | 523 | MWidgetEngineBridge* iWidgetEngineBridge;Â |
| Â | 524 | MWidgetCallback* iWidgetCallback;Â |
| Â | 525 | RPtrHashMap<TDesC,TInt> iAppUidMap;Â |
| Â | 526 | RLibrary iLibrary;Â |
| Â | 527 | CMenuItem* iMenuRoot;Â |
| Â | 528 | WidgetEventHandler* iMenuCallback;Â |
| Â | 529 | WidgetEventHandler* iRightKeyCallback;Â |
| Â | 530 | Â |
|  | 531 | struct TCascadeIDMap |
| 368 | Â | RArray<TMenuItem> iMenuItems;Â |
| 369 | Â | Â |
| 370 | Â | TInt iWidgetId;Â |
| 371 | Â | TBool iNavigationEnabled;Â |
| 372 | Â | TBool iPageScalerWasEnabled;Â |
| 373 | Â | HBufC* iWidgetBasePath;Â |
| 374 | Â | HBufC* iWidgetBundleId;Â |
| 375 | Â | Â |
| 376 | Â | MWidgetEngineBridge* iWidgetEngineBridge;Â |
| 377 | Â | MWidgetCallback* iWidgetCallback;Â |
| 378 | Â | Â |
| 379 | Â | RPtrHashMap<TDesC,TInt> iAppUidMap;Â |
| 380 | Â | RLibrary iLibrary;Â |
| Â | 537 | RArray<TCascadeIDMap> iCascadeArr;Â |
| Â | 538 | TInt iResourceId;Â |
| Â | 539 | Â |
| Â | 540 | private:Â |
| Â | 541 | /*Â |
|  | 542 | * Method AddMenuItem |
| Â | 543 | * @since 3.2Â |
|  | 544 | * @param menu pane |
|  | 545 | * @param menu item to be added |
|  | 546 | * @return void |
| Â | 547 | */Â |
| Â | 548 | void AddMenuItem( CEikMenuPane& aMenuPane, CMenuItem* aNode );Â |
| Â | 549 | Â |
| Â | 550 | /*Â |
|  | 551 | * Method Insert |
| Â | 552 | * @since 3.2Â |
|  | 553 | * @param root of the tree |
|  | 554 | * @param menu item to be inserted |
|  | 555 | * @param parent command id of the menu item to be inserted |
|  | 556 | * @return TBool |
| Â | 557 | */Â |
| Â | 558 | TBool Insert( CMenuItem* root, CMenuItem* item, TInt parentId );Â |
| Â | 559 | Â |
| Â | 560 | /*Â |
|  | 561 | * Method InsertSibling |
| Â | 562 | * @since 3.2Â |
|  | 563 | * @param root of the tree |
|  | 564 | * @param menu item to be inserted |
|  | 565 | * @return void |
| Â | 566 | */Â |
| Â | 567 | void InsertSibling( CMenuItem* root, CMenuItem* item );Â |
| Â | 568 | Â |
| Â | 569 | /*Â |
|  | 570 | * Method FindNodeById |
| Â | 571 | * @since 3.2Â |
|  | 572 | * @param root of the tree |
|  | 573 | * @param command id of the menu item  |
| Â | 574 | * @return CMenuItem*Â |
| Â | 575 | */Â |
| Â | 576 | CMenuItem* FindNodeById( CMenuItem* node, TInt aCmdId );Â |
| Â | 577 | Â |
| Â | 578 | /*Â |
|  | 579 | * Method FindNodeByText |
| Â | 580 | * @since 3.2Â |
|  | 581 | * @param root of the tree |
|  | 582 | * @param text of the menu item  |
| Â | 583 | * @return CMenuItem*Â |
| Â | 584 | */Â |
| Â | 585 | CMenuItem* FindNodeByText( CMenuItem* node, const TDesC& aText );Â |
| Â | 589 | Â |
|  | 590 | class CMenuItem : public CBase |
| Â | 591 | { Â |
| Â | 592 | public:Â |
| Â | 593 | /**Â |
|  | 594 | * Constructor  |
| Â | 595 | */Â |
| Â | 596 | static CMenuItem* NewL( const TDesC16& aText, TInt aCmdId, void* aObj = NULL );Â |
| Â | 597 | Â |
| Â | 598 | /**Â |
|  | 599 | * Destructor. |
| Â | 600 | */Â |
| Â | 601 | virtual ~CMenuItem();Â |
| Â | 602 | Â |
| Â | 603 | protected:Â |
| Â | 604 | /**Â |
|  | 605 | * 2nd phase constructor. |
| Â | 606 | */Â |
| Â | 607 | void ConstructL();Â |
| Â | 608 | Â |
| Â | 609 | /**Â |
|  | 610 | * C++ constructor. |
| Â | 611 | */Â |
| Â | 612 | CMenuItem( const TDesC16& aText, TInt aCmdId, void* aObj = NULL ); Â |
| Â | 613 | Â |
| Â | 614 | public:Â |
| Â | 615 | Â |
| Â | 616 | /*Â |
| Â | 617 | * Method Text()Â |
| Â | 618 | * @since 3.2Â |
|  | 619 | * @param none |
|  | 620 | * @return text of menu item |
| Â | 621 | */Â |
| Â | 622 | const TDesC& Text() Â |
| Â | 623 | { Â |
| Â | 624 | if ( iText ) return *iText;Â |
| Â | 625 | else return KNullDesC();Â |
| Â | 626 | }Â |
| Â | 627 | Â |
| Â | 628 | /*Â |
| Â | 629 | * Method CmdId()Â |
| Â | 630 | * @since 3.2Â |
|  | 631 | * @param none |
|  | 632 | * @return command id of menu item |
| Â | 633 | */Â |
| Â | 634 | TInt CmdId() { return iCmdId; }Â |
| Â | 635 | Â |
| Â | 636 | /*Â |
| Â | 637 | * Method FirstChild()Â |
| Â | 638 | * @since 3.2Â |
|  | 639 | * @param none |
|  | 640 | * @return first child of menu item |
| Â | 641 | */Â |
| Â | 642 | CMenuItem*& FirstChild() { return iFirstChild; }Â |
| Â | 643 | Â |
| Â | 644 | /*Â |
| Â | 645 | * Method NextSibling()Â |
| Â | 646 | * @since 3.2Â |
|  | 647 | * @param none |
|  | 648 | * @return next sibling of menu item |
| Â | 649 | */Â |
| Â | 650 | CMenuItem*& NextSibling() { return iNextSibling; }Â |
| Â | 651 | Â |
| Â | 652 | /*Â |
| Â | 653 | * Method Dimmed()Â |
| Â | 654 | * @since 3.2Â |
|  | 655 | * @param none |
|  | 656 | * @return dimmed status of menu item |
| Â | 657 | */Â |
| Â | 658 | TBool Dimmed() { return iDimmed; }Â |
| Â | 659 | Â |
| Â | 660 | /*Â |
| Â | 661 | * Method Callback()Â |
| Â | 662 | * @since 3.2Â |
|  | 663 | * @param none |
|  | 664 | * @return onselect callback function of menu item |
| Â | 665 | */Â |
| Â | 666 | WidgetEventHandler*& Callback() { return iCallback; }Â |
| Â | 667 | Â |
| Â | 668 | /*Â |
| Â | 669 | * Method Obj()Â |
| Â | 670 | * @since 3.2Â |
|  | 671 | * @param none |
|  | 672 | * @return menu item javascript object |
| Â | 673 | */Â |
| Â | 674 | void*& Obj() { return iObj; }Â |
| Â | 675 | Â |
| Â | 676 | /*Â |
| Â | 677 | * Method SetText()Â |
| Â | 678 | * @since 3.2Â |
|  | 679 | * @param text of menu item |
|  | 680 | * @return none |
| Â | 681 | */Â |
| Â | 682 | void SetText( const TDesC& aText ) Â |
| Â | 683 | { Â |
| Â | 684 | HBufC* tmpText = HBufC::NewL( aText.Length() );Â |
| Â | 685 | tmpText->Des().Append( aText );Â |
| Â | 686 | delete iText;Â |
| Â | 687 | iText = tmpText; Â |
| Â | 688 | }Â |
| Â | 689 | Â |
| Â | 690 | /*Â |
| Â | 691 | * Method SetCmdId()Â |
| Â | 692 | * @since 3.2Â |
|  | 693 | * @param command id of menu item |
|  | 694 | * @return none |
| Â | 695 | */Â |
| Â | 696 | void SetCmdId( TInt aCmdId ) { iCmdId = aCmdId; }Â |
| Â | 697 | Â |
| Â | 698 | /*Â |
| Â | 699 | * Method SetFirstChild()Â |
| Â | 700 | * @since 3.2Â |
|  | 701 | * @param first child of menu item |
|  | 702 | * @return none |
| Â | 703 | */Â |
| Â | 704 | void SetFirstChild( CMenuItem*& aFirstChild ) { iFirstChild = aFirstChild; }Â |
| Â | 705 | Â |
| Â | 706 | /*Â |
| Â | 707 | * Method SetNextSibling()Â |
| Â | 708 | * @since 3.2Â |
|  | 709 | * @param next sibling of menu item |
|  | 710 | * @return none |
| Â | 711 | */Â |
| Â | 712 | void SetNextSibling( CMenuItem*& aNextSibling ) { iNextSibling = aNextSibling; }Â |
| Â | 713 | Â |
| Â | 714 | /*Â |
| Â | 715 | * Method SetDimmed()Â |
| Â | 716 | * @since 3.2Â |
|  | 717 | * @param dimmed status |
|  | 718 | * @return none |
| Â | 719 | */Â |
| Â | 720 | void SetDimmed( TBool aDimmed ) { iDimmed = aDimmed; }Â |
| Â | 721 | Â |
| Â | 722 | /*Â |
| Â | 723 | * Method SetCallback()Â |
| Â | 724 | * @since 3.2Â |
|  | 725 | * @param callback function |
|  | 726 | * @return none |
| Â | 727 | */Â |
| Â | 728 | void SetCallback( WidgetEventHandler*& aCallback ) { iCallback = aCallback; }Â |
| Â | 729 | Â |
| Â | 730 | /*Â |
| Â | 731 | * Method SetObj()Â |
| Â | 732 | * @since 3.2Â |
|  | 733 | * @param menu item javascript object |
|  | 734 | * @return none |
| Â | 735 | */Â |
| Â | 736 | void SetObj( void*& aObj ) { iObj = aObj; }Â |
| Â | 737 | Â |
| Â | 738 | private:Â |
|  | 739 | HBufC* iText;//data |
|  | 740 | TInt iCmdId;//data |
|  | 741 | CMenuItem* iFirstChild;//left node |
|  | 742 | CMenuItem* iNextSibling;//right node |
| Â | 743 | TBool iDimmed;//ETrue to dim this menu item. EFalse to un-dim this menu item. Â |
| Â | 744 | WidgetEventHandler* iCallback;Â |
| Â | 745 | void* iObj;Â |
| Â | 746 | };Â |
| Â |