mirror of
https://github.com/FULU-Foundation/OrcaSlicer-bambulab.git
synced 2026-05-27 15:29:41 -07:00
Separate Job, ProgressStatusBar and ProgressIndicator
* Separate GUI::Job * make use of ProgressIndicator interface * make ProgressStatusbar independent from GUI::App
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
#include "ProgressIndicator.hpp"
|
||||
|
||||
class wxTimer;
|
||||
class wxGauge;
|
||||
class wxButton;
|
||||
@@ -14,6 +16,7 @@ class wxStatusBar;
|
||||
class wxWindow;
|
||||
class wxFrame;
|
||||
class wxString;
|
||||
class wxFont;
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
@@ -22,7 +25,7 @@ namespace Slic3r {
|
||||
* of the Slicer main window. It consists of a message area to the left and a
|
||||
* progress indication area to the right with an optional cancel button.
|
||||
*/
|
||||
class ProgressStatusBar
|
||||
class ProgressStatusBar : public ProgressIndicator
|
||||
{
|
||||
wxStatusBar *self; // we cheat! It should be the base class but: perl!
|
||||
wxGauge *m_prog;
|
||||
@@ -30,30 +33,29 @@ class ProgressStatusBar
|
||||
std::unique_ptr<wxTimer> m_timer;
|
||||
public:
|
||||
|
||||
/// Cancel callback function type
|
||||
using CancelFn = std::function<void()>;
|
||||
|
||||
ProgressStatusBar(wxWindow *parent = nullptr, int id = -1);
|
||||
~ProgressStatusBar();
|
||||
~ProgressStatusBar() override;
|
||||
|
||||
int get_progress() const;
|
||||
// if the argument is less than 0 it shows the last state or
|
||||
// pulses if no state was set before.
|
||||
void set_progress(int);
|
||||
int get_range() const;
|
||||
void set_range(int = 100);
|
||||
void set_progress(int) override;
|
||||
int get_range() const override;
|
||||
void set_range(int = 100) override;
|
||||
void show_progress(bool);
|
||||
void start_busy(int = 100);
|
||||
void stop_busy();
|
||||
inline bool is_busy() const { return m_busy; }
|
||||
void set_cancel_callback(CancelFn = CancelFn());
|
||||
void set_cancel_callback(CancelFn = CancelFn()) override;
|
||||
inline void reset_cancel_callback() { set_cancel_callback(); }
|
||||
void run(int rate);
|
||||
void embed(wxFrame *frame = nullptr);
|
||||
void set_status_text(const wxString& txt);
|
||||
void set_status_text(const std::string& txt);
|
||||
void set_status_text(const char *txt);
|
||||
void set_status_text(const char *txt) override;
|
||||
wxString get_status_text() const;
|
||||
void set_font(const wxFont &font);
|
||||
|
||||
// Temporary methods to satisfy Perl side
|
||||
void show_cancel_button();
|
||||
|
||||
Reference in New Issue
Block a user