bool PropertyRowNumberField::getHoverInfo(PropertyHoverInfo* hit, const Point& cursorPos, const PropertyTree* tree) const
{
	if (pressed_ && !userReadOnly())
		hit->cursor = property_tree::CURSOR_BLANK;
	else if (widgetRect(tree).contains(cursorPos) && !userReadOnly())
		hit->cursor = property_tree::CURSOR_SLIDE;
	hit->toolTip = tooltip_;
	return true;
}
bool PropertyRowNumberField::onMouseDown(PropertyTree* tree, Point point, bool& changed)
{
	changed = false;
	if (widgetRect(tree).contains(point) && !userReadOnly()) {
		startIncrement();
		pressed_ = true;
		return true;
	}
	return false;
}
void PropertyRowNumberField::redraw(IDrawContext& context)
{
	if(multiValue())
		context.drawEntry(context.widgetRect, " ... ", false, userReadOnly(), 0);
	else if (userReadOnly())
		context.drawValueText(pulledSelected(), valueAsString().c_str());
	else 
	{
		double sliderPos = sliderPosition();
		int flags = 0;
		if (context.captured)
			flags |= FIELD_SELECTED;
		if (pressed_)
			flags |= FIELD_PRESSED;
		if (userReadOnly())
			flags |= FIELD_DISABLED;
		context.drawNumberEntry(valueAsString().c_str(), context.widgetRect, flags, sliderPos);
	}
}
Ejemplo n.º 4
0
void PropertyRowField::redraw(IDrawContext& context)
{
	int buttonCount = this->buttonCount();
	int offset = 0;
	for (int i = 0; i < buttonCount; ++i) {
		Icon icon = buttonIcon(context.tree, i);
		Rect iconRect(context.widgetRect.right() - BUTTON_SIZE * buttonCount + offset, context.widgetRect.top(), BUTTON_SIZE, context.widgetRect.height());
		context.drawIcon(iconRect, icon, userReadOnly() ? ICON_DISABLED : ICON_NORMAL);
		offset += BUTTON_SIZE;
	}

	int iconSpace = offset ? offset + 2 : 0;
    if(multiValue())
		context.drawEntry(context.widgetRect, " ... ", false, userReadOnly(), iconSpace);
    else if(userReadOnly())
		context.drawValueText(pulledSelected(), valueAsString().c_str());
    else
        context.drawEntry(context.widgetRect, valueAsString().c_str(), usePathEllipsis(), false, iconSpace);

}
DragCheckBegin PropertyRowBool::onMouseDragCheckBegin() 
{
	if (userReadOnly())
		return DRAG_CHECK_IGNORE;
	return value_ ? DRAG_CHECK_UNSET : DRAG_CHECK_SET;
}
void PropertyRowBool::redraw(IDrawContext& context)
{
	context.drawCheck(widgetRect(context.tree), userReadOnly(), multiValue() ? CHECK_IN_BETWEEN : (value_ ? CHECK_SET : CHECK_NOT_SET));
}