Changeset 21970 in webkit
- Timestamp:
- Jun 4, 2007 2:49:07 PM (17 years ago)
- Location:
- S60/trunk/WebKit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
S60/trunk/WebKit/BrowserView/src/WidgetExtension.cpp
r21150 r21970 46 46 #include <apgtask.h> 47 47 #include <browserlauncher.h> 48 #include <widgetui.rsg>49 48 #include <widgetmenu.rsg> 50 49 #include <eikbtgpc.h> 50 #include <avkon.hrh> 51 51 52 52 #include "WidgetExtension.h" … … 93 93 MWidgetCallback& aWidgetCallback ) 94 94 { 95 CWidgetExtension* self = new ( ELeave ) CWidgetExtension( 95 CWidgetExtension* self = new ( ELeave ) CWidgetExtension( 96 96 aWebKitView, aWidgetCallback ); 97 97 CleanupStack::PushL( self ); … … 139 139 delete iWidgetBundleId; 140 140 // delete tree 141 DeleteTree( iMenuRoot ); 141 DeleteTree( iMenuRoot ); 142 142 iLibrary.Close(); 143 143 } … … 190 190 // ---------------------------------------------------------------------------- 191 191 // 192 void CWidgetExtension::LaunchApplicationL( 192 void CWidgetExtension::LaunchApplicationL( 193 193 const TUid& aUid, const TDesC& aParam ) 194 194 { … … 232 232 // ---------------------------------------------------------------------------- 233 233 // 234 void CWidgetExtension::OpenApplication( 234 void CWidgetExtension::OpenApplication( 235 235 const TUid& aAppUid, const TDesC& aParam ) 236 236 { … … 297 297 // ---------------------------------------------------------------------------- 298 298 // 299 void CWidgetExtension::SetPreferenceForKey( 299 void CWidgetExtension::SetPreferenceForKey( 300 300 const TDesC& aKey, const TDesC& aValue ) 301 301 { … … 331 331 } 332 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 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 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 336 // sibling. 337 338 /* 339 Example: Consider the following multiway tree 340 341 1 342 342 / | \ 343 343 / | \ … … 363 363 364 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 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 367 next-sibling edge 45 degrees clockwise. After that, the following binary tree is got: 368 368 … … 390 390 // ---------------------------------------------------------------------------- 391 391 // 392 void CWidgetExtension::AddOptionMenuItemsL( 392 void CWidgetExtension::AddOptionMenuItemsL( 393 393 CEikMenuPane& aMenuPane, TInt aResourceId ) 394 394 { … … 397 397 TInt parentCmdId = -1; 398 398 399 if ( aResourceId == R_WIDGETUI_MENU ) 400 { 401 //invoke menu onshow callback 402 if ( iWidgetEngineBridge ) 403 { 404 iWidgetEngineBridge->MenuShowed(); 405 } 406 407 if ( aMenuPane.NumberOfItemsInPane() > 1 ) 408 { 409 aMenuPane.DeleteBetweenMenuItems( 410 0, aMenuPane.NumberOfItemsInPane() - 2 ); 411 } 412 if ( iMenuRoot ) 413 node = iMenuRoot->FirstChild(); 414 } 415 else if ( aResourceId >= R_CASCADE_MENU_1 ) //one of the cascade menu pane 416 { 399 if ( aResourceId >= R_CASCADE_MENU_1 ) //one of the cascade menu pane 400 { 417 401 for ( TInt i = 0; i < iCascadeArr.Count(); i++ ) 418 402 { … … 424 408 } 425 409 if ( parentCmdId != -1 ) 426 { 410 { 427 411 MenuItemSelected( parentCmdId + KMenuItemCommandIdBase); 428 412 parentNode = FindNodeById( iMenuRoot, parentCmdId ); … … 431 415 node = parentNode->FirstChild(); 432 416 } 417 else 418 { 419 //invoke menu onshow callback 420 if ( iWidgetEngineBridge ) 421 { 422 iWidgetEngineBridge->MenuShowed(); 423 } 424 425 if ( aMenuPane.NumberOfItemsInPane() > 1 ) 426 { 427 aMenuPane.DeleteBetweenMenuItems( 428 0, aMenuPane.NumberOfItemsInPane() - 2 ); 429 } 430 if ( iMenuRoot ) 431 node = iMenuRoot->FirstChild(); 432 } 433 433 434 434 if ( node ) … … 436 436 //add first child 437 437 AddMenuItem( aMenuPane, node ); 438 438 439 439 //add all other children (siblings of first child) 440 440 CMenuItem* sibling = node->NextSibling(); … … 489 489 // ---------------------------------------------------------------------------- 490 490 void CWidgetExtension::MenuItemSelected( TInt aCmdId ) 491 { 491 { 492 492 if ( iWidgetEngineBridge ) 493 493 { … … 495 495 } 496 496 497 OnShowSelected(); 497 OnShowSelected(); 498 498 } 499 499 … … 607 607 // ----------------------------------------------------------------------------- 608 608 // 609 void CWidgetExtension::SetParamL( 609 void CWidgetExtension::SetParamL( 610 610 TBrCtlDefs::TBrCtlWidgetParams aParam, const TDesC& aValue ) 611 611 { … … 635 635 // ----------------------------------------------------------------------------- 636 636 // 637 void CWidgetExtension::SetParamL( 637 void CWidgetExtension::SetParamL( 638 638 TBrCtlDefs::TBrCtlWidgetParams aParam, TUint aValue ) 639 639 { … … 657 657 // ----------------------------------------------------------------------------- 658 658 // 659 void CWidgetExtension::AddOptionsMenuItem( 659 void CWidgetExtension::AddOptionsMenuItem( 660 660 const TDesC& aText, TInt aCmdId, TInt aParentId, void* aObj ) 661 { 662 if ( !iMenuRoot ) 663 { 661 { 662 if ( !iMenuRoot ) 663 { 664 664 iMenuRoot = CMenuItem::NewL( _L(""), -1 ); 665 } 665 } 666 666 if ( aText.Length() > 0 ) 667 667 { … … 669 669 if ( !parent ) 670 670 return; 671 CMenuItem* item = CMenuItem::NewL( aText, aCmdId, parent, aObj ); 672 Append( parent, item ); 671 CMenuItem* item = CMenuItem::NewL( aText, aCmdId, parent, aObj ); 672 Append( parent, item ); 673 673 } 674 674 } … … 683 683 void CWidgetExtension::SetRightSoftKeyLabel( const TDesC& aText ) 684 684 { 685 CEikButtonGroupContainer * pCbaGroup = CEikButtonGroupContainer::Current(); 685 CEikButtonGroupContainer * pCbaGroup = CEikButtonGroupContainer::Current(); 686 686 pCbaGroup->SetCommandL( EAknSoftkeyExit, aText ); 687 687 pCbaGroup->DrawNow(); … … 695 695 // ----------------------------------------------------------------------------- 696 696 // 697 TBool CWidgetExtension::Append( 697 TBool CWidgetExtension::Append( 698 698 CMenuItem* aParent, CMenuItem* aItem ) 699 { 699 { 700 700 if ( !aParent ) 701 701 return EFalse; 702 702 703 if ( aParent->FirstChild() == NULL ) //first child 704 { 705 aParent->SetFirstChild( aItem ); 706 } 703 if ( aParent->FirstChild() == NULL ) //first child 704 { 705 aParent->SetFirstChild( aItem ); 706 } 707 707 else //insert as sibling of first child 708 { 708 { 709 709 AppendSibling( aParent->FirstChild(), aItem ); 710 710 } 711 return ETrue; 712 } 711 return ETrue; 712 } 713 713 714 714 // ----------------------------------------------------------------------------- … … 742 742 void CWidgetExtension::DeleteMenuItem( TInt aCmdId ) 743 743 { 744 CMenuItem* node = FindNodeById( iMenuRoot, aCmdId ); 744 CMenuItem* node = FindNodeById( iMenuRoot, aCmdId ); 745 745 746 746 if ( !node ) … … 762 762 } 763 763 //or one of the sibling of firstchild 764 else 764 else 765 765 { 766 766 CMenuItem* prev = parent->FirstChild(); … … 777 777 break; 778 778 } 779 item = item->NextSibling(); 779 item = item->NextSibling(); 780 780 } 781 781 } … … 803 803 // ---------------------------------------------------------------------------- 804 804 // 805 void CWidgetExtension::ReplaceMenuItem( 806 TInt oldItemCmdId, 807 const TDesC& newItemText, 808 TInt newItemCmdId, 805 void CWidgetExtension::ReplaceMenuItem( 806 TInt oldItemCmdId, 807 const TDesC& newItemText, 808 TInt newItemCmdId, 809 809 TInt newItemDimmed ) 810 810 { 811 811 CMenuItem* node = NULL; 812 812 813 node = FindNodeById( iMenuRoot, oldItemCmdId ); 813 node = FindNodeById( iMenuRoot, oldItemCmdId ); 814 814 if ( node ) 815 815 { 816 node->SetText( newItemText ); 817 node->SetCmdId( newItemCmdId ); 816 node->SetText( newItemText ); 817 node->SetCmdId( newItemCmdId ); 818 818 node->SetDimmed( newItemDimmed ); 819 819 } … … 827 827 // ---------------------------------------------------------------------------- 828 828 // 829 void CWidgetExtension::MenuItem( 829 void CWidgetExtension::MenuItem( 830 830 TDes& textVal, TInt& cmdId, TBool& dimStat ) 831 831 { … … 834 834 if ( cmdId == -1 ) 835 835 { 836 node = FindNodeByText( iMenuRoot, textVal ); 836 node = FindNodeByText( iMenuRoot, textVal ); 837 837 } 838 838 else … … 859 859 CMenuItem* node = NULL; 860 860 861 node = FindNodeByText( iMenuRoot, textVal ); 861 node = FindNodeByText( iMenuRoot, textVal ); 862 862 if ( node ) 863 863 return node->Obj(); 864 864 else 865 return NULL; 865 return NULL; 866 866 } 867 867 … … 877 877 CMenuItem* node = NULL; 878 878 879 node = FindNodeById( iMenuRoot, cmdId ); 879 node = FindNodeById( iMenuRoot, cmdId ); 880 880 if ( node ) 881 881 return node->Obj(); 882 882 else 883 return NULL; 883 return NULL; 884 884 } 885 885 … … 894 894 { 895 895 CMenuItem* node = NULL; 896 node = FindNodeById( iMenuRoot, aCmdId ); 897 if ( node ) 896 node = FindNodeById( iMenuRoot, aCmdId ); 897 if ( node ) 898 898 node->SetDimmed( aValue ); 899 899 } … … 906 906 // ---------------------------------------------------------------------------- 907 907 // 908 void CWidgetExtension::SetMenuItemObserver( 908 void CWidgetExtension::SetMenuItemObserver( 909 909 TInt aCmdId, WidgetEventHandler* aOnSelectCallback ) 910 910 { 911 911 CMenuItem* node = NULL; 912 node = FindNodeById( iMenuRoot, aCmdId ); 912 node = FindNodeById( iMenuRoot, aCmdId ); 913 913 if ( node ) 914 914 node->SetCallback( aOnSelectCallback ); … … 925 925 { 926 926 CMenuItem* node = NULL; 927 node = FindNodeById( iMenuRoot, aCmdId ); 927 node = FindNodeById( iMenuRoot, aCmdId ); 928 928 if ( node ) 929 929 return node->Callback(); … … 953 953 // 954 954 WidgetEventHandler* CWidgetExtension::MenuObserver() 955 { 955 { 956 956 return iMenuCallback; 957 957 } … … 977 977 // 978 978 WidgetEventHandler* CWidgetExtension::RightKeyObserver() 979 { 979 { 980 980 return iRightKeyCallback; 981 981 } … … 1008 1008 CMenuItem* item = NULL; 1009 1009 1010 if ( !node ) 1010 if ( !node ) 1011 1011 return item; 1012 1012 … … 1017 1017 else 1018 1018 { 1019 if ( node->FirstChild() ) 1020 { 1021 item = FindNodeById( node->FirstChild(), aCmdId ); 1022 if ( item ) 1019 if ( node->FirstChild() ) 1020 { 1021 item = FindNodeById( node->FirstChild(), aCmdId ); 1022 if ( item ) 1023 1023 return item; 1024 } 1024 } 1025 1025 if ( node->NextSibling() ) 1026 { 1027 item = FindNodeById( node->NextSibling(), aCmdId ); 1026 { 1027 item = FindNodeById( node->NextSibling(), aCmdId ); 1028 1028 } 1029 1029 } … … 1042 1042 CMenuItem* item = NULL; 1043 1043 1044 if ( !node ) 1044 if ( !node ) 1045 1045 return item; 1046 1046 … … 1051 1051 else 1052 1052 { 1053 if ( node->FirstChild() ) 1054 { 1055 item = FindNodeByText( node->FirstChild(), aText ); 1056 1057 if ( item ) 1053 if ( node->FirstChild() ) 1054 { 1055 item = FindNodeByText( node->FirstChild(), aText ); 1056 1057 if ( item ) 1058 1058 return item; 1059 } 1059 } 1060 1060 if ( node->NextSibling() ) 1061 { 1062 item = FindNodeByText( node->NextSibling(), aText ); 1061 { 1062 item = FindNodeByText( node->NextSibling(), aText ); 1063 1063 } 1064 1064 } -
S60/trunk/WebKit/ChangeLog
r21915 r21970 1 yadavall, reviewed by <yongjun.zhang@nokia.com> 2 DESC: Remove circular dependency between UI RSS file and engine 3 http://bugs.webkit.org/show_bug.cgi?id=13994 4 5 * BrowserView/src/WidgetExtension.cpp: 6 (CWidgetExtension::NewL): 7 (CWidgetExtension::~CWidgetExtension): 8 (CWidgetExtension::LaunchApplicationL): 9 (CWidgetExtension::OpenApplication): 10 (CWidgetExtension::SetPreferenceForKey): 11 (CWidgetExtension::AddOptionMenuItemsL): 12 (CWidgetExtension::MenuItemSelected): 13 (CWidgetExtension::SetParamL): 14 (CWidgetExtension::AddOptionsMenuItem): 15 (CWidgetExtension::SetRightSoftKeyLabel): 16 (CWidgetExtension::Append): 17 (CWidgetExtension::DeleteMenuItem): 18 (CWidgetExtension::ReplaceMenuItem): 19 (CWidgetExtension::MenuItem): 20 (CWidgetExtension::GetFromMenuItemCollection): 21 (CWidgetExtension::SetDimmed): 22 (CWidgetExtension::SetMenuItemObserver): 23 (CWidgetExtension::MenuItemObserver): 24 (CWidgetExtension::MenuObserver): 25 (CWidgetExtension::RightKeyObserver): 26 (CWidgetExtension::FindNodeById): 27 (CWidgetExtension::FindNodeByText): 28 1 29 spadma, reviewed by zalan 2 30 DESC: Browser control API, CBrCtlInterface:: ContentSize() does not return correct content size.
Note: See TracChangeset
for help on using the changeset viewer.