Пример #1
0
bool CClipboard::setText(int callbackID, const Json::Value& parameters)
{
    // fetch member 'text' of parameters
    Json::Value text_JSON;
    FetchObject(parameters, "text", text_JSON);

    // fetch string
    std::string text;
    FetchString(text_JSON, text);

    // call s3e code
    if (!s3eClipboardAvailable())
    {
        // call fail callback
        clipboardError(callbackID);
        return true;
    }

    if (s3eClipboardSetText(text.c_str()) == S3E_RESULT_ERROR)
    {
        // call fail callback
        clipboardError(callbackID);
        return true;
    }

    // call success callback with text
    clipboardSuccess(callbackID, text.c_str());
    return true;
}
Пример #2
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;
}
Пример #3
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;
}
Пример #4
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;
}
Пример #5
0
static void ImGui_Marmalade_SetClipboardText(const char* text)
{
    if (s3eClipboardAvailable())
        s3eClipboardSetText(text);
}