Exemplo n.º 1
0
void CWHTable::BranchAhead(int nBranchIndex)
{
	// Put previous index on stack
	m_IndexStack.AddHead(m_nIndex);

	// Locate choice
	FindChoiceIndex(nBranchIndex, m_nIndex);
	
	// Table follows an over 1 column and down 1 row to branch ahead
	IncrementRow(m_nIndex);
	IncrementColumn(m_nIndex);
}
Exemplo n.º 2
0
void CWHTable::GetData(int nChoice, CString& csDataType, CString& csName, CString& csDescription)
{
	int nColumn;
	int nIndex = m_nIndex;

	// Locate the choice in the column
	FindChoiceIndex(nChoice, nIndex);

	// Current column is determined by # of items on branch stack
	nColumn = m_IndexStack.GetCount();

	// Data type is at m_nColumns-3 (0 based)
	int i = nColumn;
	while (i < m_nColumns-3)
	{
		IncrementColumn(nIndex);
		i++;
	}
	csDataType = m_csaLine[nIndex];

	// Name is right next to it
	IncrementColumn(nIndex);
	csName = m_csaLine[nIndex];

	// Then we have the description
	IncrementColumn(nIndex);
	csDescription = m_csaLine[nIndex];
	
	if (!csDescription.IsEmpty())
	{
		// Strip out quotes
		if (csDescription[0] == '"')
		{
			csDescription = csDescription.Mid(1, csDescription.GetLength()-2);
		}

		// Replace '|' character with '\n'
		InsertNewlines(csDescription);
	}
}
Exemplo n.º 3
0
bool
DigitEntry::OnMouseDown(PixelPoint p)
{
    int i = FindColumnAt(p.x);
    if (i >= 0 && columns[i].IsEditable()) {
        SetCursor(i);
        SetFocus();

        if (p.y < int(top))
            IncrementColumn(i);
        else if (unsigned(p.y) > bottom)
            DecrementColumn(i);

        return true;
    }

    return PaintWindow::OnMouseDown(p);
}
Exemplo n.º 4
0
bool
DigitEntry::OnKeyDown(unsigned key_code)
{
    assert(cursor < length);

    switch (key_code) {
        int i;

    case KEY_UP:
        IncrementColumn(cursor);
        return true;

    case KEY_DOWN:
        DecrementColumn(cursor);
        return true;

    case KEY_LEFT:
        i = FindEditableLeft(cursor - 1);
        if (i >= 0)
            SetCursor(i);
        return true;

    case KEY_RIGHT:
        i = FindEditableRight(cursor + 1);
        if (i >= 0)
            SetCursor(i);
        return true;

    case KEY_RETURN:
        if (action_listener != nullptr) {
            action_listener->OnAction(action_id);
            return true;
        }

        break;
    }

    return PaintWindow::OnKeyDown(key_code);
}
Exemplo n.º 5
0
void
DigitEntry::IncrementColumn(unsigned i)
{
    assert(i < length);

    valid = true;

    Column &c = columns[i];
    if (c.IsNumber()) {
        if (c.value < c.GetMaxNumber())
            ++c.value;
        else {
            c.value = 0;

            int previous = FindNumberLeft(i - 1);
            if (previous >= 0)
                IncrementColumn(previous);
        }
    } else if (c.IsSign()) {
        c.value = !c.value;
    }

    Invalidate();
}