Changeset 21150 for S60/trunk/WebKit
- Timestamp:
- 04/27/07 12:23:18 (21 months ago)
- Location:
- S60/trunk/WebKit
- Files:
-
- 7 modified
-
BrowserControl/inc/BrCtlInterface.h (modified) (1 diff)
-
BrowserView/inc/WidgetExtension.h (modified) (22 diffs)
-
BrowserView/src/WidgetExtension.cpp (modified) (20 diffs)
-
BrowserView/src/WidgetPreferences.cpp (modified) (8 diffs)
-
ChangeLog (modified) (1 diff)
-
group/BWINSCW/WEBKITU.DEF (modified) (1 diff)
-
group/EABI/browserengineU.def (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
S60/trunk/WebKit/BrowserControl/inc/BrCtlInterface.h
r21101 r21150 939 939 virtual void SetParamL(TBrCtlDefs::TBrCtlWidgetParams aParam, TUint aValue) = 0; 940 940 941 virtual TBool RightKeyCallback() = 0; 941 /** 942 * Method to invoke callback function for right soft key 943 * @since 3.2 944 * @param none 945 * @return ETrue if there is a rightsoftkey callback, else EFalse 946 */ 947 virtual TBool HandleCommandL( TInt aCommandId ) = 0; 942 948 943 949 }; -
S60/trunk/WebKit/BrowserView/inc/WidgetExtension.h
r21101 r21150 206 206 * @since 3.2 207 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 ); 208 * @return none 209 */ 210 void DeleteMenuItem( TInt aCmdId ); 212 211 213 212 /** … … 232 231 233 232 /** 234 * Method GetMenuItem233 * Method MenuItem 235 234 * @since 3.2 236 235 * @param text/label for the menu item … … 239 238 * @return none 240 239 */ 241 void GetMenuItem( TDes& textVal, TInt& cmdId, TBool& dimStat );240 void MenuItem( TDes& textVal, TInt& cmdId, TBool& dimStat ); 242 241 243 242 /** … … 266 265 * @return callback function 267 266 */ 268 WidgetEventHandler* GetMenuItemObserver( TInt aCmdId );267 WidgetEventHandler* MenuItemObserver( TInt aCmdId ); 269 268 270 269 /** … … 282 281 * @return callback function 283 282 */ 284 WidgetEventHandler* & GetMenuObserver();283 WidgetEventHandler* MenuObserver(); 285 284 286 285 /** … … 292 291 void SetRightKeyObserver( WidgetEventHandler* aMenuCallback ); 293 292 294 295 293 /** 296 294 * Method GetMenuObserver … … 299 297 * @return callback function 300 298 */ 301 WidgetEventHandler* & GetRightKeyObserver();299 WidgetEventHandler* RightKeyObserver(); 302 300 303 301 /** … … 444 442 * @return Tbool 445 443 */ 446 TBool RightKeyCallback();444 TBool HandleCommandL( TInt aCommandId ); 447 445 448 446 /** … … 471 469 472 470 private: 473 /**471 /** 474 472 * Method LoadWidgetEngineDllL 475 473 * @since 3.2 … … 477 475 */ 478 476 void LoadWidgetEngineDllL(); 479 480 /** 481 * Method CreateAppHashTableL 482 * @since 3.2 483 * @return void 484 */ 485 void CreateAppHashTableL(); 486 477 487 478 /* 488 479 * Method LaunchApplicationL … … 523 514 MWidgetEngineBridge* iWidgetEngineBridge; 524 515 MWidgetCallback* iWidgetCallback; 525 RPtrHashMap<TDesC,TInt> iAppUidMap;526 516 RLibrary iLibrary; 527 517 CMenuItem* iMenuRoot; … … 549 539 550 540 /* 551 * Method Insert 541 * Method Append 542 * @since 3.2 543 * @param parent menu item 544 * @param menu item to be inserted 545 * @return TBool 546 */ 547 TBool Append( CMenuItem* root, CMenuItem* item ); 548 549 /* 550 * Method AppendSibling 552 551 * @since 3.2 553 552 * @param root of the tree 554 553 * @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 ); 554 * @return void 555 */ 556 void AppendSibling( CMenuItem* root, CMenuItem* item ); 568 557 569 558 /* … … 594 583 * Constructor 595 584 */ 596 static CMenuItem* NewL( const TDesC16& aText, TInt aCmdId, void* aObj = NULL ); 585 static CMenuItem* NewL( const TDesC16& aText, TInt aCmdId, 586 CMenuItem* aParent = NULL, void* aObj = NULL ); 597 587 598 588 /** … … 610 600 * C++ constructor. 611 601 */ 612 CMenuItem( const TDesC16& aText, TInt aCmdId, void* aObj = NULL ); 602 CMenuItem( const TDesC16& aText, TInt aCmdId, CMenuItem* aParent = NULL, 603 void* aObj = NULL ); 613 604 614 605 public: … … 640 631 * @return first child of menu item 641 632 */ 642 CMenuItem* &FirstChild() { return iFirstChild; }633 CMenuItem* FirstChild() { return iFirstChild; } 643 634 644 635 /* … … 648 639 * @return next sibling of menu item 649 640 */ 650 CMenuItem* &NextSibling() { return iNextSibling; }641 CMenuItem* NextSibling() { return iNextSibling; } 651 642 652 643 /* … … 664 655 * @return onselect callback function of menu item 665 656 */ 666 WidgetEventHandler* &Callback() { return iCallback; }657 WidgetEventHandler* Callback() { return iCallback; } 667 658 668 659 /* … … 672 663 * @return menu item javascript object 673 664 */ 674 void*& Obj() { return iObj; } 665 void* Obj() { return iObj; } 666 667 /* 668 * Method Parent() 669 * @since 3.2 670 * @param none 671 * @return parent menu item 672 */ 673 CMenuItem* Parent() { return iParent; } 675 674 676 675 /* … … 702 701 * @return none 703 702 */ 704 void SetFirstChild( CMenuItem* &aFirstChild ) { iFirstChild = aFirstChild; }703 void SetFirstChild( CMenuItem* aFirstChild ) { iFirstChild = aFirstChild; } 705 704 706 705 /* … … 710 709 * @return none 711 710 */ 712 void SetNextSibling( CMenuItem* &aNextSibling ) { iNextSibling = aNextSibling; }711 void SetNextSibling( CMenuItem* aNextSibling ) { iNextSibling = aNextSibling; } 713 712 714 713 /* … … 726 725 * @return none 727 726 */ 728 void SetCallback( WidgetEventHandler* &aCallback ) { iCallback = aCallback; }727 void SetCallback( WidgetEventHandler* aCallback ) { iCallback = aCallback; } 729 728 730 729 /* … … 734 733 * @return none 735 734 */ 736 void SetObj( void* &aObj ) { iObj = aObj; }735 void SetObj( void* aObj ) { iObj = aObj; } 737 736 738 737 private: 739 738 HBufC* iText;//data 740 739 TInt iCmdId;//data 740 CMenuItem* iParent;//data 741 741 CMenuItem* iFirstChild;//left node 742 742 CMenuItem* iNextSibling;//right node -
S60/trunk/WebKit/BrowserView/src/WidgetExtension.cpp
r21101 r21150 71 71 // LOCAL CONSTANTS AND MACROS 72 72 const TInt KOptionsCmdId = 6000; 73 const TInt KMaxOptionsMenu = 25;73 const TInt KMaxOptionsMenu = 63; 74 74 const TInt KMaxOptionsMenuItemSize = 256; //bytes 75 75 const TInt KMenuItemCommandIdBase = 20000; 76 76 77 const TInt KMediaGalleryUid = 0x101F8599;78 _LIT(KMediaGallery,"mediagallery");79 77 const TInt KWebBrowserUid = 0x10008D39; 80 _LIT(KWebBrowser,"webbrowser");81 const TInt KCamAppEngineUid = 0x101F857A;82 _LIT(KCamAppEngine,"camera");83 78 84 79 // MODULE DATA STRUCTURES … … 143 138 delete iWidgetBasePath; 144 139 delete iWidgetBundleId; 145 iAppUidMap.ResetAndDestroy();146 iLibrary.Close();147 140 // delete tree 148 141 DeleteTree( iMenuRoot ); 149 } 150 151 // ---------------------------------------------------------------------------- 152 // CWidgetExtension::delTree 142 iLibrary.Close(); 143 } 144 145 // ---------------------------------------------------------------------------- 146 // CWidgetExtension::DeleteTree 153 147 // 154 148 // … … 186 180 LoadWidgetEngineDllL(); 187 181 iWidgetEngineBridge->SetObserver( *this ); 188 CreateAppHashTableL();189 182 iResourceId = R_CASCADE_MENU_1; 190 }191 192 // ----------------------------------------------------------------------------193 // CWidgetExtension::CreateAppHashTableL194 //195 //196 //197 // ----------------------------------------------------------------------------198 //199 void CWidgetExtension::CreateAppHashTableL()200 {201 TInt* uidmg = new TInt( KMediaGalleryUid );202 HBufC* bufmedia = HBufC::NewL( TPtrC( KMediaGallery ).Length() );203 *bufmedia = KMediaGallery;204 205 TInt* uidweb = new TInt( KWebBrowserUid );206 HBufC* bufweb = HBufC::NewL( TPtrC( KWebBrowser ).Length() );207 *bufweb = KWebBrowser;208 209 TInt* uidcam = new TInt( KCamAppEngineUid );210 HBufC* bufcam = HBufC::NewL( TPtrC( KCamAppEngine ).Length() );211 *bufcam = KCamAppEngine;212 213 iAppUidMap.InsertL( bufmedia,uidmg );214 iAppUidMap.InsertL( bufweb, uidweb );215 iAppUidMap.InsertL( bufcam, uidcam );216 183 } 217 184 … … 364 331 } 365 332 333 // The binary tree representation of a multiway tree is based on 334 // first child-next sibling representation of the tree. In this representation 335 // every node is linked with its leftmost child and its next (right nearest) 336 // sibling. 337 338 /* 339 Example: Consider the following multiway tree 340 341 1 342 / | \ 343 / | \ 344 / | \ 345 2 3 4 346 / \ | 347 5 6 7 348 / \ 349 8 9 350 351 352 This tree can be represented in first child-next sibling manner as follows : 353 354 1 355 / 356 / 357 / 358 2---3---4 359 / / 360 5---6 7 361 / 362 8---9 363 364 365 If we look at the first child-next sibling representation of the tree closely, 366 we will see that it forms a binary tree. To see this better, rotate every 367 next-sibling edge 45 degrees clockwise. After that, the following binary tree is got: 368 369 1 370 / 371 2 372 / \ 373 5 3 374 \ \ 375 6 4 376 / 377 7 378 / 379 8 380 \ 381 9 382 383 */ 384 366 385 // ---------------------------------------------------------------------------- 367 386 // CWidgetExtension::AddOptionMenuItemsL … … 372 391 // 373 392 void CWidgetExtension::AddOptionMenuItemsL( 374 CEikMenuPane& aMenuPane, TInt aResourceId )393 CEikMenuPane& aMenuPane, TInt aResourceId ) 375 394 { 376 395 CMenuItem* node = NULL; … … 396 415 else if ( aResourceId >= R_CASCADE_MENU_1 ) //one of the cascade menu pane 397 416 { 398 for ( TInt i = 0; i < iCascadeArr.Count(); i++ )417 for ( TInt i = 0; i < iCascadeArr.Count(); i++ ) 399 418 { 400 419 if ( iCascadeArr[i].iResourceId == aResourceId ) … … 439 458 { 440 459 CEikMenuPaneItem::SData menuData; 441 menuData.iCommandId = aNode->CmdId() +KMenuItemCommandIdBase;460 menuData.iCommandId = aNode->CmdId() + KMenuItemCommandIdBase; 442 461 443 462 if ( aNode->FirstChild() ) 444 menuData.iCascadeId = iResourceId; 463 { 464 if ( iResourceId > R_CASCADE_MENU_1 + KMaxOptionsMenu ) 465 menuData.iCascadeId = 0; 466 else 467 menuData.iCascadeId = iResourceId; 468 } 445 469 else 446 470 menuData.iCascadeId = 0; … … 634 658 // 635 659 void CWidgetExtension::AddOptionsMenuItem( 636 const TDesC& aText, TInt aCmdId, TInt aParentId, void* iObj )660 const TDesC& aText, TInt aCmdId, TInt aParentId, void* aObj ) 637 661 { 638 if ( iMenuRoot == NULL)662 if ( !iMenuRoot ) 639 663 { 640 664 iMenuRoot = CMenuItem::NewL( _L(""), -1 ); … … 642 666 if ( aText.Length() > 0 ) 643 667 { 644 CMenuItem* item = CMenuItem::NewL( aText, aCmdId, iObj ); 645 Insert( iMenuRoot, item, aParentId ); 668 CMenuItem* parent = FindNodeById( iMenuRoot, aParentId ); 669 if ( !parent ) 670 return; 671 CMenuItem* item = CMenuItem::NewL( aText, aCmdId, parent, aObj ); 672 Append( parent, item ); 646 673 } 647 674 } … … 662 689 663 690 // ----------------------------------------------------------------------------- 664 // CWidgetExtension:: Insert665 // 666 // 667 // 668 // ----------------------------------------------------------------------------- 669 // 670 TBool CWidgetExtension:: Insert(671 CMenuItem* a Root, CMenuItem* aItem, TInt aParentId)691 // CWidgetExtension::Append 692 // 693 // 694 // 695 // ----------------------------------------------------------------------------- 696 // 697 TBool CWidgetExtension::Append( 698 CMenuItem* aParent, CMenuItem* aItem ) 672 699 { 673 if ( aRoot ) 674 { 675 if ( aRoot->CmdId() == aParentId ) 676 { 677 if ( aRoot->FirstChild() == NULL ) //first child 678 { 679 aRoot->SetFirstChild( aItem ); 680 } 681 else //insert as sibling of first child 682 { 683 InsertSibling( aRoot->FirstChild(), aItem ); 684 } 685 return true; 686 } 687 if ( Insert( aRoot->FirstChild(), aItem, aParentId ) ) 688 return true; 689 if ( Insert( aRoot->NextSibling(), aItem, aParentId ) ) 690 return true; 691 } 692 return false; 700 if ( !aParent ) 701 return EFalse; 702 703 if ( aParent->FirstChild() == NULL ) //first child 704 { 705 aParent->SetFirstChild( aItem ); 706 } 707 else //insert as sibling of first child 708 { 709 AppendSibling( aParent->FirstChild(), aItem ); 710 } 711 return ETrue; 693 712 } 694 713 695 714 // ----------------------------------------------------------------------------- 696 // CWidgetExtension:: InsertSibling697 // 698 // 699 // 700 // ----------------------------------------------------------------------------- 701 // 702 void CWidgetExtension:: InsertSibling( CMenuItem* aRoot, CMenuItem* aItem )715 // CWidgetExtension::AppendSibling 716 // 717 // 718 // 719 // ----------------------------------------------------------------------------- 720 // 721 void CWidgetExtension::AppendSibling( CMenuItem* aRoot, CMenuItem* aItem ) 703 722 { 704 723 if ( aRoot && ( aRoot->NextSibling() == NULL ) ) //first sibling … … 708 727 else 709 728 { 710 InsertSibling( aRoot->NextSibling(), aItem );729 AppendSibling( aRoot->NextSibling(), aItem ); 711 730 } 712 731 … … 721 740 // ---------------------------------------------------------------------------- 722 741 // 723 void CWidgetExtension::DeleteMenuItem( TInt aCmdId, TInt aParentCmdId ) 724 { 725 CMenuItem* node = NULL; 726 node = FindNodeById( iMenuRoot, aParentCmdId ); 727 728 if ( node && node->FirstChild() ) 742 void CWidgetExtension::DeleteMenuItem( TInt aCmdId ) 743 { 744 CMenuItem* node = FindNodeById( iMenuRoot, aCmdId ); 745 746 if ( !node ) 747 return; 748 749 CMenuItem* parent = node->Parent(); 750 751 if ( parent && parent->FirstChild() ) 729 752 { 730 753 //it could be first child 731 if ( node->FirstChild()->CmdId() == aCmdId )732 { 733 CMenuItem* tempFirstChild = node->FirstChild();754 if ( parent->FirstChild()->CmdId() == aCmdId ) 755 { 756 CMenuItem* tempFirstChild = parent->FirstChild(); 734 757 //the sibling of firstchild will be the new firstchild 735 node->SetFirstChild( node->FirstChild()->NextSibling() );758 parent->SetFirstChild( parent->FirstChild()->NextSibling() ); 736 759 DeleteTree( tempFirstChild ); 737 760 tempFirstChild = NULL; … … 741 764 else 742 765 { 743 CMenuItem* prev = node->FirstChild();766 CMenuItem* prev = parent->FirstChild(); 744 767 CMenuItem* item = NULL; 745 768 if ( prev ) … … 798 821 799 822 // ---------------------------------------------------------------------------- 800 // CWidgetExtension:: GetMenuItem801 // 802 // 803 // 804 // ---------------------------------------------------------------------------- 805 // 806 void CWidgetExtension:: GetMenuItem(823 // CWidgetExtension::MenuItem 824 // 825 // 826 // 827 // ---------------------------------------------------------------------------- 828 // 829 void CWidgetExtension::MenuItem( 807 830 TDes& textVal, TInt& cmdId, TBool& dimStat ) 808 831 { … … 893 916 894 917 // ---------------------------------------------------------------------------- 895 // CWidgetExtension:: GetMenuItemObserver896 // 897 // 898 // 899 // ---------------------------------------------------------------------------- 900 // 901 WidgetEventHandler* CWidgetExtension:: GetMenuItemObserver( TInt aCmdId )918 // CWidgetExtension::MenuItemObserver 919 // 920 // 921 // 922 // ---------------------------------------------------------------------------- 923 // 924 WidgetEventHandler* CWidgetExtension::MenuItemObserver( TInt aCmdId ) 902 925 { 903 926 CMenuItem* node = NULL; … … 923 946 924 947 // ---------------------------------------------------------------------------- 925 // CWidgetExtension:: GetMenuObserver926 // 927 // 928 // 929 // ---------------------------------------------------------------------------- 930 // 931 WidgetEventHandler* & CWidgetExtension::GetMenuObserver()948 // CWidgetExtension::MenuObserver 949 // 950 // 951 // 952 // ---------------------------------------------------------------------------- 953 // 954 WidgetEventHandler* CWidgetExtension::MenuObserver() 932 955 { 933 956 return iMenuCallback; … … 953 976 // ---------------------------------------------------------------------------- 954 977 // 955 WidgetEventHandler* & CWidgetExtension::GetRightKeyObserver()978 WidgetEventHandler* CWidgetExtension::RightKeyObserver() 956 979 { 957 980 return iRightKeyCallback; … … 959 982 960 983 // ---------------------------------------------------------------------------- 961 // CWidgetExtension:: RightKeyCallback962 // 963 // 964 // 965 // ---------------------------------------------------------------------------- 966 // 967 TBool CWidgetExtension:: RightKeyCallback()968 { 969 if ( iWidgetEngineBridge )984 // CWidgetExtension::HandleCommandL 985 // 986 // 987 // 988 // ---------------------------------------------------------------------------- 989 // 990 TBool CWidgetExtension::HandleCommandL( TInt aCommandId ) 991 { 992 if ( iWidgetEngineBridge && aCommandId == EAknSoftkeyExit ) 970 993 { 971 994 return iWidgetEngineBridge->RightSoftKeyPressed(); … … 1052 1075 // 1053 1076 CMenuItem* CMenuItem::NewL( 1054 const TDesC16& aText, TInt aCmdId, void* aObj )1055 { 1056 CMenuItem* self = new ( ELeave ) CMenuItem( aText, aCmdId, a Obj );1077 const TDesC16& a