コード例 #1
0
	void CProgressUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue)
	{
		if( _tcsicmp(pstrName, _T("hor")) == 0 ) SetHorizontal(_tcsicmp(pstrValue, _T("true")) == 0);
		else if( _tcsicmp(pstrName, _T("min")) == 0 ) SetMinValue(_ttoi(pstrValue));
		else if( _tcsicmp(pstrName, _T("max")) == 0 ) SetMaxValue(_ttoi(pstrValue));
		else if( _tcsicmp(pstrName, _T("value")) == 0 ) SetValue(_ttoi(pstrValue));
		else if( _tcsicmp(pstrName, _T("isstretchfore"))==0) SetStretchForeImage(_tcsicmp(pstrValue, _T("true")) == 0? true : false);
		else CLabelUI::SetAttribute(pstrName, pstrValue);
	}
コード例 #2
0
ファイル: UIProgress.cpp プロジェクト: 9tong/YDWE
	void CProgressUI::SetAttribute(const wchar_t* pstrName, const wchar_t* pstrValue)
	{
		if( wcscmp(pstrName, L"foreimage") == 0 ) m_sForeImage.reset(new CImage(pstrValue));
		else if( wcscmp(pstrName, L"hor") == 0 ) SetHorizontal(wcscmp(pstrValue, L"true") == 0);
		else if( wcscmp(pstrName, L"min") == 0 ) SetMinValue(_wtoi(pstrValue));
		else if( wcscmp(pstrName, L"max") == 0 ) SetMaxValue(_wtoi(pstrValue));
		else if( wcscmp(pstrName, L"value") == 0 ) SetValue(_wtoi(pstrValue));
		else if( wcscmp(pstrName, L"isstretchfore")==0) SetStretchForeImage(wcscmp(pstrValue, L"true") == 0? true : false);
		else CLabelUI::SetAttribute(pstrName, pstrValue);
	}
コード例 #3
0
ファイル: UIProgress.cpp プロジェクト: asdlei00/gtkduilib
void CUIProgress::SetAttribute(LPCWSTR pstrName, LPCWSTR pstrValue)
{
	if( wcscmp(pstrName, L"foreimage") == 0 ) 
		SetForeImage(pstrValue);
	else if( wcscmp(pstrName, L"hor") == 0 ) 
		SetHorizontal(wcscmp(pstrValue, L"true") == 0);
	else if( wcscmp(pstrName, L"min") == 0 )
		SetMinValue(/*_wtoi(pstrValue)*/wcstol(pstrValue, NULL, 10));
	else if( wcscmp(pstrName, L"max") == 0 )
		SetMaxValue(/*_wtoi(pstrValue)*/wcstol(pstrValue, NULL, 10));
	else if( wcscmp(pstrName, L"value") == 0 )
		SetValue(/*_wtoi(pstrValue)*/wcstol(pstrValue, NULL, 10));
	else if( wcscmp(pstrName, L"isstretchfore")==0)
		SetStretchForeImage(wcscmp(pstrValue, L"true") == 0);
	else 
		CUILabel::SetAttribute(pstrName, pstrValue);
}
コード例 #4
0
void USpinBox::SynchronizeProperties()
{
	Super::SynchronizeProperties();

	MySpinBox->SetDelta(Delta);
	MySpinBox->SetSliderExponent(SliderExponent);
	MySpinBox->SetMinDesiredWidth(MinDesiredWidth);

	MySpinBox->SetForegroundColor(ForegroundColor);

	// Set optional values
	bOverride_MinValue ? SetMinValue(MinValue) : ClearMinValue();
	bOverride_MaxValue ? SetMaxValue(MaxValue) : ClearMaxValue();
	bOverride_MinSliderValue ? SetMinSliderValue(MinSliderValue) : ClearMinSliderValue();
	bOverride_MaxSliderValue ? SetMaxSliderValue(MaxSliderValue) : ClearMaxSliderValue();

	// Always set the value last so that the max/min values are taken into account.
	TAttribute<float> ValueBinding = OPTIONAL_BINDING(float, Value);
	MySpinBox->SetValue(ValueBinding);
}
コード例 #5
0
ファイル: UISlider.cpp プロジェクト: galek/dava.framework
void UISlider::LoadFromYamlNode(const YamlNode * node, UIYamlLoader * loader)
{
    RemoveControl(thumbButton);
    SafeRelease(thumbButton);

    UIControl::LoadFromYamlNode(node, loader);

    // Values
    const YamlNode * valueNode = node->Get("value");

    if (valueNode)
        SetValue(valueNode->AsFloat());

    const YamlNode * minValueNode= node->Get("minValue");

    if (minValueNode)
        SetMinValue(minValueNode->AsFloat());

    const YamlNode * maxValueNode= node->Get("maxValue");

    if (maxValueNode)
        SetMaxValue(maxValueNode->AsFloat());

    const YamlNode* spritesEmbeddedNode = node->Get("spritesEmbedded");
    if (spritesEmbeddedNode)
    {
        this->spritesEmbedded = spritesEmbeddedNode->AsBool();
    }

    if (this->spritesEmbedded)
    {
        // File is saved in new format - load the backgrounds.
        LoadBackgound("min", minBackground, node, loader);
        LoadBackgound("max", maxBackground, node, loader);
    }
}
コード例 #6
0
ファイル: DecimalSpinner.cpp プロジェクト: AmirAbrams/haiku
void
BDecimalSpinner::SetRange(double min, double max)
{
	SetMinValue(min);
	SetMaxValue(max);
}
コード例 #7
0
ファイル: Slider.cpp プロジェクト: CasteyDaSilva/XAGUI
void Slider::ReadProperties(tinyxml2::XMLElement* element)
{
	cchar* cstring = element->Attribute("orientation");
	if (cstring != 0)
	{
		if (strcmp(cstring, "VERTICAL") == 0)
		{
			SetOrientation(ORIENTATION_VERTICAL);
		}
		else
		{
			SetOrientation(ORIENTATION_HORIZONTAL);
		}
	}

	cstring = element->Attribute("mOffsetX");
	if (cstring != 0)
		SetMarkerOffsetX(xaih::StrToInt(cstring));

	cstring = element->Attribute("mOffsetY");
	if (cstring != 0)
		SetMarkerOffsetY(xaih::StrToInt(cstring));
	
	cstring = element->Attribute("mW");
	if (cstring != 0)
	{
		std::string string = cstring;
		if (string.compare("AUTO") == 0)
		{
			GetMarker()->SetAutoWidth();
		}
		else if (*string.rbegin() == 'r')
		{
			GetMarker()->SetRatioWidth(xaih::StrToDouble(xaih::ParseString(string, "r").c_str()));
		}
		else
		{
			GetMarker()->SetWidth(xaih::StrToUInt(string.c_str()));
		}
	}
	else
	{
		GetMarker()->SetWidth(0);
	}

	cstring = element->Attribute("mH");
	if (cstring != 0)
	{
		std::string string = cstring;
		if (string.compare("AUTO") == 0)
		{
			GetMarker()->SetAutoHeight();
		}
		else if (*string.rbegin() == 'r')
		{
			GetMarker()->SetRatioHeight(xaih::StrToDouble(xaih::ParseString(string, "r").c_str()));
		}
		else
		{
			GetMarker()->SetHeight(xaih::StrToUInt(string.c_str()));
		}
	}
	else
	{
		GetMarker()->SetHeight(0);
	}

	cstring = element->Attribute("mSrcX");
	if (cstring != 0)
		GetMarker()->SetSrcX(CONTROL_STATE_NORMAL, xaih::StrToUInt(cstring));

	cstring = element->Attribute("mSrcY");
	if (cstring != 0)
		GetMarker()->SetSrcY(CONTROL_STATE_NORMAL, xaih::StrToUInt(cstring));
	
	cstring = element->Attribute("mhSrcX");
	if (cstring != 0)
	{
		GetMarker()->SetSrcX(CONTROL_STATE_HOVER, xaih::StrToUInt(cstring));
	}
	else
	{
		GetMarker()->SetSrcX(CONTROL_STATE_HOVER, GetMarker()->GetSrcX(CONTROL_STATE_NORMAL));
	}

	cstring = element->Attribute("mhSrcY");
	if (cstring != 0)
	{
		GetMarker()->SetSrcY(CONTROL_STATE_HOVER, xaih::StrToUInt(cstring));
	}
	else
	{
		GetMarker()->SetSrcY(CONTROL_STATE_HOVER, GetMarker()->GetSrcY(CONTROL_STATE_NORMAL));
	}

	cstring = element->Attribute("maSrcX");
	if (cstring != 0)
	{
		GetMarker()->SetSrcX(CONTROL_STATE_ACTIVE, xaih::StrToUInt(cstring));
	}
	else
	{
		GetMarker()->SetSrcX(CONTROL_STATE_ACTIVE, GetMarker()->GetSrcX(CONTROL_STATE_NORMAL));
	}

	cstring = element->Attribute("maSrcY");
	if (cstring != 0)
	{
		GetMarker()->SetSrcY(CONTROL_STATE_ACTIVE, xaih::StrToUInt(cstring));
	}
	else
	{
		GetMarker()->SetSrcY(CONTROL_STATE_ACTIVE, GetMarker()->GetSrcY(CONTROL_STATE_NORMAL));
	}

	cstring = element->Attribute("mdSrcX");
	if (cstring != 0)
	{
		GetMarker()->SetSrcX(CONTROL_STATE_DISABLED, xaih::StrToUInt(cstring));
	}
	else
	{
		GetMarker()->SetSrcX(CONTROL_STATE_DISABLED, GetMarker()->GetSrcX(CONTROL_STATE_NORMAL));
	}

	cstring = element->Attribute("mdSrcY");
	if (cstring != 0)
	{
		GetMarker()->SetSrcY(CONTROL_STATE_DISABLED, xaih::StrToUInt(cstring));
	}
	else
	{
		GetMarker()->SetSrcY(CONTROL_STATE_DISABLED, GetMarker()->GetSrcY(CONTROL_STATE_NORMAL));
	}

	cstring = element->Attribute("mSrcW");
	if (cstring != 0)
		GetMarker()->SetSrcWidth(xaih::StrToUInt(cstring));

	cstring = element->Attribute("mSrcH");
	if (cstring != 0)
		GetMarker()->SetSrcHeight(xaih::StrToUInt(cstring));

	cstring = element->Attribute("minValue");
	if (cstring != 0)
		SetMinValue(xaih::StrToInt(cstring));
	
	cstring = element->Attribute("maxValue");
	if (cstring != 0)
		SetMaxValue(xaih::StrToInt(cstring));

	cstring = element->Attribute("value");
	if (cstring != 0)
		SetValue(xaih::StrToInt(cstring));
}
コード例 #8
0
ファイル: UISlider.cpp プロジェクト: vilonosec/dava.framework
void UISlider::LoadFromYamlNode(YamlNode * node, UIYamlLoader * loader)
{
	UIControl::LoadFromYamlNode(node, loader);
	
	InitThumb();
	
	YamlNode * thumbSpriteNode = node->Get("thumbSprite");

	if (thumbSpriteNode)
	{
		YamlNode * spriteNode = thumbSpriteNode->Get(0);
		YamlNode * frameNode = thumbSpriteNode->Get(1);
		
		if (spriteNode)
			SetThumbSprite(spriteNode->AsString(), frameNode->AsInt());
		//SetMinSprite("/XGfx/Options/slider_bg", 1);
		//SetMaxSprite("/XGfx/Options/slider_bg", 0);
	}
	
	YamlNode * minSpriteNode = node->Get("minSprite");
	
	if (minSpriteNode)
	{
		YamlNode * spriteNode = minSpriteNode->Get(0);
		YamlNode * frameNode = minSpriteNode->Get(1);
		
		if (spriteNode)
			SetMinSprite(spriteNode->AsString(), frameNode->AsInt());
		//SetMinSprite("/XGfx/Options/slider_bg", 1);
		//SetMaxSprite("/XGfx/Options/slider_bg", 0);
	}
	
	YamlNode * maxSpriteNode = node->Get("maxSprite");
	
	if (maxSpriteNode)
	{
		YamlNode * spriteNode = maxSpriteNode->Get(0);
		YamlNode * frameNode = maxSpriteNode->Get(1);
		
		if (spriteNode)
			SetMaxSprite(spriteNode->AsString(), frameNode->AsInt());
		//SetMinSprite("/XGfx/Options/slider_bg", 1);
		//SetMaxSprite("/XGfx/Options/slider_bg", 0);
	}
	
	// Values
	YamlNode * valueNode = node->Get("value");
	
	if (valueNode)
		SetValue(valueNode->AsFloat());
		
	YamlNode * minValueNode= node->Get("minValue");
	
	if (minValueNode)
		SetMinValue(minValueNode->AsFloat());
		
	YamlNode * maxValueNode= node->Get("maxValue");
	
	if (maxValueNode)
		SetMaxValue(maxValueNode->AsFloat());
	
	// Min/Max draw type
	YamlNode * minDrawTypeNode = node->Get("minDrawType");

	if(minDrawTypeNode)
	{
		UIControlBackground::eDrawType type = (UIControlBackground::eDrawType)loader->GetDrawTypeFromNode(minDrawTypeNode);
		SetMinDrawType(type);
	}
	
	YamlNode * maxDrawTypeNode = node->Get("maxDrawType");

	if(maxDrawTypeNode)
	{
		UIControlBackground::eDrawType type = (UIControlBackground::eDrawType)loader->GetDrawTypeFromNode(maxDrawTypeNode);
		SetMaxDrawType(type);
	}		
}