diff options
author | Loren Shih <seraph@lindenlab.com> | 2009-12-08 13:33:21 -0500 |
---|---|---|
committer | Loren Shih <seraph@lindenlab.com> | 2009-12-08 13:33:21 -0500 |
commit | 37848d29d9030e00086c3a499d28237cdf943e1b (patch) | |
tree | d4af1d371cf94a1970f9449b1adc8ba29e86bb9d /indra/newview/llfloateravatarpicker.cpp | |
parent | 51a196416d9bde106ae0cb3cfd77003a68a6265b (diff) | |
parent | e07ef0d0e0e8cbd58afd4c6ee970634bd2f783e7 (diff) |
automated merge viewer2.0->avp
--HG--
branch : avatar-pipeline
Diffstat (limited to 'indra/newview/llfloateravatarpicker.cpp')
-rw-r--r-- | indra/newview/llfloateravatarpicker.cpp | 53 |
1 files changed, 51 insertions, 2 deletions
diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index 07bb6f832b..6e3d5499a2 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -140,9 +140,14 @@ BOOL LLFloaterAvatarPicker::postBuild() return TRUE; } +void LLFloaterAvatarPicker::setOkBtnEnableCb(validate_callback_t cb) +{ + mOkButtonValidateSignal.connect(cb); +} + void LLFloaterAvatarPicker::onTabChanged() { - childSetEnabled("ok_btn", visibleItemsSelected()); + childSetEnabled("ok_btn", isSelectBtnEnabled()); } // Destroys the object @@ -175,6 +180,10 @@ void LLFloaterAvatarPicker::onBtnSelect(void* userdata) { LLFloaterAvatarPicker* self = (LLFloaterAvatarPicker*)userdata; + // If select btn not enabled then do not callback + if (!self || !self->isSelectBtnEnabled()) + return; + if(self->mCallback) { std::string acvtive_panel_name; @@ -244,7 +253,7 @@ void LLFloaterAvatarPicker::onList(LLUICtrl* ctrl, void* userdata) LLFloaterAvatarPicker* self = (LLFloaterAvatarPicker*)userdata; if (self) { - self->childSetEnabled("ok_btn", self->visibleItemsSelected()); + self->childSetEnabled("ok_btn", self->isSelectBtnEnabled()); } } @@ -477,3 +486,43 @@ BOOL LLFloaterAvatarPicker::handleKeyHere(KEY key, MASK mask) return LLFloater::handleKeyHere(key, mask); } + +bool LLFloaterAvatarPicker::isSelectBtnEnabled() +{ + bool ret_val = visibleItemsSelected(); + + if ( ret_val && mOkButtonValidateSignal.num_slots() ) + { + std::string acvtive_panel_name; + LLScrollListCtrl* list = NULL; + LLPanel* active_panel = childGetVisibleTab("ResidentChooserTabs"); + + if(active_panel) + { + acvtive_panel_name = active_panel->getName(); + } + + if(acvtive_panel_name == "SearchPanel") + { + list = getChild<LLScrollListCtrl>("SearchResults"); + } + else if(acvtive_panel_name == "NearMePanel") + { + list = getChild<LLScrollListCtrl>("NearMe"); + } + else if (acvtive_panel_name == "FriendsPanel") + { + list = getChild<LLScrollListCtrl>("Friends"); + } + + if(list) + { + std::vector<LLUUID> avatar_ids; + std::vector<std::string> avatar_names; + getSelectedAvatarData(list, avatar_names, avatar_ids); + return mOkButtonValidateSignal(avatar_ids); + } + } + + return ret_val; +} |