void SkStaticTextView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
#if 0
	this->INHERITED::onInflate(dom, node);

	int	index;
	if ((index = dom.findList(node, "mode", "fixed,auto-width,auto-height")) >= 0)
		this->setMode((Mode)index);
	else
		assert_no_attr(dom, node, "mode");

	if ((index = dom.findList(node, "spacing-align", "start,center,end")) >= 0)
		this->setSpacingAlign((SkTextBox::SpacingAlign)index);
	else
		assert_no_attr(dom, node, "spacing-align");

	SkScalar s[2];
	if (dom.findScalars(node, "margin", s, 2))
		this->setMargin(s[0], s[1]);
	else
		assert_no_attr(dom, node, "margin");

	const char* text = dom.findAttr(node, "text");
	if (text)
		this->setText(text);

	if ((node = dom.getFirstChild(node, "paint")) != NULL &&
		(node = dom.getFirstChild(node, "screenplay")) != NULL)
	{
		inflate_paint(dom, node, &fPaint);
	}
#endif
}
Example #2
0
void SkStackViewLayout::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
	int			index;
	SkScalar	value[4];

	if ((index = dom.findList(node, "orient", "horizontal,vertical")) >= 0)
		this->setOrient((Orient)index);
	else
		assert_no_attr(dom, node, "orient");

	if (dom.findScalars(node, "margin", value, 4))
	{
		SkRect	margin;
		margin.set(value[0], value[1], value[2], value[3]);
		this->setMargin(margin);
	}
	else
		assert_no_attr(dom, node, "margin");

	if (dom.findScalar(node, "spacer", value))
		this->setSpacer(value[0]);
	else
		assert_no_attr(dom, node, "spacer");

	if ((index = dom.findList(node, "pack", "start,center,end")) >= 0)
		this->setPack((Pack)index);
	else
		assert_no_attr(dom, node, "pack");

	if ((index = dom.findList(node, "align", "start,center,end,stretch")) >= 0)
		this->setAlign((Align)index);
	else
		assert_no_attr(dom, node, "align");
}
Example #3
0
void SkTextView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
	this->INHERITED::onInflate(dom, node);

	const char* text = dom.findAttr(node, "text");
	if (text)
		this->setText(text);

	SkPoint	margin;
	if (dom.findScalars(node, "margin", (SkScalar*)&margin, 2))
		this->setMargin(margin);
	(void)dom.findBool(node, "do-interp", &fDoInterp);

	SkPaint_Inflate(&fPaint, dom, node);
}
Example #4
0
void SkGridView::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
	this->INHERITED::onInflate(dom, node);

	SkScalar			x[2];
	const SkDOM::Node*	child;

	if (dom.findScalars(node, "cell-size", x, 2))
		this->setCellSize(x[0], x[1]);

	if ((child = dom.getFirstChild(node, "hilite-paint")) != NULL)
		SkPaint_Inflate(&this->paint(kHiliteCell_Attr), dom, child);

	// look for a listsource
	{
		SkListSource* src = NULL;

		if ((child = dom.getFirstChild(node, "file-listsource")) != NULL)
		{
			const char* path = dom.findAttr(child, "path");
			if (path)
				src = SkListSource::CreateFromDir(	path,
													dom.findAttr(child, "filter"),
													dom.findAttr(child, "target"));
		}
		else if ((child = dom.getFirstChild(node, "xml-listsource")) != NULL)
		{
			src = SkListSource::CreateFromDOM(dom, child);
		}

		if (src)
		{
			this->setListSource(src)->unref();
			this->setSelection(0);
		}
	}
	this->onSizeChange();
}
void SkFillViewLayout::onInflate(const SkDOM& dom, const SkDOM::Node* node)
{
    this->INHERITED::onInflate(dom, node);
    (void)dom.findScalars(node, "margin", (SkScalar*)&fMargin, 4);
}