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


C++ AwtTextComponent::UpdateBackground方法代码示例

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


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

示例1: Create


//.........这里部分代码省略.........

                jint scrollbarVisibility =
                    env->GetIntField(target, AwtTextArea::scrollbarVisibilityID);

                switch (scrollbarVisibility) {
                case java_awt_TextArea_SCROLLBARS_NONE:
                    scroll_style = ES_AUTOVSCROLL;
                    break;
                case java_awt_TextArea_SCROLLBARS_VERTICAL_ONLY:
                    scroll_style = WS_VSCROLL | ES_AUTOVSCROLL;
                    break;
                case java_awt_TextArea_SCROLLBARS_HORIZONTAL_ONLY:
                    scroll_style = WS_HSCROLL | ES_AUTOHSCROLL | ES_AUTOVSCROLL;
                    break;
                case java_awt_TextArea_SCROLLBARS_BOTH:
                    scroll_style = WS_VSCROLL | WS_HSCROLL |
                                   ES_AUTOVSCROLL | ES_AUTOHSCROLL;
                    break;
                }
            }

            DWORD style = WS_CHILD | WS_CLIPSIBLINGS | ES_LEFT;

            /*
             * Specify ES_DISABLENOSCROLL - RichEdit control style to disable
             * scrollbars instead of hiding them when not needed.
             */
            style |= isMultiline ?  ES_MULTILINE | ES_WANTRETURN | scroll_style
                     | ES_DISABLENOSCROLL : ES_AUTOHSCROLL;


            DWORD exStyle = WS_EX_CLIENTEDGE;
            if (GetRTL()) {
                exStyle |= WS_EX_RIGHT | WS_EX_LEFTSCROLLBAR;
                if (GetRTLReadingOrder())
                    exStyle |= WS_EX_RTLREADING;
            }


            jint x = env->GetIntField(target, AwtComponent::xID);
            jint y = env->GetIntField(target, AwtComponent::yID);
            jint width = env->GetIntField(target, AwtComponent::widthID);
            jint height = env->GetIntField(target, AwtComponent::heightID);

            c->CreateHWnd(env, L"", style, exStyle,
                          x, y, width, height,
                          awtParent->GetHWnd(),
                          reinterpret_cast<HMENU>(static_cast<INT_PTR>(
                                  awtParent->CreateControlID())),
                          ::GetSysColor(COLOR_WINDOWTEXT),
                          ::GetSysColor(COLOR_WINDOW),
                          peer);

            // Fix for 4753116.
            // If it is not win95 (we are using Richedit 2.0)
            // we set plain text mode, in which the control is
            // similar to a standard edit control:
            //  - The text in a plain text control can have only
            //    one format.
            //  - The user cannot paste rich text formats, such as RTF
            //    or embedded objects into a plain text control.
            //  - Rich text mode controls always have a default
            //    end-of-document marker or carriage return,
            //    to format paragraphs.
            // [email protected]
            c->SendMessage(EM_SETTEXTMODE, TM_PLAINTEXT, 0);

            c->m_backgroundColorSet = TRUE;
            /* suppress inheriting parent's color. */
            c->UpdateBackground(env, target);
            c->SendMessage(EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN,
                           MAKELPARAM(1, 1));
            /*
             * Fix for BugTraq Id 4260109.
             * Set the text limit to the maximum.
             * Use EM_EXLIMITTEXT for RichEdit controls.
             * For some reason RichEdit 1.0 becomes read-only if the
             * specified limit is greater than 0x7FFFFFFD.
             */
            c->SendMessage(EM_EXLIMITTEXT, 0, 0x7FFFFFFD);

            /* Unregister RichEdit built-in drop target. */
            VERIFY(::RevokeDragDrop(c->GetHWnd()) != DRAGDROP_E_INVALIDHWND);

            /* To enforce CF_TEXT format for paste operations. */
            VERIFY(c->SendMessage(EM_SETOLECALLBACK, 0,
                                  (LPARAM)&GetOleCallback()));

            c->SendMessage(EM_SETEVENTMASK, 0, ENM_CHANGE);
        }
    } catch (...) {
        env->DeleteLocalRef(target);
        throw;
    }

done:
    env->DeleteLocalRef(target);

    return c;
}
开发者ID:sakeinntojiu,项目名称:openjdk8-jdk,代码行数:101,代码来源:awt_TextComponent.cpp


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