Beispiel #1
0
int slk_set(int labnum, const char *label, int justify)
{
#ifdef PDC_WIDE
    wchar_t wlabel[32];

    PDC_mbstowcs(wlabel, label, 31);
    return slk_wset(labnum, wlabel, justify);
#else
    PDC_LOG(("slk_set() - called\n"));

    if (labnum < 1 || labnum > labels || justify < 0 || justify > 2)
        return ERR;

    labnum--;

    if (!label || !(*label)) 
    {
        /* Clear the label */

        *slk[labnum].label = 0;
        slk[labnum].format = 0;
        slk[labnum].len = 0;
    }
    else
    {
        int i, j = 0;

        /* Skip leading spaces */

        while (label[j] == ' ')
            j++;

        /* Copy it */

        for (i = 0; i < label_length; i++)
        {
            chtype ch = label[i + j];

            slk[labnum].label[i] = ch;

            if (!ch)
                break;
        }

        /* Drop trailing spaces */

        while ((i + j) && (label[i + j - 1] == ' '))
            i--;

        slk[labnum].label[i] = 0;
        slk[labnum].format = justify;
        slk[labnum].len = i;
    }

    _drawone(labnum);

    return OK;
#endif
}
Beispiel #2
0
int slk_set(int labnum, const char *label, int justify)
{
#ifdef PDC_WIDE
    wchar_t wlabel[MAX_LABEL_LENGTH];

    PDC_mbstowcs(wlabel, label, MAX_LABEL_LENGTH - 1);
    return slk_wset(labnum, wlabel, justify);
#else
    PDC_LOG(("slk_set() - called\n"));

    if (labnum < 1 || labnum > n_labels || justify < 0 || justify > 2)
        return ERR;

    labnum--;

    if (!label || !(*label))
    {
        /* Clear the label */

        *slk[labnum].label = 0;
        slk[labnum].format = 0;
        slk[labnum].len = 0;
    }
    else
    {
        int i;

        /* Skip leading spaces */

        while( *label == ' ')
            label++;

        /* Copy it */

        for (i = 0; label[i] && i < MAX_LABEL_LENGTH - 1; i++)
            slk[labnum].label[i] = label[i];

        /* Drop trailing spaces */

        while( i && label[i - 1] == ' ')
            i--;

        slk[labnum].label[i] = 0;
        slk[labnum].format = justify;
        slk[labnum].len = i;
    }

    _drawone(labnum);

    return OK;
#endif
}
Beispiel #3
0
int
slk_set(int index, const char *label, int justify)
{
	int code = ERR;
	wchar_t wcs[M_CCHAR_MAX * 8 + 1];

#ifdef M_CURSES_TRACE
	__m_trace("slk_set(%d, %p, %d)", index, label, justify);
#endif

	if (0 < mbstowcs(wcs, label, sizeof wcs)) 
		code = slk_wset(index, wcs, justify);

	return __m_return_code("slk_set", code);
}