void MyStatusBar::DoToggle() { #if wxUSE_CHECKBOX if ( m_checkbox->GetValue() ) { #if wxUSE_TIMER m_timer.Start(1000); #endif m_statbmp->SetIcon(wxIcon(green_xpm)); UpdateClock(); } else // don't show clock { #if wxUSE_TIMER m_timer.Stop(); #endif m_statbmp->SetIcon(wxIcon(red_xpm)); SetStatusText(wxEmptyString, Field_Clock); } #endif // wxUSE_CHECKBOX }
void wxNotificationMessageWindow::OnClose(wxCloseEvent& WXUNUSED(event)) { wxCommandEvent evt(wxEVT_NOTIFICATION_MESSAGE_DISMISSED); m_notificationImpl->ProcessNotificationEvent(evt); if ( m_timer.IsRunning() ) m_timer.Stop(); m_notificationImpl->Close(); }
void wxToolBoxMinimalTestFrame::OnSubmit(wxCommandEvent & event) { if(m_gaugetimer->IsRunning()) { m_gaugetimer->Stop(); } else { m_gaugetimer->Start(500); } }
void wxProcessTimer( wxTimer& rTimer ) { // // Avoid to process spurious timer events // if (rTimer.m_ulId == 0L) return; if (rTimer.IsOneShot()) rTimer.Stop(); rTimer.Notify(); }
void ValueChangingWidget::OnTimer(wxTimerEvent&) { wxMouseState state = wxGetMouseState(); int slider_pos = GetValue(); #if wxCHECK_VERSION(2, 9, 1) if (state.LeftIsDown()) #else if (state.LeftDown()) #endif observer_->change_value(this, slider_pos*0.001); #if wxCHECK_VERSION(2, 9, 1) else if (state.MiddleIsDown()) #else else if (state.MiddleDown()) #endif observer_->change_value(this, slider_pos*0.0001); #if wxCHECK_VERSION(2, 9, 1) else if (state.RightIsDown()) #else else if (state.RightDown()) #endif observer_->change_value(this, slider_pos*0.00001); else { timer_.Stop(); SetValue(0); // move the slider to the central position observer_->finalize_changes(); } }
void wxNotificationMessageWindow::Set(int timeout) { Layout(); Fit(); AddVisibleNotification(this); if ( timeout != wxGenericNotificationMessage::Timeout_Never ) { // wxTimer uses ms, timeout is in seconds m_timer.Start(500); m_timeout = timeout; m_timeoutTargetTime = wxGetUTCTime() + timeout; } else if ( m_timer.IsRunning() ) { m_timer.Stop(); } }
bool Client::OnInit() { if (!wxApp::OnInit()) return false; srand(wxDateTime::Now().GetTicks()); mTimer.SetOwner(this); m_statConnecting = 0; m_statSending = 0; m_statReceiving = 0; m_statDisconnecting = 0; m_statDone = 0; m_statFailed = 0; return true; }
int Client::OnRun() { int i; switch(m_sendType) { case STRESS_TEST: switch(m_workMode) { case THREADS: for (i = 0; i < m_stressWorkers; i++) { if (m_message.empty()) StartWorker(THREADS); else StartWorker(THREADS, m_message); } break; case EVENTS: for (i = 0; i < m_stressWorkers; i++) { if (m_message.empty()) StartWorker(EVENTS); else StartWorker(EVENTS, m_message); } break; default: for (i = 0; i < m_stressWorkers; i++) { if (m_message.empty()) StartWorker(i % 5 == 0 ? THREADS : EVENTS); else StartWorker(i % 5 == 0 ? THREADS : EVENTS, m_message); } break; } break; case SEND_MESSAGE: StartWorker(m_workMode,m_message); break; case SEND_RANDOM: StartWorker(m_workMode); break; } mTimer.Start(timeout_val,true); return wxApp::OnRun(); }
void ValueChangingWidget::OnThumbTrack(wxScrollEvent&) { if (!timer_.IsRunning()) timer_.Start(100); }
void Client::OnWorkerEvent(WorkerEvent& pEvent) { switch (pEvent.m_eventType) { case WorkerEvent::CONNECTING: if (pEvent.isFailed()) { m_statConnecting--; m_statFailed++; } break; case WorkerEvent::SENDING: if (pEvent.isFailed()) { m_statFailed++; m_statSending--; } else { m_statConnecting--; m_statSending++; } break; case WorkerEvent::RECEIVING: if (pEvent.isFailed()) { m_statReceiving--; m_statFailed++; } else { m_statSending--; m_statReceiving++; } break; case WorkerEvent::DISCONNECTING: if (pEvent.isFailed()) { m_statDisconnecting--; m_statFailed++; } else { m_statReceiving--; m_statDisconnecting++; } break; case WorkerEvent::DONE: m_statDone++; m_statDisconnecting--; break; }; if (pEvent.isFailed() || pEvent.m_eventType == WorkerEvent::DONE) { for(TList::compatibility_iterator it = m_threadWorkers.GetFirst(); it ; it = it->GetNext()) { if (it->GetData() == pEvent.m_sender) { m_threadWorkers.DeleteNode(it); break; } } for(EList::compatibility_iterator it2 = m_eventWorkers.GetFirst(); it2 ; it2 = it2->GetNext()) { if (it2->GetData() == pEvent.m_sender) { delete it2->GetData(); m_eventWorkers.DeleteNode(it2); break; } } if ((m_threadWorkers.GetCount() == 0) && (m_eventWorkers.GetCount() == 0)) { mTimer.Stop(); dumpStatistics(); wxSleep(2); ExitMainLoop(); } else { mTimer.Start(timeout_val,true); } } }
bool wxNotificationMessageWindow::Hide() { if ( m_timer.IsRunning() ) m_timer.Stop(); RemoveVisibleNotification(this); return wxFrame::HideWithEffect(wxSHOW_EFFECT_BLEND); }