//************************************************************************ // CLCDInput::DeactivateInput //************************************************************************ void CLCDInput::DeactivateInput() { if(!m_pInput) return; UnhookWindowsHookEx(m_hKBHook); m_hKBHook = NULL; m_pInput = NULL; CLCDConnection *pLCDCon = CLCDOutputManager::GetInstance()->GetLCDConnection(); pLCDCon->SetAsForeground(0); }
//************************************************************************ // CLCDInput::ActivateInput //************************************************************************ void CLCDInput::ActivateInput() { if(m_pInput) return; CLCDConnection *pLCDCon = CLCDOutputManager::GetInstance()->GetLCDConnection(); pLCDCon->SetAsForeground(1); m_hKBHook = SetWindowsHookEx(WH_KEYBOARD_LL, CLCDInput::KeyboardHook, GetModuleHandle(NULL), 0); if(!m_hKBHook) return; m_pInput = this; GetKeyboardState(m_acKeyboardState); }
//************************************************************************ // Called when an LCD-button is pressed //************************************************************************ void CNotificationScreen::OnLCDButtonDown(int iButton) { CScreen::OnLCDButtonDown(iButton); if(m_MessageText.IsVisible() && ( iButton <= 1 || iButton >=4)) { if(iButton== 1 || iButton == 5) m_MessageText.ScrollDown(); else m_MessageText.ScrollUp(); SetExpiration(CConfig::GetIntSetting(NOTIFY_DURATION)*1000); } else if(iButton == 2 && m_LNotifications.size() >= 1) { CNotificationEntry *pEntry = *(m_LNotifications.begin()); m_LNotifications.pop_front(); if(m_LNotifications.size() >= 1) SetButtonBitmap(2,IDB_NEXT); else SetButtonBitmap(2,NULL); DisplayNotification(pEntry); SetExpiration(CConfig::GetIntSetting(NOTIFY_DURATION)*1000); } else if(iButton == 3 && m_pEntry && m_pEntry->pContact) { SetExpiration(0); CLCDConnection *pLCDCon = CAppletManager::GetInstance()->GetLCDConnection(); pLCDCon->SetAsForeground(1); pLCDCon->SetAsForeground(0); CAppletManager::GetInstance()->ActivateChatScreen(m_pEntry->pContact,m_pEntry->iConnectionID); } else SetExpiration(0); }
//************************************************************************ // Called when an LCD-button is pressed //************************************************************************ void CNotificationScreen::OnLCDButtonDown(int iButton) { CScreen::OnLCDButtonDown(iButton); if((iButton == LGLCDBUTTON_BUTTON2 || iButton == LGLCDBUTTON_RIGHT) && m_LNotifications.size() >= 1) { CNotificationEntry *pEntry = *(m_LNotifications.begin()); m_LNotifications.pop_front(); if(m_LNotifications.size() >= 1) SetButtonBitmap(2,IDB_NEXT); else SetButtonBitmap(2,NULL); DisplayNotification(pEntry); SetExpiration(CConfig::GetIntSetting(NOTIFY_DURATION)*1000); } else if((iButton == LGLCDBUTTON_BUTTON3 || iButton == LGLCDBUTTON_OK) && m_pEntry && m_pEntry->hContact) { SetExpiration(0); CLCDConnection *pLCDCon = CAppletManager::GetInstance()->GetLCDConnection(); pLCDCon->SetAsForeground(1); pLCDCon->SetAsForeground(0); CAppletManager::GetInstance()->ActivateChatScreen(m_pEntry->hContact); } else if(!m_MessageText.IsVisible()) { SetExpiration(0); } else { if(iButton == LGLCDBUTTON_BUTTON1 || iButton == LGLCDBUTTON_DOWN) { m_MessageText.ScrollDown(); } else if(iButton == LGLCDBUTTON_BUTTON0 || iButton == LGLCDBUTTON_UP) { m_MessageText.ScrollUp(); } SetExpiration(CConfig::GetIntSetting(NOTIFY_DURATION)*1000); } }