本文整理汇总了C++中wxPostEvent函数的典型用法代码示例。如果您正苦于以下问题:C++ wxPostEvent函数的具体用法?C++ wxPostEvent怎么用?C++ wxPostEvent使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wxPostEvent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
void* wxProcessTerminationThread::Entry()
{
while (true)
{
usleep(100);
int status = 0;
int rc = waitpid(abs(m_data->pid), & status, 0);
if (rc != 0)
{
if ((rc != -1) && WIFEXITED(status))
m_data->exitcode = WEXITSTATUS(status);
else
m_data->exitcode = -1;
wxProcessEvent event;
wxPostEvent(m_handler, event);
break;
}
}
return NULL;
}
示例2: evt
// if diff > 0 show next, else show previous
bool PicViewCtrl::ShowPageByDiffNumber(const int diff, bool bWantRet)
{
int cnt = m_pList->GetItemCount();
int cursel = m_pList->GetSelection();
int nextsel = 0;
if(cursel != wxNOT_FOUND)
{
nextsel = ((cursel+diff) > cnt-1 ? cnt-1 : (cursel+diff));
nextsel = nextsel < 0 ? 0 : nextsel;
}
if(nextsel != cursel)
{
m_pList->SetSelection(nextsel);
wxCommandEvent evt(wxEVT_COMMAND_LISTBOX_SELECTED, wxID_ANY);
evt.SetInt(nextsel);
if(!bWantRet)
wxPostEvent(m_pFrame, evt);
else
((MainFrame*)m_pFrame)->OnThumbnailLboxSelect(evt);
return true;
}
return false;
}
示例3: socket
void Server::run()
{
Poco::Net::ServerSocket socket(port);
running = true;
while (running)
{
if (socket.poll(Poco::Timespan(1, 0),
Poco::Net::ServerSocket::SELECT_READ))
{
Poco::Net::StreamSocket ss = socket.acceptConnection();
DebugThread *runnable = new DebugThread(ss);
ClientThread *c = new ClientThread(new Poco::Thread(), runnable);
clients.push_back(c);
wxCommandEvent event(wxEVT_MY_EVENT_ADD_DEBUG_THREAD);
event.SetClientData((void *) runnable);
wxPostEvent(mainFrame, event);
c->thread->start(*(c->runnable));
}
}
BOOST_FOREACH(ClientThread *c, clients)
{
c->runnable->stop();
c->thread->join();
delete c->runnable;
delete c->thread;
delete c;
}
示例4: OnFile
virtual wxDirTraverseResult OnFile(const wxString& filename)
{
if(m_pThread->TestDestroy())
{
m_files.Clear();
return wxDIR_STOP;
}
wxFileName fn( filename );
const tSongClass *psc = CMetaDataHandler::GetSongClass(fn.GetExt());
if (psc)
{
m_files.Add( filename );
if ( m_files.GetCount() % 100 == 0 )
{
wxCommandEvent UpdateScanProg( wxEVT_COMMAND_MENU_SELECTED, MUSIK_LIBRARY_THREAD_SCAN_PROG );
UpdateScanProg.SetExtraLong((long)m_files.GetCount());
wxPostEvent( m_pThread->Parent(), UpdateScanProg );
}
}
return wxDIR_CONTINUE;
}
示例5: wxLogDebug
bool ProjectManager::PushModificationToHistory(bool force)
{
wxDateTime maintenant=wxDateTime::UNow();
if(force || (maintenant-lastHistoryUpdate).GetMilliseconds()>UNDO_HISTORY_TIMESTEP)
{
lastHistoryUpdate=maintenant;
if(this->rootUserConfig->GetElementByLibelle("mainpref")->GetElementByLibelle("history")->GetBoolConfig("keep_modification_history"))
{
if(!force)
wxLogDebug(_("Add modifications in the change log"));
else
wxLogDebug(_("Forced adding changes in the change log."));
this->UpdateXmlFile("",false);
configHistory.Add(new wxXmlDocument(projetConfig));
//Dû à la modification on perd soit la plus vieille modification soit tout les dernieres modifications ( en fonction de l'etat de navigation dans l'historique)
if(currentHistoryNavigation==0)
{
if(configHistory.size()>UNDO_HISTORY_SIZE)
configHistory.RemoveAt(0);
}else{
//L'utilisateur a fait annuler et il a ensuite modifié le projet, l'utilisateur ne peut donc plus utiliser refaire
//Supprime de la version courante jusqu'à la dernière version
configHistory.RemoveAt(configHistory.size()-currentHistoryNavigation,currentHistoryNavigation-1);
currentHistoryNavigation=0;
}
wxCommandEvent eventUpdate( wxEVT_PSPS_MAIN_EVENT, mainFrame->GetId() );
eventUpdate.SetInt(ApplicationConfiguration::MAIN_EVENT_UNDO_REDO_UPDATE);
wxPostEvent(mainFrame,eventUpdate);
return true;
}else{
return false;
}
}else{
return false;
}
}
示例6: LOG_DEBUG
void CslIrcThread::LibIrcError(CslIrcContext *context,wxInt32 error)
{
LOG_DEBUG("libirc error (%d): \n",error,irc_strerror(errno));
wxEvtHandler *handler=context->EvtHandler;
CslIrcEvent evt(context->Target,CslIrcEvent::ERR);
evt.Strings.Add(A2U(irc_strerror(error)));
evt.Ints.Add(error);
switch (error)
{
case LIBIRC_ERR_INVAL:
wxASSERT_MSG(error!=LIBIRC_ERR_INVAL,wxT("Invalid arguments."));
break;
case LIBIRC_ERR_RESOLV:
case LIBIRC_ERR_SOCKET:
case LIBIRC_ERR_CONNECT:
case LIBIRC_ERR_CLOSED:
case LIBIRC_ERR_NOMEM:
RemoveContext(context);
break;
case LIBIRC_ERR_ACCEPT:
case LIBIRC_ERR_NODCCSEND:
case LIBIRC_ERR_READ:
case LIBIRC_ERR_WRITE:
case LIBIRC_ERR_STATE:
case LIBIRC_ERR_TIMEOUT:
case LIBIRC_ERR_OPENFILE:
break;
case LIBIRC_ERR_TERMINATED:
RemoveContext(context);
break;
}
wxPostEvent(handler,evt);
}
示例7: initLabels
PowerManDlg::PowerManDlg( wxWindow* parent ):powermandlggen( parent )
{
m_Props = NULL;
m_SortCol = 0;
m_bInvertSortOrder = false;
initLabels();
m_IndexPanel->GetSizer()->Layout();
m_GeneralPanel->GetSizer()->Layout();
m_ModulesPanel->GetSizer()->Layout();
m_BlocksPanel->GetSizer()->Layout();
m_DetailsPanel->GetSizer()->Layout();
m_BoosterBook->Fit();
GetSizer()->Fit(this);
GetSizer()->SetSizeHints(this);
m_GeneralPanel->Enable(false);
m_ModulesPanel->Enable(false);
m_BlocksPanel->Enable(false);
m_DetailsPanel->Enable(false);
initIndex();
// not jet supported
m_StopDistrictLocos->Enable(false);
m_BoosterList->SetFocus();
m_BoosterBook->Connect( wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( PowerManDlg::onSetPage ), NULL, this );
m_SetPage = 0;
wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, ID_BOOSTERBOOK );
wxPostEvent( m_BoosterBook, event );
}
示例8: guGetRemoteImage
// -------------------------------------------------------------------------------- //
guDownloadCoverThread::ExitCode guDownloadCoverThread::Entry()
{
wxBitmapType ImageType;
guCoverImage * CoverImage = NULL;
wxImage * Image = guGetRemoteImage( m_UrlStr, ImageType );
if( Image )
{
if( !TestDestroy() )
{
CoverImage = new guCoverImage( m_UrlStr, m_SizeStr, Image );
}
else
{
//guLogWarning( wxT( "Could not load image from the net index %u." ), LastDownload );
delete Image;
}
}
if( !TestDestroy() )
{
//guLogMessage( wxT( "Done: '%s'" ), m_UrlStr.c_str() );
//m_CoverEditor->m_DownloadEventsMutex.Lock();
wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, ID_COVEREDITOR_ADDCOVERIMAGE );
event.SetClientObject( ( wxClientData * ) this );
event.SetClientData( CoverImage );
wxPostEvent( m_CoverEditor, event );
//m_CoverEditor->m_DownloadEventsMutex.Unlock();
}
else
{
if( CoverImage )
delete CoverImage;
}
return 0;
}
示例9: hideLayer
void browsers::LayerButton::OnLeftClick(wxMouseEvent &event)
{
if (event.ShiftDown())
//Lock layer
{
//_hidden = !_hidden;
hideLayer(!_hidden);
wxString cmd;
cmd << wxT("hidelayer(") <<_layer->layno() << wxT(", ");
if (_hidden) cmd << wxT("true") << wxT(");");
else cmd << wxT("false") << wxT(");");
Console->parseCommand(cmd);
}
else
//Select layer
{
wxString cmd;
cmd << wxT("usinglayer(") << _layer->layno()<< wxT(");");
Console->parseCommand(cmd);
if (!_selected)
{
select();
//Next block uses for unselect previous button
int bt = BT_LAYER_SELECT;
wxCommandEvent eventLAYER_SELECT(wxEVT_CMD_BROWSER);
eventLAYER_SELECT.SetExtraLong(_layer->layno());
eventLAYER_SELECT.SetInt(bt);
wxPostEvent(Browsers->TDTlayers()->getLayerPanel(), eventLAYER_SELECT);
}
}
}
示例10: while
//==============================================================================
void* console::parse_thread::Entry() {
// wxLogMessage(_T("Mouse is %s (%ld, %ld)"), where.c_str(), x, y);
// wxLogMessage(_T("Mutex try to lock..."));
while (wxMUTEX_NO_ERROR != _mutex.TryLock());
telllloc.first_column = telllloc.first_line = 1;
telllloc.last_column = telllloc.last_line = 1;
telllloc.filename = NULL;
void* b = tell_scan_string( command.mb_str() );
StatusBusy(command);
tellparse();
my_delete_yy_buffer( b );
_mutex.Unlock();
if (Console->canvas_invalid())
{
wxPaintEvent upde(wxEVT_PAINT);
wxPostEvent(_canvas_wnd, upde);
Console->set_canvas_invalid(false);
}
StatusReady();
// wxLogMessage(_T("Mutex unlocked"));
return NULL;
};
示例11: castEvent
void castEvent(int type) {
// 1 == done
// 2 == failed to connect
// 3 == failed to open output file
// 4 == terminated by main loop
// 5 == update progress bar
// 6 == unexpected http response
// 7 == connected, waiting for response
// 8 == downloading
// 9 == seeking in tar
// 10 == unpacking tibia.pic
// 11 == unpacking tibia.dat
// 12 == unpacking tibia.spr
// 13 == unpack failed
wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, Data_File_FetcherDialog::ID_WORKEREVENT );
event.SetInt( type );
// send in a thread-safe way
wxPostEvent( m_frame, event );
}
示例12: eventSTATUSUPD
void console::parse_thread::StatusReady()
{
wxCommandEvent eventSTATUSUPD(wxEVT_TPDSTATUS);
eventSTATUSUPD.SetInt(TSTS_THREADOFF);
wxPostEvent(_status_wnd, eventSTATUSUPD);
}
示例13: _event
void StaticLabel::OnMouseEvent(wxMouseEvent &event)
{
wxCommandEvent _event(wxEVT_COMMAND_BUTTON_CLICKED, GetId());
wxPostEvent(GetParent(), _event);
}
示例14: updatevent
//.........这里部分代码省略.........
wxInputStream *in = wxGetInputStreamFromURI(m_strURI);
// check INPUT
if (in == NULL) {
// something is wrong with the input URL...
wxDT_ABORT_DOWNLOAD(wxT("Cannot open the INPUT stream; ")
wxT("url is [") + m_strURI + wxT("]"));
}
if (!in->IsOk()) {
delete in;
wxDT_ABORT_DOWNLOAD(wxT("Cannot init the INPUT stream"));
}
// now work on streams; wx docs says that using wxURL::GetInputStream
// is deprecated but this is the only way to set advanced info like
// proxy, user & password...
wxFileOutputStream out(m_strOutput);
if (!out.IsOk()) {
delete in;
wxDT_ABORT_DOWNLOAD(wxT("Cannot open/init the OUPUT stream [")
+ m_strOutput + wxT("]"));
}
m_nFinalSize = in->GetSize();
// see wxHTTP docs
if (m_nFinalSize == 0xffffffff)
m_nFinalSize = 0;
// write the downloaded stuff in the output file
// without using the
// out.Write(*in);
// command; that would be easier but would not allow
// the program to stop this thread while downloading
// the file since the TestDestroy() function would not
// be called in that way...
char buf[wxDT_BUF_TEMP_SIZE];
while (!TestDestroy() && m_nStatus == wxDTS_DOWNLOADING) {
size_t bytes_read = in->Read(buf, WXSIZEOF(buf)).LastRead();
if ( !bytes_read )
break;
if ( out.Write(buf, bytes_read).LastWrite() != bytes_read )
break;
// update our downloaded bytes var
m_nCurrentSize = out.GetSize();
#ifdef __WXDEBUG__
// do not send too many log messages; send a log message
// each 20 cycles (i.e. each 20*wxDT_BUF_TEMP_SIZE byte downloaded)
if ((m_nCurrentSize % (wxDT_BUF_TEMP_SIZE*20)) == 0)
wxLogUsrMsg(wxT("wxDownloadThread::Entry - downloaded %lu bytes"),
m_nCurrentSize);
#endif
}
// we don't need the INPUT stream anymore...
delete in;
// if m_nFinalSize is set to zero, then we cannot trust it;
// we must consider the size of the remote file as unavailable
// since the wxHTTP protocol does not allow us to get it...
if (!out.IsOk() || out.GetSize() == 0 ||
(out.GetSize() != m_nFinalSize && m_nFinalSize != 0))
wxDT_ABORT_DOWNLOAD(wxT("Output FILE stream size is wrong"));
wxLogUsrMsg(wxT("wxDownloadThread::Entry - completed download of %lu bytes"),
m_nCurrentSize);
// do we have to compute MD5 ?
#if wxUSE_MD5
m_mStatus.Lock();
m_nStatus = wxDTS_COMPUTINGMD5;
m_mStatus.Unlock();
// get the md5 checksum for the just downloaded file
m_strComputedMD5 = wxMD5::GetFileMD5(m_strOutput);
#endif
// we have successfully download the file
m_bSuccess = TRUE;
{
// go in wait mode
wxMutexLocker locker(m_mStatus);
m_nStatus = wxDTS_WAITING;
}
wxPostEvent(m_pHandler, updatevent);
m_nFileCount++;
// we reset our variables here because there is a delay between the
// wxDownloadThread::BeginNewDownload() calls and the execution of the
// first statements of this thread...
m_nCurrentSize = 0;
m_nFinalSize = 0;
}
return (void*)FALSE;
}
示例15: eventReceive
void *RXWorkerThread::Entry()
{
int rv;
VscpTcpIf tcpifReceive;
wxCommandEvent eventReceive( wxVSCP_IN_EVENT, m_pCtrlObject->m_windowID );
wxCommandEvent eventConnectionLost( wxVSCP_RCV_LOST_EVENT, m_pCtrlObject->m_windowID );
// Must be a valid control object pointer
if ( NULL == m_pCtrlObject ) return NULL;
// Connect to the server with the control interface
if ( !tcpifReceive.doCmdOpen( m_pCtrlObject->m_ifVSCP.m_strHost,
m_pCtrlObject->m_ifVSCP.m_port,
m_pCtrlObject->m_ifVSCP.m_strUser,
m_pCtrlObject->m_ifVSCP.m_strPassword ) ) {
//::wxGetApp().logMsg ( _("VSCP Receive thread - Unable to connect to server."), DAEMON_LOGMSG_CRITICAL );
m_pCtrlObject->m_errorReceive = VSCP_SESSION_ERROR_UNABLE_TO_CONNECT;
wxPostEvent( m_pCtrlObject->m_pWnd, eventConnectionLost );
return NULL;
}
// Find the channel id
tcpifReceive.doCmdGetChannelID( &m_pCtrlObject->m_rxChannelID );
// Start Receive Loop
tcpifReceive.doCmdEnterReceiveLoop();
vscpEvent event;
while ( !TestDestroy() && !m_pCtrlObject->m_bQuit )
{
if ( CANAL_ERROR_SUCCESS ==
( rv = tcpifReceive.doCmdBlockReceive( &event, 1000 ) ) ) {
if ( NULL != m_pCtrlObject->m_pWnd ) {
vscpEvent *pEvent = new vscpEvent;
if ( NULL != pEvent ) {
copyVSCPEvent( pEvent, &event );
eventReceive.SetClientData( pEvent );
wxPostEvent( m_pCtrlObject->m_pWnd, eventReceive );
}
} // Session window exist
}
else {
if ( CANAL_ERROR_COMMUNICATION == rv ) m_pCtrlObject->m_bQuit = true;
}
} // while
// Close the interface
tcpifReceive.doCmdClose();
wxPostEvent( m_pCtrlObject->m_pWnd, eventConnectionLost );
return NULL;
}