xtd 0.2.0
progress_box.cpp

demonstrates the use of xtd::forms::progress_box progress dialog.

Windows
progress_box_w.png

progress_box_wd.png
macOS
progress_box_m.png

progress_box_md.png
Gnome
progress_box_g.png

progress_box_gd.png
#include <xtd/forms/application>
#include <xtd/forms/button>
#include <xtd/forms/form>
#include <xtd/forms/progress_box>
#include <xtd/threading/thread>
using namespace xtd;
using namespace xtd::forms;
class form1 : public form {
public:
form1() {
text("Progress box example");
client_size({ 400, 200 });
download_button.parent(*this)
.text("Download")
.location({ 10, 10 })
.size({ 150, 35 })
.click += [this] {
for (auto index = progress_box::minimum(); index <= progress_box::maximum(); ++index) {
threading::thread::sleep(100_ms); // Do some work...
progress_box::update(index, "Downloading", xtd::ustring::format("{}/{}", index, progress_box::maximum()));
if (progress_box::skipped()) index++;
}
};
}
private:
button download_button;
};
auto main()->int {
application::run(form1 {});
}