Exemple #1
0
void ScrollBar::SetValue(int32_t value)
{
    if (value < GetMinValue())
    {
        value = GetMinValue();
    }
    else if (value > GetMaxValue())
    {
        value = GetMaxValue();
    }

    _value = value;

    (onValueChanged != 0) ? onValueChanged(this) : OnValueChanged();

    if (GetOrientation() == ORIENTATION_HORIZONTAL)
    {
        GetMarker()->SetX(static_cast<PosType>(GetMarkerOffsetX() + (Slider::GetWidth() -
                                               GetMarker()->GetWidth()) / ((GetMaxValue() - GetMinValue()) / static_cast<float>(GetValue()))));
        GetMarker()->SetY(GetMarkerOffsetY());
    }
    else
    {
        GetMarker()->SetX(GetMarkerOffsetX());
        GetMarker()->SetY(static_cast<PosType>(GetMarkerOffsetY() + (Slider::GetHeight() -
                                               GetMarker()->GetHeight()) / ((GetMaxValue() - GetMinValue()) /
                                                       static_cast<float>(GetValue()))));
    }
}
Exemple #2
0
NBW_SpinBox::NBW_SpinBox(QWidget* parent)
    : QFrame(parent)
    , _progress(0)
    , _controls(0)
{
    setObjectName("nbw_spinBox");
    setProperty("dragging", false);

    _progress = new QFrame(this);
    _progress->setObjectName("nbw_spinBox_progress");
    _progress->setProperty("dragging", false);
    _progress->hide();

    _controls = new NBW_SpinBoxControls(this);
    _controls->show();
    connect(_controls, SIGNAL(SigBeginDragging()), this, SLOT(OnBeginDragging()));
    connect(_controls, SIGNAL(SigEndDragging()), this, SLOT(OnEndDragging()));
    connect(_controls, SIGNAL(SigValueChanged()), this, SLOT(OnValueChanged()));

    // find preferred size. depends on OS guidelines.
    // height is around 22px.
    if(!s_preferredSize.isValid()) {
        QPushButton* dummyButton = new QPushButton;
        s_preferredSize = dummyButton->sizeHint();
    }
}
 bool SSpinButtonCtrl::OnUpDownClick(EventArgs *pEvt)
 {
     SASSERT(m_uStep < (UINT)abs(m_nMax-m_nMin));
     SASSERT(m_nValue>=m_nMin && m_nValue<=m_nMax);
     
     SWindow * sender = sobj_cast<SWindow>(pEvt->sender);
     SASSERT(sender);
     if(sender == m_btnUp)
     {
         m_nValue += m_uStep;
         if(m_nValue>m_nMax)
         {
             if(m_bCircle) m_nValue = m_nMin;
             else m_nValue = m_nMax;
         }
     }else //if(sender == m_btnDown)
     {
         m_nValue -= m_uStep;
         if(m_nValue<m_nMin)
         {
             if(m_bCircle) m_nValue = m_nMax;
             else m_nValue = m_nMin;
         }
     }
     OnValueChanged();
     return true;
 }
Exemple #4
0
void CInspectorProperty_FilePath::OnEnUpdateValue()
{
	ld3d::Property_T<const boost::filesystem::path> * pProp = (ld3d::Property_T<const boost::filesystem::path>*)GetProperty();

	pProp->Set(GetValue());

	OnValueChanged();
}
Exemple #5
0
void LayerForceWidget::InitWidget(QWidget* widget)
{
    mainBox->addWidget(widget);
    connect(widget,
            SIGNAL(ValueChanged()),
            this,
            SLOT(OnValueChanged()));
}
 HRESULT SSpinButtonCtrl::OnAttrValue(const SStringW& strValue, BOOL bLoading)
 {
     m_nValue = _wtoi(strValue);
     if(!bLoading)
     {
         OnValueChanged();
     }
     return S_OK;
 }
void SIntegralCurveKeyEditor::OnValueCommitted(int32 Value, ETextCommit::Type CommitInfo)
{
	if (CommitInfo == ETextCommit::OnEnter)
	{
		const FScopedTransaction Transaction( LOCTEXT("SetIntegralKey", "Set Integral Key Value") );

		OnValueChanged(Value);
	}
}
 void SPropertyItemColor::SetString( const SStringT & strValue )
 {
     int r,g,b,a;
     if(_stscanf(strValue,m_strFormat,&r,&g,&b,&a)==4)
     {
         m_crValue = RGBA(r,g,b,a);
         OnValueChanged();
     }
 }
Exemple #9
0
void CInspectorProperty_Signal::OnSignalBtn()
{
    if(GetProperty())
    {
        ((ld3d::Property_T<ld3d::prop_signal>*)GetProperty())->Set(ld3d::prop_signal());
    }

    OnValueChanged();
}
Exemple #10
0
void Slider::ValueChanged(bool supressCallback)
{
	// Update the text string
	UpdateTextString();

	// Update the slider dimensions
	int lSliderX;
	int lSliderY;
	int lSliderWidth;
	int lSliderHeight;

	int lBarX;
	int lBarY;
	int lBarWidth;
	int lBarHeight;

	if(m_eSliderDirection == ESliderDirection_Horizontal)
	{
		lSliderX = (int)((m_dimensions.m_width - m_sliderWidth) * ((m_currentValue - m_minValue) / (m_maxValue - m_minValue)));
		lSliderY = 0;
		lSliderWidth = m_sliderWidth;
		lSliderHeight = m_dimensions.m_height;

		lBarX = (m_sliderWidth / 2);
		lBarY = (m_dimensions.m_height / 2) - (m_barHeight / 2);
		lBarWidth = m_dimensions.m_width - m_sliderWidth;
		lBarHeight = m_barHeight;
	}
	else //m_eSliderDirection == ESliderDirection_Vertical
	{
		lSliderX = 0;
		lSliderY = (int)((m_dimensions.m_height - m_sliderWidth) * ((m_currentValue - m_minValue) / (m_maxValue - m_minValue)));
		lSliderWidth = m_dimensions.m_width;
		lSliderHeight = m_sliderWidth;

		lBarX = (m_dimensions.m_width / 2) - (m_barHeight / 2);
		lBarY = (m_sliderWidth / 2);
		lBarWidth = m_barHeight;
		lBarHeight = m_dimensions.m_height - m_sliderWidth;
	}

	m_pScrollerDefault->SetDimensions(lSliderX, lSliderY, lSliderWidth, lSliderHeight);
	m_pScrollerHover->SetDimensions(lSliderX, lSliderY, lSliderWidth, lSliderHeight);
	m_pScrollerDragging->SetDimensions(lSliderX, lSliderY, lSliderWidth, lSliderHeight);
	m_pScrollerDisabled->SetDimensions(lSliderX, lSliderY, lSliderWidth, lSliderHeight);
	m_pScrollBackbarDefault->SetDimensions(lBarX, lBarY, lBarWidth, lBarHeight);
	m_pScrollBackbarPressed->SetDimensions(lBarX, lBarY, lBarWidth, lBarHeight);

	OnValueChanged();

    // Call the callback function callback if this class is just a simple button
    if(supressCallback == false && m_ValueChangedCallback)
    {
        m_ValueChangedCallback(m_pValueChangedCallbackData);
    }
}
Exemple #11
0
    void SPropertyItemColor::SetString( const SStringT & strValue )
    {

		COLORREF crTmp;
		crTmp = CR_INVALID;
		ParseValue(strValue,crTmp);
		if (m_crValue != crTmp)
		{
			m_crValue = crTmp;
			OnValueChanged();
		}
    }
Exemple #12
0
//oldschool
void ptChoice::SetValue(const QVariant Value,
                        const short    BlockSignal) {
  m_Value = Value;
  for (int i=0; i<m_ComboBox->count(); i++) {
   if (Value == m_ComboBox->itemData(i)) {
     m_ComboBox->setCurrentIndex(i);
     // setCurrentIndex does not generate signals !
     if (!BlockSignal) OnValueChanged(i);
     break;
   }
  }
}
Exemple #13
0
void DamageWindow::on_hide()
{
#ifdef DEBUG
	std::cerr << "DamageWindow::on_hide()" << std::endl;
#endif

	f_spinConnection.disconnect();
	
	OnValueChanged();

	Gtk::Dialog::on_hide();
}
void CXTPPropertyGridItemPicture::SetPicturePath(LPCTSTR lpszPath)
{
	m_strPicturePath = lpszPath;
	LPPICTUREDISP pPict = NULL;

	if (OleLoadPicturePath((LPOLESTR)XTP_CT2CW(m_strPicturePath), NULL, 0, 0, IID_IPictureDisp, (LPVOID*)&pPict) == S_OK)
	{
		m_olePicture.SetPictureDispatch(pPict);
		pPict->Release();

		OnValueChanged(_T(""));
		((CWnd*)m_pGrid)->Invalidate(FALSE);
	}
	else if (m_olePicture.GetPictureDispatch())
	{
		m_olePicture.SetPictureDispatch(NULL);

		OnValueChanged(_T(""));
		((CWnd*)m_pGrid)->Invalidate(FALSE);
	}
}
Exemple #15
0
int FloatPropertyEditor::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QDoubleSpinBox::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: OnValueChanged((*reinterpret_cast< double(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 1;
    }
    return _id;
}
int Visor::cQTimeBar::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QToolBar::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: OnValueChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 1;
    }
    return _id;
}
Exemple #17
0
void RangeBase::SetValue(double val)
{
    if (val < SmallChange())
    {
        val = SmallChange();
    }

    if (_iValue != val)
    {
        double _iOldValue = _iValue;
        _iValue = val;

        OnValueChanged(_iOldValue, val);
    }
}
void CXTPPropertyGridItemFont::OnInplaceButtonDown(CXTPPropertyGridInplaceButton* pButton)
{
	if (m_pGrid->SendNotifyMessage(XTP_PGN_INPLACEBUTTONDOWN, (LPARAM)pButton) == TRUE)
		return;

	if (!OnRequestEdit())
		return;

	InternalAddRef();

	CFontDialog dlg(&m_lfValue, CF_EFFECTS | CF_SCREENFONTS, NULL, m_pGrid);

	if (m_clrValue == (COLORREF)-1)
	{
		dlg.m_cf.lpfnHook = FontDlgProc;
	}
	else
	{
		dlg.m_cf.rgbColors = m_clrValue;
	}

	if (dlg.DoModal() == IDOK)
	{
		LOGFONT lf;
		dlg.GetCurrentFont(&lf);

		CString strValue = FontToString(lf);

		if (OnAfterEdit(strValue))
		{
			SetFont(lf);

			if (m_clrValue != (COLORREF)-1)
				m_clrValue = dlg.GetColor();

			OnValueChanged(strValue);
			SAFE_INVALIDATE(m_pGrid);
		}
	}
	else
	{
		OnCancelEdit();
	}

	InternalRelease();
}
bool CIwGameUISlider::Update(float dt)
{
	CIwFVec2 pos = Position;
	
	if (!CIwGameUIBase::Update(dt))
		return false;
	
	float old = Value;
	float range = ValueRange.y - ValueRange.x;
	float x1 = -(float)SliderSize / 2;
	float x2 = (float)SliderSize / 2;

	if (SliderType == SliderType_Horizontal)
	{
		float x = Position.x;
		if (x < x1)
			x = x1;
		if (x > x2)
			x = x2;
		Value = ValueRange.x + ((x - x1) * range) / SliderSize;

		setPosition(x, pos.y);
	}
	else
	if (SliderType == SliderType_Vertical)
	{
		float y = Position.y;
		if (y < x1)
			y = x1;
		if (y > x2)
			y = x2;
		Value = ValueRange.y - (ValueRange.x + ((y - x1) * range) / SliderSize);

		setPosition(pos.x, y);
	}

	if (fabs(old - Value) > 0.0001f)
	{
		ThumbChanged = true;
		OnValueChanged(old, Value);
	}
	else
		ThumbChanged = false;

	return true;
}
Exemple #20
0
	void SPropertyItemColor::OnColorEnd( BOOL bCancel,COLORREF cr )
	{
		if(!bCancel)
		{
			COLORREF crTmp = cr|0xff000000;

		  if (m_crValue == crTmp)
		  {
			  return;
		  }else
		  {
			  m_crValue = crTmp;
		  }
		  OnValueChanged();
		  CRect rc=GetOwner()->GetItemRect(this);
		  GetOwner()->InvalidateRect(&rc);
		}
	}
Exemple #21
0
 BOOL SSpinButtonCtrl::CreateChildren(pugi::xml_node xmlNode)
 {
     if(!__super::CreateChildren(xmlNode))
         return FALSE;
     m_btnUp = FindChildByName(KBTN_UP);
     m_btnDown = FindChildByName(KBTN_DOWN);
     
     SASSERT(m_btnUp &&m_btnDown);
     
     if(!m_btnDown || !m_btnUp)
         return FALSE;
     m_btnUp->SetAttribute(L"focusable",L"0");
     m_btnDown->SetAttribute(L"focusable",L"0");
     m_btnUp->GetEventSet()->subscribeEvent(EventCmd::EventID,Subscriber(&SSpinButtonCtrl::OnUpDownClick,this));
     m_btnDown->GetEventSet()->subscribeEvent(EventCmd::EventID,Subscriber(&SSpinButtonCtrl::OnUpDownClick,this));
     
     OnValueChanged();
     return TRUE;        
 }
Exemple #22
0
    void SPropertyItemColor::OnButtonClick()
    {
        CHOOSECOLOR cc;                 // common dialog box structure 
        static COLORREF acrCustClr[16]; // array of custom colors 

        // Initialize CHOOSECOLOR 
        ZeroMemory(&cc, sizeof(cc));
        cc.lStructSize = sizeof(cc);
        cc.hwndOwner = GetOwner()->GetContainer()->GetHostHwnd();
        cc.lpCustColors = (LPDWORD) acrCustClr;
        cc.rgbResult = m_crValue;
        cc.Flags = CC_FULLOPEN | CC_RGBINIT;
        
        if (ChooseColor(&cc))
        {
            m_crValue = cc.rgbResult|0xff000000;
            OnValueChanged();
            CRect rc=GetOwner()->GetItemRect(this);
            GetOwner()->InvalidateRect(&rc);
        }
    }
EmitterLayerWidget::EmitterLayerWidget(QWidget *parent) :
	QWidget(parent)
{
	mainBox = new QVBoxLayout;
	this->setLayout(mainBox);
	
	layerNameLineEdit = new QLineEdit();
	mainBox->addWidget(layerNameLineEdit);
	connect(layerNameLineEdit,
			SIGNAL(editingFinished()),
			this,
			SLOT(OnValueChanged()));

	layerTypeLabel = new QLabel(this);
	layerTypeLabel->setText("Layer type");
	mainBox->addWidget(layerTypeLabel);

	layerTypeComboBox = new QComboBox(this);
	FillLayerTypes();
	mainBox->addWidget(layerTypeComboBox);
	connect(layerTypeComboBox,
			SIGNAL(currentIndexChanged(int)),
			this,
			SLOT(OnValueChanged()));

	enableCheckBox = new QCheckBox("Enable layer");
	mainBox->addWidget(enableCheckBox);
	connect(enableCheckBox,
			SIGNAL(stateChanged(int)),
			this,
			SLOT(OnValueChanged()));
	
	additiveCheckBox = new QCheckBox("Additive");
	mainBox->addWidget(additiveCheckBox);
	connect(additiveCheckBox,
			SIGNAL(stateChanged(int)),
			this,
			SLOT(OnValueChanged()));
	
	QHBoxLayout* spriteHBox = new QHBoxLayout;
	spriteLabel = new QLabel(this);
	spriteLabel->setMinimumSize(SPRITE_SIZE, SPRITE_SIZE);
	spriteHBox->addWidget(spriteLabel);
	mainBox->addLayout(spriteHBox);
	QVBoxLayout* spriteVBox = new QVBoxLayout;
	spriteHBox->addLayout(spriteVBox);
	spriteBtn = new QPushButton("Set sprite", this);
	spriteBtn->setMinimumHeight(30);
	spritePathLabel = new QLineEdit(this);
	spritePathLabel->setReadOnly(true);
	spriteVBox->addWidget(spriteBtn);
	spriteVBox->addWidget(spritePathLabel);
	connect(spriteBtn,
			SIGNAL(clicked(bool)),
			this,
			SLOT(OnSpriteBtn()));
	connect(spritePathLabel, SIGNAL(textChanged(const QString&)), this, SLOT(OnSpritePathChanged(const QString&)));

	lifeTimeLine = new TimeLineWidget(this);
	InitWidget(lifeTimeLine);
	numberTimeLine = new TimeLineWidget(this);
	InitWidget(numberTimeLine);
	sizeTimeLine = new TimeLineWidget(this);
	InitWidget(sizeTimeLine);
	sizeVariationTimeLine = new TimeLineWidget(this);
	InitWidget(sizeVariationTimeLine);
	sizeOverLifeTimeLine = new TimeLineWidget(this);
	InitWidget(sizeOverLifeTimeLine);
	velocityTimeLine = new TimeLineWidget(this);
	InitWidget(velocityTimeLine);
	spinTimeLine = new TimeLineWidget(this);
	InitWidget(spinTimeLine);

	colorRandomGradient = new GradientPickerWidget(this);
	InitWidget(colorRandomGradient);
	colorOverLifeGradient = new GradientPickerWidget(this);
	InitWidget(colorOverLifeGradient);
	alphaOverLifeTimeLine = new TimeLineWidget(this);
	InitWidget(alphaOverLifeTimeLine);
	
	QHBoxLayout* frameOverlifeLayout = new QHBoxLayout();
	frameOverlifeCheckBox = new QCheckBox("frame over life", this);
	connect(frameOverlifeCheckBox, SIGNAL(stateChanged(int)),
				  this, SLOT(OnValueChanged()));

	frameOverlifeFPSSpin = new QSpinBox(this);
	frameOverlifeFPSSpin->setMinimum(0);
	frameOverlifeFPSSpin->setMaximum(1000);
	connect(frameOverlifeFPSSpin, SIGNAL(valueChanged(int)),
			this, SLOT(OnValueChanged()));

	frameOverlifeLayout->addWidget(frameOverlifeCheckBox);
	frameOverlifeLayout->addWidget(frameOverlifeFPSSpin);
	frameOverlifeLayout->addWidget(new QLabel("FPS", this));
	mainBox->addLayout(frameOverlifeLayout);
	
	angleTimeLine = new TimeLineWidget(this);
	InitWidget(angleTimeLine);

	QHBoxLayout* startTimeHBox = new QHBoxLayout;
	startTimeHBox->addWidget(new QLabel("startTime", this));
	startTimeSpin = new QDoubleSpinBox(this);
	startTimeSpin->setMinimum(-std::numeric_limits<double>::infinity());
	startTimeSpin->setMaximum(std::numeric_limits<double>::infinity());
	startTimeHBox->addWidget(startTimeSpin);
	mainBox->addLayout(startTimeHBox);
	connect(startTimeSpin,
			SIGNAL(valueChanged(double)),
			this,
			SLOT(OnValueChanged()));

	QHBoxLayout* endTimeHBox = new QHBoxLayout;
	endTimeHBox->addWidget(new QLabel("endTime", this));
	endTimeSpin = new QDoubleSpinBox(this);
	endTimeSpin->setMinimum(-std::numeric_limits<double>::infinity());
	endTimeSpin->setMaximum(std::numeric_limits<double>::infinity());
	endTimeHBox->addWidget(endTimeSpin);
	mainBox->addLayout(endTimeHBox);
	connect(endTimeSpin,
			SIGNAL(valueChanged(double)),
			this,
			SLOT(OnValueChanged()));
	
	Q_FOREACH( QAbstractSpinBox * sp, findChildren<QAbstractSpinBox*>() ) {
        sp->installEventFilter( this );
    }
void CXTPPropertyGridItemPoint::SetY(LPCTSTR sy)
{
	OnValueChanged(PointToString(CPoint(m_ptValue.x, _ttoi(sy))));
}
void CXTPPropertyGridItemPoint::SetX(LPCTSTR sx)
{
	OnValueChanged(PointToString(CPoint(_ttoi(sx), m_ptValue.y)));
}
void CXTPPropertyGridItemSize::SetHeight(LPCTSTR strHeight)
{
	OnValueChanged(SizeToString(CSize(m_szValue.cx, _ttoi(strHeight))));
}
void CXTPPropertyGridItemSize::SetWidth(LPCTSTR strWidth)
{
	OnValueChanged(SizeToString(CSize(_ttoi(strWidth), m_szValue.cy)));
}
Exemple #28
0
 void SPropertyItemColor::SetValue( void *pValue)
 {
     m_crValue = *(COLORREF*)pValue;
     OnValueChanged();
 }
Exemple #29
0
void tFloatSlider::setScale(double value)
{
    m_Scale = float(value);
    OnValueChanged(this->value());
}