bool wxIcon::LoadFile(const wxString& filename, wxBitmapType type, int desiredWidth, int desiredHeight) { UnRef(); wxBitmapHandler *handler = FindHandler(type); if ( handler ) return handler->LoadFile(this, filename, type, desiredWidth, desiredHeight); else return false; }
/* Call periodically to run the handler */ void InputHandler::Proc() { char inByte; if(timeoutInterval > 0) { if((state > 0 || index > 0) && (millis() - timeout > timeoutInterval)) { Reset(); } } while(serial->available() > 0) { timeout = millis(); inByte = serial->read(); if(inByte == DELIM1 || inByte == DELIM2) { state ++; continue; } else if(inByte == ENDL) { argumentCount = state; if(argumentCount > MAX_ARG) argumentCount = MAX_ARG; // cts debug //serial->print("search...\n"); int handle = FindHandler(command); if(handle > -1) { // cts debug //serial->print("found\n"); ExecuteHandler(handle); } Reset(); continue; } if(state == 0) { command.concat(inByte); // cts debug //serial->print(command); } else if (state >= 1 && state <= MAX_ARG) { arguments[state-1].concat(inByte); // cts debug //serial->print(arguments[state-1]); } } }
void wxAnimation::InsertHandler( wxAnimationDecoder *handler ) { // Check for an existing handler of the type being added. if (FindHandler( handler->GetType() ) == 0) { sm_handlers.Insert( handler ); } else { // see AddHandler for additional comments. wxLogDebug( wxT("Inserting duplicate animation handler for '%d' type"), handler->GetType() ); delete handler; } }
bool wxAnimation::Load(wxInputStream &stream, wxAnimationType type) { UnRef(); const wxAnimationDecoder *handler; if ( type == wxANIMATION_TYPE_ANY ) { for ( wxAnimationDecoderList::compatibility_iterator node = sm_handlers.GetFirst(); node; node = node->GetNext() ) { handler=(const wxAnimationDecoder*)node->GetData(); if ( handler->CanRead(stream) ) { // do a copy of the handler from the static list which we will own // as our reference data m_refData = handler->Clone(); return M_ANIMDATA->Load(stream); } } wxLogWarning( _("No handler found for animation type.") ); return false; } handler = FindHandler(type); if (handler == NULL) { wxLogWarning( _("No animation handler for type %ld defined."), type ); return false; } // do a copy of the handler from the static list which we will own // as our reference data m_refData = handler->Clone(); if (stream.IsSeekable() && !M_ANIMDATA->CanRead(stream)) { wxLogError(_("Animation file is not of type %ld."), type); return false; } else return M_ANIMDATA->Load(stream); }
void wxAnimation::AddHandler( wxAnimationDecoder *handler ) { // Check for an existing handler of the type being added. if (FindHandler( handler->GetType() ) == 0) { sm_handlers.Append( handler ); } else { // This is not documented behaviour, merely the simplest 'fix' // for preventing duplicate additions. If someone ever has // a good reason to add and remove duplicate handlers (and they // may) we should probably refcount the duplicates. wxLogDebug( wxT("Adding duplicate animation handler for '%d' type"), handler->GetType() ); delete handler; } }
int wxSelectDispatcher::ProcessSets(const wxSelectSets& sets) { int numEvents = 0; for ( int fd = 0; fd <= m_maxFD; fd++ ) { if ( !sets.HasFD(fd) ) continue; wxFDIOHandler * const handler = FindHandler(fd); if ( !handler ) { wxFAIL_MSG( wxT("NULL handler in wxSelectDispatcher?") ); continue; } if ( sets.Handle(fd, *handler) ) numEvents++; } return numEvents; }
void CTimer::RemoveTimerHandler(ITimerEvent* pHandler) { int idx = FindHandler(pHandler); if (idx < 0) { return; } m_vecTimerEvent.erase(m_vecTimerEvent.begin() + idx); if (!m_bSupportMultiTimer) { if (m_vecTimerEvent.size() == 0 && m_mapTimerId2EventId.size() == 1) { map<UINT_PTR, UINT>::iterator it = m_mapTimerId2EventId.begin(); UINT uTimerId = it->second; KillTimer(uTimerId); } } }
bool wxIcon::LoadFile(const wxString& filename, wxBitmapType type, int desiredWidth, int desiredHeight) { UnRef(); wxGDIImageHandler *handler = FindHandler(type); if ( !handler ) { // load via wxBitmap which, in turn, uses wxImage allowing us to // support more formats wxBitmap bmp; if ( !bmp.LoadFile(filename, type) ) return false; CopyFromBitmap(bmp); return true; } return handler->Load(this, filename, type, desiredWidth, desiredHeight); }
bool wxIcon::LoadFile( const wxString& rFilename, wxBitmapType lType, int nDesiredWidth, int nDesiredHeight ) { HPS hPs = NULLHANDLE; UnRef(); wxGDIImageHandler* pHandler = FindHandler(lType); if (pHandler) return(pHandler->Load( this ,rFilename ,hPs ,lType ,nDesiredWidth ,nDesiredHeight )); else return false; }
bool CTimer::IsTimerHandlerExist(ITimerEvent* pHandler) { return FindHandler(pHandler) >= 0; }