no ticket, minor refactoring.

add return value to notifyXXX functions, may be usefull

--HG--
branch : product-engine
master
Yuri Chebotarev 2009-12-07 12:04:27 +02:00
parent 67ff38b51b
commit c6177836ec
10 changed files with 33 additions and 22 deletions

View File

@ -932,7 +932,7 @@ void LLFlatListView::onFocusLost()
}
//virtual
void LLFlatListView::notify(const LLSD& info)
S32 LLFlatListView::notify(const LLSD& info)
{
if(info.has("action"))
{
@ -941,13 +941,16 @@ void LLFlatListView::notify(const LLSD& info)
{
setFocus(true);
selectFirstItem();
return 1;
}
else if(str_action == "select_last")
{
setFocus(true);
selectLastItem();
return 1;
}
}
return 0;
}
//EOF

View File

@ -283,7 +283,7 @@ public:
void selectFirstItem ();
void selectLastItem ();
virtual void notify(const LLSD& info) ;
virtual S32 notify(const LLSD& info) ;
protected:

View File

@ -2848,18 +2848,21 @@ LLView::default_widget_map_t& LLView::getDefaultWidgetMap() const
return *mDefaultWidgets;
}
void LLView::notifyParent(const LLSD& info)
S32 LLView::notifyParent(const LLSD& info)
{
LLView* parent = getParent();
if(parent)
parent->notifyParent(info);
return parent->notifyParent(info);
return 0;
}
void LLView::notifyChildren(const LLSD& info)
bool LLView::notifyChildren(const LLSD& info)
{
bool ret = false;
for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
{
(*child_it)->notifyChildren(info);
ret |= (*child_it)->notifyChildren(info);
}
return ret;
}
// convenient accessor for draw context

View File

@ -511,10 +511,15 @@ public:
virtual void handleReshape(const LLRect& rect, bool by_user);
virtual void dirtyRect();
virtual void notifyParent(const LLSD& info);
virtual void notifyChildren(const LLSD& info);
//send custom notification to LLView parent
virtual S32 notifyParent(const LLSD& info);
virtual void notify(const LLSD& info) {};
//send custom notification to all view childrend
// return true if _any_ children return true. otherwise false.
virtual bool notifyChildren(const LLSD& info);
//send custom notification to current view
virtual S32 notify(const LLSD& info) { return 0;};
static const LLViewDrawContext& getDrawContext();

View File

@ -71,7 +71,7 @@ void LLPanelMe::onOpen(const LLSD& key)
LLPanelProfile::onOpen(key);
}
void LLPanelMe::notifyChildren(const LLSD& info)
bool LLPanelMe::notifyChildren(const LLSD& info)
{
if (info.has("task-panel-action") && info["task-panel-action"].asString() == "handle-tri-state")
{
@ -104,10 +104,10 @@ void LLPanelMe::notifyChildren(const LLSD& info)
if (on_default_view)
LLSideTray::getInstance()->collapseSideBar();
return; // this notification is only supposed to be handled by task panels
return true; // this notification is only supposed to be handled by task panels
}
LLPanel::notifyChildren(info);
return LLPanel::notifyChildren(info);
}
void LLPanelMe::buildEditPanel()

View File

@ -54,7 +54,7 @@ public:
LLPanelMe();
/*virtual*/ void onOpen(const LLSD& key);
/*virtual*/ void notifyChildren(const LLSD& info);
/*virtual*/ bool notifyChildren(const LLSD& info);
/*virtual*/ BOOL postBuild();

View File

@ -1284,7 +1284,7 @@ void LLPanelPeople::onOpen(const LLSD& key)
reSelectedCurrentTab();
}
void LLPanelPeople::notifyChildren(const LLSD& info)
bool LLPanelPeople::notifyChildren(const LLSD& info)
{
if (info.has("task-panel-action") && info["task-panel-action"].asString() == "handle-tri-state")
{
@ -1292,7 +1292,7 @@ void LLPanelPeople::notifyChildren(const LLSD& info)
if (!container)
{
llwarns << "Cannot find People panel container" << llendl;
return;
return true;
}
if (container->getCurrentPanelIndex() > 0)
@ -1303,10 +1303,10 @@ void LLPanelPeople::notifyChildren(const LLSD& info)
else
LLSideTray::getInstance()->collapseSideBar();
return; // this notification is only supposed to be handled by task panels
return true; // this notification is only supposed to be handled by task panels
}
LLPanel::notifyChildren(info);
return LLPanel::notifyChildren(info);
}
void LLPanelPeople::showAccordion(const std::string name, bool show)

View File

@ -51,7 +51,7 @@ public:
/*virtual*/ BOOL postBuild();
/*virtual*/ void onOpen(const LLSD& key);
/*virtual*/ void notifyChildren(const LLSD& info);
/*virtual*/ bool notifyChildren(const LLSD& info);
// internals
class Updater;

View File

@ -220,15 +220,15 @@ void LLPanelProfile::openPanel(LLPanel* panel, const LLSD& params)
panel->setRect(new_rect);
}
void LLPanelProfile::notifyParent(const LLSD& info)
S32 LLPanelProfile::notifyParent(const LLSD& info)
{
std::string action = info["action"];
// lets update Picks list after Pick was saved
if("save_new_pick" == action)
{
onOpen(info);
return;
return 1;
}
LLPanel::notifyParent(info);
return LLPanel::notifyParent(info);
}

View File

@ -55,7 +55,7 @@ public:
virtual void openPanel(LLPanel* panel, const LLSD& params);
void notifyParent(const LLSD& info);
S32 notifyParent(const LLSD& info);
protected: