diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llfloatersearch.cpp | 1 | ||||
-rw-r--r-- | indra/newview/llpanelhome.cpp | 43 | ||||
-rw-r--r-- | indra/newview/llpanelhome.h | 12 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_sidetray_home_tab.xml | 87 |
4 files changed, 128 insertions, 15 deletions
diff --git a/indra/newview/llfloatersearch.cpp b/indra/newview/llfloatersearch.cpp index c8ff36b4f4..4d3724a758 100644 --- a/indra/newview/llfloatersearch.cpp +++ b/indra/newview/llfloatersearch.cpp @@ -41,6 +41,7 @@ LLFloaterSearch::LLFloaterSearch(const LLSD& key) : LLFloater(key), + LLViewerMediaObserver(), mBrowser(NULL) { // declare a map that transforms a category name into 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()); +} diff --git a/indra/newview/llpanelhome.h b/indra/newview/llpanelhome.h index d75e2c0d80..b5ca48b23f 100644 --- a/indra/newview/llpanelhome.h +++ b/indra/newview/llpanelhome.h @@ -36,13 +36,16 @@ #include "llpanel.h" #include "llsd.h" +#include "llviewermediaobserver.h" class LLMediaCtrl; /** * Base class for web-based Home side tray */ -class LLPanelHome : public LLPanel +class LLPanelHome : + public LLPanel, + public LLViewerMediaObserver { public: LLPanelHome(); @@ -50,7 +53,14 @@ public: /*virtual*/ BOOL postBuild(); /*virtual*/ void onOpen(const LLSD& key); + static void onClickBack(void* user_data); + static void onClickForward(void* user_data); + static void onClickHome(void* user_data); + private: + // inherited from LLViewerMediaObserver + /*virtual*/ void handleMediaEvent(LLPluginClassMedia *self, EMediaEvent event); + LLMediaCtrl *mBrowser; bool mFirstView; }; diff --git a/indra/newview/skins/default/xui/en/panel_sidetray_home_tab.xml b/indra/newview/skins/default/xui/en/panel_sidetray_home_tab.xml index 4fe1e08bf0..4b841b0a09 100644 --- a/indra/newview/skins/default/xui/en/panel_sidetray_home_tab.xml +++ b/indra/newview/skins/default/xui/en/panel_sidetray_home_tab.xml @@ -5,29 +5,88 @@ height="570" min_height="350" label="home_tab" + help_topic="sidetray_home" layout="topleft" top="0" left="0" name="home_tab" width="333"> - <panel + <layout_stack follows="all" height="550" layout="topleft" left="10" - help_topic="sidetray_home" - name="sidetray_home" + name="stack" top_pad="10" width="313"> - <web_browser - border_visible="false" - follows="all" - height="550" - layout="topleft" - left="0" - name="browser" - start_url="data:text/html,%3Chtml%3E%3Cbody bgcolor=%22#2A2A2A%22 text=%22eeeeee%22%3E %3Ch3%3E %0D%0A%0D%0ALoading... %3C/h3%3E %3C/body%3E%3C/html%3E" - top="0" - width="313" /> - </panel> + <layout_panel + auto_resize="false" + height="20" + layout="topleft" + left="0" + name="nav_controls" + top="0" + user_resize="false" + width="313"> + <button + follows="left|top" + enabled="false" + height="20" + label="Back" + layout="topleft" + tab_stop="false" + left="0" + name="back" + top="0" + width="70"> + <button.commit_callback + function="MediaBrowser.Back" /> + </button> + <button + follows="left|top" + height="20" + enabled="false" + label="Forward" + layout="topleft" + tab_stop="false" + left_pad="3" + name="forward" + top_delta="0" + width="70"> + <button.commit_callback + function="MediaBrowser.Forward" /> + </button> + <button + follows="left|top" + height="20" + label="Home" + layout="topleft" + tab_stop="false" + left_pad="2" + name="home" + top_delta="0" + width="70"> + <button.commit_callback + function="MediaBrowser.Home" /> + </button> + </layout_panel> + <layout_panel + height="530" + layout="topleft" + left_delta="0" + name="browser_layout" + top_delta="0" + width="313"> + <web_browser + border_visible="false" + follows="all" + height="530" + layout="topleft" + left="0" + name="browser" + start_url="data:text/html,%3Chtml%3E%3Cbody bgcolor=%22#2A2A2A%22 text=%22eeeeee%22%3E %3Ch3%3E %0D%0A%0D%0ALoading... %3C/h3%3E %3C/body%3E%3C/html%3E" + top="0" + width="313" /> + </layout_panel> + </layout_stack> </panel> |