示例#1
0
static const char* ImGui_Marmalade_GetClipboardText(void* /*user_data*/)
{
    if (!s3eClipboardAvailable())
        return NULL;

    if (int size = s3eClipboardGetText(NULL, 0))
    {
        if (g_ClipboardText)
            delete[] g_ClipboardText;
        g_ClipboardText = new char[size];
        g_ClipboardText[0] = '\0';
        s3eClipboardGetText(g_ClipboardText, size);
    }

    return g_ClipboardText;
}
示例#2
0
static const char* ImGui_Marmalade_GetClipboardText()
{
    if (s3eClipboardAvailable())
    {
        int size = s3eClipboardGetText(NULL, 0);
        if (size > 0)
        {
            if (g_ClipboardText)
            {
                delete[] g_ClipboardText;
                g_ClipboardText = NULL;
            }
            g_ClipboardText = new char[size];
            g_ClipboardText[0] = '\0';
            s3eClipboardGetText(g_ClipboardText, size);
        }
    }

    return g_ClipboardText;
}
示例#3
0
bool CClipboard::getText(int callbackID, const Json::Value& parameters)
{
    // call s3e code
    if (!s3eClipboardAvailable())
    {
        // call fail callback
        clipboardError(callbackID);
        return true;
    }

    char text[256];
    if (s3eClipboardGetText(text, 256) < 1)
    {
        // call fail callback
        clipboardError(callbackID);
        return true;
    }

    // call success callback with text
    clipboardSuccess(callbackID, text);
    return true;
}