//++ ------------------------------------------------------------------------------------ // Details: Set up the events from the SBDebugger's we would like to listen to. // Type: Method. // Args: None. // Return: MIstatus::success - Functionality succeeded. // MIstatus::failure - Functionality failed. // Throws: None. //-- bool CMICmnLLDBDebugger::InitSBListener() { m_lldbListener = m_lldbDebugger.GetListener(); if (!m_lldbListener.IsValid()) { SetErrorDescription(MIRSRC(IDS_LLDBDEBUGGER_ERR_INVALIDLISTENER)); return MIstatus::failure; } const CMIUtilString strDbgId("CMICmnLLDBDebugger1"); MIuint eventMask = lldb::SBTarget::eBroadcastBitBreakpointChanged | lldb::SBTarget::eBroadcastBitModulesLoaded | lldb::SBTarget::eBroadcastBitModulesUnloaded | lldb::SBTarget::eBroadcastBitWatchpointChanged | lldb::SBTarget::eBroadcastBitSymbolsLoaded; bool bOk = RegisterForEvent(strDbgId, CMIUtilString(lldb::SBTarget::GetBroadcasterClassName()), eventMask); eventMask = lldb::SBThread::eBroadcastBitStackChanged; bOk = bOk && RegisterForEvent(strDbgId, CMIUtilString(lldb::SBThread::GetBroadcasterClassName()), eventMask); eventMask = lldb::SBProcess::eBroadcastBitStateChanged | lldb::SBProcess::eBroadcastBitInterrupt | lldb::SBProcess::eBroadcastBitSTDOUT | lldb::SBProcess::eBroadcastBitSTDERR | lldb::SBProcess::eBroadcastBitProfileData; bOk = bOk && RegisterForEvent(strDbgId, CMIUtilString(lldb::SBProcess::GetBroadcasterClassName()), eventMask); eventMask = lldb::SBCommandInterpreter::eBroadcastBitQuitCommandReceived | lldb::SBCommandInterpreter::eBroadcastBitThreadShouldExit | lldb::SBCommandInterpreter::eBroadcastBitAsynchronousOutputData | lldb::SBCommandInterpreter::eBroadcastBitAsynchronousErrorData; bOk = bOk && RegisterForEvent(strDbgId, m_lldbDebugger.GetCommandInterpreter().GetBroadcaster(), eventMask); return bOk; }
Message::Message(Message::Type type_, const std::string& title_, const std::string& message_, const std::string& answerEventName_, bool pause_) { RegisterForEvent("WINDOW_RESIZE", [this](Event& e) { updatePosition(); }); RegisterForEvent("TOGGLE_FULLSCREEN", [this](Event& e) { updatePosition(); }); Type_ = type_; Title_ = title_; Message_ = message_; AnswerEventName_ = answerEventName_; pause = pause_; }
BOOL CControlsModule::onInit(PPBSTRUCT pPBStructure) { WNDCLASS wndclass; LPFNREGKEYNOTIFY reg_keystate; LPFNREGKEYBOARDNOTIFY reg_keyboard; wcscpy (m_szModName, MODULE_NAME); // Preload the Fusion library - it crashes if it's loaded after a previous navigation LoadLibrary (L"FusionPublicAPI.dll"); //RegisterForEvent (PB_APPFOCUSEVENT); RegisterForEvent (PB_BROWSER_BEFORE_NAV_EVENT); RegisterForEvent (PB_BROWSER_DOC_COMPLETE_EVENT); RegisterForEvent (PB_PRIMARY_MESSAGE); RegisterForEvent (PB_WINDOWCHANGED_EVENT); // Create an invisible window to receive key state messages // Only a single window needed because there is only a single physical keyboard // Return TRUE on error as the user may not be using key state in any case memset (&wndclass, 0, sizeof wndclass); wndclass.lpfnWndProc = StaticKeyWindowProc; wndclass.hInstance = pPBStructure->hInstance; wndclass.lpszClassName = L"KeyStateEvent"; RegisterClass (&wndclass); hKeyStateWindow = CreateWindow (L"KeyStateEvent", NULL, 0, 0, 0, 0, 0, NULL, (HMENU) 0, pPBStructure->hInstance, NULL); if (!hKeyStateWindow) { WRITELOG (L"Cannot create key state event window"); return TRUE; } // Add a pointer to ourselves to the window SetWindowLong (hKeyStateWindow, GWL_USERDATA, (LONG) this); // Load the keyboard driver DLL hKeyboardDriver = LoadLibrary (KEYBOARD_DLL); if (!hKeyboardDriver) { WRITELOG (L"Cannot load keyboard driver DLL"); return TRUE; } // Register for key state events reg_keystate = (LPFNREGKEYNOTIFY) GetProcAddress (hKeyboardDriver, REGKEYNOTIFY); if (reg_keystate) (*reg_keystate) (hKeyStateWindow, KEY_EVENT); reg_keyboard = (LPFNREGKEYBOARDNOTIFY) GetProcAddress (hKeyboardDriver, REGKEYBOARDNOTIFY); if (reg_keyboard) (*reg_keyboard) (hKeyStateWindow, KEYBOARD_EVENT); return true; }
BarbedWire::BarbedWire() { m_fCurrHP = m_fMaxHP = 50.0f; m_fDamage = 2.0f; RegisterForEvent("REPAIR_BARBEDWIRE"); RegisterForEvent("UPGRADE_BARBEDWIRE_HEALTH"); RegisterForEvent("UPGRADE_BARBEDWIRE_DAMAGE"); }
LandMine::LandMine() { this->SetType(ObjectType::OBJ_LANDMINE); this->SetAnimation("landmine"); RegisterForEvent("REPAIR_LANDMINES"); }
SandBag::SandBag() { this->SetType(ObjectType::OBJ_SANDBAG); this->SetAnimation("sandbag"); m_fCurrHP = m_fMaxHP = 250.0f; RegisterForEvent("REPAIR_SANDBAGS"); }
FatZombie::FatZombie() { health = 200.0f; damage = 20.0f; //damage = 3.0f; //pukeBlaster = new PukerBlaster(this); RegisterForEvent("GAME_OVER"); }
MainMenu::MainMenu( const glm::ivec2 Size ) { RegisterForEvent( "EVT_FRAME" ); RegisterForEvent( "MESSAGE_ANSWER_MAINMENU" ); RegisterForEvent( "TOGGLE_SHOW_MAINMENU" ); RegisterForEvent( "FB_CANCEL" ); RegisterForEvent( "FB_OK" ); RegisterForEvent("EVT_SAVE_GOOD"); RegisterForEvent("EVT_SAVE_BAD"); RegisterForEvent("EVT_LOAD_BAD"); RegisterForEvent("EVT_LOAD_GOOD"); currentlabeltext = 0; InitWindow( Size ); Win->Show( false ); }
//////////////////////////////////////////////////////////////////////////////// // Description: Method that is called when a module receives the first preload. // // Scope: Public // // Authors: Mike Schuette // Change History: // Oct 2009 - Created //////////////////////////////////////////////////////////////////////////////// BOOL CCardReaderMod::onInit(PBStruct *pPBStructure) { _tcscpy(m_szModName, L"CardReader"); if (m_hStopEvent == INVALID_HANDLE_VALUE) // Create an event so that main routine can signal CardReaderReadThread to exit m_hStopEvent = CreateEvent(NULL, FALSE, FALSE, NULL); if (m_hKeypadMutex == INVALID_HANDLE_VALUE) // Create a mutex to suspend a card reader close until the user's PIN has been entered m_hKeypadMutex = CreateMutex(NULL, FALSE, NULL); //Register for change in app focus events RegisterForEvent(PB_BROWSER_BEFORE_NAV_EVENT); RegisterForEvent(RHO_APPFOCUS_EVENT); //by default close the reader during a page navigate m_bReaderStayOpen = FALSE; m_eResumeAction = NONE; return RegisterForEvent(PB_APPFOCUSEVENT); }
// EventBinder EventBinder::EventBinder(const std::string& trigger, std::function<void(const Event&)> _action) { this->action = _action; RegisterForEvent(trigger, [this](Event& e) { action(e); }); }
/** * \author Darryn Campbell (DCC, JRQ768) * \date November 2009 */ BOOL CPowerOnModule::onInit(PPBSTRUCT pPBStructure) { wcscpy (m_szModName, L"PowerOn"); RegisterForEvent(PB_BROWSER_BEFORE_NAV_EVENT); return TRUE; }