| 12 | wxDEFINE_EVENT(PROGRESSBAR_STOP_EVENT, wxCommandEvent); |
| 13 | |
| 14 | CustomStatusBar::CustomStatusBar(wxWindow* parent, wxWindowID id): |
| 15 | wxStatusBar(parent, id) |
| 16 | { |
| 17 | SetFieldsCount(4); |
| 18 | |
| 19 | static const int widths[] = {-1, 200, 100, 20}; |
| 20 | SetStatusWidths(4, widths); |
| 21 | |
| 22 | static const int styles[] = {wxSB_FLAT, wxSB_FLAT, wxSB_FLAT, wxSB_FLAT}; |
| 23 | SetStatusStyles(4, styles); |
| 24 | |
| 25 | _progressBar.reset(new wxGauge(this, |
| 26 | wxID_ANY, |
| 27 | 100, |
| 28 | wxDefaultPosition, |
| 29 | wxDefaultSize, |
| 30 | wxGA_HORIZONTAL | wxGA_SMOOTH)); |
| 31 | |
| 32 | _stopButton.reset(new wxButton(this, |
| 33 | wxID_ANY, |
| 34 | "Stop", |
| 35 | wxDefaultPosition, |
| 36 | wxDefaultSize, |
| 37 | wxBU_EXACTFIT)); |
| 38 | //_stopButton->SetBitmap(wxArtProvider::GetBitmap(wxART_ERROR, |
| 39 | // wxART_BUTTON)); |
| 40 | _stopButton->Bind(wxEVT_BUTTON, |
| 41 | [this](auto&) |
| 42 | { |
| 43 | auto* event = new wxCommandEvent(PROGRESSBAR_STOP_EVENT, 0); |
| 44 | event->SetEventObject(this); |
| 45 | QueueEvent(event); |
| 46 | }); |
| 47 | |
| 48 | _rightLabel.reset(new wxStaticText(this, |
| 49 | wxID_ANY, |
| 50 | "", |
| 51 | wxDefaultPosition, |
| 52 | wxDefaultSize, |
| 53 | wxALIGN_RIGHT | wxST_NO_AUTORESIZE)); |
| 54 | |
| 55 | HideProgressBar(); |
| 56 | Layout(); |
| 57 | } |
| 58 | |
| 59 | void CustomStatusBar::OnSize(wxSizeEvent& event) |
| 60 | { |