本文整理汇总了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);
}
示例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;
}
示例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;
}