Пример #1
1
bool EventTarget::setAttributeEventListener(const AtomicString& eventType, RefPtr<EventListener>&& listener)
{
    clearAttributeEventListener(eventType);
    if (!listener)
        return false;
    return addEventListener(eventType, listener.releaseNonNull());
}
Пример #2
1
// on "init" you need to initialize your instance
bool PauseLayer::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !PopBase::init() )
    {
        return false;
    }
    
    m_RootNode = static_cast<Layout*>(CSLoader::createNode("PauseLayer.csb"));
    this->addChild(m_RootNode);
    
    auto effectBtn=dynamic_cast<CheckBox*>(Helper::seekWidgetByName(m_RootNode, "CheckBox_yinxiao"));
    if (effectBtn) {
        effectBtn->addEventListener(CC_CALLBACK_2(PauseLayer::effectButtonOnTouch, this));
    }
    auto musicBtn=dynamic_cast<CheckBox*>(Helper::seekWidgetByName(m_RootNode, "CheckBox_yinyue"));
    if (musicBtn) {
        musicBtn->addEventListener(CC_CALLBACK_2(PauseLayer::musicButtonOnTouch, this));
    }
    auto Button_Resume=dynamic_cast<ui::Button*>(Helper::seekWidgetByName(m_RootNode, "Button_RESUME"));
    if (Button_Resume) {
        Button_Resume->addTouchEventListener(CC_CALLBACK_2(PauseLayer::Button_Resume_BtnOnTouch, this));
    }
    auto Button_QUIT=dynamic_cast<ui::Button*>(Helper::seekWidgetByName(m_RootNode, "Button_QUIT"));
    if (Button_QUIT) {
        Button_QUIT->addTouchEventListener(CC_CALLBACK_2(PauseLayer::Button_QUIT_BtnOnTouch, this));
    }
    
    //声音状态
    auto soundBLL=SoundBLL::getInstance();
    musicBtn->setSelected(soundBLL->isMusicMute());
    effectBtn->setSelected(soundBLL->isEffectMute());
    
    return true;
}
Пример #3
0
 void OgreNode::setEngine(Engine* engine)
 {
   mRenderSystem = engine->getSystem<QOgreRenderSystem>();
   if(!mRenderSystem)
     return;
   mRenderSystem->setQtWindow(mQuickWindow);
   addEventListener(mRenderSystem, QOgreRenderSystem::CAMERA_CHANGED, &OgreNode::onCameraChanged);
 }
Пример #4
0
Joystick::Joystick():_pressed(false), _dir(0,0)
{
	setResAnim(res::ui.getResAnim("joystick"));
	setAlpha(128);

	//handle touch events
	addEventListener(TouchEvent::TOUCH_DOWN, CLOSURE(this, &Joystick::onEvent));
	addEventListener(TouchEvent::TOUCH_UP, CLOSURE(this, &Joystick::onEvent));
	addEventListener(TouchEvent::MOVE, CLOSURE(this, &Joystick::onEvent));

	_finger = new Sprite;
	_finger->setResAnim(res::ui.getResAnim("finger"));
	_finger->attachTo(this);
	_finger->setVisible(false);
	_finger->setAnchor(Vector2(0.5f, 0.5f));
	_finger->setTouchEnabled(false);
}
Пример #5
0
	TITANIUM_FUNCTION(Module, addEventListener)
	{
		ENSURE_STRING_AT_INDEX(name, 0);
		ENSURE_OBJECT_AT_INDEX(callback, 1);

		TITANIUM_ASSERT(callback.IsFunction());
		addEventListener(name, callback, this_object);
		return get_context().CreateUndefined();
	}
Пример #6
0
    Stage::Stage(bool autoReset) : _statUpdate(0), _statRender(0), _clipOuter(false), _viewport(0, 0, 0, 0) //, _active(true)
    {
        spClock clock = new Clock();
        setClock(clock);
        setName("Stage");

        //each mobile application should handle focus lost
        //and free/restore GPU resources
        if (autoReset)
        {
            addEventListener(Stage::DEACTIVATE, CLOSURE(this, &Stage::onDeactivate));
            addEventListener(Stage::ACTIVATE, CLOSURE(this, &Stage::onActivate));
        }
        _stage = this;

#ifdef OXYGINE_SDL
        _window = 0;
#endif
    }
Пример #7
0
//复选框
void UI:: initCheckBox(){
    auto visibleSize=Director::getInstance()->getVisibleSize();
    auto cb=CheckBox::create();
    cb->loadTextureBackGround("switch-mask.png");
    cb->loadTextureBackGroundSelected("switch-on.png");//点击时候
    cb->loadTextureFrontCross("switch-off.png");
    cb->addEventListener(CC_CALLBACK_2(UI::checkBoxClick, this));
    cb->setPosition(visibleSize/2);
    addChild(cb);
}
Пример #8
0
Z3DPunctaFilter::Z3DPunctaFilter()
  : Z3DGeometryFilter()
  , m_sphereRenderer(NULL)
  , m_boundBoxRenderer(NULL)
  , m_showPuncta("Show Puncta", true)
  , m_colorMode("Color Mode")
  , m_singleColorForAllPuncta("Puncta Color", glm::vec4(ZRandomInstance.randReal<float>(),
                                                       ZRandomInstance.randReal<float>(),
                                                       ZRandomInstance.randReal<float>(),
                                                       1.f))
  , m_useSameSizeForAllPuncta("Use Same Size", false)
  , m_pressedPunctum(NULL)
  , m_selectedPuncta(NULL)
  , m_xCut("X Cut", glm::ivec2(0,0), 0, 0)
  , m_yCut("Y Cut", glm::ivec2(0,0), 0, 0)
  , m_zCut("Z Cut", glm::ivec2(0,0), 0, 0)
  , m_widgetsGroup(NULL)
  , m_dataIsInvalid(false)
{
  m_singleColorForAllPuncta.setStyle("COLOR");
  connect(&m_singleColorForAllPuncta, SIGNAL(valueChanged()), this, SLOT(prepareColor()));

  // Color Mode
  m_colorMode.addOptions("Same Color", "Random Color", "Based on Point Source", "Original Point Color");
  m_colorMode.select("Based on Point Source");

  connect(&m_colorMode, SIGNAL(valueChanged()), this, SLOT(prepareColor()));
  connect(&m_colorMode, SIGNAL(valueChanged()), this, SLOT(adjustWidgets()));

  connect(&m_useSameSizeForAllPuncta, SIGNAL(valueChanged()), this, SLOT(changePunctaSize()));


  addParameter(m_showPuncta);
  addParameter(m_colorMode);

  addParameter(m_singleColorForAllPuncta);

  addParameter(m_useSameSizeForAllPuncta);

  m_selectPunctumEvent = new ZEventListenerParameter("Select Puncta", true, false, this);
  m_selectPunctumEvent->listenTo("select punctum", Qt::LeftButton, Qt::NoModifier, QEvent::MouseButtonPress);
  m_selectPunctumEvent->listenTo("select punctum", Qt::LeftButton, Qt::NoModifier, QEvent::MouseButtonRelease);
  m_selectPunctumEvent->listenTo("append select punctum", Qt::LeftButton, Qt::ControlModifier, QEvent::MouseButtonPress);
  m_selectPunctumEvent->listenTo("append select punctum", Qt::LeftButton, Qt::ControlModifier, QEvent::MouseButtonRelease);
  connect(m_selectPunctumEvent, SIGNAL(mouseEventTriggered(QMouseEvent*,int,int)), this, SLOT(selectPuncta(QMouseEvent*,int,int)));
  addEventListener(m_selectPunctumEvent);

  addParameter(m_xCut);
  addParameter(m_yCut);
  addParameter(m_zCut);
  connect(&m_xCut, SIGNAL(valueChanged()), this, SLOT(setClipPlanes()));
  connect(&m_yCut, SIGNAL(valueChanged()), this, SLOT(setClipPlanes()));
  connect(&m_zCut, SIGNAL(valueChanged()), this, SLOT(setClipPlanes()));
  adjustWidgets();
}
Пример #9
0
 InputHandler::InputHandler(size_t windowHandle, Engine* engine)
   : mHandle(windowHandle)
   , mEngine(engine)
   , mWidth(0)
   , mHeight(0)
   , mPreviousX(0)
   , mPreviousY(0)
   , mPreviousZ(0)
 {
   addEventListener(engine, WindowEvent::RESIZE, &InputHandler::handleWindowEvent);
 }
Пример #10
0
Msg_Layer::Msg_Layer()
{
    _tag = 0;
    _widgetRoot = NULL;
    _widgetLayer= NULL;
    _listener = NULL;
    _outsideClose = false;
    _autoCloseTime = -1.f;
    _enterType  = EnterType::Normal;
    _msgType    = MsgType::Normal;
    addEventListener();
}
Пример #11
0
void DocumentWindow::setEventHandler(const std::u16string& type, Object handler)
{
    EventListenerImp* listener = getEventHandlerListener(type);
    if (listener) {
        listener->setEventHandler(handler);
        return;
    }
    listener = new(std::nothrow) EventListenerImp(boost::bind(&ECMAScriptContext::dispatchEvent, getContext(), _1, _2));
    if (listener) {
        listener->setEventHandler(handler);
        addEventListener(type, listener, false, EventTargetImp::UseEventHandler);
    }
}
Пример #12
0
bool LevelManager::init()
{
	if (!Layer::init())
	{
		return false;
	}
	Size visibleSize = Director::getInstance()->getVisibleSize();
	Vec2 origin = Director::getInstance()->getVisibleOrigin();
	_selectedLevelIndex = 0;
	auto pageView = PageView::create();
	pageView->setContentSize(Size(480.0f,320.0f));
	pageView->setAnchorPoint(Vec2(0.5,0.5));
	pageView->setPosition(Vec2(visibleSize.width/2,visibleSize.height/2));
	for (int i = 0; i < 3;++i)
	{
		Layout* layout = Layout::create();
		layout->setContentSize(Size(480.0f,320.0f));
		ImageView* _imageView = ImageView::create(StringUtils::format("preview%d.png",i+1));
		_imageView->setContentSize(Size(480.0f,320.0f));
		_imageView->setPosition(Vec2(layout->getContentSize().width/2.f,layout->getContentSize().height/2.f));
		layout->addChild(_imageView);
		pageView->insertPage(layout,i);
	}
	pageView->addEventListener([=](Ref* pSender,PageView::EventType type){
		switch (type)
		{
		case PageView::EventType::TURNING:
		{
				PageView* pageView = dynamic_cast<PageView*>(pSender);
				_selectedLevelIndex = pageView->getCurPageIndex();
		}
			break;
		default:
			break;
		}
	});
	this->addChild(pageView,1);
	auto start_button = Button::create("btn-start.png");
	start_button->setPosition(Vec2(visibleSize.width/2,visibleSize.height*0.2));
	start_button->addTouchEventListener([=](Ref* pSender, Widget::TouchEventType type)
	{
		if (type==Widget::TouchEventType::ENDED)
		{
			auto transition = TransitionSlideInR::create(1.5,GameScene::createSceneWithLevel(++_selectedLevelIndex));
			Director::getInstance()->pushScene(transition);
		}
	});
	this->addChild(start_button, 1);
	return true;
}
Пример #13
0
void Firework::initialize()
{
	_time=0.f;
	_fireworkTime=1.5f;
	_explode=false;
	_exploding=false;

	addEventListener(EventType::UPDATE);

	_particleRenderer = std::static_pointer_cast<ParticleRenderer>(getComponent(ComponentType::PARTICLE_REND));

	_posGenerator.reset(new RoundPosGen());
	_posGenerator->setCenter(glm::vec4(0.0,0.0,0.0,1.0));
	_posGenerator->setXRadius(0.15f);
	_posGenerator->setYRadius(0.15f);
	_colGenerator.reset(new BasicColourGen());
	_colGenerator->setMinStartColour(glm::vec4( 0.5, 0.5, 0.5, 1.0 ));
	_colGenerator->setMaxStartColour(glm::vec4( 1.0, 1.0, 1.0, 1.0 ));
	_colGenerator->setMinEndColour	(glm::vec4( 0.0, 0.0, 0.0, 1.0 ));
	_colGenerator->setMaxEndColour	(glm::vec4( 0.2, 0.2, 0.2, 1.0 ));
	_velGenerator.reset(new BasicVelGen());
	_velGenerator->setMinStartVel	(glm::vec4( -5.45f, -5.45f, -5.45f, 0.0f ));
	_velGenerator->setMaxStartVel	(glm::vec4(  5.45f,  5.45f,  5.45f, 0.0f ));
	_timeGenerator.reset(new BasicTimeGen());
	_timeGenerator->setMinTime(0.5f);
	_timeGenerator->setMaxTime(2.5f);

	_emitter.reset(new ParticleEmitter());
	_emitter->init(100,1.f);
	_emitter->addGenerator(_posGenerator);
	_emitter->addGenerator(_colGenerator);
	_emitter->addGenerator(_velGenerator);
	_emitter->addGenerator(_timeGenerator);
	_particleRenderer->addEmitter(_emitter);

	_timeUpdater.reset(new BasicTimeUpdater());
	_colourUpdater.reset(new BasicColourUpdater());
	_eulerUpdater.reset(new EulerUpdater());

	_eulerUpdater->setGlobalAcc(glm::vec4(0.0,-45.0,0.0,0.0));

	_particleRenderer->clear();//clears updaters
	_particleRenderer->addUpdater(_timeUpdater);
	_particleRenderer->addUpdater(_colourUpdater);
	_particleRenderer->addUpdater(_eulerUpdater);

	_particleRenderer->generate(100);
	_particleRenderer->setEmitFlag(false);
	_particleRenderer->resetParticles();
}
HTMLElementImp::HTMLElementImp(HTMLElementImp* org, bool deep) :
    ObjectMixin(org, deep),
    style(0),
    tabIndex(org->tabIndex),
    scrollTop(0),
    scrollLeft(0),
    clickListener(boost::bind(&HTMLElementImp::handleClick, this, _1)),
    mouseMoveListener(boost::bind(&HTMLElementImp::handleMouseMove, this, _1)),
    bindingImplementation(0), // TODO: clone
    shadowTree(0),            // TODO: clone
    shadowTarget(0),          // TODO: clone
    shadowImplementation(0)   // TODO: clone
{
    if (auto orgStyle = dynamic_cast<CSSStyleDeclarationImp*>(org->style.self())) {
        CSSStyleDeclarationImp* imp = new(std::nothrow) CSSStyleDeclarationImp(orgStyle);
        if (imp) {
            imp->setOwner(this);
            style = imp;
        }
    }
    addEventListener(u"click", &clickListener, false, true);
    addEventListener(u"mousemove", &mouseMoveListener, false, true);
}
Пример #15
0
void UI::initPageView(){
    auto pv=PageView::create();
    pv->setContentSize(Size(480,320)*1.5);
    for (int i=0; i<10; i++) {
        auto ly=createLayout(i);
        pv->addPage(ly);
    }
    //设置滑动阀值
    pv->setCustomScrollThreshold(100);
    pv->addEventListener(CC_CALLBACK_2(UI::pageView, this));
    pv->setPosition(Vec2::ZERO);
    addChild(pv);
    
}
Пример #16
0
void EventDispatcher::addEventListenerWithSceneGraphPriority(EventListener* listener, Node* node)
{
    CCASSERT(listener && node, "Invalid parameters.");
    CCASSERT(!listener->isRegistered(), "The listener has been registered.");
    
    if (!listener->checkAvailable())
        return;
    
    listener->setAssociatedNode(node);
    listener->setFixedPriority(0);
    listener->setRegistered(true);
    
    addEventListener(listener);
}
Пример #17
0
Field::Field()
{
	animated_count=0;
	droped_count=0;
	back_swap = false;

	EventCallback cb = CLOSURE(this, &Field::JewelClick);
	addEventListener(TouchEvent::TOUCH_DOWN, cb);
	state = fsWaiting;

	setSize(JEWEL_SIZE * FIELD_SIZE, JEWEL_SIZE * FIELD_SIZE);

	FillField(true);
	RefreshField();
}
Пример #18
0
void EventDispatcher::addEventListenerWithFixedPriority(EventListener* listener, int fixedPriority)
{
    CCASSERT(listener, "Invalid parameters.");
    CCASSERT(!listener->isRegistered(), "The listener has been registered.");
    CCASSERT(fixedPriority != 0, "0 priority is forbidden for fixed priority since it's used for scene graph based priority.");
    
    if (!listener->checkAvailable())
        return;
    
    listener->setAssociatedNode(nullptr);
    listener->setFixedPriority(fixedPriority);
    listener->setRegistered(true);
    listener->setPaused(false);

    addEventListener(listener);
}
Пример #19
0
//滑块
void UI::initSliderView(){
    auto visibleSiez=cocos2d::Director::getInstance()->getVisibleSize();
    auto sl=Slider::create();
    //轨道
    sl->loadBarTexture("xuetiao1.png");
    //覆盖轨道
    sl->loadProgressBarTexture("xuetiao2.png");
    sl->loadSlidBallTextureNormal("switch-thumb.png");
    sl->loadSlidBallTexturePressed("switch-thumb.png");
    sl->loadSlidBallTextureDisabled("switch-thumb.png");
    //添加事件
    sl->addEventListener(CC_CALLBACK_2(UI::SliserCall, this));
    sl->setPercent(30);
    sl->setPosition(visibleSiez/2);
    addChild(sl);
}
int QContext2DCanvas::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: { QScriptValue _r = getContext((*reinterpret_cast< const QString(*)>(_a[1])));
            if (_a[0]) *reinterpret_cast< QScriptValue*>(_a[0]) = _r; }  break;
        case 1: resize((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 2: addEventListener((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const QScriptValue(*)>(_a[2])),(*reinterpret_cast< bool(*)>(_a[3]))); break;
        case 3: contentsChanged((*reinterpret_cast< const QImage(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 4;
    }
    return _id;
}
Пример #21
0
Game::Game( const char* name, int width, int height ) :
    EventDispatcher()
{
    // Initialize the library
    if( !glfwInit() )
    {
        throw GameException::GlfwInitFail;
    }

    _width = width;
    _height = height;

    // Create a windowed mode window and its OpenGL context
    _windowPtr = glfwCreateWindow(
                     width,
                     height,
                     name,
                     NULL,
                     NULL
                 );
    if( !_windowPtr )
    {
        glfwTerminate();
        throw GameException::GlfwCreateWindowFail;
    }

    glfwMakeContextCurrent( _windowPtr );

    glewExperimental = GL_TRUE;

    if ( glewInit() != GLEW_OK )
    {
        throw GameException::GlewInitFail;
    }

    // Add event listener to self for when the game closes
    Callback c = std::bind( &Game::onClose, this, std::placeholders::_1 );
    addEventListener( GameEvent::CLOSE, c );

    _mousePos = glm::vec2( _width * 0.5, _height * 0.5 );

    Random::seedRandom( unsigned( time( NULL ) ) );
}
Пример #22
0
void BBHandleLayer::initSprite()
{
    m_testLayer = LayerColor::create(Color4B(255, 0, 0, 255), 10, 10);
    addChild(m_testLayer);
    
    createHandleBg();
    
    createIdleBlock();

    createBlocks();
    
    addEventListener();
    
    m_testLayer->setPosition(Point(m_relativeX, m_relativeY));
    
    NotificationCenter::getInstance()->addObserver(this, callfuncO_selector(BBHandleLayer::showTips), "kShowTips", NULL);
    
    if (BBGameDataManager::getInstance()->getScreenScale() != 2) {
        GameCenterApi::getInstance()->hiddenAdBanner();
    }
}
Пример #23
0
  bool SceneNodeWrapper::initialize(
          OgreObjectManager* objectManager,
          const DataProxy& dict,
          const std::string& ownerId,
          const std::string& type,
          Ogre::SceneManager* sceneManager,
          Ogre::SceneNode* parent)
  {
    if(dict.count("name") == 0)
    {
      mObjectId = ownerId;
#if OGRE_VERSION_MAJOR == 2
      // TODO: static/dynamic nodes
      mNode = parent->createChildSceneNode();
#else
      mNode = parent->createChildSceneNode(mObjectId);
#endif
    }

    addEventListener(objectManager, OgreObjectManagerEvent::FACTORY_UNREGISTERED, &SceneNodeWrapper::onFactoryUnregister);
    return OgreObject::initialize(objectManager, dict, ownerId, type, sceneManager, parent);
  }
void MediaControlsApple::showClosedCaptionTrackList()
{
    if (!m_closedCaptionsContainer || m_closedCaptionsContainer->isShowing())
        return;

    m_closedCaptionsContainer->show();

    // Ensure the controls panel does not receive any events while the captions
    // track list is visible as all events now need to be captured by the
    // track list.
    m_panel->setInlineStyleProperty(CSSPropertyPointerEvents, CSSValueNone);

    EventListener& listener = eventListener();
    m_closedCaptionsContainer->addEventListener(eventNames().wheelEvent, &listener, true);

    // Track click events in the capture phase at two levels, first at the document level
    // such that a click outside of the <video> may dismiss the track list, second at the
    // media controls level such that a click anywhere outside of the track list hides the
    // track list. These two levels are necessary since it would not be possible to get a
    // reference to the track list when handling the event outside of the shadow tree.
    document().addEventListener(eventNames().clickEvent, &listener, true);
    addEventListener(eventNames().clickEvent, &listener, true);
}
Пример #25
0
void UI::initListView(){
    auto lv=ListView::create();
    lv->setContentSize(cocos2d::Size(640,480));
    lv->setItemsMargin(20);//设置间隔
    lv->setDirection(cocos2d::ui::ScrollView::Direction::VERTICAL);
        for (int i=0; i<50; i++) {
        auto ub=Button::create();
        ub->loadTextureNormal("0.png");
        ub->loadTexturePressed("1.png");
        ub->loadTextureDisabled("0.png");
        ub->setScale9Enabled(true);
        ub->setContentSize(Size(600,400));
        ub->setPressedActionEnabled(true);
        ub->setZoomScale(0.5f);
        ub->addClickEventListener(CC_CALLBACK_1(UI::buttonClick, this));
        ub->setTag(i);
        lv->pushBackCustomItem(ub);
    }
   
    lv->addEventListener(CC_CALLBACK_2(UI::ListViewCall, this));
    addChild(lv);

}
Пример #26
0
Файл: View.cpp Проект: laoo/LSC
client::HTMLElement * View::createMesureCell( int rowNr )
{
  auto ch = "input"_c;
  ch->setAttribute( "type", "checkbox" );

  auto in = "input"_c;
  in->setAttribute( "type", "number" );
  in->setAttribute( "value", mModel.getStringMeasure( rowNr ) );
  addEventListener( in, "change", [&]( client::Element * e )
  {
    double value = static_cast<client::HTMLInputElement*>( e )->get_valueAsNumber();
    mModel.setStringMeasure( rowNr, value );
    reset();
  } );


  //in->setAttribute( "disabled", "disabled" );

  auto div = "div"_c;
  div->appendChild( ch );
  div->appendChild( in );

  return div;
}
Пример #27
0
  void RocketUIManager::setUp()
  {
    if(mIsSetUp)
      return;

    EngineSystem* render = mEngine->getSystem("render");
    if(render == 0) {
      return;
    }

    const std::string type = render->getSystemInfo().get("type", "unknown");
    bool initialized = false;
#ifdef OGRE_INTERFACE
    if(type == "ogre") {
      LOG(INFO) << "Initialize for render system ogre3d";
      mRenderSystemWrapper = new RocketOgreWrapper(mEngine);
      initialized = true;
    }

    setLuaState(mLuaState);
#endif

    if(!initialized) {
      LOG(ERROR) << "Failed to initialize rocket ui manager with the render system of type \"" << type << "\"";
      return;
    }
    // mouse events
    addEventListener(mEngine, MouseEvent::MOUSE_DOWN, &RocketUIManager::handleMouseEvent, -100);
    addEventListener(mEngine, MouseEvent::MOUSE_UP, &RocketUIManager::handleMouseEvent, -100);
    addEventListener(mEngine, MouseEvent::MOUSE_MOVE, &RocketUIManager::handleMouseEvent, -100);
    // keyboard events
    addEventListener(mEngine, KeyboardEvent::KEY_DOWN, &RocketUIManager::handleKeyboardEvent, -100);
    addEventListener(mEngine, KeyboardEvent::KEY_UP, &RocketUIManager::handleKeyboardEvent, -100);
    // text input event
    addEventListener(mEngine, TextInputEvent::INPUT, &RocketUIManager::handleInputEvent, -100);
    mIsSetUp = true;
  }
Пример #28
-1
bool EventTarget::setAttributeEventListener(const AtomicString& eventType, PassRefPtrWillBeRawPtr<EventListener> listener)
{
    clearAttributeEventListener(eventType);
    if (!listener)
        return false;
    return addEventListener(eventType, listener, false);
}
Пример #29
-1
TaoStatus TaoListenerManager::addCallListener(TaoMessage& rMsg)
{
        TaoStatus ret = TAO_SUCCESS;
        UtlString terminalName;

        TaoString str(rMsg.getArgList(), TAOMESSAGE_DELIMITER);
        terminalName = str[0];

        if (terminalName.isNull() || 0 == terminalName.compareTo("0.0.0.0"))
        {
                if (mListenerCnt <= 0)
                {
                        terminalName = "127.0.0.1";
                        osPrintf("WARNING - TaoListenerManager::addCallListener: using invalid host, replaced with %s\n", terminalName.data());
                }
                else
                {
                        osPrintf("WARNING - TaoListenerManager::addCallListener: using invalid host %s, listener not added.\n", terminalName.data());
                        return TAO_FAILURE;
                }
        }

        mpCallMgr->addTaoListener(this);

        ret = addEventListener(terminalName.data(), TRUE);

        return ret;
}
void EventTargetNode::setInlineEventListenerForType(const AtomicString& eventType, PassRefPtr<EventListener> listener)
{
    // In case we are the only one holding a reference to it, we don't want removeInlineEventListenerForType to destroy it.
    removeInlineEventListenerForType(eventType);
    if (listener)
        addEventListener(eventType, listener, false);
}