コード例 #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
ファイル: StatusBar.cpp プロジェクト: D-os/BeFree
void
BStatusBar::Reset(const char *label, const char *trailing_label)
{
	SetMaxValue(100);
	SetTo(0, "", "");

	if (fLabel) delete[] fLabel;
	fLabel = (label == NULL ? NULL : EStrdup(label));

	if (fTrailingLabel) delete[] fTrailingLabel;
	fTrailingLabel = (trailing_label == NULL ? NULL : EStrdup(trailing_label));
}
コード例 #4
0
ファイル: MeterIcon.cpp プロジェクト: RussianPenguin/samples
bool CMeterIcon::Init(HICON hFrame, int nMaxVal, int nNumBars, int nSpacingWidth, int nWidth, int nHeight, COLORREF crColor)
// nWidth & nHeight are the dimensions of the icon that you want created
// nSpacingWidth is the space between the bars
// hFrame is the overlay for the bars
// crColor is the outline color for the bars
{// begin Init
	SetFrame(hFrame);
	SetWidth(nSpacingWidth);
	SetMaxValue(nMaxVal);
	SetDimensions(nWidth,nHeight);
	SetNumBars(nNumBars);
	SetBorderColor(crColor);
	m_bInit = true;
	return m_bInit;
}// end Init
コード例 #5
0
ファイル: TimeDatapoint.cpp プロジェクト: Strongc/DC_source
I32 DayDataPoint::GetValue(void)
{
  I32 current_value = mValue;

  // max value might have changed due to change in month or year
  if( SetMaxValue( LastdayInMonth(MonthDataPoint::GetInstance()->GetAsInt(), YearDataPoint::GetInstance()->GetAsInt()) ) )
  {
    if (current_value != mValue) 
    {
      //be sure to set clock if current value has changed
      SetValue(mValue);
    }
  }
    
  return mValue;
}
コード例 #6
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);
}
コード例 #7
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);
}
コード例 #8
0
ファイル: myStatusBar.cpp プロジェクト: DonkeyWs/BeGUI
void 
MyStatusBar	::	AttachedToWindow(	void)
{
	BStatusBar::AttachedToWindow();
	rgb_color tempRgbColor;
	myPrefs->GetPreferredMyStatusBarHighColor(&tempRgbColor);
	SetHighColor(tempRgbColor);
	myPrefs->GetPreferredMyStatusBarLowColor(&tempRgbColor);
	SetLowColor(tempRgbColor);
	myPrefs->GetPreferredMyStatusBarViewColor(&tempRgbColor);
	SetViewColor(tempRgbColor);
	myPrefs->GetPreferredMyBarStatusColor(&tempRgbColor);
	SetBarColor(tempRgbColor);
	BString label(Label());
	BString trailingLabel(TrailingLabel());
	Reset(label.String(), trailingLabel.String());
	SetMaxValue(mfMaxValue);
	ResizeTo(mfWidthPref, mfHeightPref);
	Update(mfValue);
}//end
コード例 #9
0
    void CreateBuilding( SUser *user, uint8 building_type, S2UInt32 position )
    {
        CBuildingData::SData *data = theBuildingExt.Find( building_type );

        if ( data == NULL )
        {
            HandleErrCode(user, kErrBuildingDataNotExist, 0);
            return;
        }

        std::vector<SUserBuilding>::iterator iter = std::find_if(user->data.building_list.begin(), user->data.building_list.end(), Building_EqualBuildingType( building_type ) );

        //所有的建筑物,限制一个
        if ( user->data.building_list.end() != iter )
        {
            HandleErrCode(user, kErrBuildingCountNotMax, 0);
            return;
        }

        SUserBuilding sbuilding;
        sbuilding.building_guid      = GetGuid( user, building_type );
        sbuilding.building_type      = building_type;

        sbuilding.data.target_id     = user->guid;
        sbuilding.data.info_id       = sbuilding.building_guid;
        sbuilding.data.info_type     = building_type;
        sbuilding.data.info_level    = 1;
        sbuilding.data.info_position = position;

        sbuilding.ext.production     = 0;
        sbuilding.ext.time_point     = (uint32)server::local_time();

        user->data.building_list.push_back( sbuilding );

        sbuilding.ext.production = SetMaxValue( user, building_type );

        ReplyBuildingSet( user, sbuilding, kObjectAdd );
    }
コード例 #10
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);
    }
}
コード例 #11
0
ファイル: DecimalSpinner.cpp プロジェクト: AmirAbrams/haiku
void
BDecimalSpinner::SetRange(double min, double max)
{
	SetMinValue(min);
	SetMaxValue(max);
}
コード例 #12
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));
}
コード例 #13
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);
	}		
}