HRESULT CLuaMultiEventContainer::AttachEvent(lua_State* pLuaState, int nIndex, DWORD& dwCookie) { std::wstring strEventName = LuaGetString(pLuaState, nIndex); HRESULT hr = S_OK; hr = AttachEvent(strEventName, pLuaState, nIndex + 1, dwCookie); return hr; }
bool PluginWebView::OnAttach() { EvtManagerTop& ec(wm.evtmgr); ec.link_a<String>("Webview.script"); ec.table["Webview.script"].ref<String>(); ec.append(new EvtCommand("Webview.Exec")); ec.append(new EvtCommand("Webview.Clear")); AttachEvent("Webview.Exec"); AttachEvent("Webview.Clear"); WndModelWvScript* pmdl=new WndModelWvScript(wm); ec.append(pmdl); ec.gp_beg("OtherWindow"); ec.gp_add(new EvtCommandShowModel("Webview.Script",pmdl)); ec.gp_end(); ec.gp_beg(_kT("Webview.Page")); ec.gp_add("Forward"); ec.gp_end(); ec.gp_beg("Menu.Extra"); ec.gp_add("Webview.Page"); ec.gp_end(); ec["Webview.Page"].flags.add(EvtCommand::FLAG_HIDE_UI); ec.gp_beg(_kT("tb.WebView")); ec.gp_add(new EvtCommandCtrl("WebView.URL","searchctrl",WndProperty().width(320))); ec.gp_add(new EvtCommand(_kT("WebView.Go"))); ec.gp_end(); AttachEvent("WebView.URL"); AttachEvent("WebView.Go"); ec.gp_beg("ToolBar.default"); ec.gp_add("tb.WebView"); ec.gp_end(); return true; }
bool PluginSearch::OnAttach() { EvtManagerTop& ec(wm.evtmgr); //DataPtrT<WndModelFindSearch> pevt(new WndModelFindSearch(wm)); //ec.append(pevt.get()); ec.append(new WndModelScript("Model.Search","scripting/ui/dlg_search.script"));//,WndModel::FLAG_AUTO_FIT|WndModel::FLAG_NO_CLOSE)); ec.gp_beg("CmdProc"); ec.gp_add(new EvtCmdShowSearch(wm,_kT("Find"),CmdProc::CP_FIND)); ec.gp_add(new EvtCmdShowSearch(wm,_kT("Replace"),CmdProc::CP_REPLACE)); ec.gp_add(new EvtCmdSearch(wm,_kT("Btn.Find"),CmdProc::CP_FIND)); ec.gp_add(new EvtCmdSearch(wm,_kT("Btn.Replace"),CmdProc::CP_REPLACE)); ec.gp_add(new EvtCmdSearch(wm,_kT("Btn.ReplaceAll"),CmdProc::CP_REPLACEALL)); ec.gp_end(); ec.append(new EvtCommand("search.replace")); IDat_search& data(IDat_search::current()); ec.gp_beg("search.group"); ec.link("search.text_old",data.text_old); ec.link("search.text_new",data.text_new); ec.link("search.case",data.flags,4); ec.link("search.word",data.flags,2); ec.link("search.regexp",data.flags,0x00200000); ec.gp_end(); ec["search.group"].flags.add(EvtBase::FLAG_RECURSIVE); AttachEvent("search.text_old"); AttachEvent("search.text_new"); AttachEvent("search.regexp"); AttachEvent("search.replace"); return true; }
// This is called by IE to notify us of events // http://msdn.microsoft.com/en-us/library/aa768283(VS.85).aspx STDMETHODIMP CEventSink::Invoke(DISPID dispIdMember,REFIID riid,LCID lcid,WORD wFlags,DISPPARAMS *pDispParams,VARIANT *pVarResult,EXCEPINFO *pExcepInfo,UINT *puArgErr) { UNREFERENCED_PARAMETER(lcid); UNREFERENCED_PARAMETER(wFlags); UNREFERENCED_PARAMETER(pVarResult); UNREFERENCED_PARAMETER(pExcepInfo); UNREFERENCED_PARAMETER(puArgErr); if(!IsEqualIID(riid,IID_NULL)) return DISP_E_UNKNOWNINTERFACE; // riid should always be IID_NULL /* Order: [6184] HTTPSEverywhere DISPID_COMMANDSTATECHANGE [6184] HTTPSEverywhere DISPID_COMMANDSTATECHANGE [6184] HTTPSEverywhere DISPID_DOWNLOADCOMPLETE [6184] HTTPSEverywhere DISPID_COMMANDSTATECHANGE [6184] HTTPSEverywhere DISPID_NAVIGATECOMPLETE2 */ if(dispIdMember == DISPID_DOCUMENTCOMPLETE) { // DWebBrowserEvents2::DocumentComplete //Debug::Log("DISPID_DOCUMENTCOMPLETE"); CheckForUpdate(); } else if(dispIdMember==DISPID_NAVIGATECOMPLETE2) { // DWebBrowserEvents2::NavigateComplete2 Debug::Log("DISPID_NAVIGATECOMPLETE2"); AttachEvent(pDispParams->rgvarg[1].pdispVal); // helps a bit but not enough for HTTP script } else if (dispIdMember==DISPID_WINDOWSTATECHANGED) { //Debug::Log("DISPID_WINDOWSTATECHANGED"); DWORD dwMask = pDispParams->rgvarg[0].lVal; DWORD dwFlags = pDispParams->rgvarg[1].lVal; // Is tab visible? if (dwMask & OLECMDIDF_WINDOWSTATE_USERVISIBLE) { visible = dwFlags & OLECMDIDF_WINDOWSTATE_USERVISIBLE; } } /*else if (dispIdMember==DISPID_ONQUIT) { Debug::Log("ONQUIT"); //WinInetRemoveHooks(); //Debug::Log("Wininet hook removed"); }*/ return S_OK; }
/** * @fn void InitSystem(void) * * @brief This function initializes the microcontroller peripherals needed, the * application and the protocol. */ void InitSystem(void) { // Initialize microcontroller peripherals and application. // Disable all interrupts while setting up microcontroller. __BSP_DISABLE_INTERRUPT(); // Halt the watchdog. WatchdogHold(); // Stop the watchdog timer Nodes[0].ID = CreateRandomAddress(); // Generate a random address. This must be done // before the clocks and ADC are initialized. // Setup board clock system. BoardClockSystemInit(); // Intialize the system clocks SetOFIEBit(0); // Disable Osc Fault interrupt SetOFIFGBit(0); // Clear Osc Fault interrupt flag FCTL2 = FWKEY | FSSEL_1 | 19; SetMyNodeID(0); // Set node ID. The Flash block requires the clock // to be configured prior to calling this function. // Setup timers. TimerConfigure(__BSP_TIMER1); // Initialize Timer1 AttachEvent(__BSP_TIMER1_CCR0_EVENT_HANDLE, Timer1CCREventHandler); AttachEvent(__BSP_TIMER1_CCR1_EVENT_HANDLE, Timer1CCREventHandler); TimerConfigure(__BSP_TIMER2); // Initialize Timer2 AttachEvent(__BSP_TIMER2_CCR0_EVENT_HANDLE, Timer2CCREventHandler); TimerSetCCR(__BSP_TIMER2, __BSP_TIMER2_CCR0, __BSP_CONFIG_SWTIMER1_SOURCE_DIV); // Setup software timers. SoftwareTimerConfigure(); // Initialize Software Timer SoftwareTimerSetInterval(__BSP_SWTIMER[0], 100); SoftwareTimerEnable(__BSP_SWTIMER[0]); AttachEvent(__BSP_SWTIMER[0].event, SWTimer0EventHandler); // AttachEvent(__BSP_SWTIMER[1].event, SWTimer1EventHandler); RadioConfigure(&__BSP_RADIO1_CONNECTION); // Initialize the Radio Communication module // Setup UART. UARTConfigure(__BSP_UART1); // Initialize the UART Communication module AttachEvent(__BSP_UART1_RX_EVENT_HANDLE, UARTRXEventHandler); // Attach UART RX event handler // Setup LEDs. LEDConfigure(__BSP_LEDRED1); // Initialize the Red LED LEDConfigure(__BSP_LEDGREEN1); // Initialize the Green LED // Setup push button. PushButtonConfigure(__BSP_PUSHBUTTON1); // Initialize push button. AttachEvent(__BSP_PUSHBUTTON1_EVENT_HANDLE, PushButton1EventHandler); AttachEvent(__BSP_PORT1_EVENT_HANDLE, PortEventHandler); AttachEvent(__BSP_PORT2_EVENT_HANDLE, PortEventHandler); // Setup ADC. ADCChannelConfigure(__BSP_ADC1, __BSP_ADC1_CHAN9); // Initialize ADC channel. ADCReferenceOn(__BSP_ADC1); ADCEnableInterrupt(__BSP_ADC1); ADCOn(__BSP_ADC1); ADCEnableConversion(__BSP_ADC1); AttachEvent(__BSP_ADC1_EVENT_HANDLE, ADCEventHandler); // Setup Application. InitApplication(Nodes[0].ID); // Initialize the Application (application state of the module, supporting protocol) // Start timers in "UP" mode. TimerEnable(__BSP_TIMER1, UP_MODE); // Start the timer prior to enabling interrupts TimerEnable(__BSP_TIMER2, UP_MODE); // Start the timer prior to enabling interrupts // Enable interrupts now that microcontroller is ready for normal operation. __BSP_ENABLE_INTERRUPT(); }
/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aStateFlags, in nsresult aStatus); */ NS_IMETHODIMP BrowserWindow::OnStateChange(nsIWebProgress* progress, nsIRequest* request, PRUint32 state, nsresult status) { owner->events->OnStateChange(progress, request, status, state); bool netstop = ( state & STATE_STOP ) && ( state & STATE_IS_NETWORK ) && ( status == NS_OK ); bool windowstop = ( state & STATE_STOP ) && ( state & STATE_IS_WINDOW ) && ( status == NS_OK ); if (netstop) { bool/* PRBool */ visibility; this->GetVisibility(&visibility); if (visibility) this->SetVisibility(PR_TRUE); } if ( windowstop ) { nsCOMPtr< nsIDOMWindow > window; nsresult result = progress->GetDOMWindow( getter_AddRefs( window ) ); nsCOMPtr< nsIDOMEventTarget > target = do_QueryInterface( window ); AttachEvent ( target, "window", "load" ); AttachEvent ( target, "window", "unload" ); #ifndef NS_WIN32 AttachEvent ( target, "window", "focus" ); #endif AttachEvent ( target, "window", "blur" ); AttachEvent ( target, "window", "abort" ); AttachEvent ( target, "window", "error" ); AttachEvent ( target, "window", "activate" ); AttachEvent ( target, "window", "deactivate" ); AttachEvent ( target, "window", "focusin" ); AttachEvent ( target, "window", "focusout" ); AttachEvent ( target, "window", "input" ); AttachEvent ( target, "window", "select" ); AttachEvent ( target, "window", "change" ); AttachEvent ( target, "window", "submit" ); AttachEvent ( target, "window", "reset" ); AttachEvent ( target, "window", "keydown" ); AttachEvent ( target, "window", "keypress" ); AttachEvent ( target, "window", "keyup" ); AttachEvent ( target, "window", "click" ); AttachEvent ( target, "window", "dblclick" ); AttachEvent ( target, "window", "mousedown" ); AttachEvent ( target, "window", "mouseup" ); AttachEvent ( target, "window", "mouseover" ); AttachEvent ( target, "window", "mouseout" ); AttachEvent ( target, "window", "mousemove" ); AttachEvent ( target, "window", "popupshowing" ); AttachEvent ( target, "window", "popupshown" ); AttachEvent ( target, "window", "popuphiding" ); AttachEvent ( target, "window", "popuphidden" ); } return NS_OK; }