Ejemplo n.º 1
0
unsigned int CValveMenuDisplay::DrawItem(const ItemDrawInfo &item)
{
    if (m_NextPos > 9 || !CanDrawItem(item.style))
    {
        return 0;
    }

    /**
     * For these cases we can't draw anything at all, but
     * we can at least bump the position since we were explicitly asked to.
     */
    if ((item.style & ITEMDRAW_NOTEXT)
            || (item.style & ITEMDRAW_SPACER))
    {
        return m_NextPos++;
    }

    char buffer[255];
    UTIL_Format(buffer, sizeof(buffer), "%d. %s", m_NextPos, item.display);

    KeyValues *ki = m_pKv->FindKey(g_OptionNumTable[m_NextPos], true);
    ki->SetString("command", g_OptionCmdTable[m_NextPos]);
    ki->SetString("msg", buffer);

    return m_NextPos++;
}
Ejemplo n.º 2
0
unsigned int CRadioDisplay::DrawItem(const ItemDrawInfo &item)
{
	if (m_NextPos > s_RadioMaxPageItems || !CanDrawItem(item.style))
	{
		return 0;
	}

	if (item.style & ITEMDRAW_RAWLINE)
	{
		if (item.style & ITEMDRAW_SPACER)
		{
			m_BufferText.append(" \n");
		} else {
			m_BufferText.append(item.display);
			m_BufferText.append("\n");
		}
		return 0;
	} else if (item.style & ITEMDRAW_SPACER) {
		m_BufferText.append(" \n");
		return m_NextPos++;
	} else if (item.style & ITEMDRAW_NOTEXT) {
		return m_NextPos++;
	}

	if (item.style & ITEMDRAW_DISABLED)
	{
		m_BufferText.append(g_RadioNumTable[m_NextPos]);
		m_BufferText.append(item.display);
		m_BufferText.append("\n");
	} else {
		m_BufferText.append("->");
		m_BufferText.append(g_RadioNumTable[m_NextPos]);
		m_BufferText.append(item.display);
		m_BufferText.append("\n");
		keys |= (1<<(m_NextPos-1));
	}

	return m_NextPos++;
}