Example #1
0
/**
 * Sets whether the widgets in this container are visible.
 * @param visible @c true to show, @c false to hide.
 */
void BaseContainer::SetVisible(bool visible)
{
	if (this->visible != visible) {
		this->visible = visible;
		FireModelUpdate(Props::VISIBLE);
	}
}
Example #2
0
/**
 * Sets the position offset of child widgets.
 * @param childOffset The child offset.
 */
void BaseContainer::SetChildOffset(const Vec2 &childOffset)
{
	if (this->childOffset != childOffset) {
		this->childOffset = childOffset;
		FireModelUpdate(Props::CHILD_OFFSET);
	}
}
Example #3
0
/**
 * Set whether child elements are clipped to the container bounds.
 * @param clip @c true if clipping is enabled, @c false if elements are
 *             allowed to render outside of the bounds.
 */
void BaseContainer::SetClip(bool clip)
{
	if (this->clip != clip) {
		this->clip = clip;
		FireModelUpdate(Props::CLIP);
	}
}
Example #4
0
/**
 * Set the caret position.
 * @param pos The position (not clamped to the length of the text).
 * @see SetCaretVisible(bool)
 */
void ActiveText::SetCaretPos(size_t pos)
{
	if (caretPos != pos) {
		caretPos = pos;
		FireModelUpdate(Props::CARET_POS);
	}
}
Example #5
0
/**
 * Set the size of the container.
 * @param size The size of the container, where @c x is the width
 *             and @c y is the height.
 */
void BaseContainer::SetSize(const Vec2 &size)
{
	if (this->size != size) {
		this->size = size;
		FireModelUpdate(Props::SIZE);
	}
}
Example #6
0
/**
 * Set the visibility of the caret.
 * @param visible @c true if visible, @c false otherwise.
 */
void ActiveText::SetCaretVisible(bool visible)
{
	if (caretVisible != visible) {
		caretVisible = visible;
		FireModelUpdate(Props::CARET_VISIBLE);
	}
}
Example #7
0
/**
 * Set the color of the icon.
 * @param color The color (including alpha).
 */
void Picture::SetColor(const Color color)
{
	if (this->color != color) {
		this->color = color;
		FireModelUpdate(Props::COLOR);
	}
}
Example #8
0
/**
 * Set the texture.
 * @param texture The texture (may be @c nullptr).
 */
void Picture::SetTexture(std::shared_ptr<Res<Texture>> texture)
{
	if (this->texture != texture) {
		this->texture = std::move(texture);
		FireModelUpdate(Props::TEXTURE);
	}
}
Example #9
0
/**
 * Set the button state.
 * @param checked @c true for checked, @c false for unchecked.
 */
void StateButton::SetChecked(bool checked)
{
	if (this->checked != checked) {
		this->checked = checked;
		FireModelUpdate(Props::CHECKED);
		UpdateIcon();
	}
}
Example #10
0
/**
 * Set the optional icon to appear on the button, in addition to the text.
 *
 * The icon will be sized to the standard size for the button (namely, the
 * height of the text), so while it is safe to share the icon between
 * buttons, be aware that it may be modified.
 *
 * @param icon A subclass of FillBox to use as an icon, or @c nullptr to
 *             unset the icon.
 */
void Button::SetIcon(std::shared_ptr<FillBox> icon)
{
	if (this->icon != icon) {
		this->icon = std::move(icon);
		FireModelUpdate(Props::ICON);
		RequestSizing();
		RequestLayout();
	}
}
Example #11
0
void FlexGrid::SetPadding(double width, double height)
{
	if (padding.x != width || padding.y != height) {
		padding.x = width;
		padding.y = height;

		FireModelUpdate(Props::MARGIN);
		RequestLayout();
	}
}
Example #12
0
void FlexGrid::SetMargin(double width, double height)
{
	if (margin.x != width || margin.y != height) {
		margin.x = width;
		margin.y = height;

		FireModelUpdate(Props::MARGIN);
		RequestLayout();
	}
}
Example #13
0
/**
 * Set the opacity of the container.
 *
 * The opacity is applied to the container as a whole; the container is first
 * rendered off-screen, then the opacity is applied when drawing the buffer
 * to the screen.
 *
 * The value will be clamped to the range 0.0 to 1.0 inclusive.
 *
 * @param opacity The opacity (1.0 is fully-opaque, 0.0 is fully-transparent).
 */
void BaseContainer::SetOpacity(double opacity)
{
	if (opacity < 0.0) opacity = 0.0;
	else if (opacity > 1.0) opacity = 1.0;

	if (this->opacity != opacity) {
		this->opacity = opacity;
		FireModelUpdate(Props::OPACITY);
	}
}
Example #14
0
void SymbolIcon::SetSymbol(int symbol)
{
    if (this->symbol != symbol) {

        // The symbol ID is implemented as a wchar_t, which may be 16 bits wide
        // (e.g. on Win32) so we make sure the symbol is within the safe range.
        if (symbol <= 0 || symbol > 65535) {
            Log::Warn("Invalid symbol (expected to be 1..65535): %d", symbol);
            symbol = 32;
        }

        this->symbol = symbol;
        FireModelUpdate(Props::SYMBOL);
    }
}
Example #15
0
/**
 * Set the value.
 *
 * The value will be clamped to the range of the slider.
 *
 * @param value The value.
 */
void Slider::SetValue(double value)
{
	if (value < min) value = min;
	else if (value > max) value = max;
	else {
		// Clamp to the nearest step.
		value = round(value * (1.0 / step)) * step;
	}

	if (this->value != value) {
		this->value = value;
		FireModelUpdate(Props::VALUE);
		valueChangedSignal(value);
		RequestLayout();
	}
}