From 3157f5f0569de78d62b8a02d8624f51a9def7315 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Fri, 29 May 2015 15:37:11 +0200 Subject: [PATCH] progressbar with stop() --- include/nana/gui/widgets/progress.hpp | 5 +++++ source/gui/widgets/progress.cpp | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/include/nana/gui/widgets/progress.hpp b/include/nana/gui/widgets/progress.hpp index 91e58ab7..f7697d7e 100644 --- a/include/nana/gui/widgets/progress.hpp +++ b/include/nana/gui/widgets/progress.hpp @@ -30,6 +30,8 @@ namespace nana unsigned Max(unsigned); void unknown(bool); bool unknown() const; + bool stop(bool s = true); + bool stoped() const; private: void attached(widget_reference, graph_reference) override; void refresh(graph_reference) override; @@ -45,6 +47,7 @@ namespace nana nana::paint::graphics* graph_{nullptr}; unsigned draw_width_{static_cast(-1)}; bool unknown_{false}; + bool stop_{false}; unsigned max_{100}; unsigned value_{0}; }; //end class drawer @@ -67,6 +70,8 @@ namespace nana unsigned amount(unsigned value); void unknown(bool); bool unknown() const; + bool stop(bool s=true); ///< request stop or cancel and return previus stop status + bool stoped() const; }; }//end namespace nana #endif diff --git a/source/gui/widgets/progress.cpp b/source/gui/widgets/progress.cpp index 4459ddb1..e37b5814 100644 --- a/source/gui/widgets/progress.cpp +++ b/source/gui/widgets/progress.cpp @@ -89,6 +89,15 @@ namespace nana { return unknown_; } + bool trigger::stoped() const + { + return stop_; + } + bool trigger::stop(bool s) + { + std::swap(s,stop_); + return s; + } void trigger::refresh(graph_reference) { @@ -197,5 +206,13 @@ namespace nana { return get_drawer_trigger().unknown(); } + bool progress::stop(bool s) + { + return get_drawer_trigger().stop(s); + } + bool progress::stoped() const + { + return get_drawer_trigger().stoped(); + } //end class progress }//end namespace nana