diff options
author | Lynx Linden <lynx@lindenlab.com> | 2009-12-02 21:18:59 +0000 |
---|---|---|
committer | Lynx Linden <lynx@lindenlab.com> | 2009-12-02 21:18:59 +0000 |
commit | d491050c553ad2fa20f1ecadc37077fba3962b10 (patch) | |
tree | 416a316e20b2dd7361d90a05a7f9b7f3106dc527 /indra/newview/llpanelhome.cpp | |
parent | a6b9765d6237f6a251eb875d38164b53c0eb2bd2 (diff) |
DEV-43439: Added navigation buttons to the Home side panel.
Added Back, Forward, and Home buttons to the web view for the Home
side panel. Still more work to do here, but the basic functionality
is there; albeit hardcoded to secondlife.com.
I notice that you can click Back on the first page. Seems to be an
issue for the general media browser too. I'll file a JIRA for that.
Diffstat (limited to 'indra/newview/llpanelhome.cpp')
-rw-r--r-- | indra/newview/llpanelhome.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/indra/newview/llpanelhome.cpp b/indra/newview/llpanelhome.cpp index 5e7b9ef6bb..de7a85836d 100644 --- a/indra/newview/llpanelhome.cpp +++ b/indra/newview/llpanelhome.cpp @@ -40,6 +40,7 @@ static LLRegisterPanelClassWrapper<LLPanelHome> t_people("panel_sidetray_home"); LLPanelHome::LLPanelHome() : LLPanel(), + LLViewerMediaObserver(), mBrowser(NULL), mFirstView(true) { @@ -48,6 +49,7 @@ LLPanelHome::LLPanelHome() : void LLPanelHome::onOpen(const LLSD& key) { // display the home page the first time we open the panel + // *NOTE: this seems to happen during login. Can we avoid that? if (mFirstView && mBrowser) { mBrowser->navigateHome(); @@ -60,10 +62,51 @@ BOOL LLPanelHome::postBuild() mBrowser = getChild<LLMediaCtrl>("browser"); if (mBrowser) { + mBrowser->addObserver(this); mBrowser->setTrusted(true); mBrowser->setHomePageUrl("http://www.secondlife.com/"); + + childSetAction("back", onClickBack, this); + childSetAction("forward", onClickForward, this); + childSetAction("home", onClickHome, this); } return TRUE; } +//static +void LLPanelHome::onClickBack(void* user_data) +{ + LLPanelHome *self = (LLPanelHome*)user_data; + if (self && self->mBrowser) + { + self->mBrowser->navigateBack(); + } +} + +//static +void LLPanelHome::onClickForward(void* user_data) +{ + LLPanelHome *self = (LLPanelHome*)user_data; + if (self && self->mBrowser) + { + self->mBrowser->navigateForward(); + } +} + +//static +void LLPanelHome::onClickHome(void* user_data) +{ + LLPanelHome *self = (LLPanelHome*)user_data; + if (self && self->mBrowser) + { + self->mBrowser->navigateHome(); + } +} + +void LLPanelHome::handleMediaEvent(LLPluginClassMedia *self, EMediaEvent event) +{ + // update back/forward button state + childSetEnabled("back", mBrowser->canNavigateBack()); + childSetEnabled("forward", mBrowser->canNavigateForward()); +} |