summaryrefslogtreecommitdiff
path: root/indra/newview/llsidetray.cpp
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2009-10-22 17:30:45 -0700
committerJames Cook <james@lindenlab.com>2009-10-22 17:30:45 -0700
commit350138e2bb086314bcdf74052d2b14c2f9f84c83 (patch)
tree12cbb6d11ad8ff72f56dd1989d2f3a1c6a719813 /indra/newview/llsidetray.cpp
parent34316644305f2c212d99c01474d585e1a241cef4 (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.
Diffstat (limited to 'indra/newview/llsidetray.cpp')
-rw-r--r--indra/newview/llsidetray.cpp96
1 files changed, 42 insertions, 54 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()