bool CIwGameUITextView::setProperty(unsigned int element_name, CIwGameString& data, bool delta)
{
	if (CIwGameUIBase::setProperty(element_name, data, delta))
		return true;

	if (element_name == CIwGameXomlNames::MinZoom_Hash)
	{
		if (delta)
			setMinZoom(MinZoom + data.GetAsFloat());
		else
			setMinZoom(data.GetAsFloat());
	}
	else
	if (element_name == CIwGameXomlNames::MaxZoom_Hash)
	{
		if (delta)
			setMaxZoom(MaxZoom + data.GetAsFloat());
		else
			setMaxZoom(data.GetAsFloat());
	}
	else
	if (element_name == CIwGameXomlNames::Zoom_Hash)
	{
		if (delta)
			setZoom(Zoom + data.GetAsFloat());
		else
			setZoom(data.GetAsFloat());
	}
	else
		return false;

	return true;
}
bool CIwGameUITextView::UpdateBinding(unsigned int element_name, CIwGameXomlVariable* var)
{
	// Two way binding for Zoom (passes the value back to the variable)
	if (PrevZoom != Zoom)
	{
		if (element_name == CIwGameXomlNames::Zoom_Hash)
		{
			if (var->Type == VT_Float)
				var->setValue(CIwGameString(Zoom).c_str());	// Write Value back to bound variable
			else
			if (var->Type == VT_Int)
				var->setValue(CIwGameString((int)Zoom).c_str());	// Write Value back to bound variable
			return true;
		}
	}

	if (!var->Modified || var->getValue().IsEmpty())
		return false;
	if (CIwGameUILabel::UpdateBinding(element_name, var))
		return true;

	if (element_name == CIwGameXomlNames::Zoom_Hash)
	{
		if (var->Type == VT_Float)
			setZoom(((CIwGameXomlVariableFloat*)var)->NativeValue);
		else
		if (var->Type == VT_Int)
			setZoom((float)((CIwGameXomlVariableInt*)var)->NativeValue);
#if defined(_DEBUG)
		else
			CIwGameError::LogError("Warning: Incorrect binding variable type, expected float or int for Zoom");
#endif // _DEBUG
	}
	else
	if (element_name == CIwGameXomlNames::MinZoom_Hash)
	{
		if (var->Type == VT_Float)
			setMinZoom(((CIwGameXomlVariableFloat*)var)->NativeValue);
#if defined(_DEBUG)
		else
			CIwGameError::LogError("Warning: Incorrect binding variable type, expected float for MinZoom");
#endif // _DEBUG
	}
	else
	if (element_name == CIwGameXomlNames::MaxZoom_Hash)
	{
		if (var->Type == VT_Float)
			setMaxZoom(((CIwGameXomlVariableFloat*)var)->NativeValue);
#if defined(_DEBUG)
		else
			CIwGameError::LogError("Warning: Incorrect binding variable type, expected float for MaxZoom");
#endif // _DEBUG
	}
	else
		return false;

	return true;
}
Esempio n. 3
0
/*!
 * Constructor
 */
ControlWidget::ControlWidget(QWidget *ipParent)
    : QWidget(ipParent)
{
    ui.setupUi(this);

    setMinZoom(0);
    setMaxZoom(10);
    setZoom(5);
}
Esempio n. 4
0
void UIMinimap::onStyleApply(const std::string& styleName, const OTMLNodePtr& styleNode)
{
    UIWidget::onStyleApply(styleName, styleNode);
    for(const OTMLNodePtr& node : styleNode->children()) {
        if(node->tag() == "zoom")
            setZoom(node->value<int>());
        else if(node->tag() == "max-zoom")
            setMaxZoom(node->value<int>());
        else if(node->tag() == "min-zoom")
            setMinZoom(node->value<int>());
    }
}
Esempio n. 5
0
NodeGraphDisplay::NodeGraphDisplay(ParentElement *parent_, APoint a_pos, AVec a_size, GuiStateFlags s_flags, NodeGraph *node_graph)
	: GuiElement(parent_, a_pos, a_size, GuiProps(s_flags, PROP_FLAGS)),
		NodeElementContainer(s_flags, APoint(-10000.0f, -10000.0f), APoint(10000.0f, 10000.0f), BASE_GRAPH_STEP, ZOOM_STEP),
		nodeGraph(node_graph)
{
	initGraph();

	setAllBgStateColors(Color(0.10f, 0.10f, 0.10f, 1.0f));

	setMinZoom(AVec(0.3f, 0.3f));
	setMaxZoom(AVec(3.0f, 3.0f));
	setMinViewOffset(APoint(-FLT_MAX, -FLT_MAX));
	setMaxViewOffset(APoint(FLT_MAX, FLT_MAX));
	
	setViewOffset(-size*(1.0f/2.0f));
	setZoomPivot(size*(1.0f/2.0f));
}
Esempio n. 6
0
void ZoomSlider::setZoomLimits(double newMinZoom, double newMaxZoom){
    setMinZoom(newMinZoom);
    setMaxZoom(newMaxZoom);
}