Beispiel #1
0
LRESULT __stdcall CMyNotepad::wndProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg)
    {
    case WM_CREATE:
        onCreate();
        return 0;

    case WM_CLOSE:
        onClose();
        return 0;

    case WM_SIZE:
        onSize();
        return 0;

    case WM_DESTROY:
        onDestroy();
        return 0;

    case WM_PAINT:
        handlePaint();
        return 0;

    case WM_COMMAND:
        onCommand(wParam, lParam);
        return 0;

    default:
        return ::DefWindowProc(handle, uMsg, wParam, lParam);
    }
}
LRESULT __stdcall CEllipseWindow::wndProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
{		
	switch (uMsg)
	{
	case WM_CREATE:
		SetTimer(handle, 1, 10, NULL);
		return 0;

	case WM_TIMER:
		onTimer();
		return 0;

	case WM_CLOSE:
		onClose();
		return 0;

	case WM_DESTROY:
		OnDestroy();
		return 0;

	case WM_PAINT:
		handlePaint();
		return 0;

	case WM_LBUTTONDOWN:
		onClick();
		return 0;

	default:
		return ::DefWindowProc(handle, uMsg, wParam, lParam);
	}
}
Beispiel #3
0
LRESULT __stdcall COverlappedWindow::wndProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
{		
	switch (uMsg)
	{
	case WM_CREATE:
		onCreate();
		return 0;

	case WM_TIMER:
		onTimer();
		return 0;

	case WM_CLOSE:
		onClose();
		return 0;

	case WM_DESTROY:
		OnDestroy();
		return 0;

	case WM_PAINT:
		handlePaint();
		return 0;

	default:
		return ::DefWindowProc(handle, uMsg, wParam, lParam);
	}
}
    //==============================================================================
    void handlePaintCallback (JNIEnv* env, jobject canvas)
    {
        jobject rect = env->CallObjectMethod (canvas, CanvasMinimal.getClipBounds);
        const int left   = env->GetIntField (rect, RectClass.left);
        const int top    = env->GetIntField (rect, RectClass.top);
        const int right  = env->GetIntField (rect, RectClass.right);
        const int bottom = env->GetIntField (rect, RectClass.bottom);
        env->DeleteLocalRef (rect);

        const Rectangle<int> clip (left, top, right - left, bottom - top);

        const int sizeNeeded = clip.getWidth() * clip.getHeight();
        if (sizeAllocated < sizeNeeded)
        {
            buffer.clear();
            sizeAllocated = sizeNeeded;
            buffer = GlobalRef (env->NewIntArray (sizeNeeded));
        }

        jint* dest = env->GetIntArrayElements ((jintArray) buffer.get(), 0);

        if (dest != nullptr)
        {
            {
                Image temp (new PreallocatedImage (clip.getWidth(), clip.getHeight(),
                                                   dest, ! component.isOpaque()));

                {
                    LowLevelGraphicsSoftwareRenderer g (temp);
                    g.setOrigin (-clip.getX(), -clip.getY());
                    handlePaint (g);
                }
            }

            env->ReleaseIntArrayElements ((jintArray) buffer.get(), dest, 0);

            env->CallVoidMethod (canvas, CanvasMinimal.drawBitmap, (jintArray) buffer.get(), 0, clip.getWidth(),
                                 (jfloat) clip.getX(), (jfloat) clip.getY(),
                                 clip.getWidth(), clip.getHeight(), true, (jobject) 0);
        }
    }
Beispiel #5
0
LRESULT BSPanel::processEvent(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    if (uMsg >= WM_MOUSEFIRST && uMsg <= WM_MOUSELAST ||
        uMsg == WM_MOUSEHOVER || uMsg == WM_MOUSELEAVE)
    {
        return handleMouse(uMsg, wParam, lParam);
    }
    else
    {
        switch (uMsg)
        {
        case WM_CREATE:
            return handleCreate(uMsg, wParam, lParam);
        case WM_DESTROY:
            return handleDestroy(uMsg, wParam, lParam);
        case WM_WINDOWPOSCHANGED:
            return handlePositionChanges(uMsg, wParam, lParam);
        case WM_PAINT:
            return handlePaint(uMsg, wParam, lParam);
        case WM_SETCURSOR:
            return handleSetCursor(uMsg, wParam, lParam);
        case WM_SETFOCUS:
        case WM_KILLFOCUS:
            return handleFocus(uMsg, wParam, lParam);
        case WM_KEYDOWN:
        case WM_KEYUP:
        case WM_CHAR:
        case WM_SYSKEYDOWN:
        case WM_SYSKEYUP:
        case WM_SYSCHAR:
            return handleKey(uMsg, wParam, lParam);
        case WM_IME_STARTCOMPOSITION:
        case WM_IME_COMPOSITION:
        case WM_IME_ENDCOMPOSITION:
            return handleIME(uMsg, wParam, lParam);
        default:
            return defProcessEvent(uMsg, wParam, lParam);
        }
    }
}