Ejemplo n.º 1
0
int TextWidget::Load(XmlSynthElem *elem)
{
	SynthWidget::Load(elem);
	char *txt;
	if (elem->GetAttribute("lbl", &txt) == 0)
	{
		SetText(txt);
		delete txt;
	}
	if (elem->GetAttribute("fmt", &txt) == 0)
	{
		SetFormat(txt);
		delete txt;
	}
	short th;
	if (elem->GetAttribute("th", th) == 0)
		SetTextHeight(th);
	if (elem->GetAttribute("bold", th) == 0)
		SetBold(th);
	if (elem->GetAttribute("italic", th) == 0)
		SetItalic(th);
	if (elem->GetAttribute("filled", th) == 0)
		SetFilled(th);
	if (elem->GetAttribute("align", th) == 0)
		SetAlign(th);
	if (elem->GetAttribute("shadow", th) == 0)
		SetShadow(th);
	if (elem->GetAttribute("inset", th) == 0)
		SetInset(th);
	if (elem->GetAttribute("edit", th) == 0)
		editable = (int) th;
	return 0;
}
Ejemplo n.º 2
0
void HKWidgetLabel::SetProperty(const char *pProperty, const char *pValue)
{
	if(!MFString_CaseCmp(pProperty, "text"))
		SetText(pValue);
	else if(!MFString_CaseCmp(pProperty, "text_colour"))
		SetTextColour(HKWidget_GetColourFromString(pValue));
	else if(!MFString_CaseCmp(pProperty, "text_height"))
		SetTextHeight(MFString_AsciiToFloat(pValue));
	else if(!MFString_CaseCmp(pProperty, "text_shadowDepth"))
		SetShadowDepth(MFString_AsciiToFloat(pValue));
	else if(!MFString_CaseCmp(pProperty, "text_font"))
	{
		if(bOwnFont)
			MFFont_Release(pFont);
		pFont = MFFont_Create(pValue);
		bOwnFont = true;

		if(bAutoTextHeight)
			textHeight = MFFont_GetFontHeight(pFont);

		AdjustSize();
	}
	else if(!MFString_CaseCmp(pProperty, "text_align"))
		SetTextJustification((MFFontJustify)HKWidget_GetEnumValue(pValue, sJustifyKeys));
	else
		HKWidget::SetProperty(pProperty, pValue);
}
Ejemplo n.º 3
0
void LIB_FIELD::Init( int id )
{
    m_id = id;

    SetTextWidth( GetDefaultTextSize() );
    SetTextHeight( GetDefaultTextSize() );

    SetTextAngle( TEXT_ANGLE_HORIZ );    // constructor already did this.

    // fields in RAM must always have names, because we are trying to get
    // less dependent on field ids and more dependent on names.
    // Plus assumptions are made in the field editors.
    m_name = TEMPLATE_FIELDNAME::GetDefaultFieldName( id );

    switch( id )
    {
    case DATASHEET:
    case FOOTPRINT:
        // by contrast, VALUE and REFERENCE are are always constructed as
        // initially visible, and template fieldsnames' initial visibility
        // is controlled by the template fieldname configuration record.
        SetVisible( false );
        break;
    }
}