2011年4月27日星期三

patch file_Implement progress bar in windows

The patch file I have modified in the following spaces, to keep same with the source code:
==================1 ap_usb_ProgressListener======
create a class to deal with ProgressListener(the same as the gtk code). seperate from the statusBarListener
class ap_usb_ProgressListener : public AP_StatusBarFieldListener
{
public:
.............
virtual void notify();   //deal with progressbar update
protected:
HWND m_ProgressWND;
};
==================2======
and in the notify function deal with the update:   and i find the place to add pulse process bar
void ap_usb_ProgressListener::notify()
{  
if(pProgress->isDefinate())
{
double fraction = pProgress->getFraction();
SendMessage(m_ProgressWND,PBM_SETPOS,fraction*100,0);
}
else
{   //here pulse process bar  <--------------pulse process bar
}
}
===========================3============
In this situation, I need to build the connection between ap_usb_ProgressListener and ProcessBar in the createWindow()    in this place, your code have one error(the elseif is in the wrong place)
else if(pf->getFillMethod() == PROGRESS_BAR)
{
pf->setListener((AP_StatusBarFieldListener *)(new ap_usb_ProgressListener(pf, m_hwndProgressBar)));
}
===========================4============
Remove unused function and variables

没有评论:

发表评论