Re-add missing code for checkboxed toolbar button

meow-7.2.2
Ansariel 2013-06-30 22:18:30 +02:00
parent 12c7875f1b
commit e864171846
1 changed files with 47 additions and 2 deletions

View File

@ -50,6 +50,8 @@
#include "llhelp.h"
#include "lldockablefloater.h"
#include "llcheckboxctrl.h" // <FS:Zi> Add checkbox control toggle
static LLDefaultChildRegistry::Register<LLButton> 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")
// <FS:Zi> Add checkbox control toggle
//button_flash_rate("button_flash_rate")
button_flash_rate("button_flash_rate"),
checkbox_control("checkbox_control")
// </FS:Zi>
{
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)
// <FS:Zi> Add checkbox control toggle
//mFlashingTimer(NULL)
mFlashingTimer(NULL),
mCheckboxControl(p.checkbox_control),
mCheckboxControlPanel(NULL)
// </FS:Zi>
{
if (p.button_flash_enable)
{
@ -383,6 +394,31 @@ BOOL LLButton::postBuild()
{
autoResize();
// <FS:Zi> Add checkbox control toggle
if(!mCheckboxControl.empty())
{
mCheckboxControlPanel=LLUICtrlFactory::createFromFile<LLPanel>("panel_button_checkbox.xml",this,LLDefaultChildRegistry::instance());
if(mCheckboxControlPanel)
{
mCheckboxControlPanel->reshape(getRect().getWidth(),getRect().getHeight());
LLCheckBoxCtrl* check=mCheckboxControlPanel->findChild<LLCheckBoxCtrl>("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;
}
}
// <FS:Zi>
addBadgeToParentPanel();
return LLUICtrl::postBuild();
@ -940,6 +976,15 @@ void LLButton::draw()
NULL, mUseEllipses);
}
// <FS:Zi> Add checkbox control toggle
if(mCheckboxControlPanel)
{
mCheckboxControlPanel->setOrigin(0,0);
mCheckboxControlPanel->reshape(getRect().getWidth(),getRect().getHeight());
mCheckboxControlPanel->draw();
}
// <FS:Zi>
LLUICtrl::draw();
}