Example #1
0
void InputListener::onEvent(const sf::Event& event)
{
	switch (event.type)
	{
		/* Window */
		case sf::Event::LostFocus:               onFocusLost();                                   break;
		case sf::Event::GainedFocus:             onFocusGained();                                 break;
		case sf::Event::Closed:                  onWindowClosed();                                break;
		case sf::Event::Resized:                 onWindowResized(event.size);                     break;
			
		/* Keyboard */
		case sf::Event::TextEntered:             onTextEntered(event.text);                       break;
		case sf::Event::KeyPressed:              onKeyPressed(event.key);                         break;
		case sf::Event::KeyReleased:             onKeyReleased(event.key);                        break;
			
		/* Mouse */
		case sf::Event::MouseEntered:            onMouseEntered();                                break;
		case sf::Event::MouseLeft:               onMouseLeft();                                   break;
		case sf::Event::MouseMoved:              onMouseMoved(event.mouseMove);                   break;
		case sf::Event::MouseWheelMoved:         onMouseWheelMoved(event.mouseWheel);             break;
		case sf::Event::MouseButtonPressed:      onMouseButtonPressed(event.mouseButton);         break;
		case sf::Event::MouseButtonReleased:     onMouseButtonReleased(event.mouseButton);        break;
			
		/* Joystick */
		case sf::Event::JoystickConnected:       onJoystickConnected(event.joystickConnect);      break;
		case sf::Event::JoystickDisconnected:    onJoystickDisconnected(event.joystickConnect);   break;
		case sf::Event::JoystickButtonPressed:   onJoystickButtonPressed(event.joystickButton);   break;
		case sf::Event::JoystickButtonReleased:  onJoystickButtonReleased(event.joystickButton);  break;
		case sf::Event::JoystickMoved:           onJoystickMoved(event.joystickMove);             break;
			
		default:
			Logger::log("Warning", "Unknow event type: %d", event.type);
			break;
	}
}
void ofxDatGuiComponent::onKeyPressed(ofKeyEventArgs &e)
{
    onKeyPressed(e.key);
    if ((e.key == OF_KEY_RETURN || e.key == OF_KEY_TAB)){
        onFocusLost();
        ofRemoveListener(ofEvents().keyPressed, this, &ofxDatGuiComponent::onKeyPressed);
    }
}
void ofxDatGuiComponent::setFocused(bool focused)
{
    if (focused){
        onFocus();
    }   else{
        onFocusLost();
    }
}
Example #4
0
File: List.cpp Project: jotak/jogy
// -----------------------------------------------------------------
// Name : ~List
//  Destructor
// -----------------------------------------------------------------
List::~List()
{
    if (m_bHasFocus) {
        onFocusLost();
    }
    FREE(m_pSelectionGeometry);
    FREE(m_pLabelTemplate);
}
Example #5
0
void geGUIBase::focusLost()
{
	for(std::vector<geGUIBase*>::iterator it = m_vControls.begin(); it != m_vControls.end(); ++it)
	{
		geGUIBase* obj = *it;
		obj->focusLost();
	}

	onFocusLost();
}
	void RenderWindowManager::_update()
	{
		RenderWindow* newWinInFocus = nullptr;
		Vector<RenderWindow*> movedOrResizedWindows;
		Vector<RenderWindow*> mouseLeftWindows;
		Vector<RenderWindow*> closeRequestedWindows;

		{
			Lock lock(mWindowMutex);
			newWinInFocus = mNewWindowInFocus;

			std::swap(mMovedOrResizedWindows, movedOrResizedWindows);
			std::swap(mMouseLeftWindows, mouseLeftWindows);

			for (auto& dirtyPropertyWindow : mDirtyProperties)
				dirtyPropertyWindow->syncProperties();

			mDirtyProperties.clear();

			std::swap(mCloseRequestedWindows, closeRequestedWindows);
		}

		if(mWindowInFocus != newWinInFocus)
		{
			if(mWindowInFocus != nullptr)
				onFocusLost(*mWindowInFocus);

			if(newWinInFocus != nullptr)
				onFocusGained(*newWinInFocus);

			mWindowInFocus = newWinInFocus;
		}

		for (auto& window : movedOrResizedWindows)
			window->onResized();

		if (!onMouseLeftWindow.empty())
		{
			for (auto& window : mouseLeftWindows)
				onMouseLeftWindow(*window);
		}

		SPtr<RenderWindow> primaryWindow = gCoreApplication().getPrimaryWindow();
		for(auto& entry : closeRequestedWindows)
		{
			// Default behaviour for primary window is to quit the app on close
			if(entry == primaryWindow.get() && entry->onCloseRequested.empty())
			{
				gCoreApplication().quitRequested();
				continue;
			}

			entry->onCloseRequested();
		}
	}
TextEditComponent::TextEditComponent(Window* window) : GuiComponent(window),
	mBox(window, ":/textinput_ninepatch.png"), mFocused(false), 
	mScrollOffset(0.0f, 0.0f), mCursor(0), mEditing(false), mFont(Font::get(FONT_SIZE_MEDIUM, FONT_PATH_LIGHT)), 
	mCursorRepeatDir(0)
{
	addChild(&mBox);
	
	onFocusLost();

	setSize(4096, mFont->getHeight() + TEXT_PADDING_VERT);
}
// Ansariel: Workaround for FIRE-3814:
//           Explicitely call the according event handlers
//           so the context menu is shown properly.
//           This might go away later.
void LLMediaCtrl::setFocus(BOOL b)
{
	if (b)
	{
		onFocusReceived();
	}
	else
	{
		onFocusLost();
	}
	LLPanel::setFocus(b);
}
void ofxDatGuiComponent::update(bool acceptEvents)
{
// if window does not have focus x & y will both be zero //
    if (acceptEvents && mEnabled && mVisible){
        bool mp = ofGetMousePressed();
        ofPoint mouse = ofPoint(ofGetMouseX() - mParentPosition.x, ofGetMouseY() - mParentPosition.y);
        if (hitTest(mouse)){
            if (!mMouseOver){
                onMouseEnter(mouse);
            }
            if (!mMouseDown && mp){
                onMousePress(mouse);
                if (!mFocused) onFocus();
            }
        }   else{
    // the mouse is not over the component //
            if (mMouseOver){
                onMouseLeave(mouse);
            }
            if (!mMouseDown && mp && mFocused){
                onFocusLost();
            }
        }
        if (mMouseDown) {
            if (mp){
                onMouseDrag(mouse);
            }   else{
                onMouseRelease(mouse);
            }
        }
    }
// don't update children unless they're visible //
    if (this->getIsExpanded()) {
        for(int i=0; i<children.size(); i++) {
            children[i]->update(acceptEvents);
            if (children[i]->getFocused()){
                if (acceptEvents == false ) children[i]->setFocused(false);
                acceptEvents = false;
            }
        }
    }
}
void PhoneUiHouseHoldPrivate::ConstructL()
{
    new( ELeave ) CPhoneLogger( KUidPhoneUILoggerSingleton );
    FeatureManager::InitializeLibL();
    
    HbTranslator *translator = new HbTranslator(QString("telephone"));

	if (translator) {
        translator->loadCommon();
        m_translators.append(translator);
	}
    
	HbTranslator *translator2 = new HbTranslator(QString("telephone_cp"));
    if (translator2) {
        m_translators.append(translator2);
    }

    PhoneUIQtView *view = new PhoneUIQtView(m_window);
    iViewAdapter = new PhoneUIQtViewAdapter(*view);
    iPhoneUIController = CPhoneUIController::NewL(iViewAdapter);
    iViewAdapter->setEngineInfo(iPhoneUIController->EngineInfo());
    
    m_window.addView (view);
    m_window.setCurrentView (view);
    m_window.scene ()->setFocusItem (view);
    iKeyEventAdapter = new PhoneUIKeyEventAdapter (*iPhoneUIController);
    iCommandAdapter = new PhoneUiCommandAdapter (*iPhoneUIController);
    QObject::connect(view, SIGNAL(dialpadIsAboutToClose()), iViewAdapter, SLOT(dialpadClosed()));
    QObject::connect(view, SIGNAL(keyReleased(QKeyEvent *)), iViewAdapter, SLOT(keyReleased (QKeyEvent *)));
    QObject::connect(view, SIGNAL(keyPressed (QKeyEvent *)), iKeyEventAdapter, SLOT(keyPressed (QKeyEvent *)));
    QObject::connect(view, SIGNAL(keyReleased (QKeyEvent *)), iKeyEventAdapter, SLOT(keyReleased (QKeyEvent *)));
    QObject::connect(view, SIGNAL(command (int)), iCommandAdapter, SLOT(handleCommand (int)),
                     Qt::QueuedConnection); // async to enable deletion of widget during signal handling
    QObject::connect(view, SIGNAL(windowActivated()), iViewAdapter, SLOT(handleWindowActivated()));
    QObject::connect(view, SIGNAL(windowDeactivated()), iViewAdapter, SLOT(handleWindowDeactivated()));
    QObject::connect(&m_window, SIGNAL(focusLost()),iViewAdapter, SLOT(onFocusLost()));
    QObject::connect(&m_window, SIGNAL(focusGained()),iViewAdapter, SLOT(onFocusGained()));
    QObject::connect(iViewAdapter->noteController(), SIGNAL(command (int)), 
                     iCommandAdapter, SLOT(handleCommand (int))); 
    
    // Disable default Send key functionality in application framework 
    // avkon removal
//    CAknAppUi *appUi = static_cast<CAknAppUi*>(CEikonEnv::Static()->AppUi());
//    appUi->SetKeyEventFlags( CAknAppUiBase::EDisableSendKeyShort | 
//                             CAknAppUiBase::EDisableSendKeyLong );
    
    // CLI Name.
    TInt err = RProperty::Define( 
        KPSUidTelRemotePartyInformation,
        KTelCLIName,
        RProperty::EText,
        KPhoneReadPolicy,
        KPhoneWritePolicy );
      
    // CLI Number.
    err = RProperty::Define( 
        KPSUidTelRemotePartyInformation,
        KTelCLINumber,
        RProperty::EText,
        KPhoneReadPolicy,
        KPhoneWritePolicy );

    // Startup event signalling
    // Define the telephony application system property 
 
     err = RProperty::Define( 
        KPSUidTelInformation,
        KTelPhoneUid,
        RProperty::EInt,
        KPhoneReadPolicy,
        KPhoneWritePolicy );  

// DefineNewPSKeys:

    // UID: KPSUidTelInternalInformation:
    err = RProperty::Define( 
        KPSUidTelInternalInformation,
        KTelRemotePartyContactInfo,
        RProperty::EByteArray,
        KPhoneReadPolicy,
        KPhoneWritePolicy );    
               
    // VT UID.
    err = RProperty::Define( 
        KPSUidTelInternalInformation,
        KTelVideoCallUid,
        RProperty::EInt,
        KPhoneReadPolicy,
        KPhoneWritePolicy );

    // TELINTERNALPSKEY CHANGE 
    // Move to AudioHandling
    // UID: KPSUidTelAudioPreference
    // Call Audio Routing
    err = RProperty::Define( 
        KPSUidTelAudioPreference, 
        KTelAudioOutput, 
        RProperty::EInt,
        KPhoneReadPolicyAlwaysPass,
        KPhoneWritePolicy );

    // UID: KPSUidNEInformation
    err = RProperty::Define( 
        KPSUidNEInformation, 
        KTelNumberEntryInfo, 
        RProperty::EInt,
        KPhoneReadPolicyAlwaysPass,
        KPhoneWritePolicy );


    // Add DoStartupSignalL to the recovery system 
    iStartupSignalRecoveryId = 
        CPhoneRecoverySystem::Instance()->AddL( 
            TCallBack( DoStartupSignalL, this ),
            CTeleRecoverySystem::EPhonePriorityHigh,
            CTeleRecoverySystem::EPhoneStateIdle );

    // Call DoStartupSignalL within recovery system
    const TInt startupState = CPhonePubSubProxy::Instance()->Value(
        KPSUidStartup,
        KPSGlobalSystemState );

    PHONE_DEBUG2("phoneui::main() startupState value=", startupState );

    if ( startupState == ESwStateCriticalPhaseOK ||
        startupState == ESwStateEmergencyCallsOnly ||
        startupState == ESwStateNormalRfOn ||
        startupState == ESwStateNormalRfOff ||
        startupState == ESwStateNormalBTSap )
        {
        PHONE_DEBUG("phoneui::main() Notify Starter that phone is ready...");    
        CPhoneRecoverySystem::Instance()->RecoverNow(
            iStartupSignalRecoveryId, 
            CTeleRecoverySystem::EPhonePriorityHigh );
        }
    else
        {        
        PHONE_DEBUG("phoneui::main() Startup not ready yet. Start listening...");
        CPhonePubSubProxy::Instance()->NotifyChangeL(
            KPSUidStartup,
            KPSGlobalSystemState,
            this );
        }

    if ( err == KErrNone || err == KErrAlreadyExists )
        {
        // Indicate to the system that the Phone has been started
        CPhonePubSubProxy::Instance()->ChangePropertyValue(
            KPSUidTelInformation,
            KTelPhoneUid,
            KUidPhoneApplication.iUid );
        }

    // Update the Apps ready flag
    iAppsReady += EPhoneStartedUp;

    HbMainWindow *main = hbInstance->allMainWindows().at(0);
    RWindow *win = static_cast<RWindow *>(main->effectiveWinId()->DrawableWindow());

    CEikonEnv* env = CEikonEnv::Static();
    if ( env ) {
        env->SetSystem(ETrue);
        // Blacklist singleton is initialized here
        CPhoneClearBlacklist::CreateL( env->WsSession(), *win);
    }
}