コード例 #1
0
void ColumnManager::ColumnMoved (int column, int position)
{
	// in front of what column has it been inserted?

	int index = columns[column].index;

	std::vector<int> gridColumnOrder = GetGridColumnOrder();

	size_t visiblePosition = static_cast<size_t>(position);
	size_t columnCount = gridColumnOrder.size();

	for (; (visiblePosition < columnCount)
			&& !columns[gridColumnOrder[visiblePosition]].visible
			; ++visiblePosition )
	{
	}

	int next = -1;
	if (visiblePosition != columnCount)
	{
		next = gridColumnOrder[visiblePosition];
	}

	// move logical column index just in front of that "next" column

	columnOrder.erase (std::find ( columnOrder.begin(), columnOrder.end(), index));
	columnOrder.insert ( std::find ( columnOrder.begin(), columnOrder.end(), next), index);

	// make sure, invisible columns are still put in front of all others

	ApplyColumnOrder();
}
コード例 #2
0
void ColumnManager::ApplyColumnOrder()
{
	// extract order of used columns from order of all columns
	int order[MAX_COLUMNS + 1] = { 0 };

	std::vector<int> gridColumnOrder = GetGridColumnOrder();
	std::copy(gridColumnOrder.cbegin(), gridColumnOrder.cend(), stdext::checked_array_iterator<int*>(&order[0], sizeof(order)));

	// we must have placed all columns or something is really fishy ..
	assert(gridColumnOrder.size() == columns.size());
	assert(GetColumnCount() == control->GetHeaderCtrl()->GetItemCount());

	// o.k., apply our column ordering
	control->SetColumnOrderArray(GetColumnCount(), order);
}
コード例 #3
0
void ColumnManager::ApplyColumnOrder()
{
	// extract order of used columns from order of all columns

	int order[GITSLC_MAXCOLUMNCOUNT+1];
	SecureZeroMemory (order, sizeof (order));

	std::vector<int> gridColumnOrder = GetGridColumnOrder();
	std::copy (gridColumnOrder.begin(), gridColumnOrder.end(), stdext::checked_array_iterator<int*>(&order[0], sizeof(order)));

	// we must have placed all columns or something is really fishy ..

	assert (gridColumnOrder.size() == columns.size());
	assert (GetColumnCount() == ((CHeaderCtrl*)(control->GetDlgItem(0)))->GetItemCount());

	// o.k., apply our column ordering

	control->SetColumnOrderArray (GetColumnCount(), order);
}