2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 /*@file: IntAddressbar
19 *@brief: This class defines common behaviour of Addressbar control.
22 #include "IntAddressbar.h"
23 #include "IntCommonLib.h"
25 #include "IntMultipleWindowPresentationModel.h"
26 #include "IntSettingPresentationModel.h"
27 #include "IntMultipleWindowPresentationModel.h"
29 using namespace Tizen::App;
30 using namespace Tizen::Base;
31 using namespace Tizen::Ui;
32 using namespace Tizen::Ui::Controls;
33 using namespace Tizen::Graphics;
35 static const wchar_t* IDB_SEARCH_INPUT_FIELD_BG = L"I01_toolbar_input_field.9.png";
36 static const wchar_t* IDB_TITLE_PROGRESS_BAR_BG = L"I01_title_progress_bar_bg.png";
37 static const wchar_t* IDB_TITLE_PROGRESS_BAR = L"I01_title_progress_bar.png";
38 static const wchar_t* IDB_ICON_PRIVATE = L"I01_icon_private.png";
41 const int Addressbar::IDA_REFRESH_BTN_CLICKED = 101;
42 const int Addressbar::IDA_READER_BTN_CLICKED = 102;
43 const int Addressbar::IDA_STOP_BTN_CLICKED = 103;
44 const int Addressbar::IDA_GO_BACK = 104;
45 const int Addressbar::IDA_GO_FORWARD = 105;
46 const int Addressbar::IDA_CANCEL = 106;
47 const int Addressbar::IDA_CLEAR_URL = 107;
49 Addressbar::Addressbar(void)
51 //__currentAddMode = ADDRESSBAR_MODE_LOADING_COMPLETE;
54 __isLoadingData = false;
55 __isLoadingCompleted = false;
56 __progressPercentage = 0;
57 __pAddressbarBg = null;
59 //__pCancelBtn = null;
61 __pFavIcon = FaviconManager::GetInstance()->GetDefaultFaviconN();
62 __pFaviconLabel = null;
63 //__pGoBackBtn = null;
64 //__pGoForwardBtn = null;
65 __pLabelPrivateOn = null;
67 __pPrivateIconLabel = null;
68 __pProgressbarLabel = null;
69 __pPrivateIconLabel = null ;
70 //__pReaderBtn = null;
71 //__pRefreshBtn = null;
74 __pSearchLabel = null;
75 __pAddressbarUrlField = null;
76 __pToolBarLabel = null;
77 __pAddressbarURLLabel = null;
78 __pAddressBackBtn = null;
81 Addressbar::~Addressbar(void)
83 if (__pFavIcon != null)
91 Addressbar::Initialize(const Rectangle& rect)
95 AppLogDebug("Addressbar::Initialize entered");
96 //Construct the base first
97 r = Construct(L"IDL_ADDRESSBAR");
99 //Add background label
100 Label* pBgLabel = static_cast<Label*> (GetControl(L"IDC_BG_LABEL",true));
101 if (pBgLabel == NULL)
103 AppLogDebug("Control not found returning E_INVALID_KEY");
104 return E_INVALID_KEY;
107 //Add inner panel for border
108 __pBgPanel = static_cast<Panel*> (GetControl(L"IDC_BG_PANEL",true));
109 if (__pBgPanel == NULL)
111 AppLogDebug("Control not found returning E_INVALID_KEY");
112 return E_INVALID_KEY;
115 /*__pLabelPrivateOn = static_cast<Label*> (GetControl(L"IDC_LABEL_PRIVATE_ON",true));
117 if (__pLabelPrivateOn == NULL)
119 AppLogDebug("Control not found returning E_INVALID_KEY");
120 return E_INVALID_KEY;
122 __pLabelPrivateOn->SetShowState(false);*/
124 __pAddressbarBg = static_cast<Label*> (GetControl(L"IDC_ADDRESSBAR_BG_LABEL",true));
125 if (__pAddressbarBg == NULL)
127 AppLogDebug("Control not found returning E_INVALID_KEY");
128 return E_INVALID_KEY;
130 __pBgPanel->SetBackgroundColor(CUSTOM_COLOR_TRANSPARENT);
131 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_SEARCH_INPUT_FIELD_BG, __pAddressbarBg->GetWidth(), __pAddressbarBg->GetHeight());
134 __pAddressbarBg->SetBackgroundBitmap(*pBitmap);
138 //Add the backround label for displaying progressbar
139 __pProgressbarLabel = static_cast<Label*> (GetControl(L"IDC_PROGRESS_BAR_LABEL",true));
140 if (__pProgressbarLabel == NULL)
142 AppLogDebug("Control not found returning E_INVALID_KEY");
143 return E_INVALID_KEY;
145 __pProgressbarLabel->SetShowState(false);
147 //Add the stop button
148 __pStopBtn = static_cast<Button*> (GetControl(L"IDC_STOP_BUTTON",true));
149 if (__pStopBtn == NULL)
151 AppLogDebug("Control not found returning E_INVALID_KEY");
152 return E_INVALID_KEY;
154 __pStopBtn->SetActionId(IDA_STOP_BTN_CLICKED);
155 __pStopBtn->AddActionEventListener(*this);
156 __pStopBtn->SetShowState(false);
159 __pClearBtn = static_cast<Button*> (GetControl(L"IDC_CLEAR_BUTTON",true));
160 if (__pClearBtn == NULL)
162 AppLogDebug("Control not found returning E_INVALID_KEY");
163 return E_INVALID_KEY;
165 __pClearBtn->SetActionId(IDA_CLEAR_URL);
166 __pClearBtn->AddActionEventListener(*this);
167 __pClearBtn->SetShowState(true);
169 //Add the editfield for url
170 __pAddressbarUrlField = static_cast<EditField*> (GetControl(L"IDC_URL_EDITFIELD",true));
171 if (__pAddressbarUrlField == NULL)
173 AppLogDebug("Control not found returning E_INVALID_KEY");
174 return E_INVALID_KEY;
177 __pAddressbarUrlField->SetOverlayKeypadCommandButtonVisible(false);
178 __pAddressbarUrlField->SetKeypadAction(KEYPAD_ACTION_GO);
179 __pAddressbarUrlField->AddFocusEventListener(*this);
180 __pAddressbarUrlField->AddTextEventListener(*this);
181 if(__pAddressbarUrlField->GetTextLength() == 0)
183 __pAddressbarUrlField->SetKeypadActionEnabled(false);
187 __pAddressbarUrlField->SetKeypadActionEnabled(true);
190 __pToolBarLabel = static_cast<Label*> (GetControl(L"IDC_TOOLBAR_LABEL",true));
191 if (__pToolBarLabel == NULL)
193 AppLogDebug("Control not found returning E_INVALID_KEY");
194 return E_INVALID_KEY;
196 __pToolBarLabel->SetShowState(true);
198 __pAddressbarURLLabel = static_cast<Label*> (GetControl(L"IDC_URL_LABEL",true));
199 if (__pAddressbarURLLabel == NULL)
201 AppLogDebug("__pURLLabel Control not found returning E_INVALID_KEY");
202 return E_INVALID_KEY;
204 __pAddressbarURLLabel->SetShowState(true);
206 __pAddressBackBtn = static_cast<Button*> (GetControl(L"IDC_ADDRESS_BACK_BUTTON",true));
207 if (__pAddressBackBtn == NULL)
209 AppLogDebug("__pAddressBackBtn Control not found returning E_INVALID_KEY");
210 return E_INVALID_KEY;
212 __pAddressBackBtn->SetActionId(IDA_CANCEL);
213 __pAddressBackBtn->AddActionEventListener(*this);
214 __pAddressBackBtn->SetShowState(true);
215 //IDC_ADDRESS_BACK_BUTTON
217 // Added to get the favorite url if not set then address bar is about blank
219 if (SettingPresentationModel::GetInstance()->GetHomepage().CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
221 __pAddressbarUrlField->SetGuideText(CommonUtil::GetString(L"IDS_BR_BODY_SEARCH_OR_ENTER_URL"));
223 else if (SettingPresentationModel::GetInstance()->GetHomepage().CompareTo((L"IDS_BR_BODY_BLANK_PAGE")) == 0)
225 __pAddressbarUrlField->SetGuideText(CommonUtil::GetString(L"IDS_BR_BODY_ABOUT_C_BLANK"));
229 //__pUrlField->SetText(SettingPresentationModel::GetInstance()->GetFavoriteURL());
230 __pAddressbarUrlField->SetGuideText(CommonUtil::GetString(L"IDS_BR_BODY_SEARCH_OR_ENTER_URL"));
232 __pAddressbarUrlField->AddKeypadEventListener(*this);
234 AppLogDebug("Addressbar::Initialize exit");
239 Addressbar::UpdateProgressBitmap(void)
241 result r = E_SUCCESS;
242 if (__pProgressbarLabel == null)
244 int w = __pProgressbarLabel->GetWidth();
245 int h = __pProgressbarLabel->GetHeight();
247 int progressWidth = 0;
248 Bitmap* pRetBitmap = null;
250 if (__progressPercentage == 0 || __progressPercentage == 100)
252 __pProgressbarLabel->SetShowState(false);
253 __pProgressbarLabel->Invalidate(false);
258 __pProgressbarLabel->SetShowState(true);
259 __pProgressbarLabel->Invalidate(false);
262 r = canvas.Construct(Rectangle(0, 0, w, h));
266 AppLogException("Canvas construction failed with %s", GetErrorMessage(r));
271 Bitmap *pBgBmp = AppResource::GetInstance()->GetBitmapN(IDB_TITLE_PROGRESS_BAR_BG);
275 pBgBmp->Scale(Dimension(w, h));
276 canvas.DrawBitmap(Point(0,0), *pBgBmp);
280 progressWidth = (double) (w) * __progressPercentage / 100;
281 AppLogDebug("progressWidth: %d", progressWidth);
282 Bitmap *pProgressBmp = AppResource::GetInstance()->GetBitmapN(IDB_TITLE_PROGRESS_BAR);
284 if (pProgressBmp != null)
286 pProgressBmp->Scale(Dimension(progressWidth, h));
287 canvas.DrawBitmap(Point(0,0), *pProgressBmp);
291 pRetBitmap = new (std::nothrow) Bitmap();
293 if (pRetBitmap == null)
295 AppLogException("Bitmap creation failed with %s", GetErrorMessage(r));
299 pRetBitmap->Construct(canvas, canvas.GetBounds());
301 if (__pProgressbarLabel != null && pRetBitmap != null)
303 __pProgressbarLabel->SetBackgroundBitmap(*pRetBitmap);
304 __pProgressbarLabel->Invalidate(false);
308 if (pRetBitmap != null)
317 Addressbar::SetUrl(const String& url)
320 String updatedDisplayUrl;
321 updatedDisplayUrl.Clear();
323 if (__pAddressbarUrlField != NULL)
325 String removedHttpUrl = RemoveHttpTextFromDisplayURL();
326 if (removedHttpUrl.IsEmpty() == false)
328 __pAddressbarUrlField->SetText(removedHttpUrl);
332 __pAddressbarUrlField->SetText(__displayUrl);
335 __pAddressbarUrlField->Invalidate(false);
336 __pAddressbarUrlField->SetCursorPosition(0);
341 Addressbar::GetUrl(void)
347 Addressbar::GetAddressbarMode(void)
349 return __currentAddMode;
353 Addressbar::SetAddressbarMode(AddressBarMode addMode)
355 AppLogDebug("AddressBar::setAddressbarMode to %d",addMode);
357 __currentAddMode = addMode;
361 case ADDRESSBAR_MODE_INVALID:
366 case ADDRESSBAR_MODE_READER:
368 // __pBgPanel->SetPosition(__pGoBackBtn->GetPosition().x + 2* __pGoBackBtn->GetWidth() + 13,__pBgPanel->GetPosition().y);
369 // __pSearchLabel->SetShowState(false);
370 // __pFaviconLabel->SetShowState(true);
371 // __pCancelBtn->SetShowState(false);
372 // __pRefreshBtn->SetShowState(false);
373 __pStopBtn->SetShowState(false);
374 // __pReaderBtn->SetShowState(true);
375 // __pReaderBtn->Invalidate(true);
376 // __pGoForwardBtn->SetShowState(true);
377 // __pGoBackBtn->SetShowState(true);
378 __pClearBtn->SetShowState(false);
381 case ADDRESSBAR_MODE_LOADING:
383 // __pBgPanel->SetPosition(__pGoBackBtn->GetPosition().x + 2* __pGoBackBtn->GetWidth() + 13,__pBgPanel->GetPosition().y);
384 // __pSearchLabel->SetShowState(false);
385 // __pFaviconLabel->SetShowState(true);
386 // __pCancelBtn->SetShowState(false);
387 // __pRefreshBtn->SetShowState(false);
388 __pStopBtn->SetShowState(true);
389 // __pReaderBtn->SetShowState(false);
390 // __pGoForwardBtn->SetShowState(true);
391 // __pGoBackBtn->SetShowState(true);
392 __pClearBtn->SetShowState(false);
396 case ADDRESSBAR_MODE_LOADING_COMPLETE:
398 // __pBgPanel->SetPosition(__pGoBackBtn->GetPosition().x + 2* __pGoBackBtn->GetWidth() + 13,__pBgPanel->GetPosition().y);
399 // __pCancelBtn->SetShowState(false);
401 if (__pAddressbarUrlField && __pAddressbarUrlField->GetText().IsEmpty() == false)
403 // __pSearchLabel->SetShowState(false);
404 // __pFaviconLabel->SetShowState(true);
408 // __pSearchLabel->SetShowState(true);
409 // __pFaviconLabel->SetShowState(false);
412 if (__pAddressbarUrlField != NULL)
414 __pAddressbarUrlField->SetText(__displayUrl);
415 __pAddressbarUrlField->HideKeypad();
418 // __pRefreshBtn->SetShowState(true);
419 __pStopBtn->SetShowState(false);
420 // __pReaderBtn->SetShowState(false);
421 // __pGoForwardBtn->SetShowState(true);
422 // __pGoBackBtn->SetShowState(true);
423 __pClearBtn->SetShowState(false);
426 case ADDRESSBAR_MODE_EDIT:
428 Form *pForm = static_cast<Form*>(GetParent());
429 if (pForm!= null && (pForm->GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT ||pForm->GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE ))
431 // __pBgPanel->SetBounds(__pBgPanel->GetX(),__pBgPanel->GetY(),static_cast<Form*>(GetParent())->GetClientAreaBounds().width - __pCancelBtn->GetWidth() - 30,__pBgPanel->GetHeight());
432 // __pAddressbarBg->SetBounds(__pAddressbarBg->GetX(),__pAddressbarBg->GetY(),static_cast<Form*>(GetParent())->GetClientAreaBounds().width - __pCancelBtn->GetWidth() - 30,__pAddressbarBg->GetHeight());
433 __pClearBtn->SetBounds(__pBgPanel->GetWidth() - __pClearBtn->GetWidth(),__pClearBtn->GetY(),__pClearBtn->GetWidth(),__pClearBtn->GetHeight());
437 // __pBgPanel->SetBounds(__pBgPanel->GetX(),__pBgPanel->GetY(),static_cast<Form*>(GetParent())->GetClientAreaBounds().width - __pCancelBtn->GetWidth() - 48,__pBgPanel->GetHeight());
438 // __pAddressbarBg->SetBounds(__pAddressbarBg->GetX(),__pAddressbarBg->GetY(),static_cast<Form*>(GetParent())->GetClientAreaBounds().width - __pCancelBtn->GetWidth() - 48,__pAddressbarBg->GetHeight());
439 __pClearBtn->SetBounds(__pBgPanel->GetWidth() - __pClearBtn->GetWidth(),__pClearBtn->GetY(),__pClearBtn->GetWidth(),__pClearBtn->GetHeight());
442 // __pBgPanel->SetPosition(__pGoBackBtn->GetPosition().x,__pBgPanel->GetPosition().y);
443 // __pCancelBtn->SetShowState(true);
444 // __pRefreshBtn->SetShowState(false);
445 __pStopBtn->SetShowState(false);
446 // __pReaderBtn->SetShowState(false);
447 // __pGoForwardBtn->SetShowState(false);
448 // __pGoBackBtn->SetShowState(false);
449 __pClearBtn->SetShowState(true);
452 // __pCancelBtn->SetBounds(__pBgPanel->GetWidth(), __pCancelBtn->GetY(), GetWidth() - 48 - __pBgPanel->GetWidth(), __pCancelBtn->GetHeight());
454 if (__pAddressbarUrlField && __pAddressbarUrlField->GetText().IsEmpty() == true)
456 // __pSearchLabel->SetShowState(true);
457 // __pFaviconLabel->SetShowState(false);
461 // __pSearchLabel->SetShowState(false);
462 // __pFaviconLabel->SetShowState(true);
464 if (__pAddressbarUrlField != NULL)
466 __pAddressbarUrlField->SetCursorPosition(__pAddressbarUrlField->GetTextLength());
473 if (__pAddressbarBg->GetWidth() != __pBgPanel->GetWidth())
475 __pAddressbarBg->SetBounds(Rectangle(0, 0, __pBgPanel->GetWidth(), __pBgPanel->GetHeight()));
476 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_search_input_field_bg.9.png", __pAddressbarBg->GetWidth(), __pAddressbarBg->GetHeight());
479 __pAddressbarBg->SetBackgroundBitmap(*pBitmap);
486 if (__pListener != null)
488 __pListener->OnAddressBarModeChanged(*this);
493 Addressbar::SetFaviconBitmap(const Tizen::Graphics::Bitmap& favicon)
496 String url =__pAddressbarUrlField->GetText();
497 String secureSiteText = "https://";
499 flag = url.StartsWith(secureSiteText,0);
501 if (__pFavIcon != null)
506 __pFavIcon = new(std::nothrow) Bitmap();
507 __pFavIcon->Construct(favicon,Rectangle(0,0,favicon.GetWidth(),favicon.GetHeight()));
511 Bitmap* pButtonImage = GetLockedImageN();
513 if (pButtonImage != null)
515 // __pFaviconLabel->SetBackgroundBitmap(*pButtonImage);
516 // __pFaviconLabel->Invalidate(true);
522 /*if (__pFaviconLabel != null)
524 __pFaviconLabel->SetBackgroundBitmap(*__pFavIcon);
525 __pFaviconLabel->Invalidate(true);
530 void Addressbar::SaveAddressbarEditText()
532 __editTextUrl = __pAddressbarUrlField->GetText();
536 Addressbar::UpdateFaviconBitmap(bool isPrivateOn)
539 String url =__pAddressbarUrlField->GetText();
540 String secureSiteText = "https://";
542 flag = url.StartsWith(secureSiteText,0);
544 /*if (isPrivateOn == true)
546 __pUrlField->SetBounds(__pLabelPrivateOn->GetBounds().x + __pLabelPrivateOn->GetBounds().width,__pUrlField->GetBounds().y , __pAddressbarBg->GetBounds().width - __pLabelPrivateOn->GetBounds().width - __pRefreshBtn->GetBounds().width - __pSearchLabel->GetBounds().width,__pUrlField->GetBounds().height );
547 __pLabelPrivateOn->SetShowState(true);
552 __pUrlField->SetBounds(__pLabelPrivateOn->GetBounds().x ,__pUrlField->GetBounds().y , __pAddressbarBg->GetBounds().width - __pRefreshBtn->GetBounds().width - __pSearchLabel->GetBounds().width,__pUrlField->GetBounds().height );
553 __pLabelPrivateOn->SetShowState(false);
559 Bitmap* pButtonImage = GetLockedImageN();
561 if (pButtonImage != null)
563 // __pFaviconLabel->SetBackgroundBitmap(*pButtonImage);
564 // __pFaviconLabel->Invalidate(true);
570 /*if (__pFaviconLabel != null)
572 __pFaviconLabel->SetBackgroundBitmap(*__pFavIcon);
573 __pFaviconLabel->Invalidate(true);
578 __pAddressbarBg->Invalidate(true);
582 Addressbar::SetForwardButtonEnabled(bool isEnabled)
584 // __pGoForwardBtn->SetEnabled(isEnabled);
585 // __pGoBackBtn->Invalidate(true);
589 Addressbar::SetBackButtonEnabled(bool isEnabled)
591 // __pGoBackBtn->SetEnabled(isEnabled);
592 // __pGoBackBtn->Invalidate(true);
596 Addressbar::SetAddressbarEventListener(IAddressbarEventListener* plistener)
598 __pListener = plistener;
602 Addressbar::UpdateProgress(int percentage)
604 __progressPercentage = percentage;
605 if (percentage == 0 || percentage == 100)
607 __isLoadingData = false;
608 if (percentage == 100)
610 __isLoadingCompleted = true;
611 __progressPercentage = 0;
615 __isLoadingCompleted = false;
620 __isLoadingData = true;
622 UpdateProgressBitmap();
626 Addressbar::GetProgress(void)
628 return __progressPercentage;
632 Addressbar::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
634 AppLogDebug("Addressbar::OnActionPerformed action %d",actionId);
638 case IDA_REFRESH_BTN_CLICKED:
639 __isLoadingCompleted = false;
640 __isLoadingData = true;
641 __progressPercentage = 0;
642 __pAddressbarUrlField->HideKeypad();
643 __displayUrl = __pAddressbarUrlField->GetText();
645 /*if (__pListener != NULL)
647 __pListener->OnUrlSubmitted(*this);
650 UpdateProgressBitmap();
653 case IDA_STOP_BTN_CLICKED:
654 __isLoadingCompleted = false;
655 __isLoadingData = false;
656 __progressPercentage = 0;
657 __pAddressbarUrlField->HideKeypad();
658 __displayUrl = __pAddressbarUrlField->GetText();
660 if (__pListener != NULL)
662 __pListener->OnStopClicked(*this);
665 UpdateProgressBitmap();
667 case IDA_READER_BTN_CLICKED:
668 __pAddressbarUrlField->HideKeypad();
669 __displayUrl = __pAddressbarUrlField->GetText();
671 if (__pListener != NULL)
673 __pListener->OnReaderClicked(*this);
680 if (__pListener != NULL)
682 __pListener->OnBackClicked(*this);
690 if (__pListener != NULL )
691 __pListener->OnForwardClicked(*this);
697 __pListener->OnAddressCancelledClicked(*this);
698 __pAddressbarUrlField->SetText(__displayUrl);
700 __pAddressbarUrlField->HideKeypad();
701 //SetAddressbarMode(ADDRESSBAR_MODE_LOADING_COMPLETE);
707 if (__pAddressbarUrlField->GetText().IsEmpty() == false)
709 //__displayUrl = __pUrlField->GetText();
710 __pAddressbarUrlField->Clear();
711 __pAddressbarUrlField->Invalidate(true);
721 Addressbar::OnKeypadActionPerformed(Tizen::Ui::Control& source, Tizen::Ui::KeypadAction keypadAction)
723 AppLog("Addressbar::OnKeypadActionPerformed keypadAction %d",keypadAction);
724 switch (keypadAction)
726 case KEYPAD_ACTION_GO:
727 case KEYPAD_ACTION_ENTER:
728 case KEYPAD_ACTION_SEND:
730 if (__pAddressbarUrlField->GetText().IsEmpty() == false)
732 //SetAddressbarMode(ADDRESSBAR_MODE_LOADING);
733 __displayUrl = __pAddressbarUrlField->GetText();
735 __isLoadingCompleted = false;
736 __isLoadingData = true;
737 __progressPercentage = 0;
738 __pAddressbarUrlField->HideKeypad();
740 if (__pListener != NULL)
742 __pListener->OnUrlSubmitted(*this);
744 //UpdateProgressBitmap();
755 Addressbar::OnKeypadClosed(Tizen::Ui::Control& source)
757 __pListener->OnAddressBarKeypadClosed(*this);
761 Addressbar::OnKeypadOpened(Tizen::Ui::Control& source)
764 __pListener->OnAddressBarKeypadClosed(*this,false);
768 Addressbar::OnKeypadWillOpen(Tizen::Ui::Control& source)
770 //SetAddressbarMode(ADDRESSBAR_MODE_EDIT);
771 // SetAddressbarMode(__prevAddMode);
772 if(__pListener != null)
774 __pListener->OnAddressBarKeypadWillOpen(*this);
779 Addressbar::OrientationChanged(void)
781 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_SEARCH_INPUT_FIELD_BG, __pAddressbarBg->GetWidth(), __pAddressbarBg->GetHeight());
784 __pAddressbarBg->SetBackgroundBitmap(*pBitmap);
791 Addressbar::RemoveHttpTextFromDisplayURL(void)
793 bool isHttpText = __displayUrl.Contains(L"http://");
794 String updatedDisplayUrl;
795 updatedDisplayUrl.Clear();
797 if (isHttpText == true)
799 __displayUrl.SubString(7,updatedDisplayUrl);
801 return updatedDisplayUrl;
805 Addressbar::GetLockedImageN(void)
807 Bitmap* pIconImage = null;
809 AppResource* pAppResource = Application::GetInstance()->GetAppResource();
812 pIconImage = pAppResource->GetBitmapN(IDB_ICON_PRIVATE);
815 Bitmap* pLockImage = new (std::nothrow) Bitmap();
817 Canvas* pCanvas = new (std::nothrow) Canvas();
818 pCanvas->Construct(Rectangle(0,0,__pFaviconLabel->GetWidth(),__pFaviconLabel->GetHeight()));
820 pCanvas->DrawBitmap(Rectangle(0,0,__pFaviconLabel->GetWidth(),__pFaviconLabel->GetHeight()),*__pFavIcon);
821 pCanvas->DrawBitmap(Rectangle(__pFaviconLabel->GetWidth()/2,__pFaviconLabel->GetHeight()/2,__pFaviconLabel->GetWidth()/2,__pFaviconLabel->GetHeight()/2),*pIconImage);
822 pLockImage->Construct(*pCanvas,Rectangle(0,0,__pFaviconLabel->GetWidth(),__pFaviconLabel->GetHeight()));
829 Addressbar::OnFocusGained(const Control& source)
831 //SetAddressbarMode(ADDRESSBAR_MODE_EDIT);
832 // SetAddressbarMode(__prevAddMode);
833 if (__pListener != null)
835 __pListener->OnAddressBarKeypadWillOpen(*this);
836 __pListener->OnAddressBarKeypadOpened(*this);
841 Addressbar::OnTextValueChanged(const Control& source)
843 if(__pAddressbarUrlField != null)
845 if(__pAddressbarUrlField->GetTextLength() == 0)
847 if(__pAddressbarUrlField->IsKeypadActionEnabled() == true)
849 __pAddressbarUrlField->SetKeypadActionEnabled(false);
850 GetParent()->GetParent()->Invalidate(true);
855 if(__pAddressbarUrlField->IsKeypadActionEnabled() == false)
857 __pAddressbarUrlField->SetKeypadActionEnabled(true);
858 GetParent()->GetParent()->Invalidate(true);
866 Addressbar::SetAddressbarURLFocus()
868 __pAddressbarUrlField->SetFocus();
872 Addressbar::GetAddressbarURL()
874 return __pAddressbarUrlField->GetText();