working C++ status bar.
Signed-off-by: tamasmeszaros <meszaros.q@gmail.com>
This commit is contained in:
@@ -30,7 +30,6 @@ ProgressStatusBar::ProgressStatusBar(wxWindow *parent, int id):
|
||||
prog_->Hide();
|
||||
cancelbutton_->Hide();
|
||||
|
||||
|
||||
self->SetFieldsCount(3);
|
||||
int w[] = {-1, 150, 155};
|
||||
self->SetStatusWidths(3, w);
|
||||
@@ -60,11 +59,6 @@ ProgressStatusBar::ProgressStatusBar(wxWindow *parent, int id):
|
||||
});
|
||||
}
|
||||
|
||||
//ProgressStatusBar::ProgressStatusBar(): ProgressStatusBar(nullptr, wxID_ANY)
|
||||
//{
|
||||
|
||||
//}
|
||||
|
||||
ProgressStatusBar::~ProgressStatusBar() {
|
||||
if(timer_->IsRunning()) timer_->Stop();
|
||||
}
|
||||
@@ -86,6 +80,11 @@ void ProgressStatusBar::set_progress(int val)
|
||||
}
|
||||
}
|
||||
|
||||
int ProgressStatusBar::get_range() const
|
||||
{
|
||||
return prog_->GetRange();
|
||||
}
|
||||
|
||||
void ProgressStatusBar::set_range(int val)
|
||||
{
|
||||
if(val != prog_->GetRange()) {
|
||||
@@ -129,28 +128,25 @@ void ProgressStatusBar::run(int rate)
|
||||
}
|
||||
}
|
||||
|
||||
void ProgressStatusBar::Embed()
|
||||
void ProgressStatusBar::embed(wxFrame *frame)
|
||||
{
|
||||
std::cout << "Embedding" << std::endl;
|
||||
wxFrame* mf = GUI::get_main_frame();
|
||||
std::cout << mf->GetName() << std::endl;
|
||||
std::cout << self->GetName() << std::endl;
|
||||
wxFrame* mf = frame? frame : GUI::get_main_frame();
|
||||
mf->SetStatusBar(self);
|
||||
}
|
||||
|
||||
void ProgressStatusBar::SetStatusText(std::string txt)
|
||||
void ProgressStatusBar::set_status_text(const std::string& txt)
|
||||
{
|
||||
self->SetStatusText(txt);
|
||||
}
|
||||
|
||||
int ProgressStatusBar::GetId()
|
||||
void ProgressStatusBar::show_cancel_button()
|
||||
{
|
||||
return self->GetId();
|
||||
cancelbutton_->Show();
|
||||
}
|
||||
|
||||
int ProgressStatusBar::GetProgId()
|
||||
void ProgressStatusBar::hide_cancel_button()
|
||||
{
|
||||
return prog_->GetId();
|
||||
cancelbutton_->Hide();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ class wxButton;
|
||||
class wxTimerEvent;
|
||||
class wxStatusBar;
|
||||
class wxWindow;
|
||||
class wxFrame;
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
@@ -33,19 +34,21 @@ public:
|
||||
|
||||
int get_progress() const;
|
||||
void set_progress(int);
|
||||
int get_range() const;
|
||||
void set_range(int = 100);
|
||||
void show_progress(bool);
|
||||
void start_busy(int = 100);
|
||||
void stop_busy();
|
||||
inline bool is_busy() const { return busy_; }
|
||||
void set_cancel_callback(CancelFn);
|
||||
void set_cancel_callback(CancelFn = CancelFn());
|
||||
inline void remove_cancel_callback() { set_cancel_callback(); }
|
||||
void run(int rate);
|
||||
void embed(wxFrame *frame = nullptr);
|
||||
void set_status_text(const std::string& txt);
|
||||
|
||||
// Temporary methods to satisfy Perl side
|
||||
void Embed();
|
||||
void SetStatusText(std::string txt);
|
||||
int GetId();
|
||||
int GetProgId();
|
||||
void show_cancel_button();
|
||||
void hide_cancel_button();
|
||||
|
||||
private:
|
||||
bool busy_ = false;
|
||||
|
||||
Reference in New Issue
Block a user