llsidetray.cpp
上传用户:king477883
上传日期:2021-03-01
资源大小:9553k
文件大小:18k
源码类别:

游戏引擎

开发平台:

C++ Builder

  1. /** 
  2.  * @file llsidetray.cpp
  3.  * @brief SideBar implementation
  4.  *
  5.  * $LicenseInfo:firstyear=2009&license=viewergpl$
  6.  * 
  7.  * Copyright (c) 2009-2010, Linden Research, Inc.
  8.  * 
  9.  * Second Life Viewer Source Code
  10.  * The source code in this file ("Source Code") is provided by Linden Lab
  11.  * to you under the terms of the GNU General Public License, version 2.0
  12.  * ("GPL"), unless you have obtained a separate licensing agreement
  13.  * ("Other License"), formally executed by you and Linden Lab.  Terms of
  14.  * the GPL can be found in doc/GPL-license.txt in this distribution, or
  15.  * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  16.  * 
  17.  * There are special exceptions to the terms and conditions of the GPL as
  18.  * it is applied to this Source Code. View the full text of the exception
  19.  * in the file doc/FLOSS-exception.txt in this software distribution, or
  20.  * online at
  21.  * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  22.  * 
  23.  * By copying, modifying or distributing this software, you acknowledge
  24.  * that you have read and understood your obligations described above,
  25.  * and agree to abide by those obligations.
  26.  * 
  27.  * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  28.  * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  29.  * COMPLETENESS OR PERFORMANCE.
  30.  * $/LicenseInfo$
  31.  */
  32. #include "llviewerprecompiledheaders.h"
  33. #include "lltextbox.h"
  34. #include "llagent.h"
  35. #include "llbottomtray.h"
  36. #include "llsidetray.h"
  37. #include "llviewerwindow.h"
  38. #include "llaccordionctrl.h"
  39. #include "llfocusmgr.h"
  40. #include "llrootview.h"
  41. #include "llnavigationbar.h"
  42. #include "llaccordionctrltab.h"
  43. #include "llfloater.h" //for gFloaterView
  44. #include "lliconctrl.h"//for OpenClose tab icon
  45. #include "llsidetraypanelcontainer.h"
  46. #include "llwindow.h"//for SetCursor
  47. #include "lltransientfloatermgr.h"
  48. //#include "llscrollcontainer.h"
  49. using namespace std;
  50. static LLRootViewRegistry::Register<LLSideTray> t1("side_tray");
  51. static LLDefaultChildRegistry::Register<LLSideTrayTab> t2("sidetray_tab");
  52. static const std::string COLLAPSED_NAME = "<<";
  53. static const std::string EXPANDED_NAME  = ">>";
  54. static const std::string TAB_PANEL_CAPTION_NAME = "sidetray_tab_panel";
  55. static const std::string TAB_PANEL_CAPTION_TITLE_BOX = "sidetray_tab_title";
  56. LLSideTray* LLSideTray::sInstance = 0;
  57. LLSideTray* LLSideTray::getInstance()
  58. {
  59. if (!sInstance)
  60. {
  61. sInstance = LLUICtrlFactory::createFromFile<LLSideTray>("panel_side_tray.xml",NULL, LLRootView::child_registry_t::instance());
  62. sInstance->setXMLFilename("panel_side_tray.xml");
  63. }
  64. return sInstance;
  65. }
  66. bool LLSideTray::instanceCreated ()
  67. {
  68. return sInstance!=0;
  69. }
  70. //////////////////////////////////////////////////////////////////////////////
  71. // LLSideTrayTab
  72. // Represents a single tab in the side tray, only used by LLSideTray
  73. //////////////////////////////////////////////////////////////////////////////
  74. class LLSideTrayTab: public LLPanel
  75. {
  76. friend class LLUICtrlFactory;
  77. friend class LLSideTray;
  78. public:
  79. struct Params 
  80. : public LLInitParam::Block<Params, LLPanel::Params>
  81. {
  82. // image name
  83. Optional<std::string> image;
  84. Optional<std::string> image_selected;
  85. Optional<std::string> tab_title;
  86. Optional<std::string> description;
  87. Params()
  88. : image("image"),
  89. image_selected("image_selected"),
  90. tab_title("tab_title","no title"),
  91. description("description","no description")
  92. {};
  93. };
  94. protected:
  95. LLSideTrayTab(const Params& params);
  96. public:
  97. virtual ~LLSideTrayTab();
  98.     /*virtual*/ BOOL postBuild ();
  99. /*virtual*/ bool addChild (LLView* view, S32 tab_group);
  100. void reshape (S32 width, S32 height, BOOL called_from_parent = TRUE);
  101. static LLSideTrayTab*  createInstance ();
  102. const std::string& getDescription () const { return mDescription;}
  103. const std::string& getTabTitle() const { return mTabTitle;}
  104. void onOpen (const LLSD& key);
  105. LLPanel *getPanel();
  106. private:
  107. std::string mTabTitle;
  108. std::string mImage;
  109. std::string mImageSelected;
  110. std::string mDescription;
  111. LLView* mMainPanel;
  112. };
  113. LLSideTrayTab::LLSideTrayTab(const Params& p)
  114. : LLPanel(),
  115. mTabTitle(p.tab_title),
  116. mImage(p.image),
  117. mImageSelected(p.image_selected),
  118. mDescription(p.description),
  119. mMainPanel(NULL)
  120. {
  121. // Necessary for focus movement among child controls
  122. setFocusRoot(TRUE);
  123. }
  124. LLSideTrayTab::~LLSideTrayTab()
  125. {
  126. }
  127. bool LLSideTrayTab::addChild(LLView* view, S32 tab_group)
  128. {
  129. if(mMainPanel == 0 && TAB_PANEL_CAPTION_NAME != view->getName())//skip our caption panel
  130. mMainPanel = view;
  131. return LLPanel::addChild(view,tab_group);
  132. //return res;
  133. }
  134. //virtual 
  135. BOOL LLSideTrayTab::postBuild()
  136. {
  137. LLPanel* title_panel = LLUICtrlFactory::getInstance()->createFromFile<LLPanel>("panel_side_tray_tab_caption.xml",this, child_registry_t::instance());
  138. string name = title_panel->getName();
  139. LLPanel::addChild(title_panel);
  140. title_panel->getChild<LLTextBox>(TAB_PANEL_CAPTION_TITLE_BOX)->setValue(mTabTitle);
  141. return true;
  142. }
  143. static const S32 splitter_margin = 1;
  144. void LLSideTrayTab::reshape (S32 width, S32 height, BOOL called_from_parent )
  145. {
  146. LLPanel::reshape(width, height, called_from_parent);
  147. LLView* title_panel = findChildView(TAB_PANEL_CAPTION_NAME, true);
  148. if (!title_panel)
  149. {
  150. // not fully constructed yet
  151. return;
  152. }
  153. S32 title_height = title_panel->getRect().getHeight();
  154. title_panel->setOrigin( 0, height - title_height );
  155. title_panel->reshape(width,title_height);
  156. LLRect sRect;
  157. sRect.setLeftTopAndSize( splitter_margin, height - title_height - splitter_margin, 
  158. width - 2*splitter_margin, height - title_height - 2*splitter_margin);
  159. mMainPanel->setShape(sRect);
  160. }
  161. void LLSideTrayTab::onOpen (const LLSD& key)
  162. {
  163. LLPanel *panel = getPanel();
  164. if(panel)
  165. panel->onOpen(key);
  166. }
  167. LLPanel* LLSideTrayTab::getPanel()
  168. {
  169. LLPanel* panel = dynamic_cast<LLPanel*>(mMainPanel);
  170. return panel;
  171. }
  172. LLSideTrayTab*  LLSideTrayTab::createInstance ()
  173. {
  174. LLSideTrayTab::Params tab_params; 
  175. tab_params.tab_title("openclose");
  176. LLSideTrayTab* tab = LLUICtrlFactory::create<LLSideTrayTab>(tab_params);
  177. return tab;
  178. }
  179. //////////////////////////////////////////////////////////////////////////////
  180. // LLSideTray
  181. //////////////////////////////////////////////////////////////////////////////
  182. LLSideTray::Params::Params()
  183. : collapsed("collapsed",false),
  184. tab_btn_image_normal("tab_btn_image","sidebar_tab_left.tga"),
  185. tab_btn_image_selected("tab_btn_image_selected","button_enabled_selected_32x128.tga"),
  186. default_button_width("tab_btn_width",32),
  187. default_button_height("tab_btn_height",32),
  188. default_button_margin("tab_btn_margin",0)
  189. {}
  190. //virtual 
  191. LLSideTray::LLSideTray(Params& params)
  192.    : LLPanel(params)
  193.     ,mActiveTab(0)
  194. ,mCollapsed(false)
  195. ,mCollapseButton(0)
  196. {
  197. mCollapsed=params.collapsed;
  198. LLUICtrl::CommitCallbackRegistry::Registrar& commit = LLUICtrl::CommitCallbackRegistry::currentRegistrar();
  199. // register handler function to process data from the xml. 
  200. // panel_name should be specified via "parameter" attribute.
  201. commit.add("SideTray.ShowPanel", boost::bind(&LLSideTray::showPanel, this, _2, LLUUID::null));
  202. LLTransientFloaterMgr::getInstance()->addControlView(this);
  203. LLView* side_bar_tabs  = gViewerWindow->getRootView()->getChildView("side_bar_tabs");
  204. if (side_bar_tabs != NULL)
  205. {
  206. LLTransientFloaterMgr::getInstance()->addControlView(side_bar_tabs);
  207. }
  208. LLPanel::Params p;
  209. p.name = "buttons_panel";
  210. p.mouse_opaque = false;
  211. mButtonsPanel = LLUICtrlFactory::create<LLPanel>(p);
  212. }
  213. BOOL LLSideTray::postBuild()
  214. {
  215. createButtons();
  216. arrange();
  217. selectTabByName("sidebar_home");
  218. if(mCollapsed)
  219. collapseSideBar();
  220. setMouseOpaque(false);
  221. return true;
  222. }
  223. LLSideTrayTab* LLSideTray::getTab(const std::string& name)
  224. {
  225. return getChild<LLSideTrayTab>(name,false);
  226. }
  227. void LLSideTray::toggleTabButton(LLSideTrayTab* tab)
  228. {
  229. if(tab == NULL)
  230. return;
  231. std::string name = tab->getName();
  232. std::map<std::string,LLButton*>::iterator it = mTabButtons.find(name);
  233. if(it != mTabButtons.end())
  234. {
  235. LLButton* btn = it->second;
  236. bool new_state = !btn->getToggleState();
  237. btn->setToggleState(new_state); 
  238. btn->setImageOverlay( new_state ? tab->mImageSelected : tab->mImage );
  239. }
  240. }
  241. bool LLSideTray::selectTabByIndex(size_t index)
  242. {
  243. if(index>=mTabs.size())
  244. return false;
  245. LLSideTrayTab* sidebar_tab = mTabs[index];
  246. return selectTabByName(sidebar_tab->getName());
  247. }
  248. bool LLSideTray::selectTabByName (const std::string& name)
  249. {
  250. LLSideTrayTab* side_bar = getTab(name);
  251. if(side_bar == mActiveTab)
  252. return false;
  253. //deselect old tab
  254. toggleTabButton(mActiveTab);
  255. if(mActiveTab)
  256. mActiveTab->setVisible(false);
  257. //select new tab
  258. mActiveTab = side_bar;
  259. toggleTabButton(mActiveTab);
  260. LLSD key;//empty
  261. mActiveTab->onOpen(key);
  262. mActiveTab->setVisible(true);
  263. //arrange();
  264. //hide all tabs - show active tab
  265. child_vector_const_iter_t child_it;
  266. for ( child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it)
  267. {
  268. LLSideTrayTab* sidebar_tab = *child_it;
  269. sidebar_tab->setVisible(sidebar_tab  == mActiveTab);
  270. }
  271. return true;
  272. }
  273. LLButton* LLSideTray::createButton (const std::string& name,const std::string& image,const std::string& tooltip,
  274.  LLUICtrl::commit_callback_t callback)
  275. {
  276. static LLSideTray::Params sidetray_params(LLUICtrlFactory::getDefaultParams<LLSideTray>());
  277. LLButton::Params bparams;
  278. LLRect rect;
  279. rect.setOriginAndSize(0, 0, sidetray_params.default_button_width, sidetray_params.default_button_height); 
  280. bparams.name(name);
  281. bparams.follows.flags (FOLLOWS_LEFT | FOLLOWS_TOP);
  282. bparams.rect (rect);
  283. bparams.tab_stop(false);
  284. bparams.image_unselected.name(sidetray_params.tab_btn_image_normal);
  285. bparams.image_selected.name(sidetray_params.tab_btn_image_selected);
  286. bparams.image_disabled.name(sidetray_params.tab_btn_image_normal);
  287. bparams.image_disabled_selected.name(sidetray_params.tab_btn_image_selected);
  288. LLButton* button = LLUICtrlFactory::create<LLButton> (bparams);
  289. button->setLabel(name);
  290. button->setClickedCallback(callback);
  291. button->setToolTip(tooltip);
  292. if(image.length())
  293. {
  294. button->setImageOverlay(image);
  295. }
  296. mButtonsPanel->addChildInBack(button);
  297. return button;
  298. }
  299. bool LLSideTray::addChild(LLView* view, S32 tab_group)
  300. {
  301. LLSideTrayTab* tab_panel = dynamic_cast<LLSideTrayTab*>(view);
  302. if (tab_panel)
  303. {
  304. mTabs.push_back(tab_panel);
  305. }
  306. return LLUICtrl::addChild(view, tab_group);
  307. }
  308. void LLSideTray::createButtons ()
  309. {
  310. //create buttons for tabs
  311. child_vector_const_iter_t child_it = mTabs.begin();
  312. for ( ; child_it != mTabs.end(); ++child_it)
  313. {
  314. LLSideTrayTab* sidebar_tab = *child_it;
  315. std::string name = sidebar_tab->getName();
  316. // The "OpenClose" button will open/close the whole panel
  317. if (name == "sidebar_openclose")
  318. {
  319. mCollapseButton = createButton("",sidebar_tab->mImage,sidebar_tab->getTabTitle(),
  320. boost::bind(&LLSideTray::onToggleCollapse, this));
  321. }
  322. else
  323. {
  324. LLButton* button = createButton("",sidebar_tab->mImage,sidebar_tab->getTabTitle(),
  325. boost::bind(&LLSideTray::onTabButtonClick, this, name));
  326. mTabButtons[name] = button;
  327. }
  328. }
  329. }
  330. void LLSideTray::processTriState ()
  331. {
  332. if(mCollapsed)
  333. expandSideBar();
  334. else
  335. {
  336. #if 0 // *TODO: EXT-2092
  337. // Tell the active task panel to switch to its default view
  338. // or collapse side tray if already on the default view.
  339. LLSD info;
  340. info["task-panel-action"] = "handle-tri-state";
  341. mActiveTab->notifyChildren(info);
  342. #else
  343. collapseSideBar();
  344. #endif
  345. }
  346. }
  347. void LLSideTray::onTabButtonClick(string name)
  348. {
  349. LLSideTrayTab* side_bar = getTab(name);
  350. if(side_bar == mActiveTab)
  351. {
  352. processTriState ();
  353. return;
  354. }
  355. selectTabByName (name);
  356. if(mCollapsed)
  357. expandSideBar();
  358. }
  359. void LLSideTray::onToggleCollapse()
  360. {
  361. if(mCollapsed)
  362. {
  363. expandSideBar();
  364. //selectTabByName("sidebar_openclose");
  365. }
  366. else
  367. collapseSideBar();
  368. }
  369. void LLSideTray::reflectCollapseChange()
  370. {
  371. updateSidetrayVisibility();
  372. if(mCollapsed)
  373. {
  374. gFloaterView->setSnapOffsetRight(0);
  375. setFocus(FALSE);
  376. }
  377. else
  378. {
  379. gFloaterView->setSnapOffsetRight(getRect().getWidth());
  380. setFocus(TRUE);
  381. }
  382. gFloaterView->refresh();
  383. }
  384. void LLSideTray::arrange()
  385. {
  386. static LLSideTray::Params sidetray_params(LLUICtrlFactory::getDefaultParams<LLSideTray>());
  387. updateSidetrayVisibility();
  388. LLRect ctrl_rect;
  389. ctrl_rect.setLeftTopAndSize(0,
  390. mButtonsPanel->getRect().getHeight() - sidetray_params.default_button_width,
  391. sidetray_params.default_button_width,
  392. sidetray_params.default_button_height);
  393. mCollapseButton->setRect(ctrl_rect);
  394. //arrange tab buttons
  395. //arrange tab buttons
  396. child_vector_const_iter_t child_it;
  397. int offset = (sidetray_params.default_button_height+sidetray_params.default_button_margin)*2;
  398. for ( child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it)
  399. {
  400. LLSideTrayTab* sidebar_tab = *child_it;
  401. ctrl_rect.setLeftTopAndSize(0,
  402. mButtonsPanel->getRect().getHeight()-offset,
  403. sidetray_params.default_button_width,
  404. sidetray_params.default_button_height);
  405. if(mTabButtons.find(sidebar_tab->getName()) == mTabButtons.end())
  406. continue;
  407. LLButton* btn = mTabButtons[sidebar_tab->getName()];
  408. btn->setRect(ctrl_rect);
  409. offset+=sidetray_params.default_button_height;
  410. offset+=sidetray_params.default_button_margin;
  411. btn->setVisible(ctrl_rect.mBottom > 0);
  412. }
  413. //arrange tabs
  414. for ( child_vector_t::iterator child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it)
  415. {
  416. LLSideTrayTab* sidebar_tab = *child_it;
  417. sidebar_tab->setShape(getLocalRect());
  418. }
  419. }
  420. void LLSideTray::collapseSideBar()
  421. {
  422. mCollapsed = true;
  423. // Reset all overlay images, because there is no "selected" tab when the
  424. // whole side tray is hidden.
  425. child_vector_const_iter_t it = mTabs.begin();
  426. for ( ; it != mTabs.end(); ++it )
  427. {
  428. LLSideTrayTab* tab = *it;
  429. std::string name = tab->getName();
  430. std::map<std::string,LLButton*>::const_iterator btn_it =
  431. mTabButtons.find(name);
  432. if (btn_it != mTabButtons.end())
  433. {
  434. LLButton* btn = btn_it->second;
  435. btn->setImageOverlay( tab->mImage );
  436. }
  437. }
  438. // OpenClose tab doesn't put its button in mTabButtons
  439. LLSideTrayTab* openclose_tab = getTab("sidebar_openclose");
  440. if (openclose_tab)
  441. {
  442. mCollapseButton->setImageOverlay( openclose_tab->mImage );
  443. }
  444. //mActiveTab->setVisible(FALSE);
  445. reflectCollapseChange();
  446. setFocus( FALSE );
  447. }
  448. void LLSideTray::expandSideBar()
  449. {
  450. mCollapsed = false;
  451. LLSideTrayTab* openclose_tab = getTab("sidebar_openclose");
  452. if (openclose_tab)
  453. {
  454. mCollapseButton->setImageOverlay( openclose_tab->mImageSelected );
  455. }
  456. LLSD key;//empty
  457. mActiveTab->onOpen(key);
  458. reflectCollapseChange();
  459. std::string name = mActiveTab->getName();
  460. std::map<std::string,LLButton*>::const_iterator btn_it =
  461. mTabButtons.find(name);
  462. if (btn_it != mTabButtons.end())
  463. {
  464. LLButton* btn = btn_it->second;
  465. btn->setImageOverlay( mActiveTab->mImageSelected  );
  466. }
  467. }
  468. void LLSideTray::highlightFocused()
  469. {
  470. /* uncomment in case something change
  471. if(!mActiveTab)
  472. return;
  473. BOOL dependent_has_focus = gFocusMgr.childHasKeyboardFocus(this);
  474. setBackgroundOpaque( dependent_has_focus ); 
  475. mActiveTab->setBackgroundOpaque( dependent_has_focus ); 
  476. */
  477. }
  478. //virtual
  479. BOOL LLSideTray::handleMouseDown (S32 x, S32 y, MASK mask)
  480. {
  481. BOOL ret = LLPanel::handleMouseDown(x,y,mask);
  482. if(ret)
  483. setFocus(true);
  484. return ret;
  485. }
  486. void LLSideTray::reshape(S32 width, S32 height, BOOL called_from_parent)
  487. {
  488. LLPanel::reshape(width, height, called_from_parent);
  489. if(!mActiveTab)
  490. return;
  491. arrange();
  492. }
  493. /**
  494.  * Activate tab with "panel_name" panel
  495.  * if no such tab - return false, otherwise true.
  496.  * TODO* In some cases a pointer to a panel of
  497.  * a specific class may be needed so this method
  498.  * would need to use templates.
  499.  */
  500. LLPanel* LLSideTray::showPanel (const std::string& panel_name, const LLSD& params)
  501. {
  502. //arrange tabs
  503. child_vector_const_iter_t child_it;
  504. for ( child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it)
  505. {
  506. LLView* view = (*child_it)->findChildView(panel_name,true);
  507. if(view)
  508. {
  509. selectTabByName ((*child_it)->getName());
  510. if(mCollapsed)
  511. expandSideBar();
  512. LLSideTrayPanelContainer* container = dynamic_cast<LLSideTrayPanelContainer*>(view->getParent());
  513. if(container)
  514. {
  515. LLSD new_params = params;
  516. new_params[LLSideTrayPanelContainer::PARAM_SUB_PANEL_NAME] = panel_name;
  517. container->onOpen(new_params);
  518. return container->getCurrentPanel();
  519. }
  520. LLPanel* panel = dynamic_cast<LLPanel*>(view);
  521. if(panel)
  522. {
  523. panel->onOpen(params);
  524. }
  525. return panel;
  526. }
  527. }
  528. return NULL;
  529. }
  530. void LLSideTray::togglePanel(LLPanel* &sub_panel, const std::string& panel_name, const LLSD& params)
  531. {
  532. if(!sub_panel)
  533. return;
  534. if (sub_panel->isInVisibleChain())
  535. {
  536. LLSideTray::getInstance()->collapseSideBar();
  537. }
  538. else
  539. {
  540. LLSideTray::getInstance()->showPanel(panel_name, params);
  541. }
  542. }
  543. // This is just LLView::findChildView specialized to restrict the search to LLPanels.
  544. // Optimization for EXT-4068 to avoid searching down to the individual item level
  545. // when inventories are large.
  546. LLPanel *findChildPanel(LLPanel *panel, const std::string& name, bool recurse)
  547. {
  548. for (LLView::child_list_const_iter_t child_it = panel->beginChild();
  549.  child_it != panel->endChild(); ++child_it)
  550. {
  551. LLPanel *child_panel = dynamic_cast<LLPanel*>(*child_it);
  552. if (!child_panel)
  553. continue;
  554. if (child_panel->getName() == name)
  555. return child_panel;
  556. }
  557. if (recurse)
  558. {
  559. for (LLView::child_list_const_iter_t child_it = panel->beginChild();
  560.  child_it != panel->endChild(); ++child_it)
  561. {
  562. LLPanel *child_panel = dynamic_cast<LLPanel*>(*child_it);
  563. if (!child_panel)
  564. continue;
  565. LLPanel *found_panel = findChildPanel(child_panel,name,recurse);
  566. if (found_panel)
  567. {
  568. return found_panel;
  569. }
  570. }
  571. }
  572. return NULL;
  573. }
  574. LLPanel* LLSideTray::getPanel(const std::string& panel_name)
  575. {
  576. for ( child_vector_const_iter_t child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it)
  577. {
  578. LLPanel *panel = findChildPanel(*child_it,panel_name,true);
  579. if(panel)
  580. {
  581. return panel;
  582. }
  583. }
  584. return NULL;
  585. }
  586. LLPanel* LLSideTray::getActivePanel()
  587. {
  588. if (mActiveTab && !mCollapsed)
  589. {
  590. return mActiveTab->getPanel();
  591. }
  592. return NULL;
  593. }
  594. bool LLSideTray::isPanelActive(const std::string& panel_name)
  595. {
  596. LLPanel *panel = getActivePanel();
  597. if (!panel) return false;
  598. return (panel->getName() == panel_name);
  599. }
  600. // *TODO: Eliminate magic constants.
  601. static const S32 fake_offset = 132;
  602. static const S32 fake_top_offset = 18;
  603. void LLSideTray::updateSidetrayVisibility()
  604. {
  605. // set visibility of parent container based on collapsed state
  606. if (getParent())
  607. {
  608. getParent()->setVisible(!mCollapsed && !gAgent.cameraMouselook());
  609. }
  610. }