Migrate to boost::bind for a bunch of CommitCallbacks. Converted several static member functions to nonstatic member functions

This commit is contained in:
Shyotl
2012-12-06 17:13:17 -06:00
parent ef6f411b70
commit 26191dd274
27 changed files with 326 additions and 440 deletions

View File

@@ -70,9 +70,6 @@ std::map<const LLUUID, LLFloaterGroupPicker*> LLFloaterGroupPicker::sInstances;
// helper functions
void init_group_list(LLScrollListCtrl* ctrl, const LLUUID& highlight_id, const std::string& none_text, U64 powers_mask = GP_ALL_POWERS);
//callbacks
void onGroupSortChanged(void* user_data);
///----------------------------------------------------------------------------
/// Class LLFloaterGroupPicker
///----------------------------------------------------------------------------
@@ -128,7 +125,8 @@ BOOL LLFloaterGroupPicker::postBuild()
{
const std::string none_text = getString("none");
init_group_list(getChild<LLScrollListCtrl>("group list"), gAgent.getGroupID(), none_text, mPowersMask);
LLScrollListCtrl* group_list = getChild<LLScrollListCtrl>("group list");
init_group_list(group_list, gAgent.getGroupID(), none_text, mPowersMask);
childSetAction("OK", onBtnOK, this);
@@ -213,15 +211,14 @@ void LLPanelGroups::reset()
BOOL LLPanelGroups::postBuild()
{
childSetCommitCallback("group list", onGroupList, this);
childSetTextArg("groupcount", "[COUNT]", llformat("%d",gAgent.mGroups.count()));
childSetTextArg("groupcount", "[MAX]", llformat("%d", gHippoLimits->getMaxAgentGroups()));
const std::string none_text = getString("none");
LLScrollListCtrl *group_list = getChild<LLScrollListCtrl>("group list");
init_group_list(group_list, gAgent.getGroupID(), none_text);
group_list->setSortChangedCallback(boost::bind(&onGroupSortChanged,this)); //Force 'none' to always be first entry.
group_list->setCommitCallback(boost::bind(&LLPanelGroups::onGroupList,this));
group_list->setSortChangedCallback(boost::bind(&LLPanelGroups::onGroupSortChanged,this)); //Force 'none' to always be first entry.
group_list->setDoubleClickCallback(boost::bind(&LLPanelGroups::onBtnIM,this));
childSetAction("Activate", onBtnActivate, this);
@@ -475,15 +472,20 @@ bool LLPanelGroups::callbackLeaveGroup(const LLSD& notification, const LLSD& res
return false;
}
void LLPanelGroups::onGroupList(LLUICtrl* ctrl, void* userdata)
void LLPanelGroups::onGroupSortChanged()
{
LLPanelGroups *self = (LLPanelGroups*)userdata;
if(!self)
LLScrollListCtrl *group_list = getChild<LLScrollListCtrl>("group list");
if(!group_list)
return;
self->enableButtons();
group_list->moveToFront(group_list->getItemIndex(LLUUID::null));
}
LLScrollListCtrl *group_list = (LLScrollListCtrl*)self->getChild<LLScrollListCtrl>("group list");
void LLPanelGroups::onGroupList()
{
enableButtons();
LLScrollListCtrl *group_list = getChild<LLScrollListCtrl>("group list");
if(!group_list)
return;
@@ -558,18 +560,6 @@ LLSD create_group_element(const LLGroupData *group_datap, const LLUUID &active_g
return element;
}
void onGroupSortChanged(void* user_data)
{
LLPanelGroups *panel = (LLPanelGroups*)user_data;
if(!panel)
return;
LLScrollListCtrl *group_list = (LLScrollListCtrl*)panel->getChild<LLScrollListCtrl>("group list");
if(!group_list)
return;
group_list->moveToFront(group_list->getItemIndex(LLUUID::null));
}
void init_group_list(LLScrollListCtrl* ctrl, const LLUUID& highlight_id, const std::string& none_text, U64 powers_mask)
{
S32 count = gAgent.mGroups.count();