EXP-1463 FIXED (IM chiclets overlay Mini-Location bar)

- Now chiclet bar adjusts its width with Mini-Location bar
meow-7.2.2
Paul ProductEngine 2011-11-25 19:24:47 +02:00
parent c577966d19
commit 8a442d5edb
4 changed files with 62 additions and 0 deletions

View File

@ -35,6 +35,7 @@
// newview includes
#include "llchiclet.h"
#include "llimfloater.h" // for LLIMFloater
#include "llpaneltopinfobar.h"
#include "llsyswellwindow.h"
namespace
@ -181,6 +182,9 @@ BOOL LLChicletBar::postBuild()
showWellButton("im_well", !LLIMWellWindow::getInstance()->isWindowEmpty());
showWellButton("notification_well", !LLNotificationWellWindow::getInstance()->isWindowEmpty());
LLPanelTopInfoBar::instance().setResizeCallback(boost::bind(&LLChicletBar::fitWithTopInfoBar, this));
LLPanelTopInfoBar::instance().setVisibleCallback(boost::bind(&LLChicletBar::fitWithTopInfoBar, this));
return TRUE;
}
@ -338,3 +342,31 @@ S32 LLChicletBar::getChicletPanelShrinkHeadroom() const
llassert(shrink_headroom >= 0); // the panel cannot get narrower than the minimum
return shrink_headroom;
}
void LLChicletBar::fitWithTopInfoBar()
{
LLPanelTopInfoBar& top_info_bar = LLPanelTopInfoBar::instance();
LLRect rect = getRect();
S32 width = rect.getWidth();
if (top_info_bar.getVisible())
{
S32 delta = top_info_bar.calcScreenRect().mRight - calcScreenRect().mLeft;
rect.setLeftTopAndSize(rect.mLeft + delta, rect.mTop, rect.getWidth(), rect.getHeight());
width = rect.getWidth() - delta;
}
else
{
LLView* parent = getParent();
if (parent)
{
LLRect parent_rect = parent->getRect();
rect.setLeftTopAndSize(0, rect.mTop, rect.getWidth(), rect.getHeight());
width = parent_rect.getWidth();
}
}
setRect(rect);
LLPanel::reshape(width, rect.getHeight(), false);
}

View File

@ -89,6 +89,12 @@ private:
*/
S32 getChicletPanelShrinkHeadroom() const;
/**
* function adjusts Chiclet bar width to prevent overlapping with Mini-Location bar
* EXP-1463
*/
void fitWithTopInfoBar();
protected:
LLChicletBar(const LLSD& key = LLSD());

View File

@ -203,6 +203,11 @@ void LLPanelTopInfoBar::onVisibilityChange(const LLSD& show)
gFloaterView->setMinimizePositionVerticalOffset(minimize_pos_offset);
}
boost::signals2::connection LLPanelTopInfoBar::setResizeCallback( const resize_signal_t::slot_type& cb )
{
return mResizeSignal.connect(cb);
}
void LLPanelTopInfoBar::draw()
{
updateParcelInfoText();
@ -224,6 +229,7 @@ void LLPanelTopInfoBar::buildLocationString(std::string& loc_str, bool show_coor
void LLPanelTopInfoBar::setParcelInfoText(const std::string& new_text)
{
LLRect old_rect = getRect();
const LLFontGL* font = mParcelInfoText->getDefaultFont();
S32 new_text_width = font->getWidth(new_text);
@ -235,6 +241,11 @@ void LLPanelTopInfoBar::setParcelInfoText(const std::string& new_text)
mParcelInfoText->reshape(rect.getWidth(), rect.getHeight(), TRUE);
mParcelInfoText->setRect(rect);
layoutParcelIcons();
if (old_rect != getRect())
{
mResizeSignal();
}
}
void LLPanelTopInfoBar::update()
@ -342,6 +353,8 @@ void LLPanelTopInfoBar::updateHealth()
void LLPanelTopInfoBar::layoutParcelIcons()
{
LLRect old_rect = getRect();
// TODO: remove hard-coded values and read them as xml parameters
static const int FIRST_ICON_HPAD = 32;
static const int LAST_ICON_HPAD = 11;
@ -358,6 +371,11 @@ void LLPanelTopInfoBar::layoutParcelIcons()
LLRect rect = getRect();
rect.set(rect.mLeft, rect.mTop, left + LAST_ICON_HPAD, rect.mBottom);
setRect(rect);
if (old_rect != getRect())
{
mResizeSignal();
}
}
S32 LLPanelTopInfoBar::layoutWidget(LLUICtrl* ctrl, S32 left)

View File

@ -41,6 +41,8 @@ class LLPanelTopInfoBar : public LLPanel, public LLSingleton<LLPanelTopInfoBar>,
friend class LLDestroyClass<LLPanelTopInfoBar>;
public:
typedef boost::signals2::signal<void ()> resize_signal_t;
LLPanelTopInfoBar();
~LLPanelTopInfoBar();
@ -57,6 +59,8 @@ public:
*/
void onVisibilityChange(const LLSD& show);
boost::signals2::connection setResizeCallback( const resize_signal_t::slot_type& cb );
private:
class LLParcelChangeObserver;
@ -167,6 +171,8 @@ private:
boost::signals2::connection mParcelPropsCtrlConnection;
boost::signals2::connection mShowCoordsCtrlConnection;
boost::signals2::connection mParcelMgrConnection;
resize_signal_t mResizeSignal;
};
#endif /* LLPANELTOPINFOBAR_H_ */