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


C++ TextEvent::data方法代码示例

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


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

示例1: defaultEventHandler

void WMLInputElement::defaultEventHandler(Event* evt)
{
    bool clickDefaultFormButton = false;

    if (evt->type() == eventNames().textInputEvent && evt->isTextEvent()) {
        TextEvent* textEvent = static_cast<TextEvent*>(evt);
        if (textEvent->data() == "\n")
            clickDefaultFormButton = true;
        else if (renderer() && !isConformedToInputMask(textEvent->data()[0], toRenderTextControl(renderer())->text().length() + 1))
            // If the inputed char doesn't conform to the input mask, stop handling 
            return;
    }

    if (evt->type() == eventNames().keydownEvent && evt->isKeyboardEvent() && focused() && document()->frame()
        && document()->frame()->doTextFieldCommandFromEvent(this, static_cast<KeyboardEvent*>(evt))) {
        evt->setDefaultHandled();
        return;
    }
    
    // Let the key handling done in EventTargetNode take precedence over the event handling here for editable text fields
    if (!clickDefaultFormButton) {
        WMLElement::defaultEventHandler(evt);
        if (evt->defaultHandled())
            return;
    }

    // Use key press event here since sending simulated mouse events
    // on key down blocks the proper sending of the key press event.
    if (evt->type() == eventNames().keypressEvent && evt->isKeyboardEvent()) {
        // Simulate mouse click on the default form button for enter for these types of elements.
        if (static_cast<KeyboardEvent*>(evt)->charCode() == '\r')
            clickDefaultFormButton = true;
    }

    if (clickDefaultFormButton) {
        // Fire onChange for text fields.
        RenderObject* r = renderer();
        if (r && toRenderTextControl(r)->isEdited()) {
            dispatchEvent(Event::create(eventNames().changeEvent, true, false));
            
            // Refetch the renderer since arbitrary JS code run during onchange can do anything, including destroying it.
            r = renderer();
            if (r)
                toRenderTextControl(r)->setEdited(false);
        }

        evt->setDefaultHandled();
        return;
    }

    if (evt->isBeforeTextInsertedEvent())
        InputElement::handleBeforeTextInsertedEvent(m_data, this, this, evt);

    if (renderer() && (evt->isMouseEvent() || evt->isDragEvent() || evt->isWheelEvent() || evt->type() == eventNames().blurEvent || evt->type() == eventNames().focusEvent))
        toRenderTextControlSingleLine(renderer())->forwardEvent(evt);
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:56,代码来源:WMLInputElement.cpp

示例2: jsTextEventData

JSValue jsTextEventData(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSTextEvent* castedThis = static_cast<JSTextEvent*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    TextEvent* imp = static_cast<TextEvent*>(castedThis->impl());
    JSValue result = jsString(exec, imp->data());
    return result;
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:8,代码来源:JSTextEvent.cpp

示例3: getValueProperty

JSValue* JSTextEvent::getValueProperty(ExecState* exec, int token) const
{
    switch (token) {
    case DataAttrNum: {
        TextEvent* imp = static_cast<TextEvent*>(impl());

        return jsString(imp->data());
    }
    }
    return 0;
}
开发者ID:pk-codebox-evo,项目名称:remixos-usb-tool,代码行数:11,代码来源:JSTextEvent.cpp


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