diff options
author | James Cook <james@lindenlab.com> | 2009-10-22 17:30:45 -0700 |
---|---|---|
committer | James Cook <james@lindenlab.com> | 2009-10-22 17:30:45 -0700 |
commit | 350138e2bb086314bcdf74052d2b14c2f9f84c83 (patch) | |
tree | 12cbb6d11ad8ff72f56dd1989d2f3a1c6a719813 | |
parent | 34316644305f2c212d99c01474d585e1a241cef4 (diff) |
EXT-287 Side tray open/close arrows are now an image, not the text "<<" and ">>"
Removed some dead code from LLSideTray
Next step is to merge all the tab art with overlay art and use button selected images to show a "pressed" state for all buttons.
Reviewed with Angela.
-rw-r--r-- | indra/newview/llsidetray.cpp | 96 | ||||
-rw-r--r-- | indra/newview/llsidetray.h | 17 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_side_tray.xml | 1 |
3 files changed, 43 insertions, 71 deletions
diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp index 47bf69d56c..22c3779050 100644 --- a/indra/newview/llsidetray.cpp +++ b/indra/newview/llsidetray.cpp @@ -126,13 +126,15 @@ public: : public LLInitParam::Block<Params, LLPanel::Params> { // image name - Optional<std::string> image_path; + Optional<std::string> image; + Optional<std::string> image_selected; Optional<std::string> tab_title; Optional<std::string> description; Params() - : image_path("image"), - tab_title("tab_title","no title"), - description("description","no description") + : image("image"), + image_selected("image_selected"), + tab_title("tab_title","no title"), + description("description","no description") {}; }; protected: @@ -160,18 +162,21 @@ public: private: std::string mTabTitle; - std::string mImagePath; + std::string mImage; + std::string mImageSelected; std::string mDescription; LLView* mMainPanel; }; -LLSideTrayTab::LLSideTrayTab(const Params& params):mMainPanel(0) +LLSideTrayTab::LLSideTrayTab(const Params& p) +: LLPanel(), + mTabTitle(p.tab_title), + mImage(p.image), + mImageSelected(p.image_selected), + mDescription(p.description), + mMainPanel(NULL) { - mImagePath = params.image_path; - mTabTitle = params.tab_title; - mDescription = params.description; - // Necessary for focus movement among child controls setFocusRoot(TRUE); } @@ -322,35 +327,6 @@ BOOL LLSideTray::postBuild() setMouseOpaque(false); return true; } - -/** - * add new panel to tab with tab_name name - * @param tab_name - name of sidebar tab to add new panel - * @param panel - pointer to panel - */ -bool LLSideTray::addPanel ( const std::string& tab_name - ,LLPanel* panel ) -{ - return false; -} -/** - * Add new tab to side bar - * @param tab_name - name of the new tab - * @param image - image for new sidebar button - * @param title - title for new tab - */ -bool LLSideTray::addTab ( const std::string& tab_name - ,const std::string& image - ,const std::string& title) -{ - LLSideTrayTab::Params params; - params.image_path = image; - params.tab_title = title; - LLSideTrayTab* tab = LLUICtrlFactory::create<LLSideTrayTab> (params); - addChild(tab,1); - return true; -} - LLSideTrayTab* LLSideTray::getTab(const std::string& name) { @@ -358,7 +334,6 @@ LLSideTrayTab* LLSideTray::getTab(const std::string& name) } - void LLSideTray::toggleTabButton (LLSideTrayTab* tab) { if(tab == NULL) @@ -460,25 +435,30 @@ bool LLSideTray::addChild(LLView* view, S32 tab_group) void LLSideTray::createButtons () { - //create show/hide button - mCollapseButton = createButton(EXPANDED_NAME,"",boost::bind(&LLSideTray::onToggleCollapse, this)); - //create buttons for tabs child_vector_const_iter_t child_it = mTabs.begin(); - ++child_it; - for ( ; child_it != mTabs.end(); ++child_it) { LLSideTrayTab* sidebar_tab = dynamic_cast<LLSideTrayTab*>(*child_it); if(sidebar_tab == NULL) continue; - string name = sidebar_tab->getName(); + std::string name = sidebar_tab->getName(); - LLButton* button = createButton("",sidebar_tab->mImagePath,boost::bind(&LLSideTray::onTabButtonClick, this, sidebar_tab->getName())); - mTabButtons[sidebar_tab->getName()] = button; + // The "home" button will open/close the whole panel, this will need to + // change if the home screen becomes its own tab. + if (name == "sidebar_home") + { + mCollapseButton = createButton("",sidebar_tab->mImage, + boost::bind(&LLSideTray::onToggleCollapse, this)); + } + else + { + LLButton* button = createButton("",sidebar_tab->mImage, + boost::bind(&LLSideTray::onTabButtonClick, this, name)); + mTabButtons[name] = button; + } } - } void LLSideTray::onTabButtonClick(string name) @@ -581,25 +561,33 @@ void LLSideTray::arrange () } } -void LLSideTray::collapseSideBar () +void LLSideTray::collapseSideBar() { mCollapsed = true; - mCollapseButton->setLabel(COLLAPSED_NAME); + LLSideTrayTab* home_tab = getTab("sidebar_home"); + if (home_tab) + { + mCollapseButton->setImageOverlay( home_tab->mImage ); + } mActiveTab->setVisible(FALSE); reflectCollapseChange(); setFocus( FALSE ); } -void LLSideTray::expandSideBar () + +void LLSideTray::expandSideBar() { mCollapsed = false; - mCollapseButton->setLabel(EXPANDED_NAME); + LLSideTrayTab* home_tab = getTab("sidebar_home"); + if (home_tab) + { + mCollapseButton->setImageOverlay( home_tab->mImageSelected ); + } LLSD key;//empty mActiveTab->onOpen(key); mActiveTab->setVisible(TRUE); reflectCollapseChange(); - } void LLSideTray::highlightFocused() diff --git a/indra/newview/llsidetray.h b/indra/newview/llsidetray.h index ebebb7f6bf..845eb86bc1 100644 --- a/indra/newview/llsidetray.h +++ b/indra/newview/llsidetray.h @@ -89,23 +89,6 @@ public: */ bool selectTabByIndex(size_t index); - /** - * add new panel to tab with tab_name name - * @param tab_name - name of sidebar tab to add new panel - * @param panel - pointer to panel - */ - bool addPanel ( const std::string& tab_name - ,LLPanel* panel ); - /** - * Add new tab to side bar - * @param tab_name - name of the new tab - * @param image - image for new sidebar button - * @param title - title for new tab - */ - bool addTab ( const std::string& tab_name - ,const std::string& image - ,const std::string& title); - /** * Activate tab with "panel_name" panel * if no such tab - return NULL, otherwise a pointer to the panel diff --git a/indra/newview/skins/default/xui/en/panel_side_tray.xml b/indra/newview/skins/default/xui/en/panel_side_tray.xml index 395b574425..6abcbc40d2 100644 --- a/indra/newview/skins/default/xui/en/panel_side_tray.xml +++ b/indra/newview/skins/default/xui/en/panel_side_tray.xml @@ -18,6 +18,7 @@ tab_title="Home" description="Home." image="TabIcon_Open_Off" + image_selected="TabIcon_Close_Off" mouse_opaque="false" background_visible="true" > |