Example #1
0
void twidget::place(const tpoint& origin, const tpoint& size)
{
    assert(size.x >= 0);
    assert(size.y >= 0);

    x_ = origin.x;
    y_ = origin.y;
    width_ = size.x;
    height_ = size.y;

#if 0
    std::cerr
            << "Id " << id()
            << " rect " << get_rectangle()
            << " parent "
            << (parent ? parent->get_x() : 0)
            << ','
            << (parent ? parent->get_y() : 0)
            << " screen origin " << x_ << ',' << y_
            << ".\n";
#endif

    set_is_dirty(true);
}
Example #2
0
void ttext_box::handle_mouse_selection(tpoint mouse, const bool start_selection)
{
	mouse.x -= get_x();
	mouse.y -= get_y();
	// FIXME we don't test for overflow in width
	if(mouse.x < static_cast<int>(text_x_offset_)
	   || mouse.y < static_cast<int>(text_y_offset_)
	   || mouse.y >= static_cast<int>(text_y_offset_ + text_height_)) {
		return;
	}

	int offset = get_column_line(tpoint(mouse.x - text_x_offset_,
										mouse.y - text_y_offset_)).x;

	if(offset < 0) {
		return;
	}


	set_cursor(offset, !start_selection);
	update_canvas();
	set_is_dirty(true);
	dragging_ |= start_selection;
}
Example #3
0
	void set_variable(const std::string& key, const variant& value)
	{
		variables_.add(key, value);
		set_is_dirty(true);
	}
Example #4
0
	void set_height(const unsigned height)
	{
		h_ = height;
		set_is_dirty(true);
	}
Example #5
0
	void set_width(const unsigned width)
	{
		w_ = width;
		set_is_dirty(true);
	}
Example #6
0
	/**
	 * Sets the grow factor for a column.
	 *
	 * @todo refer to a page with the layout manipulation info.
	 *
	 * @param column              The column to modify.
	 * @param factor              The grow factor.
	 */
	void set_column_grow_factor(const unsigned column, const unsigned factor)
	{
		assert(column < col_grow_factor_.size());
		col_grow_factor_[column] = factor;
		set_is_dirty(true);
	}
Example #7
0
	void set_best_slider_length(const unsigned length)
	{
		best_slider_length_ = length;
		set_is_dirty(true);
	}
Example #8
0
	/**
	 * Sets the grow factor for a row.
	 *
	 * @todo refer to a page with the layout manipulation info.
	 *
	 * @param row                 The row to modify.
	 * @param factor              The grow factor.
	 */
	void set_row_grow_factor(const unsigned row, const unsigned factor)
	{
		assert(row < row_grow_factor_.size());
		row_grow_factor_[row] = factor;
		set_is_dirty(true);
	}