#include "checkbox.h"

CheckBox::CheckBox( QWidget *parent ) : QWidget( parent )
{
  QHBoxLayout *hLayout = new QHBoxLayout( this );
  cb = new QCheckBox();
  hLayout->addWidget( cb );
  label = new ClickableLabel();
  label->setWordWrap( true );
  label->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
  hLayout->addWidget( label );
  connect(cb,SIGNAL(stateChanged(int)),this,SIGNAL(stateChanged(int)));
  connect( label, SIGNAL( clicked() ), this, SLOT( setCB() ) );
}

void CheckBox::setCB( void )
{
  cb->setChecked( !cb->isChecked() );
}

void CheckBox::setText( QString text )
{
  label->setText( text );
}

void CheckBox::setChecked( bool state )
{
  cb->setChecked( state );
}

bool CheckBox::isChecked( void )
{
  return cb->isChecked();
}
