ET++: VObject::Align() used in graphical layout

VObject::Align() is called when a VObject needs to be placed (at the beginning of the application, or when the VObject's container has moved or resized). It places the VObject according to the VObjAlign value specified.


void VObject::Align(const Point &aa, const Metric &m, VObjAlign a)
{
	Point at(aa);
	switch (a & eVObjH) {
	case eVObjHLeft:
		break;
	case eVObjHCenter:
		at.x+= (m.Width() - Width())/2;
		break;
	case eVObjHRight:
		at.x+= m.Width() - Width();
		break;
	}
	switch (a & eVObjV) {
	case eVObjVBase:
		at.y+= m.Base() - Base();
		break;
	case eVObjVCenter:
		at.y+= (m.Height() - Height())/2;
		break;
	case eVObjVBottom:
		at.y+= m.Height() - Height();
		break;
	}
	SetOrigin(at);
}

Back to the graphical layout description

Back to the main ET++ page