#include <wxReadingPriorityPanel.h>
Public Member Functions | |
BarLoading (wxWindow *parent, int w, int h) | |
virtual | ~BarLoading () |
void | SetI (int i) |
void | Reset () |
void | Paint () |
virtual void | OnPaint (wxPaintEvent &WXUNUSED(event)) |
void | SetSizeData (int sizeData) |
void | RefreshForce () |
Private Attributes | |
std::vector< int > | lstInt |
int | _w |
int | _h |
int | _sizeData |
wxBitmap * | _bitmap |
bool | _flag_bitmap |
bool | _flag2_bitmap |
Definition at line 80 of file wxReadingPriorityPanel.h.
BarLoading::BarLoading | ( | wxWindow * | parent, | |
int | w, | |||
int | h | |||
) |
Definition at line 327 of file wxReadingPriorityPanel.cpp.
References s_mutexProtectingTheGlobalData.
00328 :wxPanel(parent,-1,wxDefaultPosition,wxDefaultSize,wxTAB_TRAVERSAL) 00329 { 00330 _w=w; 00331 _h=h; 00332 SetSize(_w,_h); 00333 SetWindowStyle(wxNO_FULL_REPAINT_ON_RESIZE); 00334 _bitmap = new wxBitmap(_w,_h); 00335 _flag_bitmap=true; 00336 _flag2_bitmap=true; 00337 00338 if (s_mutexProtectingTheGlobalData!=NULL) 00339 { 00340 delete s_mutexProtectingTheGlobalData; 00341 s_mutexProtectingTheGlobalData=NULL; 00342 } 00343 s_mutexProtectingTheGlobalData = new wxMutex(); 00344 Reset(); 00345 }
BarLoading::~BarLoading | ( | ) | [virtual] |
Definition at line 348 of file wxReadingPriorityPanel.cpp.
void BarLoading::OnPaint | ( | wxPaintEvent & | WXUNUSEDevent | ) | [virtual] |
Definition at line 450 of file wxReadingPriorityPanel.cpp.
References Paint().
00451 { 00452 Paint(); 00453 }
void BarLoading::Paint | ( | ) |
Definition at line 410 of file wxReadingPriorityPanel.cpp.
References _bitmap, _flag2_bitmap, _flag_bitmap, _h, _sizeData, _w, lstInt, and s_mutexProtectingTheGlobalData.
Referenced by OnPaint().
00411 { 00412 _flag2_bitmap=false; 00413 wxMutexLocker lock(*s_mutexProtectingTheGlobalData); 00414 00415 00416 if (_flag_bitmap==true){ 00417 wxMemoryDC temp_dc; 00418 temp_dc.SelectObject( *_bitmap ); 00419 00420 int i,ii,size=lstInt.size(); 00421 for (ii=0;ii<size; ii++) 00422 { 00423 i=lstInt[ii]; 00424 int x = (_w*i)/_sizeData; 00425 int d = (_w/_sizeData)+1; 00426 temp_dc.SetBrush(wxBrush( wxColour(0,0,255),wxSOLID )); 00427 temp_dc.SetPen(wxPen( wxColour(0,0,255),1,wxSOLID )); 00428 temp_dc.DrawRectangle(x,0,d,_h); 00429 } 00430 lstInt.clear(); 00431 00432 00433 00434 00435 wxPaintDC dc( this ); 00436 dc.Blit(0,0, _w, _h, &temp_dc, 0, 0); 00437 } 00438 _flag2_bitmap=true;//SIL//POR QUE TANTAS VECES LO MISMO?????? 00439 _flag2_bitmap=true; 00440 _flag2_bitmap=true; 00441 _flag2_bitmap=true; 00442 _flag2_bitmap=true; 00443 _flag2_bitmap=true; 00444 00445 00446 }
void BarLoading::RefreshForce | ( | ) |
Definition at line 385 of file wxReadingPriorityPanel.cpp.
Referenced by PriorityLoadImageBar::RefreshForce().
void BarLoading::Reset | ( | ) |
Definition at line 396 of file wxReadingPriorityPanel.cpp.
References _bitmap, _flag_bitmap, _h, _w, and lstInt.
00397 { 00398 if (_flag_bitmap==true){ 00399 wxMemoryDC temp_dc; 00400 temp_dc.SelectObject( *_bitmap ); 00401 temp_dc.SetBrush(wxBrush( wxColour(255,0,0),wxSOLID )); 00402 temp_dc.SetPen(wxPen( wxColour(255,0,0),1,wxSOLID )); 00403 temp_dc.DrawRectangle(0,0,_w,_h); 00404 lstInt.clear(); 00405 } 00406 }
void BarLoading::SetI | ( | int | i | ) |
Definition at line 352 of file wxReadingPriorityPanel.cpp.
References _flag2_bitmap, _flag_bitmap, lstInt, and s_mutexProtectingTheGlobalData.
Referenced by PriorityLoadImageBar::Action_i().
00353 { 00354 00355 s_mutexProtectingTheGlobalData->Lock(); 00356 00357 _flag_bitmap=false; 00358 00359 while (_flag2_bitmap==false){ 00360 //sleep force 00361 #if defined(WIN32) 00362 Sleep(1); 00363 #else 00364 // usleep(1000); 00365 #endif 00366 } 00367 00368 /* 00369 wxMemoryDC temp_dc; 00370 temp_dc.SelectObject( *_bitmap ); 00371 int x = (_w*i)/_sizeData; 00372 int d = (_w/_sizeData)+1; 00373 temp_dc.SetBrush(wxBrush( wxColour(0,0,255),wxSOLID )); 00374 temp_dc.SetPen(wxPen( wxColour(0,0,255),1,wxSOLID )); 00375 temp_dc.DrawRectangle(x,0,d,_h); 00376 */ 00377 00378 lstInt.push_back(i); 00379 00380 s_mutexProtectingTheGlobalData->Unlock(); 00381 _flag_bitmap=true; 00382 00383 }
void BarLoading::SetSizeData | ( | int | sizeData | ) |
Definition at line 391 of file wxReadingPriorityPanel.cpp.
References _sizeData.
00392 { 00393 _sizeData=sizeData; 00394 }
wxBitmap* BarLoading::_bitmap [private] |
Definition at line 95 of file wxReadingPriorityPanel.h.
bool BarLoading::_flag2_bitmap [private] |
Definition at line 97 of file wxReadingPriorityPanel.h.
bool BarLoading::_flag_bitmap [private] |
Definition at line 96 of file wxReadingPriorityPanel.h.
int BarLoading::_h [private] |
Definition at line 93 of file wxReadingPriorityPanel.h.
int BarLoading::_sizeData [private] |
Definition at line 94 of file wxReadingPriorityPanel.h.
Referenced by Paint(), and SetSizeData().
int BarLoading::_w [private] |
Definition at line 92 of file wxReadingPriorityPanel.h.
std::vector<int> BarLoading::lstInt [private] |
Definition at line 91 of file wxReadingPriorityPanel.h.