Example #1
0
void tlistbox::set_active_sorting_option(const order_pair& option)
{
	// TODO: should this be moved to a public header_grid() getter function?
	tgrid& header_grid = find_widget<tgrid>(this, "_header_grid", false);

	tselectable_& widget = find_widget<tselectable_>(&header_grid, "sort_" +  std::to_string(option.first), false);
	widget.set_value(static_cast<int>(option.second));

	order_by_column(option.first, dynamic_cast<twidget&>(widget));
}
Example #2
0
void listbox::set_active_sorting_option(const order_pair& sort_by, const bool select_first)
{
	// TODO: should this be moved to a public header_grid() getter function?
	grid& header_grid = find_widget<grid>(this, "_header_grid", false);

	selectable_item& w = find_widget<selectable_item>(&header_grid, "sort_" + std::to_string(sort_by.first), false);

	// Set the sorting toggle widgets' value (in this case, its state) to the given sorting
	// order. This is necessary since the widget's value is used to determine the order in
	// @ref order_by_column in lieu of a direction being passed directly.
	w.set_value(static_cast<int>(sort_by.second));

	order_by_column(sort_by.first, dynamic_cast<widget&>(w));

	if(select_first && generator_->get_item_count() > 0) {
		select_row_at(0);
	}
}