CDirectionWidget::CDirectionWidget(QWidget *parent)
	: QWidget(parent), _globalName("")
{
	_ui.setupUi(this);

	_ui.xzWidget->installEventFilter(this);
	_ui.yzWidget->installEventFilter(this);
	_ui.xzWidget->setObjectName("XZ");
	_ui.yzWidget->setObjectName("YZ");
	_ui.globalPushButton->hide();

	connect(_ui.globalPushButton ,SIGNAL(clicked()), this, SLOT(setGlobalDirection()));
	connect(_ui.incVecIPushButton ,SIGNAL(clicked()), this, SLOT(incVecI()));
	connect(_ui.incVecJPushButton ,SIGNAL(clicked()), this, SLOT(incVecJ()));
	connect(_ui.incVecKPushButton ,SIGNAL(clicked()), this, SLOT(incVecK()));
	connect(_ui.decVecIPushButton ,SIGNAL(clicked()), this, SLOT(decVecI()));
	connect(_ui.decVecJPushButton ,SIGNAL(clicked()), this, SLOT(decVecJ()));
	connect(_ui.decVecKPushButton ,SIGNAL(clicked()), this, SLOT(decVecK()));

	// Set default value +K
	setValue(NLMISC::CVector::K);
}
CDirectionWidget::CDirectionWidget(QWidget *parent)
    : QWidget(parent), _Wrapper(NULL), _DirectionWrapper(NULL)
{
	_ui.setupUi(this);
	
	_ui.xzWidget->setMode(Mode::Direction);
	_ui.yzWidget->setMode(Mode::Direction);
	_ui.xzWidget->setText("XZ");
	_ui.yzWidget->setText("YZ");
	_ui.globalPushButton->hide();
	
	connect(_ui.globalPushButton ,SIGNAL(clicked()), this, SLOT(setGlobalDirection()));
	connect(_ui.incVecIPushButton ,SIGNAL(clicked()), this, SLOT(incVecI()));
	connect(_ui.incVecJPushButton ,SIGNAL(clicked()), this, SLOT(incVecJ()));
	connect(_ui.incVecKPushButton ,SIGNAL(clicked()), this, SLOT(incVecK()));
	connect(_ui.decVecIPushButton ,SIGNAL(clicked()), this, SLOT(decVecI()));
	connect(_ui.decVecJPushButton ,SIGNAL(clicked()), this, SLOT(decVecJ()));
	connect(_ui.decVecKPushButton ,SIGNAL(clicked()), this, SLOT(decVecK()));
	
	connect(_ui.xzWidget, SIGNAL(applyNewVector(float,float)), this, SLOT(setNewVecXZ(float,float)));
	connect(_ui.yzWidget, SIGNAL(applyNewVector(float,float)), this, SLOT(setNewVecYZ(float,float)));
}