当前位置: 首页>>代码示例>>C++>>正文


C++ AwtComponent类代码示例

本文整理汇总了C++中AwtComponent的典型用法代码示例。如果您正苦于以下问题:C++ AwtComponent类的具体用法?C++ AwtComponent怎么用?C++ AwtComponent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AwtComponent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: JNI_CHECK_NULL_RETURN

/*
 * Class:     java_awt_AWTEvent
 * Method:    nativeSetSource
 * Signature: (Ljava/awt/peer/ComponentPeer;)V
 */
JNIEXPORT void JNICALL Java_java_awt_AWTEvent_nativeSetSource
    (JNIEnv *env, jobject self, jobject newSource)
{
    TRY;

    JNI_CHECK_NULL_RETURN(self, "null AWTEvent");

    MSG *pMsg;

    jbyteArray bdata = (jbyteArray)
        env->GetObjectField(self, AwtAWTEvent::bdataID);
    if (bdata != NULL) {
        jboolean dummy;
        PDATA pData;
        JNI_CHECK_PEER_RETURN(newSource);
        AwtComponent *p = (AwtComponent *)pData;
        HWND hwnd = p->GetHWnd();

        pMsg = (MSG *)env->GetPrimitiveArrayCritical(bdata, &dummy);
        if (pMsg == NULL) {
            throw std::bad_alloc();
        }
        pMsg->hwnd = hwnd;
        env->ReleasePrimitiveArrayCritical(bdata, (void *)pMsg, 0);
    }

    CATCH_BAD_ALLOC;
}
开发者ID:Gustfh,项目名称:jdk8u-dev-jdk,代码行数:33,代码来源:awt_AWTEvent.cpp

示例2:

LRESULT CALLBACK
AwtScrollbar::MouseFilter(int nCode, WPARAM wParam, LPARAM lParam)
{
    if (((UINT)wParam == WM_LBUTTONUP || (UINT)wParam == WM_MOUSEMOVE) &&
        ms_isInsideMouseFilter != TRUE &&
        nCode >= 0)
    {
        HWND hwnd = ((PMOUSEHOOKSTRUCT)lParam)->hwnd;
        AwtComponent *comp = AwtComponent::GetComponent(hwnd);

        if (comp != NULL && comp->IsScrollbar()) {
            MSG msg;
            LPMSG lpMsg = (LPMSG)&msg;
            UINT msgID = (UINT)wParam;

            ms_isInsideMouseFilter = TRUE;

            // Peek the message to get wParam containing the message's flags.
            // <::PeekMessage> will call this hook again. To prevent recursive
            // processing the <ms_isInsideMouseFilter> flag is used.
            // Calling <::PeekMessage> is not so good desision but is the only one
            // found to get those flags (used further in Java event creation).
            // WARNING! If you are about to add new hook of WM_MOUSE type make
            // it ready for recursive call, otherwise modify this one.
            if (::PeekMessage(lpMsg, hwnd, msgID, msgID, PM_NOREMOVE)) {
                comp->WindowProc(msgID, lpMsg->wParam, lpMsg->lParam);
            }

            ms_isInsideMouseFilter = FALSE;
        }
    }
    return ::CallNextHookEx(AwtScrollbar::ms_hMouseFilter, nCode, wParam, lParam);
}
开发者ID:,项目名称:,代码行数:33,代码来源:

示例3: Java_sun_awt_pocketpc_PPCCheckboxPeer_setState

JNIEXPORT void JNICALL
Java_sun_awt_pocketpc_PPCCheckboxPeer_setState (JNIEnv *env, jobject thisObj,
                                                  jboolean state)
{
    CHECK_PEER(thisObj);
    AwtComponent* c = (AwtComponent*) env->GetIntField(thisObj,
                  WCachedIDs.PPCObjectPeer_pDataFID);

    //when multifont and group checkbox receive setState native method,
    //it must be redraw to display correct check mark
    jobject target =
       env -> GetObjectField(thisObj, WCachedIDs.PPCObjectPeer_targetFID);

    if (env->CallObjectMethod(target, WCachedIDs.java_awt_Checkbox_getCheckboxGroupMID) != NULL) {
        HWND hWnd = c->GetHWnd();
        RECT rect;
        VERIFY(::GetWindowRect(hWnd,&rect));
        VERIFY(::ScreenToClient(hWnd, (LPPOINT)&rect));
        VERIFY(::ScreenToClient(hWnd, ((LPPOINT)&rect)+1));
        VERIFY(::InvalidateRect(hWnd,&rect,TRUE));
        VERIFY(::UpdateWindow(hWnd));
    } else {
        c->SendMessage(BM_SETCHECK, (WPARAM)(state ? BST_CHECKED : BST_UNCHECKED));
        VERIFY(::InvalidateRect(c->GetHWnd(), NULL, FALSE));
    }

    c->VerifyState();
}
开发者ID:AllBinary,项目名称:phoneme-components-cdc,代码行数:28,代码来源:PPCCheckboxPeer.cpp

示例4: Java_sun_awt_windows_WCheckboxPeer_setState

/*
 * Class:     sun_awt_windows_WCheckboxPeer
 * Method:    setState
 * Signature: (Z)V
 */
JNIEXPORT void JNICALL 
Java_sun_awt_windows_WCheckboxPeer_setState(JNIEnv *env, jobject self,
					    jboolean state) 
{
    TRY;

    PDATA pData;
    JNI_CHECK_PEER_RETURN(self);
    AwtComponent* c = (AwtComponent*)JNI_GET_PDATA(self);
    /* 
     * when multifont and group checkbox receive setState native
     * method, it must be redraw to display correct check mark 
     */
    jobject target = env->GetObjectField(self, AwtObject::targetID);

    jobject group = env->GetObjectField(target, AwtCheckbox::groupID);
    if (group != NULL) {
	HWND hWnd = c->GetHWnd();
        RECT rect;
        VERIFY(::GetWindowRect(hWnd,&rect));
        VERIFY(::ScreenToClient(hWnd, (LPPOINT)&rect));
        VERIFY(::ScreenToClient(hWnd, ((LPPOINT)&rect)+1));
        VERIFY(::InvalidateRect(hWnd,&rect,TRUE));
        VERIFY(::UpdateWindow(hWnd));
    } else {
	c->SendMessage(BM_SETCHECK, (WPARAM)(state ? BST_CHECKED : 
					     BST_UNCHECKED));
	VERIFY(::InvalidateRect(c->GetHWnd(), NULL, FALSE));
    }
    c->VerifyState();

    CATCH_BAD_ALLOC;
}
开发者ID:,项目名称:,代码行数:38,代码来源:

示例5: Java_sun_awt_windows_WCheckboxPeer_setLabel

/*
 * Class:     sun_awt_windows_WCheckboxPeer
 * Method:    setLabel
 * Signature: (Ljava/lang/String;)V
 */
JNIEXPORT void JNICALL
Java_sun_awt_windows_WCheckboxPeer_setLabel(JNIEnv *env, jobject self,
					    jstring label) 
{
    TRY;

    PDATA pData;
    JNI_CHECK_PEER_RETURN(self);
    AwtComponent* c = (AwtComponent*)JNI_GET_PDATA(self);

    LPCTSTR labelStr;

    // Fix for 4378378: by convention null label means empty string
    if (label == NULL) {
        labelStr = TEXT("");
    } else {
        labelStr = JNU_GetStringPlatformChars(env, label, JNI_FALSE);
    }

    if (labelStr == NULL) {
        throw std::bad_alloc();
    }
    c->SetText(labelStr);
    c->VerifyState();

    // Fix for 4378378: release StringPlatformChars only if label is not null
    if (label != NULL) {
        JNU_ReleaseStringPlatformChars(env, label, labelStr);
    }

    CATCH_BAD_ALLOC;
}
开发者ID:,项目名称:,代码行数:37,代码来源:

示例6: Java_sun_awt_windows_WPrintDialogPeer__1show

JNIEXPORT jboolean JNICALL
Java_sun_awt_windows_WPrintDialogPeer__1show(JNIEnv *env, jobject peer)
{
    TRY;

    DASSERT(peer != NULL);
    jobject target = env->GetObjectField(peer, AwtObject::targetID);
    DASSERT(target != NULL);
    jobject parent = env->GetObjectField(peer, AwtPrintDialog::parentID);
    DASSERT(parent != NULL);
    jobject control = env->GetObjectField(target, AwtPrintDialog::controlID);
    DASSERT(control != NULL);

    AwtComponent *awtParent = (AwtComponent *)JNI_GET_PDATA(parent);
    DASSERT(awtParent != NULL);
    
    PRINTDLG pd;
    memset(&pd, 0, sizeof(PRINTDLG));
    pd.lStructSize = sizeof(PRINTDLG);
    AwtPrintControl::InitPrintDialog(env, control, pd);
    pd.lpfnPrintHook = (LPPRINTHOOKPROC)PrintDialogHookProc;
    pd.lpfnSetupHook = (LPSETUPHOOKPROC)PrintDialogHookProc;
    pd.Flags |= PD_ENABLESETUPHOOK | PD_ENABLEPRINTHOOK;    
    AwtDialog::ModalDisable(NULL);
    BOOL ret = AwtPrintDialog::PrintDlg(&pd);
    AwtDialog::ModalEnable(NULL);
    AwtDialog::ModalNextWindowToFront(awtParent->GetHWnd());
    if (ret) {
        AwtPrintControl::UpdateAttributes(env, control, pd);
    }

    return ret;

    CATCH_BAD_ALLOC_RET(0);
}
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:35,代码来源:awt_PrintDialog.cpp

示例7: Java_sun_awt_pocketpc_PPCTextFieldPeer_setEchoCharacter

JNIEXPORT void JNICALL
Java_sun_awt_pocketpc_PPCTextFieldPeer_setEchoCharacter (JNIEnv *env, 
                                                         jobject self, jchar ch)
{
    CHECK_PEER(self);
    AwtComponent* c = PDATA(AwtComponent, self);
    c->SendMessage(EM_SETPASSWORDCHAR, ch);
}
开发者ID:AllBinary,项目名称:phoneme-components-cdc,代码行数:8,代码来源:PPCTextFieldPeer.cpp

示例8: Java_sun_awt_pocketpc_PPCCheckboxPeer_setLabelNative

void
Java_sun_awt_pocketpc_PPCCheckboxPeer_setLabelNative(JNIEnv *env, jobject self,
                                       jstring label)
{
    CHECK_PEER(self);
    AwtComponent* c = (AwtComponent*) env->GetIntField(self,
                  WCachedIDs.PPCObjectPeer_pDataFID);
    c->SetText(JavaStringBuffer(env, label));
}
开发者ID:AllBinary,项目名称:phoneme-components-cdc,代码行数:9,代码来源:PPCCheckboxPeer.cpp

示例9: Java_sun_awt_pocketpc_PPCCheckboxPeer_getState

long
Java_sun_awt_pocketpc_PPCCheckboxPeer_getState(JNIEnv * env, jobject self)
{
    CHECK_PEER_RETURN(self);
    AwtComponent* c = (AwtComponent*) env->GetIntField(self,
                  WCachedIDs.PPCObjectPeer_pDataFID);
    c->VerifyState();
    return c->SendMessage(BM_GETCHECK);
}
开发者ID:AllBinary,项目名称:phoneme-components-cdc,代码行数:9,代码来源:PPCCheckboxPeer.cpp

示例10: Java_sun_awt_pocketpc_PPCTextComponentPeer_getSelectionEnd

JNIEXPORT jint JNICALL
Java_sun_awt_pocketpc_PPCTextComponentPeer_getSelectionEnd (JNIEnv *env, 
                                                            jobject self)
{
     CHECK_PEER_RETURN(self);
     AwtComponent* c = PDATA(AwtComponent, self);
     long end;
     c->SendMessage(EM_GETSEL, 0, (LPARAM)&end);
     return getJavaSelPos((AwtTextComponent*)c, end);    
}
开发者ID:AllBinary,项目名称:phoneme-components-cdc,代码行数:10,代码来源:PPCTextComponentPeer.cpp

示例11: Java_sun_awt_pocketpc_PPCTextComponentPeer_getSelectionStart

JNIEXPORT jint JNICALL
Java_sun_awt_pocketpc_PPCTextComponentPeer_getSelectionStart (JNIEnv *env,
                                                              jobject thisObj)
{
    CHECK_PEER_RETURN(thisObj);
    AwtComponent* c = PDATA(AwtComponent, thisObj);
    long start;
    c->SendMessage(EM_GETSEL, (WPARAM)&start);
    return getJavaSelPos((AwtTextComponent*)c, start);

}
开发者ID:AllBinary,项目名称:phoneme-components-cdc,代码行数:11,代码来源:PPCTextComponentPeer.cpp

示例12: Java_sun_awt_windows_WInputMethod_handleNativeIMEEvent

/*
 * Class:     sun_awt_windows_WComponentPeer
 * Method:    handleEvent
 * Signature: (Lsun/awt/windows/WComponentPeer;Ljava/awt/AWTEvent;)V
 */
JNIEXPORT void JNICALL
Java_sun_awt_windows_WInputMethod_handleNativeIMEEvent(JNIEnv *env, jobject self, 
                                                       jobject peer, jobject event)
{
    TRY;

    PDATA pData;
    JNI_CHECK_PEER_RETURN(peer);
    AwtComponent* p = (AwtComponent *)pData;

    JNI_CHECK_NULL_RETURN(event, "null AWTEvent");
    if (env->EnsureLocalCapacity(1) < 0) {
	return;
    }
    jbyteArray bdata = (jbyteArray)(env)->GetObjectField(event, AwtAWTEvent::bdataID);
    if (bdata == 0) {
	return;
    }
    MSG msg;
    (env)->GetByteArrayRegion(bdata, 0, sizeof(MSG), (jbyte *)&msg);
    (env)->DeleteLocalRef(bdata);
    BOOL isConsumed =
      (BOOL)(env)->GetBooleanField(event, AwtAWTEvent::consumedID);
    int id = (env)->GetIntField(event, AwtAWTEvent::idID);
    DASSERT(!safe_ExceptionOccurred(env));

    if (isConsumed || p==NULL)	return;

    if (id >= java_awt_event_InputMethodEvent_INPUT_METHOD_FIRST &&
        id <= java_awt_event_InputMethodEvent_INPUT_METHOD_LAST) 
    {
	long modifiers = p->GetJavaModifiers();
        if (msg.message==WM_CHAR || msg.message==WM_SYSCHAR) {
            WCHAR unicodeChar = L'\0';
	    unicodeChar = (WCHAR)msg.wParam;
            p->SendKeyEvent(java_awt_event_KeyEvent_KEY_TYPED, 
                            0, //to be fixed nowMillis(), 
                            java_awt_event_KeyEvent_CHAR_UNDEFINED, 
                            unicodeChar, 
                            modifiers, 
                            java_awt_event_KeyEvent_KEY_LOCATION_UNKNOWN, (jlong)0,
                            &msg);
        } else {
            MSG* pCopiedMsg = new MSG;
            *pCopiedMsg = msg;
            p->SendMessage(WM_AWT_HANDLE_EVENT, (WPARAM) FALSE,
			(LPARAM) pCopiedMsg);
        }
        (env)->SetBooleanField(event, AwtAWTEvent::consumedID, JNI_TRUE);
    }

    CATCH_BAD_ALLOC;
}
开发者ID:,项目名称:,代码行数:58,代码来源:

示例13: Java_sun_awt_pocketpc_PPCTextComponentPeer_select

JNIEXPORT void JNICALL
Java_sun_awt_pocketpc_PPCTextComponentPeer_select (JNIEnv *env, 
                                                   jobject thisObj,
                                                   jint start, jint end)
{
    CHECK_PEER(thisObj);
    AwtComponent* c = PDATA(AwtComponent, thisObj);

    c->SendMessage(EM_SETSEL, 
		   getWin32SelPos((AwtTextComponent*)c, start),
		   getWin32SelPos((AwtTextComponent*)c, end));

    c->SendMessage(EM_SCROLLCARET);    
}
开发者ID:AllBinary,项目名称:phoneme-components-cdc,代码行数:14,代码来源:PPCTextComponentPeer.cpp

示例14: GetTarget

void AwtChoice::Reshape(int x, int y, int w, int h)
{
    // Choice component height is fixed (when rolled up)
    // so vertically center the choice in it's bounding box
    JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
    jobject target = GetTarget(env);
    jobject parent = env->GetObjectField(target, AwtComponent::parentID);
    RECT rc;

    int fieldHeight = GetFieldHeight();
    if ((parent != NULL && env->GetObjectField(parent, AwtContainer::layoutMgrID) != NULL) &&
            fieldHeight > 0 && fieldHeight < h) {
        y += (h - fieldHeight) / 2;
    }

    /* Fix for 4783342
     * Choice should ignore reshape on height changes,
     * as height is dependent on Font size only.
     */
    AwtComponent* awtParent = GetParent();
    BOOL bReshape = true;
    if (awtParent != NULL) {
        ::GetWindowRect(GetHWnd(), &rc);
        int oldW = rc.right - rc.left;
        RECT parentRc;
        ::GetWindowRect(awtParent->GetHWnd(), &parentRc);
        int oldX = rc.left - parentRc.left;
        int oldY = rc.top - parentRc.top;
        bReshape = (x != oldX || y != oldY || w != oldW);
    }

    if (bReshape)
    {
        int totalHeight = GetTotalHeight();
        AwtComponent::Reshape(x, y, w, totalHeight);
    }

    /* Bug 4255631 Solaris: Size returned by Choice.getSize() does not match
     * actual size
     * Fix: Set the Choice to its actual size in the component.
     */
    ::GetClientRect(GetHWnd(), &rc);
    env->SetIntField(target, AwtComponent::widthID,  (jint)rc.right);
    env->SetIntField(target, AwtComponent::heightID, (jint)rc.bottom);

    env->DeleteLocalRef(target);
    env->DeleteLocalRef(parent);
}
开发者ID:,项目名称:,代码行数:48,代码来源:

示例15: Java_sun_awt_pocketpc_PPCCheckboxPeer_create

JNIEXPORT void JNICALL
Java_sun_awt_pocketpc_PPCCheckboxPeer_create (JNIEnv *env, jobject thisObj,
                                                jobject hParent)
{
    CHECK_PEER(hParent);
    AwtToolkit::CreateComponent(
       thisObj, hParent, (AwtToolkit::ComponentFactory)AwtCheckbox::Create);

    CHECK_PEER_CREATION(thisObj);

#ifdef DEBUG
    AwtComponent* parent = (AwtComponent*) env->GetIntField(thisObj,
                  WCachedIDs.PPCObjectPeer_pDataFID);
    parent->VerifyState();
#endif 
}
开发者ID:AllBinary,项目名称:phoneme-components-cdc,代码行数:16,代码来源:PPCCheckboxPeer.cpp


注:本文中的AwtComponent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。