void InitInterface_RR(string iniName,ref myCh,ref enemyCh) { refMyCharacter = myCh; refEnemyCharacter = enemyCh; GameInterface.title = "titleRansack"; SendMessage(&GameInterface,"ls",MSG_INTERFACE_INIT,iniName); SetVariable(); ref shipRef = GetShipByType(sti(refMyCharacter.ship.Type)); CreateImage("myShip","SHIPS",shipRef.name,32,39,160,167); CreateImage("myFace","FACE128_"+refMyCharacter.FaceId,"face",164,39,292,167); CreateString(TRUE,"MyShipType",XI_ConvertString(shipRef.Name),FONT_NORMAL,COLOR_NORMAL,96,140,SCRIPT_ALIGN_CENTER,1.0); CreateString(TRUE,"MyShipName",refMyCharacter.ship.Name,FONT_NORMAL,COLOR_NORMAL,177,198,SCRIPT_ALIGN_CENTER,1.0); shipRef = GetShipByType(sti(refEnemyCharacter.ship.Type)); CreateImage("enemyShip","SHIPS",shipRef.name,480,39,608,167); CreateImage("enemyFace","FACE128_"+refEnemyCharacter.FaceId,"face",348,39,476,167); CreateString(TRUE,"EnemyShipType",XI_ConvertString(shipRef.Name),FONT_NORMAL,COLOR_NORMAL,544,140,SCRIPT_ALIGN_CENTER,1.0); CreateString(TRUE,"EnemyShipName",refEnemyCharacter.ship.Name,FONT_NORMAL,COLOR_NORMAL,463,198,SCRIPT_ALIGN_CENTER,1.0); CreateString(TRUE,"String1",XI_ConvertString(str1),FONT_NORMAL,COLOR_NORMAL,320,240,SCRIPT_ALIGN_CENTER,1.0); CreateString(TRUE,"String2",XI_ConvertString(str2),FONT_NORMAL,COLOR_NORMAL,320,268,SCRIPT_ALIGN_CENTER,1.0); CreateString(TRUE,"String3",XI_ConvertString(str3_1)+" "+nSurrenderedMen+" "+XI_ConvertString(str3_2),FONT_NORMAL,COLOR_NORMAL,320,296,SCRIPT_ALIGN_CENTER,1.0); SetEventHandler("InterfaceBreak","ProcessCancelExit",0); SetEventHandler("InterfaceCancel","ProcessCancelExit",0); SetEventHandler("KillPress","KillProcess",0); SetEventHandler("SlavesPress","SlavesProcess",0); }
void CGumpEntity::SetEventHandler(LPCTSTR szEvClick, LPCTSTR szEvClose, LPCTSTR szEvMouseUp, LPCTSTR szEvMouseDown, LPCTSTR szEvKeyPressed) { SetEventHandler(ONCLICK, szEvClick); SetEventHandler(ONCLOSE, szEvClose); SetEventHandler(ONMOUSEUP, szEvMouseUp); SetEventHandler(ONMOUSEDOWN, szEvMouseDown); SetEventHandler(ONKEYPRESSED, szEvKeyPressed); }
void BroadcastChannel::SetOnmessage(EventHandlerNonNull* aCallback) { if (NS_IsMainThread()) { SetEventHandler(nsGkAtoms::onmessage, EmptyString(), aCallback); } else { SetEventHandler(nullptr, NS_LITERAL_STRING("message"), aCallback); } UpdateMustKeepAlive(); }
void MediaDevices::SetOndevicechange(mozilla::dom::EventHandlerNonNull* aCallback) { if (NS_IsMainThread()) { SetEventHandler(nsGkAtoms::ondevicechange, EmptyString(), aCallback); } else { SetEventHandler(nullptr, NS_LITERAL_STRING("devicechange"), aCallback); } MediaManager::Get()->AddDeviceChangeCallback(this); }
ApplicationClass::ApplicationClass() { SetEventHandler( WProcessAttachEvent, this, (WEventHandler) ProcessAttachHandler ); SetEventHandler( WProcessDetachEvent, this, (WEventHandler) ProcessDetachHandler ); SetEventHandler( WThreadAttachEvent, this, (WEventHandler) ThreadAttachHandler ); SetEventHandler( WThreadDetachEvent, this, (WEventHandler) ThreadDetachHandler ); }
void InitInterface(string iniName) { GameInterface.title = "titleNationRelation"; SendMessage(&GameInterface,"ls",MSG_INTERFACE_INIT,iniName); CreateImage("England","relations",GetRelationName(GetNationRelation2MainCharacter(ENGLAND)),171,69,285,183); CreateImage("France","relations",GetRelationName(GetNationRelation2MainCharacter(FRANCE)),171,203,292,317); CreateImage("Spain","relations",GetRelationName(GetNationRelation2MainCharacter(SPAIN)),171,337,292,451); CreateImage("Pirate","relations",GetRelationName(GetNationRelation2MainCharacter(PIRATE)),489,69,603,183); CreateImage("Holland","relations",GetRelationName(GetNationRelation2MainCharacter(HOLLAND)),489,203,603,317); CreateImage("Portugal","relations",GetRelationName(GetNationRelation2MainCharacter(PORTUGAL)),489,337,603,451); SetEventHandler("InterfaceBreak","ProcessExitCancel",0); SetEventHandler("exitCancel","ProcessExitCancel",0); }
static void synopsis_toc_selected(char *pos) { long long position = 0; TSynopsisItem::PositionToLong(pos, &position); cpos = position; PBSynopsisItem *cur = SynTOC.GetCurrent(); if (cur != NULL && cur->GetType() == SYNOPSIS_PEN) { PBSynopsisPen *pen = (PBSynopsisPen *)cur; ChangeSettings(SynTOC.GetSettings()->GetFB2Settings(pen->GetSettingsId())); } int p = position_to_page(cpos); if (is_footnote_mode()) { ((FBReader *)mainApplication)->showBookTextView(); } // if (is_footnote_mode() || p >= npages) { if (p >= npages) { set_position(cpos); // mainApplication->doAction(ActionCode::PAGE_SCROLL_FORWARD); mainApplication->refreshWindow(); } else { cpos = page_to_position(p); set_position(cpos); mainApplication->refreshWindow(); } calc_position_changed = 1; SetEventHandler(PBMainFrame::main_handler); repaint_all(0); FlushMarker(cur); }
BOOLEAN KTdiStreamSocket::Listen(IN USHORT wRemotePort, IN ULONG dwRemoteAddress) { BOOLEAN bRes = FALSE; __try { if (m_bOpen == TRUE && m_bBind == TRUE && m_bConnected == FALSE && Disconnect() == TRUE) { m_nRemotePort = wRemotePort; m_nRemoteAddress = dwRemoteAddress; KeInitializeEvent(&m_kAcceptDestroyEvent, NotificationEvent, FALSE); KeInitializeEvent(&m_kListenEvent, NotificationEvent, FALSE); if (SetEventHandler(TDI_EVENT_CONNECT, (PVOID)ClientEventConnect, (PVOID)this)) { DbgPrint ("TdiListen: OK!!!\n"); m_bListen = TRUE; bRes = TRUE; } } } __finally { } return bRes; }
BOOL CGumpEntity::FromString( XML::Node* node ) { if (!CDiagramEntity::FromString(node)) return FALSE; std::string onclick, onclose, onmouseup, onmousedown, onkeypressed; int alpha=0,flags=0; node->lookupAttribute("alpha", alpha); node->lookupAttribute("flags", flags); XML::Node* event_node = node->findNode("event"); if (event_node) { event_node->lookupAttribute("onclick", onclick); event_node->lookupAttribute("onclose", onclose); event_node->lookupAttribute("onmouseup", onmouseup); event_node->lookupAttribute("onmousedown", onmousedown); event_node->lookupAttribute("onkeypressed", onkeypressed); } SetAlpha(alpha); SetFlags(flags); SetEventHandler(onclick.c_str(), onclose.c_str(), onmouseup.c_str(), onmousedown.c_str(), onkeypressed.c_str()); return TRUE; }
void InitInterface(string iniName) { GameInterface.title = "titleCharacterSelect"; GameInterface.faces.current = 0; SendMessage(&GameInterface,"ls",MSG_INTERFACE_INIT,iniName); //SetEventHandler("InterfaceBreak","DoSelect",0); SetEventHandler("DoSelect","DoSelect",0); }
void MIDIInput::SetOnmidimessage(EventHandlerNonNull* aCallback) { SetEventHandler(nsGkAtoms::onmidimessage, aCallback); if (mPort->ConnectionState() != MIDIPortConnectionState::Open) { mPort->SendOpen(); } }
kGUIDbTablesListWindowObj::kGUIDbTablesListWindowObj(kGUIDb *dbobj) { MYSQL *conn; MYSQL_RES *res_set; MYSQL_ROW row; m_dbobj=dbobj; SetEventHandler(this,CALLBACKNAME(WindowEvent)); SetTitle("Database tables"); SetPos(50,50); SetSize(600,500); m_def.SetPos(25,10); m_def.SetSize(150,20); m_def.SetString("Design View"); m_def.SetEventHandler(this,CALLBACKNAME(Design)); AddObject(&m_def); m_data.SetPos(200,10); m_data.SetSize(150,20); m_data.SetString("Data View"); m_data.SetEventHandler(this,CALLBACKNAME(Data)); AddObject(&m_data); m_newtable.SetPos(400,10); m_newtable.SetSize(150,20); m_newtable.SetString("New Table"); m_newtable.SetEventHandler(this,CALLBACKNAME(NewTable)); AddObject(&m_newtable); m_table.SetPos(0,50); m_table.SetSize(400,400); m_table.SetNumCols(1); m_table.SetColTitle(0,"Name"); m_table.SetColWidth(0,200); m_table.SetEventHandler(this,&CALLBACKNAME(WindowEvent)); m_table.SetAllowAddNewRow(true); AddObject(&m_table); conn=dbobj->GetConn(); res_set=mysql_list_tables(conn, 0); /* populate table */ while ((row = mysql_fetch_row(res_set)) != NULL) { kGUIDbTablesListRowObj *robj=new kGUIDbTablesListRowObj(dbobj); robj->SetName(row[0]); m_table.AddRow(robj); } mysql_free_result(res_set); /* automatically calculate */ //m_table.CalculateColWidths(); kGUI::AddWindow(this); }
void InitInterface(string iniName) { GameInterface.title = "titleSalary"; SendMessage(&GameInterface,"ls",MSG_INTERFACE_INIT,iniName); CalculateInfoData(); int tmpLangFileID = LanguageOpenFile("interface_strings.txt"); SetFormatedText("INFO_TEXT",LanguageConvertString(tmpLangFileID,"Salary info")); LanguageCloseFile(tmpLangFileID); SendMessage(&GameInterface,"lsl",MSG_INTERFACE_MSG_TO_NODE,"INFO_TEXT",5); SetEventHandler("InterfaceBreak","ProcessBreakExit",0) SetEventHandler("exitCancel","ProcessCancelExit",0); SetEventHandler("ievnt_command","ProcCommand",0); SetEventHandler("evntDoPostExit","DoPostExit",0); }
void EventTarget::SetEventHandler(const nsAString& aType, EventHandlerNonNull* aHandler, ErrorResult& aRv) { if (!StringBeginsWith(aType, NS_LITERAL_STRING("on"))) { aRv.Throw(NS_ERROR_INVALID_ARG); return; } if (NS_IsMainThread()) { nsCOMPtr<nsIAtom> type = NS_Atomize(aType); SetEventHandler(type, EmptyString(), aHandler); return; } SetEventHandler(nullptr, Substring(aType, 2), // Remove "on" aHandler); }
AsyncEvent AsyncByteStream::WaitNextEvent(timeout_type timeout) { AsyncEvent event = AsyncEvent::None; StreamEventHandler oldHandler = GetEventHandler(); RunLoopPtr oldRunLoop = EventTargetRunLoop(); SetTargetRunLoop(RunLoop::CurrentRunLoop()); SetEventHandler([&](AsyncEvent evt, AsyncByteStream* st) { event = evt; RunLoop::CurrentRunLoop()->Stop(); }); RunLoop::CurrentRunLoop()->Run(false, timeout); SetTargetRunLoop(oldRunLoop); SetEventHandler(oldHandler); return event; }
BOOLEAN KTdiStreamSocket::Accept(ULONG dwTimeOut) { //KLocker locker(&m_KSynchroObject); BOOLEAN bRes = FALSE; NTSTATUS NtStatus; PVOID pkEvents[2]; LARGE_INTEGER TimeOut; PLARGE_INTEGER pTimeOut = NULL; //m_KSynchroObject.Lock(); __try { if (m_bOpen == TRUE && m_bBind == TRUE && m_bConnected == FALSE && m_bListen == TRUE) { if (dwTimeOut != 0) { pTimeOut = &TimeOut; TimeOut.QuadPart = dwTimeOut * 10000; // msec -> 100 nsec intervals TimeOut.QuadPart = -TimeOut.QuadPart; } pkEvents[0] = &m_kListenEvent; pkEvents[1] = &m_kAcceptDestroyEvent; NtStatus = KeWaitForMultipleObjects(2, pkEvents, WaitAny, Suspended, KernelMode, TRUE, pTimeOut, NULL); if (NtStatus == STATUS_WAIT_0) { if (NT_SUCCESS(m_ListenStatusBlock.Status)) { SetEventHandler(TDI_EVENT_CONNECT, (PVOID)NULL, (PVOID)NULL); m_bConnected = TRUE; bRes = TRUE; DbgPrint ("TdiAccept: OK (%08x : %04x)!!!\n", m_nRemoteAddress, m_nRemotePort); } else { DbgPrint ("TdiAccept: ERROR (%08x)!!!\n", NtStatus); } } } } __finally { } //m_KSynchroObject.UnLock(); return bRes; }
void EventTarget::SetEventHandler(const nsAString& aType, EventHandlerNonNull* aHandler, ErrorResult& aRv) { if (!StringBeginsWith(aType, NS_LITERAL_STRING("on"))) { aRv.Throw(NS_ERROR_INVALID_ARG); return; } RefPtr<nsAtom> type = NS_Atomize(aType); SetEventHandler(type, aHandler); }
static void stop_search() { ClearTimer(search_timer); delete textout; delete searchout; free(stext); stext = NULL; search_mode = 0; scale = savescale; reflow_mode = savereflow; SetEventHandler(PBMainFrame::main_handler/*main_handler*/); }
nsresult DOMEventTargetHelper::SetEventHandler(nsIAtom* aType, JSContext* aCx, const JS::Value& aValue) { RefPtr<EventHandlerNonNull> handler; JS::Rooted<JSObject*> callable(aCx); if (aValue.isObject() && JS::IsCallable(callable = &aValue.toObject())) { handler = new EventHandlerNonNull(aCx, callable, dom::GetIncumbentGlobal()); } SetEventHandler(aType, EmptyString(), handler); return NS_OK; }
kGUIDbTableDataWindowObj::kGUIDbTableDataWindowObj(kGUIDb *dbobj,const char *tablename) { kGUIDbQuery *q; const char **row; unsigned int i; unsigned int numfields; int *coltypes; SetEventHandler(this,CALLBACKNAME(WindowEvent)); SetTitle(tablename); SetPos(50,50); SetSize(800,500); m_table.SetPos(0,0); m_table.SetSize(700,400); kGUI::SetMouseCursor(MOUSECURSOR_BUSY); q=new kGUIDbQuery(dbobj,"SELECT * FROM %s",tablename); numfields=q->GetNumFields(); m_table.SetNumCols(numfields); for(i=0; i<numfields; ++i) { m_table.SetColTitle(i,q->GetFieldName(i)); m_table.SetColWidth(i,200); } /* build a table of field types for display */ coltypes=new int[numfields]; for(i=0; i<numfields; ++i) { if(q->GetFieldType(i)==MYSQL_TYPE_TINY && q->GetFieldLength(i)==1) coltypes[i]=1; else coltypes[i]=0; } /* populate table */ while ((row = q->GetRow()) != NULL) { kGUIDbTableDataRowObj *robj=new kGUIDbTableDataRowObj(numfields,coltypes,row); m_table.AddRow(robj); } /* automatically calculate */ m_table.CalculateColWidths(); delete q; delete []coltypes; AddObject(&m_table); kGUI::AddWindow(this); kGUI::SetMouseCursor(MOUSECURSOR_DEFAULT); }
void synopsis_toc_handler(char *cposition) { long long position; TSynopsisItem::PositionToLong(cposition, &position); // cpage = position_to_page(position); cpage = position >> 40; if (cpage < 1) cpage = 1; if (cpage > npages) cpage = npages; subpage = 0; offx = offy = 0; out_page(1); SetEventHandler(PBMainFrame::main_handler); }
void ServiceWorkerGlobalScope::SetOnfetch( mozilla::dom::EventHandlerNonNull* aCallback) { MOZ_ASSERT(mWorkerPrivate); mWorkerPrivate->AssertIsOnWorkerThread(); if (aCallback) { if (mWorkerPrivate->WorkerScriptExecutedSuccessfully()) { RefPtr<Runnable> r = new ReportFetchListenerWarningRunnable(mScope); mWorkerPrivate->DispatchToMainThreadForMessaging(r.forget()); } mWorkerPrivate->SetFetchHandlerWasAdded(); } SetEventHandler(nsGkAtoms::onfetch, aCallback); }
int main() { #ifdef WIN32 WSADATA wsa_data; WSAStartup(MAKEWORD(2,1), &wsa_data); #endif CPipeEventServerHandler::InitMsgHandle(); auto reactor = new CPipeReactor; reactor->SetEventHandler(new CNetEventServerHandler); reactor->Listen(23456); reactor->Close(); delete reactor; return 0; }
BOOL CGumpEditorDoc::OnNewDocument() { if (!CDialogEditorDemoDoc::OnNewDocument()) return FALSE; // TODO: add reinitialization code here // (SDI documents will reuse this document) SetName(""); SetAlpha(0); SetFade(0,0); SetEventHandler("","","","",""); SetShapeName(""); m_objs.Clear(); m_objs.SetVirtualSize(CSize(m_iDefWidth,m_iDefHeight)); return TRUE; }
void search_enter(char* text) { if (text == NULL || text[0] == 0) return; savescale = scale; savereflow = reflow_mode; scale = 105; reflow_mode = 0; textout = new TextOutputDev(NULL, gFalse, gFalse, gFalse); searchout = new SearchOutputDev(text); if (! textout->isOk()) { fprintf(stderr, "cannot create text output device\n"); return; } SetEventHandler(search_handler); do_search(text, cpage, +1); }
bool CProxySocket::Start(const wxIPaddress &peerAddress) { SaveState(); // Important note! SaveState()/RestoreState() DO NOT save/restore // the event handler. The method SaveEventHandler() has been created // for that. SaveEventHandler(); SetEventHandler(g_proxyEventHandler, ID_PROXY_SOCKET_EVENT); SetNotify( wxSOCKET_CONNECTION_FLAG | wxSOCKET_INPUT_FLAG | wxSOCKET_OUTPUT_FLAG | wxSOCKET_LOST_FLAG); Notify(true); Connect(m_proxyAddress, false); SetFlags(wxSOCKET_NONE); bool ok = m_proxyStateMachine->Start(peerAddress, this); return ok; }
void InitBaseInterfaces() { SetEventHandler("GetQuestTextFileName","GetQuestTextFileName",0); GameInterface.GameTime.sec = InterfaceStates.GameTime.sec; GameInterface.GameTime.min = InterfaceStates.GameTime.min; GameInterface.GameTime.hour = InterfaceStates.GameTime.hour; CreateEntity(&GameInterface,"xinterface"); DelEventHandler("GetQuestTextFileName","GetQuestTextFileName"); LayerAddObject("iExecute",&GameInterface,-100); LayerAddObject("iRealize",&GameInterface,-100); if(!IsEntity(&LanguageObject)) { CreateEntity(&LanguageObject,"obj_strservice"); } InitLogInterface(); InitBattleLandInterface(); InterfaceStates.Launched = false; if( storeDayUpdateCnt>=0 ) // обновление магазина можно включить { Event("EvStoreDayUpdate"); } }
void CGumpEditorDoc::OnSettings() { CGumpEditorView* pView = (CGumpEditorView*)FindView(RUNTIME_CLASS(CGumpEditorView)); if (!pView) return; CDEditor& editor = pView->GetDEditor(); CDialogSettings dlg; dlg.m_width = editor.GetVirtualSize().cx; dlg.m_height = editor.GetVirtualSize().cy; dlg.m_gridWidth = editor.GetGridSize().cx; dlg.m_gridHeight = editor.GetGridSize().cy; editor.GetMargins( dlg.m_marginLeft, dlg.m_marginTop, dlg.m_marginRight, dlg.m_marginBottom ); dlg.m_strName = GetName(); dlg.m_iAlpha = GetAlpha(); dlg.m_iFlags = GetFlags(); dlg.m_iFadeAlpha = GetFadeAlpha(); dlg.m_iFadeTime = GetFadeTime(); dlg.m_strShapeName = GetShapeName(); GetEventHandler(dlg.m_strEvClick, dlg.m_strEvClose, dlg.m_strEvMouseUp, dlg.m_strEvMouseDown, dlg.m_strEvKeyPressed); if( dlg.DoModal() == IDOK ) { editor.SetGridSize( CSize( dlg.m_gridWidth, dlg.m_gridHeight ) ); editor.SetVirtualSize( CSize( dlg.m_width, dlg.m_height ) ); editor.SetMargins( dlg.m_marginLeft, dlg.m_marginTop, dlg.m_marginRight, dlg.m_marginBottom ); SetName(dlg.m_strName); SetAlpha(dlg.m_iAlpha); SetFlags(dlg.m_iFlags); SetFade(dlg.m_iFadeAlpha, dlg.m_iFadeTime); SetShapeName(dlg.m_strShapeName); SetEventHandler(dlg.m_strEvClick, dlg.m_strEvClose, dlg.m_strEvMouseUp, dlg.m_strEvMouseDown, dlg.m_strEvKeyPressed); editor.RedrawWindow(); } }
CListenSocket::CListenSocket(wxIPaddress &addr, const CProxyData *ProxyData) : // wxSOCKET_NOWAIT - means non-blocking i/o // wxSOCKET_REUSEADDR - means we can reuse the socket imediately (wx-2.5.3) CSocketServerProxy(addr, wxSOCKET_NOWAIT|wxSOCKET_REUSEADDR, ProxyData) { // 0.42e - vars not used by us bListening = false; shutdown = false; m_OpenSocketsInterval = 0; m_nPendingConnections = 0; totalconnectionchecks = 0; averageconnections = 0.0; // Set the listen socket event handler -- The handler is written in amule.cpp if (IsOk()) { SetEventHandler(*theApp, ID_LISTENSOCKET_EVENT); SetNotify(wxSOCKET_CONNECTION_FLAG); Notify(true); AddLogLineNS(_("ListenSocket: Ok.")); } else { AddLogLineCS(_("ERROR: Could not listen to TCP port.") ); } }
wxDynamicSashWindow::~wxDynamicSashWindow() { SetEventHandler(this); delete m_impl; }