diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 392d9964a7..4b03cb4061 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -50,6 +50,8 @@ #include "llhelp.h" #include "lldockablefloater.h" +#include "llcheckboxctrl.h" // Add checkbox control toggle + static LLDefaultChildRegistry::Register r("button"); // Compiler optimization, generate extern template @@ -107,7 +109,11 @@ LLButton::Params::Params() held_down_delay("held_down_delay"), button_flash_enable("button_flash_enable", false), button_flash_count("button_flash_count"), - button_flash_rate("button_flash_rate") + // Add checkbox control toggle + //button_flash_rate("button_flash_rate") + button_flash_rate("button_flash_rate"), + checkbox_control("checkbox_control") + // { addSynonym(is_toggle, "toggle"); changeDefault(initial_value, LLSD(false)); @@ -172,7 +178,12 @@ LLButton::LLButton(const LLButton::Params& p) mHeldDownSignal(NULL), mUseDrawContextAlpha(p.use_draw_context_alpha), mHandleRightMouse(p.handle_right_mouse), - mFlashingTimer(NULL) + // Add checkbox control toggle + //mFlashingTimer(NULL) + mFlashingTimer(NULL), + mCheckboxControl(p.checkbox_control), + mCheckboxControlPanel(NULL) + // { if (p.button_flash_enable) { @@ -383,6 +394,31 @@ BOOL LLButton::postBuild() { autoResize(); + // Add checkbox control toggle + if(!mCheckboxControl.empty()) + { + mCheckboxControlPanel=LLUICtrlFactory::createFromFile("panel_button_checkbox.xml",this,LLDefaultChildRegistry::instance()); + if(mCheckboxControlPanel) + { + mCheckboxControlPanel->reshape(getRect().getWidth(),getRect().getHeight()); + + LLCheckBoxCtrl* check=mCheckboxControlPanel->findChild("check_control"); + if(check) + { + check->setControlName(mCheckboxControl,NULL); + } + else + { + llwarns << "Could not find checkbox control for button " << getName() << llendl; + } + } + else + { + llwarns << "Could not create checkbox panel for button " << getName() << llendl; + } + } + // + addBadgeToParentPanel(); return LLUICtrl::postBuild(); @@ -940,6 +976,15 @@ void LLButton::draw() NULL, mUseEllipses); } + // Add checkbox control toggle + if(mCheckboxControlPanel) + { + mCheckboxControlPanel->setOrigin(0,0); + mCheckboxControlPanel->reshape(getRect().getWidth(),getRect().getHeight()); + mCheckboxControlPanel->draw(); + } + // + LLUICtrl::draw(); }