本文整理汇总了C++中TextEvent类的典型用法代码示例。如果您正苦于以下问题:C++ TextEvent类的具体用法?C++ TextEvent怎么用?C++ TextEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TextEvent类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: textEventDeleted
/**
* This is called when a text event is deleted.
*/
void EventSystem::textEventDeleted(QString ID) {
for (int i = 0; i < _textEvents.size(); i++) {
TextEvent *it = _textEvents.at(i);
if (it->getName() == ID)
_textEvents.remove(i);
}
}
开发者ID:juniordiscart,项目名称:RPGMaker,代码行数:10,代码来源:EventSystem.cpp
示例2: ProjectException
/**
* Translate the text event from XML.
*/
TextEvent* TextEvent::translateFromXML(QDomElement element) {
QString ID = element.attributeNode("ID").value();
QDomElement typeElement = element.firstChildElement("type");
QString typeString = typeElement.attributeNode("value").value();
if (typeString != "TEXT")
throw ProjectException("The translation of a text event should have type TEXT instead of " + typeString + ".");
Event::Trigger trigger = Event::NONE;
QString triggerString = element.firstChildElement("trigger").attributeNode("value").value();
if (triggerString == "TOUCH")
trigger = Event::TOUCH;
else if (triggerString == "INTERACT")
trigger = Event::INTERACT;
else if (triggerString == "NONE")
trigger = Event::NONE;
TextEvent *event = create(ID, trigger);
Event::translateFromXML(element, event);
QDomNodeList textElements = element.elementsByTagName("text");
for (int i = 0; i < textElements.size(); i++) {
QDomElement textElement = textElements.at(i).toElement();
event->addMessage(textElement.text());
}
return event;
}
开发者ID:juniordiscart,项目名称:RPGMaker,代码行数:31,代码来源:TextEvent.cpp
示例3: jsTextEventPrototypeFunctionInitTextEvent
EncodedJSValue JSC_HOST_CALL jsTextEventPrototypeFunctionInitTextEvent(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTextEvent::s_info))
return throwVMTypeError(exec);
JSTextEvent* castedThis = static_cast<JSTextEvent*>(asObject(thisValue));
ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTextEvent::s_info);
TextEvent* imp = static_cast<TextEvent*>(castedThis->impl());
const String& typeArg(ustringToString(exec->argument(0).toString(exec)));
if (exec->hadException())
return JSValue::encode(jsUndefined());
bool canBubbleArg(exec->argument(1).toBoolean(exec));
if (exec->hadException())
return JSValue::encode(jsUndefined());
bool cancelableArg(exec->argument(2).toBoolean(exec));
if (exec->hadException())
return JSValue::encode(jsUndefined());
DOMWindow* viewArg(toDOMWindow(exec->argument(3)));
if (exec->hadException())
return JSValue::encode(jsUndefined());
const String& dataArg(ustringToString(exec->argument(4).toString(exec)));
if (exec->hadException())
return JSValue::encode(jsUndefined());
imp->initTextEvent(typeArg, canBubbleArg, cancelableArg, viewArg, dataArg);
return JSValue::encode(jsUndefined());
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:27,代码来源:JSTextEvent.cpp
示例4: 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
示例5: 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
示例6: switch
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
示例7: ProjectException
/**
* Get text event with specified name.
*/
TextEvent* EventSystem::getTextEvent(QString ID) const {
if (ID == QString())
throw ProjectException("Cannot search for a text event with an empty ID.");
for (int i = 0; i < _textEvents.size(); i++) {
TextEvent *it = _textEvents.at(i);
if (!!it && (it->getName() == ID))
return it;
}
return 0;
}
开发者ID:juniordiscart,项目名称:RPGMaker,代码行数:15,代码来源:EventSystem.cpp
示例8: initTextEventCallback
static v8::Handle<v8::Value> initTextEventCallback(const v8::Arguments& args)
{
INC_STATS("DOM.TextEvent.initTextEvent");
TextEvent* imp = V8TextEvent::toNative(args.Holder());
STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, typeArg, args[0]);
EXCEPTION_BLOCK(bool, canBubbleArg, args[1]->BooleanValue());
EXCEPTION_BLOCK(bool, cancelableArg, args[2]->BooleanValue());
EXCEPTION_BLOCK(DOMWindow*, viewArg, V8DOMWindow::HasInstance(args[3]) ? V8DOMWindow::toNative(v8::Handle<v8::Object>::Cast(args[3])) : 0);
STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, dataArg, args[4]);
imp->initTextEvent(typeArg, canBubbleArg, cancelableArg, viewArg, dataArg);
return v8::Handle<v8::Value>();
}
开发者ID:Treeeater,项目名称:chrome_bindings,代码行数:12,代码来源:V8TextEvent.cpp
示例9: jsTextEventPrototypeFunctionInitTextEvent
JSValue* jsTextEventPrototypeFunctionInitTextEvent(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
{
if (!thisValue->isObject(&JSTextEvent::s_info))
return throwError(exec, TypeError);
JSTextEvent* castedThisObj = static_cast<JSTextEvent*>(thisValue);
TextEvent* imp = static_cast<TextEvent*>(castedThisObj->impl());
const UString& typeArg = args[0]->toString(exec);
bool canBubbleArg = args[1]->toBoolean(exec);
bool cancelableArg = args[2]->toBoolean(exec);
DOMWindow* viewArg = toDOMWindow(args[3]);
const UString& dataArg = args[4]->toString(exec);
imp->initTextEvent(typeArg, canBubbleArg, cancelableArg, viewArg, dataArg);
return jsUndefined();
}
开发者ID:Chingliu,项目名称:EAWebkit,代码行数:15,代码来源:JSTextEvent.cpp
示例10: throwError
JSValue* JSTextEventPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args)
{
if (!thisObj->inherits(&JSTextEvent::info))
return throwError(exec, TypeError);
TextEvent* imp = static_cast<TextEvent*>(static_cast<JSTextEvent*>(thisObj)->impl());
switch (id) {
case JSTextEvent::InitTextEventFuncNum: {
String typeArg = args[0]->toString(exec);
bool canBubbleArg = args[1]->toBoolean(exec);
bool cancelableArg = args[2]->toBoolean(exec);
DOMWindow* viewArg = toDOMWindow(args[3]);
String dataArg = args[4]->toString(exec);
imp->initTextEvent(typeArg, canBubbleArg, cancelableArg, viewArg, dataArg);
return jsUndefined();
}
}
return 0;
}
开发者ID:pk-codebox-evo,项目名称:remixos-usb-tool,代码行数:21,代码来源:JSTextEvent.cpp
示例11: processEventsClient
void ChatEntity::processEventsClient(ChatEvent* cEvent) {
// A text line
TextEvent* text = dynamic_cast<TextEvent*> (cEvent);
if (text) {
// Update all the listeners
std::string user = text->getUser();
std::string line = text->getLine();
for (listener_iterator it = listenersBegin(); it != listenersEnd(); ++it) {
(*it)->newMessage(user, line);
}
}
// A notification
NotifyEvent* notify = dynamic_cast<NotifyEvent*> (cEvent);
if (notify) {
// Update all the listeners
std::string line = notify->getLine();
for (listener_iterator it = listenersBegin(); it != listenersEnd(); ++it) {
(*it)->newNotification(line);
}
}
}
开发者ID:allenjacksonmaxplayio,项目名称:uhasseltaacgua,代码行数:22,代码来源:ChatEntity.cpp
注:本文中的TextEvent类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论